From bcfbfc32c8fe8ca27786a9aaffa3d1b963a49648 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Sch=C3=A4fer?= <schafjan@fjfi.cvut.cz>
Date: Tue, 8 May 2018 20:58:29 +0200
Subject: [PATCH] prvni nastrel

---
 examples/CMakeLists.txt                       |    1 +
 .../flow/DensityBoundaryConditionCavity.h     |    8 +-
 examples/flow/EnergyBoundaryConditionCavity.h |   30 +-
 examples/flow/LaxFridrichsEnergy.h            |   18 +-
 examples/flow/LaxFridrichsMomentumX.h         |    8 +-
 examples/flow/LaxFridrichsMomentumY.h         |    8 +-
 .../flow/MomentumXBoundaryConditionCavity.h   |    2 +-
 .../1d/Euler1DPressureGetter.h~               |   65 +
 .../1d/LaxFridrichsContinuity_impl.h~         |  347 ++++
 .../1d/LaxFridrichsMomentum_impl.h~           |  351 ++++
 .../1d/MyMixedBoundaryConditions.h            |  152 ++
 .../1d/MyNeumannBoundaryConditions.h          |  152 ++
 examples/inviscid-flow-sw/1d/euler.h~         |  142 ++
 .../inviscid-flow-sw/1d/eulerProblem_impl.h~  |  343 ++++
 examples/inviscid-flow-sw/1d/tnl-run-euler-1d |   25 +
 .../inviscid-flow-sw/1d/tnl-run-euler-1d~     |   25 +
 .../1d/tnlMyNeumannBoundaryConditions.h~      |  152 ++
 .../inviscid-flow-sw/2d/Euler2DVelXGetter.h   |   56 +
 .../2d/EulerPressureGetter.h~                 |   69 +
 .../2d/LaxFridrichsContinuity_impl .h~        |  349 ++++
 .../2d/MyMixedBoundaryConditions.h            |  175 ++
 .../2d/MyNeumannBoundaryConditions.h          |  157 ++
 .../2d/MyNeumannBoundaryConditions.h~         |  157 ++
 .../inviscid-flow-sw/2d/eulerProblem_impl.h~  |  450 ++++++
 examples/inviscid-flow-sw/2d/tnl-run-euler-2d |   41 +
 .../inviscid-flow-sw/2d/tnl-run-euler-2d~     |   42 +
 examples/inviscid-flow-sw/3d/CMakeLists.txt   |   21 +
 examples/inviscid-flow-sw/3d/CMakeLists.txt~  |   21 +
 .../inviscid-flow-sw/3d/Euler2DVelXGetter.h   |   56 +
 .../inviscid-flow-sw/3d/Euler2DVelXGetter.h~  |   56 +
 .../inviscid-flow-sw/3d/EulerPressureGetter.h |   72 +
 .../3d/EulerPressureGetter.h~                 |   72 +
 examples/inviscid-flow-sw/3d/EulerVelGetter.h |   62 +
 .../inviscid-flow-sw/3d/EulerVelGetter.h~     |   60 +
 .../inviscid-flow-sw/3d/EulerVelXGetter.h~    |   56 +
 .../inviscid-flow-sw/3d/LaxFridrichs2D.h~     |   41 +
 examples/inviscid-flow-sw/3d/LaxFridrichs3D.h |   41 +
 .../inviscid-flow-sw/3d/LaxFridrichs3D.h~     |   41 +
 .../3d/LaxFridrichsContinuity.h~              |  210 +++
 .../3d/LaxFridrichsContinuity_impl .h         |  350 ++++
 .../3d/LaxFridrichsContinuity_impl .h~        |  350 ++++
 .../inviscid-flow-sw/3d/LaxFridrichsEnergy.h  |  237 +++
 .../inviscid-flow-sw/3d/LaxFridrichsEnergy.h~ |  219 +++
 .../3d/LaxFridrichsEnergy_impl.h~             |  350 ++++
 .../3d/LaxFridrichsMomentumX.h                |  237 +++
 .../3d/LaxFridrichsMomentumX.h~               |  224 +++
 .../3d/LaxFridrichsMomentumX_impl.h~          |  355 +++++
 .../3d/LaxFridrichsMomentumY.h~               |  218 +++
 .../3d/LaxFridrichsMomentumY_impl.h~          |  355 +++++
 .../3d/LaxFridrichsMomentumZ.h                |  236 +++
 .../3d/LaxFridrichsMomentumZ.h~               |  236 +++
 .../3d/LaxFridrichsMomentumZ_impl.h~          |  351 ++++
 .../3d/MyMixedBoundaryConditions.h            |  175 ++
 .../3d/MyMixedBoundaryConditions.h~           |  175 ++
 .../3d/MyNeumannBoundaryConditions.h          |  157 ++
 .../3d/MyNeumannBoundaryConditions.h~         |  157 ++
 examples/inviscid-flow-sw/3d/euler-cuda.cu    |    1 +
 examples/inviscid-flow-sw/3d/euler.cpp        |    1 +
 examples/inviscid-flow-sw/3d/euler.h          |  170 ++
 examples/inviscid-flow-sw/3d/euler.h~         |  162 ++
 .../inviscid-flow-sw/3d/eulerBuildConfigTag.h |   52 +
 .../3d/eulerBuildConfigTag.h~                 |   52 +
 examples/inviscid-flow-sw/3d/eulerProblem.h   |  119 ++
 examples/inviscid-flow-sw/3d/eulerProblem.h~  |  118 ++
 .../inviscid-flow-sw/3d/eulerProblem_impl.h   |  579 +++++++
 .../inviscid-flow-sw/3d/eulerProblem_impl.h~  |  565 +++++++
 examples/inviscid-flow-sw/3d/eulerRhs.h       |   35 +
 examples/inviscid-flow-sw/3d/run-euler        |   19 +
 examples/inviscid-flow-sw/3d/tnl-run-euler-2d |   33 +
 examples/inviscid-flow-sw/CMakeLists.txt      |   23 +
 .../CompressibleConservativeVariables.h       |  147 ++
 examples/inviscid-flow-sw/LaxFridrichs.h      |  141 ++
 .../inviscid-flow-sw/LaxFridrichsContinuity.h |  288 ++++
 .../inviscid-flow-sw/LaxFridrichsEnergy.h     |  309 ++++
 .../LaxFridrichsMomentumBase.h                |   68 +
 .../inviscid-flow-sw/LaxFridrichsMomentumX.h  |  276 ++++
 .../inviscid-flow-sw/LaxFridrichsMomentumY.h  |  260 +++
 .../inviscid-flow-sw/LaxFridrichsMomentumZ.h  |  240 +++
 .../PhysicalVariablesGetter.h                 |  122 ++
 .../RiemannProblemInitialCondition.h          | 1417 +++++++++++++++++
 examples/inviscid-flow-sw/Upwind.h            |  136 ++
 examples/inviscid-flow-sw/UpwindContinuity.h  |  353 ++++
 examples/inviscid-flow-sw/UpwindEnergy.h      |  593 +++++++
 .../inviscid-flow-sw/UpwindMomentumBase.h     |   67 +
 examples/inviscid-flow-sw/UpwindMomentumX.h   |  394 +++++
 examples/inviscid-flow-sw/UpwindMomentumX.h~  |  396 +++++
 examples/inviscid-flow-sw/UpwindMomentumY.h   |  362 +++++
 examples/inviscid-flow-sw/UpwindMomentumZ.h   |  304 ++++
 examples/inviscid-flow-sw/euler.cpp           |    1 +
 examples/inviscid-flow-sw/euler.cu            |    1 +
 examples/inviscid-flow-sw/euler.h             |  116 ++
 .../inviscid-flow-sw/eulerBuildConfigTag.h    |   51 +
 examples/inviscid-flow-sw/eulerProblem.h      |  130 ++
 examples/inviscid-flow-sw/eulerProblem_impl.h |  416 +++++
 examples/inviscid-flow-sw/eulerRhs.h          |   35 +
 examples/inviscid-flow-sw/run-euler           |   25 +
 96 files changed, 17056 insertions(+), 37 deletions(-)
 create mode 100644 examples/inviscid-flow-sw/1d/Euler1DPressureGetter.h~
 create mode 100644 examples/inviscid-flow-sw/1d/LaxFridrichsContinuity_impl.h~
 create mode 100644 examples/inviscid-flow-sw/1d/LaxFridrichsMomentum_impl.h~
 create mode 100644 examples/inviscid-flow-sw/1d/MyMixedBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/1d/MyNeumannBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/1d/euler.h~
 create mode 100644 examples/inviscid-flow-sw/1d/eulerProblem_impl.h~
 create mode 100644 examples/inviscid-flow-sw/1d/tnl-run-euler-1d
 create mode 100644 examples/inviscid-flow-sw/1d/tnl-run-euler-1d~
 create mode 100644 examples/inviscid-flow-sw/1d/tnlMyNeumannBoundaryConditions.h~
 create mode 100644 examples/inviscid-flow-sw/2d/Euler2DVelXGetter.h
 create mode 100644 examples/inviscid-flow-sw/2d/EulerPressureGetter.h~
 create mode 100644 examples/inviscid-flow-sw/2d/LaxFridrichsContinuity_impl .h~
 create mode 100644 examples/inviscid-flow-sw/2d/MyMixedBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h~
 create mode 100644 examples/inviscid-flow-sw/2d/eulerProblem_impl.h~
 create mode 100644 examples/inviscid-flow-sw/2d/tnl-run-euler-2d
 create mode 100644 examples/inviscid-flow-sw/2d/tnl-run-euler-2d~
 create mode 100644 examples/inviscid-flow-sw/3d/CMakeLists.txt
 create mode 100644 examples/inviscid-flow-sw/3d/CMakeLists.txt~
 create mode 100644 examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h
 create mode 100644 examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h~
 create mode 100644 examples/inviscid-flow-sw/3d/EulerPressureGetter.h
 create mode 100644 examples/inviscid-flow-sw/3d/EulerPressureGetter.h~
 create mode 100644 examples/inviscid-flow-sw/3d/EulerVelGetter.h
 create mode 100644 examples/inviscid-flow-sw/3d/EulerVelGetter.h~
 create mode 100644 examples/inviscid-flow-sw/3d/EulerVelXGetter.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichs2D.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichs3D.h
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichs3D.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsContinuity.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsEnergy_impl.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX_impl.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY_impl.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h~
 create mode 100644 examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ_impl.h~
 create mode 100644 examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h~
 create mode 100644 examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h
 create mode 100644 examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h~
 create mode 100644 examples/inviscid-flow-sw/3d/euler-cuda.cu
 create mode 100644 examples/inviscid-flow-sw/3d/euler.cpp
 create mode 100644 examples/inviscid-flow-sw/3d/euler.h
 create mode 100644 examples/inviscid-flow-sw/3d/euler.h~
 create mode 100644 examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h
 create mode 100644 examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h~
 create mode 100644 examples/inviscid-flow-sw/3d/eulerProblem.h
 create mode 100644 examples/inviscid-flow-sw/3d/eulerProblem.h~
 create mode 100644 examples/inviscid-flow-sw/3d/eulerProblem_impl.h
 create mode 100644 examples/inviscid-flow-sw/3d/eulerProblem_impl.h~
 create mode 100644 examples/inviscid-flow-sw/3d/eulerRhs.h
 create mode 100644 examples/inviscid-flow-sw/3d/run-euler
 create mode 100644 examples/inviscid-flow-sw/3d/tnl-run-euler-2d
 create mode 100644 examples/inviscid-flow-sw/CMakeLists.txt
 create mode 100644 examples/inviscid-flow-sw/CompressibleConservativeVariables.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichs.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsContinuity.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsEnergy.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsMomentumBase.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsMomentumX.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsMomentumY.h
 create mode 100644 examples/inviscid-flow-sw/LaxFridrichsMomentumZ.h
 create mode 100644 examples/inviscid-flow-sw/PhysicalVariablesGetter.h
 create mode 100644 examples/inviscid-flow-sw/RiemannProblemInitialCondition.h
 create mode 100644 examples/inviscid-flow-sw/Upwind.h
 create mode 100644 examples/inviscid-flow-sw/UpwindContinuity.h
 create mode 100644 examples/inviscid-flow-sw/UpwindEnergy.h
 create mode 100644 examples/inviscid-flow-sw/UpwindMomentumBase.h
 create mode 100644 examples/inviscid-flow-sw/UpwindMomentumX.h
 create mode 100644 examples/inviscid-flow-sw/UpwindMomentumX.h~
 create mode 100644 examples/inviscid-flow-sw/UpwindMomentumY.h
 create mode 100644 examples/inviscid-flow-sw/UpwindMomentumZ.h
 create mode 100644 examples/inviscid-flow-sw/euler.cpp
 create mode 100644 examples/inviscid-flow-sw/euler.cu
 create mode 100644 examples/inviscid-flow-sw/euler.h
 create mode 100644 examples/inviscid-flow-sw/eulerBuildConfigTag.h
 create mode 100644 examples/inviscid-flow-sw/eulerProblem.h
 create mode 100644 examples/inviscid-flow-sw/eulerProblem_impl.h
 create mode 100644 examples/inviscid-flow-sw/eulerRhs.h
 create mode 100644 examples/inviscid-flow-sw/run-euler

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 82533c83ad..41198f09bb 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -11,5 +11,6 @@ add_subdirectory( navier-stokes )
 #add_subdirectory( narrow-band )
 
 add_subdirectory( inviscid-flow )
+add_subdirectory( inviscid-flow-sw )
 #add_subdirectory( mean-curvature-flow )
 add_subdirectory( flow )
diff --git a/examples/flow/DensityBoundaryConditionCavity.h b/examples/flow/DensityBoundaryConditionCavity.h
index a2d34ce540..06515a88c8 100644
--- a/examples/flow/DensityBoundaryConditionCavity.h
+++ b/examples/flow/DensityBoundaryConditionCavity.h
@@ -253,20 +253,20 @@ class DensityBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshIn
          const IndexType& index = entity.getIndex();
          if( entity.getCoordinates().x() == 0 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+            return u[ neighborEntities.template getEntityIndex< 1, 0 >() ];
          }
          if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+            return u[ neighborEntities.template getEntityIndex< -1, 0 >() ];
          }
          if( entity.getCoordinates().y() == 0 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+            return u[ neighborEntities.template getEntityIndex< 0, 1 >() ];
          }
          // The following line is commented to avoid compiler warning
          //if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+            return u[ neighborEntities.template getEntityIndex< 0, -1 >() ];
          }         
       }
 
diff --git a/examples/flow/EnergyBoundaryConditionCavity.h b/examples/flow/EnergyBoundaryConditionCavity.h
index 9d1a55176e..74ea75a70f 100644
--- a/examples/flow/EnergyBoundaryConditionCavity.h
+++ b/examples/flow/EnergyBoundaryConditionCavity.h
@@ -271,12 +271,12 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshInd
          const IndexType& index = entity.getIndex();
          if( entity.getCoordinates().x() == 0 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
-                 /*( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, 0 >() ]
+            return //u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+                ( (* this->pressure)[ neighborEntities.template getEntityIndex< 1, 0 >() ]
                 / ( this->gamma - 1 )
                 )
-                + 0.5
-                * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 0 >()]
+                + 0
+                * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 1, 0 >()]
                 * (
                     ( (* (* this->compressibleConservativeVariables->getMomentum())[ 1 ])[neighborEntities.template getEntityIndex< 1, 0 >()]
                       /  (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 1, 0 >()]
@@ -287,15 +287,15 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshInd
                       /  (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 1, 0 >()]
                       + 0
                     )
-                );*/
+                );
          }
          if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
-                 /*( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, 0 >() ]
+            return //u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+                ( (* this->pressure)[ neighborEntities.template getEntityIndex< -1, 0 >() ]
                 / ( this->gamma - 1 )
                 )
-                + 0.5
+                + 0
                 * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 0 >()]
                 * (
                     ( (* (* this->compressibleConservativeVariables->getMomentum())[ 1 ])[neighborEntities.template getEntityIndex< -1, 0 >()]
@@ -306,15 +306,15 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshInd
                     / (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< -1, 0 >()]
                     + 0
                   )
-                );*/
+                );
          }
          if( entity.getCoordinates().y() == 0 )
          {
-            return u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
-                 /*( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, 0 >() ]
+            return //u[ neighborEntities.template getEntityIndex< 0, 0 >() ];
+                ( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, 1 >() ]
                 / ( this->gamma - 1 )
                 )
-                + 0.5
+                + 0
                 * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 0 >()]
                 * (
                     ( (* (* this->compressibleConservativeVariables->getMomentum())[ 0 ])[neighborEntities.template getEntityIndex< 0, 1 >()]
@@ -325,16 +325,16 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshInd
                   / (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 1 >()]
                   + 0
                   )
-                );*/
+                );
          }
          // The following line is commented to avoid compiler warning
          //if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
          {
-            return ( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, 0 >() ]
+            return ( (* this->pressure)[ neighborEntities.template getEntityIndex< 0, -1 >() ]
                 / ( this->gamma - 1 )
                 )
                 + 0.5
-                * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 0 >()]
+                * (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, -1 >()]
                 * (
                   this->cavitySpeed/*
                     * (
diff --git a/examples/flow/LaxFridrichsEnergy.h b/examples/flow/LaxFridrichsEnergy.h
index b80e968bf2..4e8d9ffa6b 100644
--- a/examples/flow/LaxFridrichsEnergy.h
+++ b/examples/flow/LaxFridrichsEnergy.h
@@ -236,22 +236,22 @@ class LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real,
                 + ( 4.0 / 3.0 * ( velocity_x_east * velocity_x_center - velocity_x_center * velocity_x_west
                                 - velocity_x_center * velocity_x_center + velocity_x_west * velocity_x_west
                                 ) * hxSquareInverse
-                  - 2.0 / 3.0 * ( velocity_y_northEast * velocity_x_east - velocity_y_southEast * velocity_x_east
+/*                  - 2.0 / 3.0 * ( velocity_y_northEast * velocity_x_east - velocity_y_southEast * velocity_x_east
                                 - velocity_y_northWest * velocity_x_west + velocity_y_southWest * velocity_x_west
-                                ) * hxInverse * hyInverse  / 4
+                                ) * hxInverse * hyInverse  / 4*/
                   ) * this->dynamicalViscosity 
 // vT_21_x
-                + ( ( velocity_y_northEast * velocity_y_east - velocity_y_southEast * velocity_y_east
+                + ( /*( velocity_y_northEast * velocity_y_east - velocity_y_southEast * velocity_y_east
                     - velocity_y_northWest * velocity_y_west + velocity_y_southWest * velocity_y_west
-                    ) * hxInverse * hyInverse / 4
+                    ) * hxInverse * hyInverse / 4*/
                   + ( velocity_x_east * velocity_y_center - velocity_x_center * velocity_y_west
                     - velocity_x_center * velocity_y_center + velocity_x_west * velocity_y_west
                     ) * hxSquareInverse
                   ) * this->dynamicalViscosity
 // uT_12_y
-                + ( ( velocity_x_northEast * velocity_x_north - velocity_x_southEast * velocity_x_south 
+                + ( /*( velocity_x_northEast * velocity_x_north - velocity_x_southEast * velocity_x_south 
                     - velocity_x_northWest * velocity_x_north + velocity_x_southWest * velocity_x_south 
-                    ) * hxInverse * hyInverse  / 4
+                    ) * hxInverse * hyInverse  / 4*/
                   + ( velocity_y_north * velocity_x_center - velocity_y_center * velocity_x_south
                     - velocity_y_center * velocity_x_center + velocity_y_south * velocity_x_south
                     ) * hySquareInverse
@@ -260,9 +260,9 @@ class LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real,
                 + ( 4.0 / 3.0 * ( velocity_y_north * velocity_y_center - velocity_y_center * velocity_y_south
                                 - velocity_y_center * velocity_y_center + velocity_y_south * velocity_y_south
                                 ) * hySquareInverse
-                  - 2.0 / 3.0 * ( velocity_x_northEast * velocity_y_north - velocity_x_southEast * velocity_y_east 
+/*                  - 2.0 / 3.0 * ( velocity_x_northEast * velocity_y_north - velocity_x_southEast * velocity_y_east 
                                 - velocity_x_northWest * velocity_y_north + velocity_x_southWest * velocity_y_west
-                                ) * hxInverse * hyInverse / 4
+                                ) * hxInverse * hyInverse / 4*/
                 ) * this->dynamicalViscosity;
       }
 
@@ -476,7 +476,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real,
                     ) * hzSquareInverse
                   ) * this->dynamicalViscosity
 // 3D T_33_z
-                - ( 4.0 / 3.0 * ( velocity_z_up * velocity_z_center - velocity_z_center * velocity_z_down
+                + ( 4.0 / 3.0 * ( velocity_z_up * velocity_z_center - velocity_z_center * velocity_z_down
                                 - velocity_z_center * velocity_z_center + velocity_z_down * velocity_z_down
                                 ) * hzSquareInverse
                   - 2.0 / 3.0 * ( velocity_y_upNorth * velocity_z_up - velocity_y_downNorth * velocity_z_down
diff --git a/examples/flow/LaxFridrichsMomentumX.h b/examples/flow/LaxFridrichsMomentumX.h
index 74491e7145..1879490475 100644
--- a/examples/flow/LaxFridrichsMomentumX.h
+++ b/examples/flow/LaxFridrichsMomentumX.h
@@ -186,13 +186,13 @@ class LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Rea
 // 2D T_11_x
                 + ( 4.0 / 3.0 * ( velocity_x_east - 2 * velocity_x_center + velocity_x_west 
                                 ) * hxSquareInverse
-                  - 2.0 / 3.0 * ( velocity_y_northEast - velocity_y_southEast - velocity_y_northWest + velocity_y_southWest 
-                                ) * hxInverse * hyInverse / 4
+/*                  - 2.0 / 3.0 * ( velocity_y_northEast - velocity_y_southEast - velocity_y_northWest + velocity_y_southWest 
+                                ) * hxInverse * hyInverse / 4*/
                   ) * this->dynamicalViscosity 
 // T_21_y
-                + ( ( velocity_y_northEast - velocity_y_southEast - velocity_y_northWest + velocity_y_southWest
+                + (/* ( velocity_y_northEast - velocity_y_southEast - velocity_y_northWest + velocity_y_southWest
                     ) * hxInverse * hyInverse / 4
-                  + ( velocity_x_north - 2 * velocity_x_center + velocity_x_south
+                  + */( velocity_x_north - 2 * velocity_x_center + velocity_x_south
                     ) * hxInverse * hyInverse
                   ) * this->dynamicalViscosity;
       }
diff --git a/examples/flow/LaxFridrichsMomentumY.h b/examples/flow/LaxFridrichsMomentumY.h
index a9158b1210..fa41d78ff4 100644
--- a/examples/flow/LaxFridrichsMomentumY.h
+++ b/examples/flow/LaxFridrichsMomentumY.h
@@ -170,12 +170,12 @@ class LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Rea
 // 2D T_22_y
                 + ( 4.0 / 3.0 * ( velocity_y_north - 2 * velocity_y_center + velocity_y_south
                                 ) * hySquareInverse
-                  - 2.0 / 3.0 * ( velocity_x_northEast - velocity_x_southEast - velocity_x_northWest + velocity_x_southWest
-                                ) * hxInverse * hyInverse / 4
+/*                  - 2.0 / 3.0 * ( velocity_x_northEast - velocity_x_southEast - velocity_x_northWest + velocity_x_southWest
+                                ) * hxInverse * hyInverse / 4*/
                   ) * this->dynamicalViscosity
 // T_12_x
-                + ( ( velocity_x_northEast - velocity_x_southEast - velocity_x_northWest + velocity_x_southWest
-                    ) * hxInverse * hyInverse / 4
+                + (/* ( velocity_x_northEast - velocity_x_southEast - velocity_x_northWest + velocity_x_southWest
+                    ) * hxInverse * hyInverse / 4*/
                   + ( velocity_y_west - 2 * velocity_y_center + velocity_y_east
                     ) * hxSquareInverse
                   ) * this->dynamicalViscosity;
diff --git a/examples/flow/MomentumXBoundaryConditionCavity.h b/examples/flow/MomentumXBoundaryConditionCavity.h
index 5d3be8ba0e..b787313827 100644
--- a/examples/flow/MomentumXBoundaryConditionCavity.h
+++ b/examples/flow/MomentumXBoundaryConditionCavity.h
@@ -279,7 +279,7 @@ class MomentumXBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, Mesh
          // The following line is commented to avoid compiler warning
          //if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
          {
-            return (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, 0 >()] 
+            return (* this->compressibleConservativeVariables->getDensity())[neighborEntities.template getEntityIndex< 0, -1 >()] 
               * ( 
                    ( this->cavitySpeed/* 
                     * (
diff --git a/examples/inviscid-flow-sw/1d/Euler1DPressureGetter.h~ b/examples/inviscid-flow-sw/1d/Euler1DPressureGetter.h~
new file mode 100644
index 0000000000..7900c4b085
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/Euler1DPressureGetter.h~
@@ -0,0 +1,65 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerPressureGetter( const MeshFunctionType& rho,
+                           const MeshFunctionType& rhoVel,
+                           const MeshFunctionType& energy,
+                           const RealType& gamma)
+      : rho( rho ), rhoVel( rhoVel ), energy( energy ), gamma( gamma )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+          //if (this->rho[ idx ]==0) return 0; else return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rhoVel[ idx ] * this->rhoVel[ idx ] / this->rho[ idx ]);
+          return ( this->gamma - 1.0 ) * this->energy[ idx ] * this->rho[ idx ];
+
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+      
+      const MeshFunctionType& energy;
+
+      RealType gamma;
+
+};
+
+} //namespace TNL
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow-sw/1d/LaxFridrichsContinuity_impl.h~ b/examples/inviscid-flow-sw/1d/LaxFridrichsContinuity_impl.h~
new file mode 100644
index 0000000000..0a051d1257
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/LaxFridrichsContinuity_impl.h~
@@ -0,0 +1,347 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+    //rho
+    const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+    const IndexType& center = entity.getIndex(); 
+    const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+    const IndexType& west = neighbourEntities.template getEntityIndex< -1 >();
+    return /*(0.5 / this->tau) * ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocity[ east ] - u[ west ] * this->velocity[ west ] );*/
+	  (0.5) * ( u[ west ]  + u[ east ] ) 
+          - 0.5 * hxInverse * this->tau * ( u[ east ] * this->velocity[ east ] - u[ west ] * this->velocity[ west ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
+          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} // namespace TNL
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/1d/LaxFridrichsMomentum_impl.h~ b/examples/inviscid-flow-sw/1d/LaxFridrichsMomentum_impl.h~
new file mode 100644
index 0000000000..ebfe407324
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/LaxFridrichsMomentum_impl.h~
@@ -0,0 +1,351 @@
+#ifndef LaxFridrichsMomentum_IMPL_H
+#define LaxFridrichsMomentum_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentum< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rhoVelocity
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >();
+   return (0.5 / this->tau) * ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) 
+          - 0.5 * hxInverse * 
+          (( u[ east ] * this -> velocity[ east ] + this -> pressure [ east ] ) 
+          -( u[ west ] * this -> velocity[ west ] + this -> pressure [ west ] ));
+	  /*(0.5) * ( u[ west ] + u[ east ] ) 
+          - 0.5 * hxInverse * this->tau *
+          (( u[ east ] * this -> velocity[ east ] + this -> pressure [ east ] ) 
+          -( u[ west ] * this -> velocity[ west ] + this -> pressure [ west ] ));*/
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentum< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentum< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentum< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentum< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentum< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentum< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
+          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentum< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentum< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} // namespace TNL
+
+#endif	/* LaxFridrichsMomentumIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/1d/MyMixedBoundaryConditions.h b/examples/inviscid-flow-sw/1d/MyMixedBoundaryConditions.h
new file mode 100644
index 0000000000..006a33e53f
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/MyMixedBoundaryConditions.h
@@ -0,0 +1,152 @@
+// coppied and changed
+/***************************************************************************
+                          tnlMyMixedBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYMIXEDBOUNDARYCONDITIONS_H_
+#define MYMIXEDBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyMixedBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      const IndexType& index = entity.getIndex();
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 0 >() ];
+      else
+         return u[ neighbourEntities.template getEntityIndex< -1 >() ];  
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyMixedBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyMixed boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYMIXEDBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/1d/MyNeumannBoundaryConditions.h b/examples/inviscid-flow-sw/1d/MyNeumannBoundaryConditions.h
new file mode 100644
index 0000000000..cf9b29dcc1
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/MyNeumannBoundaryConditions.h
@@ -0,0 +1,152 @@
+//** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      const IndexType& index = entity.getIndex();
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1 >() ];
+      else
+         return u[ neighbourEntities.template getEntityIndex< -1 >() ];  
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/1d/euler.h~ b/examples/inviscid-flow-sw/1d/euler.h~
new file mode 100644
index 0000000000..742ade98af
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/euler.h~
@@ -0,0 +1,142 @@
+#include <TNL/tnlConfig.h>
+#include <TNL/Solvers/Solver.h>
+#include <TNL/Solvers/BuildConfigTags.h>
+#include <TNL/Operators/DirichletBoundaryConditions.h>
+#include <TNL/Operators/NeumannBoundaryConditions.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include "eulerProblem.h"
+#include "LaxFridrichs1D.h"
+#include "MyMixedBoundaryConditions.h"
+#include "MyNeumannBoundaryConditions.h"
+
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+
+using namespace TNL;
+
+typedef eulerBuildConfigTag BuildConfig;
+
+/****
+ * Uncoment the following (and comment the previous line) for the complete build.
+ * This will include support for all floating point precisions, all indexing types
+ * and more solvers. You may then choose between them from the command line.
+ * The compile time may, however, take tens of minutes or even several hours,
+ * esppecially if CUDA is enabled. Use this, if you want, only for the final build,
+ * not in the development phase.
+ */
+//typedef tnlDefaultConfigTag BuildConfig;
+
+template< typename ConfigTag >class eulerConfig
+{
+   public:
+      static void configSetup( Config::ConfigDescription & config )
+      {
+         config.addDelimiter( "euler settings:" );
+         config.addEntry< String >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+         //config.addEntry< String >( "boundary-conditions-file", "Choose the boundary conditions type.", "u.tnl");
+            config.addEntryEnum< String >( "dirichlet" );
+            config.addEntryEnum< String >( "neumann" );
+            config.addEntryEnum< String >( "mymixed" );
+            config.addEntryEnum< String >( "myneumann" );
+         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
+         config.addEntry< double >( "left-density", "This sets a value of left density." );
+         config.addEntry< double >( "left-velocity", "This sets a value of left velocity." );
+         config.addEntry< double >( "left-pressure", "This sets a value of left pressure." );
+         config.addEntry< double >( "riemann-border", "This sets a position of discontinuity." );
+         config.addEntry< double >( "right-density", "This sets a value of right density." );
+         config.addEntry< double >( "right-velocity", "This sets a value of right velocity." );
+         config.addEntry< double >( "right-pressure", "This sets a value of right pressure." );
+         config.addEntry< double >( "gamma", "This sets a value of gamma constant." );
+
+         /****
+          * Add definition of your solver command line arguments.
+          */
+
+      }
+};
+
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename MeshType,
+          typename ConfigTag,
+          typename SolverStarter >
+class eulerSetter
+{
+   public:
+
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+
+      static bool run( const Config::ParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs1D< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex;
+
+         /****
+          * Resolve the template arguments of your solver here.
+          * The following code is for the Dirichlet and the Neumann boundary conditions.
+          * Both can be constant or defined as descrete values of Vector.
+          */
+          String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef Functions::Analytic::Constant< Dimensions, Real > Constant;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef Functions::MeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "mymixed" )
+          {
+             typedef Operators::MyMixedBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "myneumann" )
+          {
+             typedef Operators::MyNeumannBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "neumann" )
+          {
+             typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+
+      return true;}
+
+};
+
+int main( int argc, char* argv[] )
+{
+   Solvers::Solver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
+
+
diff --git a/examples/inviscid-flow-sw/1d/eulerProblem_impl.h~ b/examples/inviscid-flow-sw/1d/eulerProblem_impl.h~
new file mode 100644
index 0000000000..33903a784b
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/eulerProblem_impl.h~
@@ -0,0 +1,343 @@
+#ifndef eulerPROBLEM_IMPL_H_
+#define eulerPROBLEM_IMPL_H_
+
+#include <TNL/FileName.h>
+#include <TNL/Matrices/MatrixSetter.h>
+#include <TNL/Solvers/PDE/ExplicitUpdater.h>
+#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
+#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsMomentum.h"
+#include "LaxFridrichsEnergy.h"
+#include "Euler1DVelGetter.h"
+#include "Euler1DPressureGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return String( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return String( "euler" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{
+   /****
+    * Add data you want to have in the computation report (log) as follows:
+    * logger.writeParameter< double >( "Parameter description", parameter );
+    */
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setup( const MeshPointer& meshPointer,
+       const Config::ParameterContainer& parameters,
+       const String& prefix )
+{
+   if( //! this->boundaryConditionsPointer->setup( meshPointer, parameters, prefix + "boundary-conditions-" ) ||
+       ! this->rightHandSidePointer->setup( parameters, prefix + "right-hand-side-" ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+typename eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getDofs( const MeshPointer& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */
+   return 3*mesh->template getEntitiesCount< typename MeshType::Cell >();
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+bindDofs( const MeshPointer& mesh,
+          DofVectorPointer& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const Config::ParameterContainer& parameters,
+                     const MeshPointer& mesh,
+                     DofVectorPointer& dofs,
+                     MeshDependentDataPointer& meshDependentData )
+{
+  std::cout << std::endl << "get conditions from CMD";
+   typedef typename MeshType::Cell Cell;
+   this->gamma = parameters.getParameter< RealType >( "gamma" );
+   RealType rhoL = parameters.getParameter< RealType >( "left-density" );
+   RealType velL = parameters.getParameter< RealType >( "left-velocity" );
+   RealType preL = parameters.getParameter< RealType >( "left-pressure" );
+   RealType eL = ( preL / ( rhoL * (gamma - 1) ) );
+   //RealType eL = ( preL / (gamma - 1) ) + 0.5 * rhoL * velL * velL;
+   RealType rhoR = parameters.getParameter< RealType >( "right-density" );
+   RealType velR = parameters.getParameter< RealType >( "right-velocity" );
+   RealType preR = parameters.getParameter< RealType >( "right-pressure" );
+   RealType eR = ( preR / ( rhoR * (gamma - 1) ) );
+   //RealType eR = ( preR / (gamma - 1) ) + 0.5 * rhoR * velR * velR;
+   RealType x0 = parameters.getParameter< RealType >( "riemann-border" );
+   int count = mesh->template getEntitiesCount< Cell >();
+   uRho->bind( mesh, *dofs, 0);
+   uRhoVelocity->bind( mesh, *dofs, count);
+   uEnergy->bind( mesh, *dofs, 2 * count);
+   Containers::Vector < RealType, DeviceType, IndexType > data;
+   data.setSize(2*count);
+   velocity->bind( mesh, data, 0);
+   pressure->bind( mesh, data, count );
+   std::cout << std::endl << "set conditions from CMD"<< std::endl;   
+   for(IndexType i = 0; i < count; i++)
+      if (i < x0 * count )
+         {
+            ( *uRho )[i] = rhoL;
+            ( *uRhoVelocity )[i] = rhoL * velL;
+            ( *uEnergy )[i] = eL;
+            ( *velocity )[i] = velL;
+            ( *pressure )[i] = preL;
+         }
+      else
+         {
+            ( *uRho )[i] = rhoR;
+            ( *uRhoVelocity )[i] = rhoR * velR;
+            ( *uEnergy )[i] = eR;
+            ( *velocity )[i] = velR;
+            ( *pressure )[i] = preR;
+         };
+   /*
+   const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" );
+   if( ! dofs.load( initialConditionFile ) )
+   {
+      std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << std::endl;
+      return false;
+   }
+   */
+   return true; 
+}
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshPointer& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
+   matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh,
+                                                                          differentialOperator,
+                                                                          boundaryCondition,
+                                                                          rowLengths );
+   matrix.setDimensions( dofs, dofs );
+   if( ! matrix.setCompressedRowsLengths( rowLengths ) )
+      return false;*/
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshPointer& mesh,
+              DofVectorPointer& dofs,
+              MeshDependentDataPointer& meshDependentData )
+{
+   std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+   this->bindDofs( mesh, dofs );
+   FileName fileName;
+   fileName.setExtension( "tnl" );
+   fileName.setIndex( step );
+   fileName.setFileNameBase( "rho-" );
+   if( ! uRho->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVel-" );
+   if( ! uRhoVelocity->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "energy-" );
+   if( ! uEnergy->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocity-" );
+   if( ! velocity->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "pressure-" );
+   if( ! pressure->save( fileName.getFileName() ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getExplicitRHS( const RealType& time,
+                const RealType& tau,
+                const MeshPointer& mesh,
+                DofVectorPointer& _u,
+                DofVectorPointer& _fu,
+                MeshDependentDataPointer& meshDependentData )
+{
+    typedef typename MeshType::Cell Cell;
+    int count = mesh->template getEntitiesCount< Cell >();
+	//bind _fu
+    this->fuRho->bind(mesh, _fu, 0);
+    this->fuRhoVelocity->bind(mesh, _fu, count);
+    this->fuEnergy->bind(mesh, _fu, 2 * count);
+
+   //generating Differential operator object
+   SharedPointer< Continuity > lF1DContinuity;
+   SharedPointer< Momentum > lF1DMomentum;
+   SharedPointer< Energy > lF1DEnergy;
+
+   //rho
+   this->bindDofs( mesh, _u );
+   lF1DContinuity->setTau(tau);
+   lF1DContinuity->setVelocity( *velocity);
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity;
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DContinuity,
+                                                           this->boundaryConditionsPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRho,
+                                                           fuRho );
+
+
+   //rhoVelocity
+   lF1DMomentum->setTau(tau);
+   lF1DMomentum->setVelocity( *velocity);
+   lF1DMomentum->setPressure( *pressure);
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Momentum, BoundaryCondition, RightHandSide > explicitUpdaterMomentum;
+   explicitUpdaterMomentum.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DMomentum,
+                                                           this->boundaryConditionsPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocity,
+                                                           fuRhoVelocity );
+   
+   //energy
+   lF1DEnergy->setTau(tau);
+   lF1DEnergy->setPressure( *pressure);
+   lF1DEnergy->setVelocity( *velocity);
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DEnergy,
+                                                           this->boundaryConditionsPointer,
+                                                           this->rightHandSidePointer,
+                                                           uEnergy,
+                                                           fuEnergy ); 
+ }
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshPointer& mesh,
+                      DofVectorPointer& _u,
+                      Matrix& matrix,
+                      DofVectorPointer& b,
+                      MeshDependentDataPointer& meshDependentData )
+{
+/*   LinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             BackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   MeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+postIterate( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& mesh,
+             DofVectorPointer& dofs,
+             MeshDependentDataPointer& meshDependentData )
+{
+   //velocity
+   this->velocity->setMesh( mesh );
+   Velocity velocityGetter( *uRho, *uRhoVelocity );
+   *this->velocity = velocityGetter;
+   //pressure
+   this->pressure->setMesh( mesh );
+   Pressure pressureGetter( *uRho, *uRhoVelocity, *uEnergy, gamma );
+   *this->pressure = pressureGetter;
+   return true;
+}
+
+} // namespace TNL
+
+#endif /* eulerPROBLEM_IMPL_H_ */
diff --git a/examples/inviscid-flow-sw/1d/tnl-run-euler-1d b/examples/inviscid-flow-sw/1d/tnl-run-euler-1d
new file mode 100644
index 0000000000..4829c27d0e
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/tnl-run-euler-1d
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 1 \
+               --origin-x 0.0 \
+               --proportions-x 1.0 \
+               --size-x 100 
+
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+tnl-euler-1d-dbg --time-discretisation explicit \
+	      --time-step 2.5e-3 \
+              --boundary-conditions-type myneumann \
+              --discrete-solver euler \
+              --snapshot-period 0.015 \
+              --final-time 0.15 \
+              --left-density 1.0 \
+              --left-velocity -2.0 \
+              --left-pressure 0.4 \
+              --right-density 1.0 \
+              --right-velocity 2.0 \
+              --right-pressure 0.4 \
+              --gamma 1.4 \
+              --riemann-border 0.5 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/inviscid-flow-sw/1d/tnl-run-euler-1d~ b/examples/inviscid-flow-sw/1d/tnl-run-euler-1d~
new file mode 100644
index 0000000000..9f7b98e6b5
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/tnl-run-euler-1d~
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 1 \
+               --origin-x 0.0 \
+               --proportions-x 1.0 \
+               --size-x 100 
+
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+~/bak/tnl/Debug/bin/tnl-euler-1d-dbg --time-discretisation explicit \
+	      --time-step 2.5e-3 \
+              --boundary-conditions-type myneumann \
+              --discrete-solver euler \
+              --snapshot-period 0.015 \
+              --final-time 0.15 \
+              --left-density 1.0 \
+              --left-velocity -2.0 \
+              --left-pressure 0.4 \
+              --right-density 1.0 \
+              --right-velocity 2.0 \
+              --right-pressure 0.4 \
+              --gamma 1.4 \
+              --riemann-border 0.5 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/inviscid-flow-sw/1d/tnlMyNeumannBoundaryConditions.h~ b/examples/inviscid-flow-sw/1d/tnlMyNeumannBoundaryConditions.h~
new file mode 100644
index 0000000000..d0a8e7ae0e
--- /dev/null
+++ b/examples/inviscid-flow-sw/1d/tnlMyNeumannBoundaryConditions.h~
@@ -0,0 +1,152 @@
+/*** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      const IndexType& index = entity.getIndex();
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1 >() ];
+      else
+         return u[ neighbourEntities.template getEntityIndex< -1 >() ];  
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* TNLMYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/2d/Euler2DVelXGetter.h b/examples/inviscid-flow-sw/2d/Euler2DVelXGetter.h
new file mode 100644
index 0000000000..2e79798a31
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/Euler2DVelXGetter.h
@@ -0,0 +1,56 @@
+#ifndef EulerVelXGetter_H
+#define EulerVelXGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelXGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelXGetter( const MeshFunctionType& rho,
+                       const MeshFunctionType& rhoVel)
+      : rho( rho ), rhoVel( rhoVel )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+          if (this->rho[ idx ]==0) return 0; else return this->rhoVel[ idx ] / this->rho[ idx ];
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelXGetter_H */
diff --git a/examples/inviscid-flow-sw/2d/EulerPressureGetter.h~ b/examples/inviscid-flow-sw/2d/EulerPressureGetter.h~
new file mode 100644
index 0000000000..23865afd3b
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/EulerPressureGetter.h~
@@ -0,0 +1,69 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerPressureGetter( const MeshFunctionType& rho,
+                           const MeshFunctionType& rhoVelX,
+                           const MeshFunctionType& rhoVelY,
+                           const MeshFunctionType& energy,
+                           const RealType& gamma )
+      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), energy( energy ), gamma( gamma )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+            {
+         if (this->rho[ idx ]==0) return 0 
+         else return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rho[ idx ] * 
+         ( std::pow(this->rhoVelX[ idx ] / this->rho[ idx ],2) + std::pow(this->rhoVelY[ idx ] / this->rho[ idx ],2) ) );
+//*/       return ( this->gamma - 1.0 ) * ( this->energy[ idx ] * this->rho[ idx ] );
+      }
+
+      
+   protected:
+
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVelX;
+      
+      const MeshFunctionType& rhoVelY;
+
+      const MeshFunctionType& energy;
+
+      RealType gamma;
+
+};
+
+} //namespace TNL
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow-sw/2d/LaxFridrichsContinuity_impl .h~ b/examples/inviscid-flow-sw/2d/LaxFridrichsContinuity_impl .h~
new file mode 100644
index 0000000000..539e574c96
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/LaxFridrichsContinuity_impl .h~	
@@ -0,0 +1,349 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+    const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+    const IndexType& center = entity.getIndex(); 
+    const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+    const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return 0;/*( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;*/
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rho
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocityX[ east ] - u[ west ] * this->velocityX[ west ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ south ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
+          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/2d/MyMixedBoundaryConditions.h b/examples/inviscid-flow-sw/2d/MyMixedBoundaryConditions.h
new file mode 100644
index 0000000000..066600f483
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/MyMixedBoundaryConditions.h
@@ -0,0 +1,175 @@
+// coppied and changed
+/***************************************************************************
+                          tnlMyMixedBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYMIXEDBOUNDARYCONDITIONS_H_
+#define MYMIXEDBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyMixedBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      float x0 = 0.5;
+      if( entity.getCoordinates().x() == 0 )
+      {
+         if ( entity.getCoordinates().y() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().y() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().y() == 0 )
+      {
+         if ( entity.getCoordinates().x() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().x() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().x() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+      else if( entity.getCoordinates().y() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+      else return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyMixedBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyMixed boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYMIXEDBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h b/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h
new file mode 100644
index 0000000000..72285a4ae0
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h
@@ -0,0 +1,157 @@
+//** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return true; //Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().x() == count-1 )
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+            else if( entity.getCoordinates().y() == 0 )
+               return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+               else return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h~ b/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h~
new file mode 100644
index 0000000000..680e3751f9
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/MyNeumannBoundaryConditions.h~
@@ -0,0 +1,157 @@
+//** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return true //Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().x() == count-1 )
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+            else if( entity.getCoordinates().y() == 0 )
+               return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+               else return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/2d/eulerProblem_impl.h~ b/examples/inviscid-flow-sw/2d/eulerProblem_impl.h~
new file mode 100644
index 0000000000..3800566e1e
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/eulerProblem_impl.h~
@@ -0,0 +1,450 @@
+#include <TNL/FileName.h>
+#include <TNL/Matrices/MatrixSetter.h>
+#include <TNL/Solvers/PDE/ExplicitUpdater.h>
+#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
+#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+#include "MyMixedBoundaryConditions.h"
+#include "MyNeumannBoundaryConditions.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return String( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return String( "euler2D" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{
+   /****
+    * Add data you want to have in the computation report (log) as follows:
+    * logger.writeParameter< double >( "Parameter description", parameter );
+    */
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setup( const MeshPointer& meshPointer,
+       const Config::ParameterContainer& parameters,
+       const String& prefix )
+{
+   if( //! this->boundaryConditionPointer->setup( meshPointer, parameters, prefix + "boundary-conditions-" ) ||
+       ! this->rightHandSidePointer->setup( parameters, prefix + "right-hand-side-" ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+typename eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getDofs( const MeshPointer& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */ 
+   return 4*mesh->template getEntitiesCount< typename MeshType::Cell >();
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+bindDofs( const MeshPointer& mesh,
+          DofVectorPointer& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const Config::ParameterContainer& parameters,
+                     const MeshPointer& mesh,
+                     DofVectorPointer& dofs,
+                     MeshDependentDataPointer& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   gamma = parameters.getParameter< RealType >( "gamma" );
+   RealType rhoLu = parameters.getParameter< RealType >( "NW-density" );
+   RealType velLuX = parameters.getParameter< RealType >( "NW-velocityX" );
+   RealType velLuY = parameters.getParameter< RealType >( "NW-velocityY" );
+   RealType preLu = parameters.getParameter< RealType >( "NW-pressure" );
+   //RealType eLu = ( preLu / ( rhoLu * (gamma - 1) ) );
+   RealType eLu = ( preLu / (gamma - 1) ) + 0.5 * rhoLu * ( std::pow(velLuX,2)+std::pow(velLuY,2) );
+   std::cout << rhoLu <<' '<< velLuX<<' '<<velLuY<<' '<<preLu<<' '<<eLu<<' ';  
+   RealType rhoLd = parameters.getParameter< RealType >( "SW-density" );
+   RealType velLdX = parameters.getParameter< RealType >( "SW-velocityX" );
+   RealType velLdY = parameters.getParameter< RealType >( "SW-velocityY" );
+   RealType preLd = parameters.getParameter< RealType >( "SW-pressure" );
+   //RealType eLd = ( preLd / ( rhoLd * (gamma - 1) ) );
+   RealType eLd = ( preLd / (gamma - 1) ) + 0.5 * rhoLd * ( std::pow(velLdX,2)+std::pow(velLdY,2) );
+   std::cout << rhoLd <<' '<< velLdX<<' '<<velLdY<<' '<<preLd<<' '<<eLd<<' '; 
+   RealType rhoRu = parameters.getParameter< RealType >( "NE-density" );
+   RealType velRuX = parameters.getParameter< RealType >( "NE-velocityX" );
+   RealType velRuY = parameters.getParameter< RealType >( "NE-velocityY" );
+   RealType preRu = parameters.getParameter< RealType >( "NE-pressure" );
+   //RealType eRu = ( preRu / ( rhoRu * (gamma - 1) ) );
+   RealType eRu = ( preRu / (gamma - 1) ) + 0.5 * rhoRu * ( std::pow(velRuX,2)+std::pow(velRuY,2) );
+   std::cout << rhoRu <<' '<< velRuX<<' '<<velRuY<<' '<<preRu<<' '<<eRu<<' '; 
+   RealType rhoRd = parameters.getParameter< RealType >( "SE-density" );
+   RealType velRdX = parameters.getParameter< RealType >( "SE-velocityX" );
+   RealType velRdY = parameters.getParameter< RealType >( "SE-velocityY" );
+   RealType preRd = parameters.getParameter< RealType >( "SE-pressure" );
+   //RealType eRd = ( preRd / ( rhoRd * (gamma - 1) ) );
+   RealType eRd = ( preRd / (gamma - 1) ) + 0.5 * rhoRd * ( std::pow(velRdX,2)+std::pow(velRdY,2) );
+   RealType x0 = parameters.getParameter< RealType >( "riemann-border" );
+   int size = mesh->template getEntitiesCount< Cell >();
+   uRho->bind(mesh, dofs, 0);
+   uRhoVelocityX->bind(mesh, dofs, size);
+   uRhoVelocityY->bind(mesh, dofs, 2*size);
+   uEnergy->bind(mesh, dofs, 3*size);
+   Containers::Vector< RealType, DeviceType, IndexType > data;
+   data.setSize(4*size);
+   pressure->bind(mesh, data, 0);
+   velocity->bind(mesh, data, size);
+   velocityX->bind(mesh, data, 2*size);
+   velocityY->bind(mesh, data, 3*size);
+   for(IndexType j = 0; j < std::sqrt(size); j++)   
+      for(IndexType i = 0; i < std::sqrt(size); i++)
+         if ((i <= x0 * std::sqrt(size))&&(j <= x0 * std::sqrt(size)) )
+            {
+               (* uRho)[j*std::sqrt(size)+i] = rhoLd;
+               (* uRhoVelocityX)[j*std::sqrt(size)+i] = rhoLd * velLdX;
+               (* uRhoVelocityY)[j*std::sqrt(size)+i] = rhoLd * velLdY;
+               (* uEnergy)[j*std::sqrt(size)+i] = eLd;
+               (* velocity)[j*std::sqrt(size)+i] = std::sqrt(std::pow(velLdX,2)+std::pow(velLdY,2));
+               (* velocityX)[j*std::sqrt(size)+i] = velLdX;
+               (* velocityY)[j*std::sqrt(size)+i] = velLdY;
+               (* pressure)[j*std::sqrt(size)+i] = preLd;
+            }
+         else
+         if ((i <= x0 * std::sqrt(size))&&(j > x0 * std::sqrt(size)) )
+            {
+               (* uRho)[j*std::sqrt(size)+i] = rhoLu;
+               (* uRhoVelocityX)[j*std::sqrt(size)+i] = rhoLu * velLuX;
+               (* uRhoVelocityY)[j*std::sqrt(size)+i] = rhoLu * velLuY;
+               (* uEnergy)[j*std::sqrt(size)+i] = eLu;
+               (* velocity)[j*std::sqrt(size)+i] = std::sqrt(std::pow(velLuX,2)+std::pow(velLuY,2));
+               (* velocityX)[j*std::sqrt(size)+i] = velLuX;
+               (* velocityY)[j*std::sqrt(size)+i] = velLuY;
+               (* pressure)[j*std::sqrt(size)+i] = preLu;
+            }
+         else
+         if ((i > x0 * std::sqrt(size))&&(j > x0 * std::sqrt(size)) )
+            {
+               (* uRho)[j*std::sqrt(size)+i] = rhoRu;
+               (* uRhoVelocityX)[j*std::sqrt(size)+i] = rhoRu * velRuX;
+               (* uRhoVelocityY)[j*std::sqrt(size)+i] = rhoRu * velRuY;
+               (* uEnergy)[j*std::sqrt(size)+i] = eRu;
+               (* velocity)[j*std::sqrt(size)+i] = std::sqrt(std::pow(velRuX,2)+std::pow(velRuY,2));
+               (* velocityX)[j*std::sqrt(size)+i] = velRuX;
+               (* velocityY)[j*std::sqrt(size)+i] = velRuY;
+               (* pressure)[j*std::sqrt(size)+i] = preRu;
+            }
+         else
+            {
+               (* uRho)[j*std::sqrt(size)+i] = rhoRd;
+               (* uRhoVelocityX)[j*std::sqrt(size)+i] = rhoRd * velRdX;
+               (* uRhoVelocityY)[j*std::sqrt(size)+i] = rhoRd * velRdY;
+               (* uEnergy)[j*std::sqrt(size)+i] = eRd;
+               (* velocity)[j*std::sqrt(size)+i] = std::sqrt(std::pow(velRdX,2)+std::pow(velRdY,2));
+               (* velocityX)[j*std::sqrt(size)+i] = velRdX;
+               (* velocityY)[j*std::sqrt(size)+i] = velRdY;
+               (* pressure)[j*std::sqrt(size)+i] = preRd;
+            };
+   return true; 
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshPointer& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
+   matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh,
+                                                                          differentialOperator,
+                                                                          boundaryCondition,
+                                                                          rowLengths );
+   matrix.setDimensions( dofs, dofs );
+   if( ! matrix.setCompressedRowsLengths( rowLengths ) )
+      return false;*/
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshPointer& mesh,
+              DofVectorPointer& dofs,
+              MeshDependentDataPointer& meshDependentData )
+{
+  std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+   FileName fileName;
+   fileName.setExtension( "tnl" );
+   fileName.setIndex( step );
+   fileName.setFileNameBase( "rho-" );
+   if( ! uRho->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelX-" );
+   if( ! uRhoVelocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelY-" );
+   if( ! uRhoVelocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "energy-" );
+   if( ! uEnergy->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityX-" );
+   if( ! velocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityY-" );
+   if( ! velocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocity-" );
+   if( ! velocity->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "pressure-" );
+   if( ! pressure->save( fileName.getFileName() ) )
+      return false;
+
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getExplicitRHS( const RealType& time,
+                const RealType& tau,
+                const MeshPointer& mesh,
+                DofVectorPointer& _u,
+                DofVectorPointer& _fu,
+                MeshDependentDataPointer& meshDependentData )
+{
+    typedef typename MeshType::Cell Cell;
+    int count = mesh->template getEntitiesCount< Cell >();
+   //bind MeshFunctionType fu
+   fuRho->bind( mesh, _fu, 0 );
+   fuRhoVelocityX->bind( mesh, _fu, count );
+   fuRhoVelocityY->bind( mesh, _fu, 2*count );
+   fuEnergy->bind( mesh, _fu, 3*count );
+   SharedPointer< Continuity > lF2DContinuity;
+   SharedPointer< MomentumX > lF2DMomentumX;
+   SharedPointer< MomentumY > lF2DMomentumY;
+   SharedPointer< Energy > lF2DEnergy;
+
+   this->bindDofs( mesh, _u );
+   //rho
+   lF2DContinuity->setTau(tau);
+   lF2DContinuity->setVelocityX( *velocityX );
+   lF2DContinuity->setVelocityY( *velocityY );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; 
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DContinuity,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRho,
+                                                           fuRho );
+
+   //rhoVelocityX
+   lF2DMomentumX->setTau(tau);
+   lF2DMomentumX->setVelocityX( *velocityX );
+   lF2DMomentumX->setVelocityY( *velocityY );
+   lF2DMomentumX->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumX, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; 
+   explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DMomentumX,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityX,
+                                                           fuRhoVelocityX );
+
+   //rhoVelocityY
+   lF2DMomentumY->setTau(tau);
+   lF2DMomentumY->setVelocityX( *velocityX );
+   lF2DMomentumY->setVelocityY( *velocityY );
+   lF2DMomentumY->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumY, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY;
+   explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DMomentumY,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityY,
+                                                           fuRhoVelocityY );
+  
+   //energy
+   lF2DEnergy->setTau(tau);
+   lF2DEnergy->setVelocityX( *velocityX ); 
+   lF2DEnergy->setVelocityY( *velocityY ); 
+   lF2DEnergy->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DEnergy,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uEnergy,
+                                                           fuEnergy );
+/*
+cout << "rho " << uRho.getData() << endl;
+getchar();
+cout << "rhoVelX " << uRhoVelocityX.getData() << endl;
+getchar();
+cout << "rhoVelY " << uRhoVelocityY.getData() << endl;
+getchar();
+cout << "Energy " << uEnergy.getData() << endl;
+getchar();
+cout << "velocity " << velocity.getData() << endl;
+getchar();
+cout << "velocityX " << velocityX.getData() << endl;
+getchar();
+cout << "velocityY " << velocityY.getData() << endl;
+getchar();
+cout << "pressure " << pressure.getData() << endl;
+getchar();
+*/
+
+
+/*
+   BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; 
+   boundaryConditionsSetter.template apply< typename Mesh::Cell >( 
+      this->boundaryCondition, 
+      time + tau, 
+       u );*/
+ }
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshPointer& mesh,
+                      DofVectorPointer& _u,
+                      Matrix& matrix,
+                      DofVectorPointer& b,
+                      MeshDependentDataPointer& meshDependentData )
+{
+/*   LinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             BackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   MeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+postIterate( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& mesh,
+             DofVectorPointer& dofs,
+             MeshDependentDataPointer& meshDependentData )
+{
+
+   //velocityX
+   this->velocityX->setMesh( mesh );
+   VelocityX velocityXGetter( *uRho, *uRhoVelocityX );
+   *this->velocityX = velocityXGetter;
+
+   //velocityY
+   this->velocityY->setMesh( mesh );
+   VelocityX velocityYGetter( *uRho, *uRhoVelocityY );
+   *this->velocityY = velocityYGetter;
+
+   //velocity
+   this->velocity->setMesh( mesh );
+   Velocity velocityGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY );
+   *this->velocity = velocityGetter;
+
+   //pressure
+   this->pressure->setMesh( mesh );
+   Pressure pressureGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY, *uEnergy, gamma );
+   *this->pressure = pressureGetter;
+
+   return true;
+}
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/2d/tnl-run-euler-2d b/examples/inviscid-flow-sw/2d/tnl-run-euler-2d
new file mode 100644
index 0000000000..463dd3506a
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/tnl-run-euler-2d
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 1.0 \
+               --proportions-y 1.0 \
+               --size-x 400 \
+               --size-y 400
+
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+#              --boundary-conditions-type neumann \
+#              --boundary-conditions-constant 0 \
+
+tnl-euler-2d-dbg --time-discretisation explicit \
+              --time-step 5.0e-4 \
+              --boundary-conditions-type myneumann \
+              --discrete-solver euler \
+              --snapshot-period 0.03 \
+              --final-time 0.3 \
+              --NW-density 0.5323 \
+              --NW-velocityX 1.206 \
+              --NW-velocityY 0.0 \
+              --NW-pressure 0.3 \
+              --NE-density 1.5 \
+              --NE-velocityX 0.0 \
+              --NE-velocityY 0.0 \
+              --NE-pressure 1.5 \
+              --SW-density 0.138 \
+              --SW-velocityX 1.206 \
+              --SW-velocityY 1.206 \
+              --SW-pressure 0.029 \
+              --SE-density 0.5323 \
+              --SE-velocityX 0 \
+              --SE-velocityY 1.206 \
+              --SE-pressure 0.3 \
+              --gamma 1.4 \
+              --riemann-border 0.5 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/inviscid-flow-sw/2d/tnl-run-euler-2d~ b/examples/inviscid-flow-sw/2d/tnl-run-euler-2d~
new file mode 100644
index 0000000000..05cfd80b5c
--- /dev/null
+++ b/examples/inviscid-flow-sw/2d/tnl-run-euler-2d~
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 1.0 \
+               --proportions-y 1.0 \
+               --size-x 400 \
+               --size-y 400
+
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+#              --boundary-conditions-type neumann \
+#              --boundary-conditions-constant 0 \
+
+tnl-euler-2d-dbg --time-discretisation explicit \
+              --time-step 5.0e-4 \
+              --boundary-conditions-type myneumann \
+              --discrete-solver euler \
+              --snapshot-period 0.03 \
+              --final-time 0.3 \
+              --NW-density 0.5323 \
+              --NW-velocityX 1.206 \
+              --NW-velocityY 0.0 \
+              --NW-pressure 0.3 \
+              --NE-density 1.5 \
+              --NE-velocityX 0.0 \
+              --NE-velocityY 0.0 \
+              --NE-pressure 1.5 \
+              --SW-density 0.138 \
+              --SW-velocityX 1.206 \
+              --SW-velocityY 1.206 \
+              --SW-pressure 0.029 \
+              --SE-density 0.5323 \
+              --SE-velocityX 0 \
+              --SE-velocityY 1.206 \
+              --SE-pressure 0.3 \
+              --gamma 1.4 \
+              --riemann-border 0.5 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
+tnl-view --mesh mesh.tnl --input-files *tnl --output-format vtk  
diff --git a/examples/inviscid-flow-sw/3d/CMakeLists.txt b/examples/inviscid-flow-sw/3d/CMakeLists.txt
new file mode 100644
index 0000000000..41096a73a7
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/CMakeLists.txt
@@ -0,0 +1,21 @@
+set( tnl_heat_equation_SOURCES     
+     euler.cpp
+     euler-cuda.cu )
+               
+IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE(tnl-euler-3d${debugExt} euler-cuda.cu)
+   target_link_libraries (tnl-euler-3d${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+   ADD_EXECUTABLE(tnl-euler-3d${debugExt} euler.cpp)     
+   target_link_libraries (tnl-euler-3d${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
+
+
+INSTALL( TARGETS tnl-euler-3d${debugExt}
+         RUNTIME DESTINATION bin
+         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+        
+INSTALL( FILES run-euler
+               ${tnl_heat_equation_SOURCES}
+         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow-3d )
+
diff --git a/examples/inviscid-flow-sw/3d/CMakeLists.txt~ b/examples/inviscid-flow-sw/3d/CMakeLists.txt~
new file mode 100644
index 0000000000..d753d50afc
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/CMakeLists.txt~
@@ -0,0 +1,21 @@
+set( tnl_heat_equation_SOURCES     
+     euler.cpp
+     euler-cuda.cu )
+               
+IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE(tnl-euler-2d${debugExt} euler-cuda.cu)
+   target_link_libraries (tnl-euler-2d${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+   ADD_EXECUTABLE(tnl-euler-2d${debugExt} euler.cpp)     
+   target_link_libraries (tnl-euler-2d${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
+
+
+INSTALL( TARGETS tnl-euler-2d${debugExt}
+         RUNTIME DESTINATION bin
+         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+        
+INSTALL( FILES run-euler
+               ${tnl_heat_equation_SOURCES}
+         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow-2d )
+
diff --git a/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h b/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h
new file mode 100644
index 0000000000..2e79798a31
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h
@@ -0,0 +1,56 @@
+#ifndef EulerVelXGetter_H
+#define EulerVelXGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelXGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelXGetter( const MeshFunctionType& rho,
+                       const MeshFunctionType& rhoVel)
+      : rho( rho ), rhoVel( rhoVel )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+          if (this->rho[ idx ]==0) return 0; else return this->rhoVel[ idx ] / this->rho[ idx ];
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelXGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h~ b/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h~
new file mode 100644
index 0000000000..224aa61fb8
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/Euler2DVelXGetter.h~
@@ -0,0 +1,56 @@
+#ifndef EulerVelXGetter_H
+#define EulerVelXGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelXGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelXGetter( const MeshFunctionType& rho,
+                       /*const MeshFunctionType& rhoVel*/)
+      : rho( rho ), rhoVel( rhoVel )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+          if (this->rho[ idx ]==0) return 0; else return this->rhoVel[ idx ] / this->rho[ idx ];
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelXGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/EulerPressureGetter.h b/examples/inviscid-flow-sw/3d/EulerPressureGetter.h
new file mode 100644
index 0000000000..45611c6475
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/EulerPressureGetter.h
@@ -0,0 +1,72 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerPressureGetter( const MeshFunctionType& rho,
+                           const MeshFunctionType& rhoVelX,
+                           const MeshFunctionType& rhoVelY,
+                           const MeshFunctionType& rhoVelZ,
+                           const MeshFunctionType& energy,
+                           const RealType& gamma )
+      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), rhoVelZ( rhoVelZ ), energy( energy ), gamma( gamma )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+            {
+/*         if (this->rho[ idx ]==0) return 0; 
+         else return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rho[ idx ] * 
+         ( std::pow(this->rhoVelX[ idx ] / this->rho[ idx ],2) + std::pow(this->rhoVelY[ idx ] / this->rho[ idx ],2) + std::pow(this->rhoVelZ[ idx ] / this->rho[ idx ],2) );
+*/       return ( this->gamma - 1.0 ) * ( this->energy[ idx ] * this->rho[ idx ] );
+      }
+
+      
+   protected:
+
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVelX;
+      
+      const MeshFunctionType& rhoVelY;
+
+      const MeshFunctionType& rhoVelZ;
+
+      const MeshFunctionType& energy;
+
+      RealType gamma;
+
+};
+
+} //namespace TNL
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/EulerPressureGetter.h~ b/examples/inviscid-flow-sw/3d/EulerPressureGetter.h~
new file mode 100644
index 0000000000..45611c6475
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/EulerPressureGetter.h~
@@ -0,0 +1,72 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerPressureGetter( const MeshFunctionType& rho,
+                           const MeshFunctionType& rhoVelX,
+                           const MeshFunctionType& rhoVelY,
+                           const MeshFunctionType& rhoVelZ,
+                           const MeshFunctionType& energy,
+                           const RealType& gamma )
+      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), rhoVelZ( rhoVelZ ), energy( energy ), gamma( gamma )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+            {
+/*         if (this->rho[ idx ]==0) return 0; 
+         else return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rho[ idx ] * 
+         ( std::pow(this->rhoVelX[ idx ] / this->rho[ idx ],2) + std::pow(this->rhoVelY[ idx ] / this->rho[ idx ],2) + std::pow(this->rhoVelZ[ idx ] / this->rho[ idx ],2) );
+*/       return ( this->gamma - 1.0 ) * ( this->energy[ idx ] * this->rho[ idx ] );
+      }
+
+      
+   protected:
+
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVelX;
+      
+      const MeshFunctionType& rhoVelY;
+
+      const MeshFunctionType& rhoVelZ;
+
+      const MeshFunctionType& energy;
+
+      RealType gamma;
+
+};
+
+} //namespace TNL
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/EulerVelGetter.h b/examples/inviscid-flow-sw/3d/EulerVelGetter.h
new file mode 100644
index 0000000000..24d06eaf5f
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/EulerVelGetter.h
@@ -0,0 +1,62 @@
+#ifndef EulerVelGetter_H
+#define EulerVelGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelGetter( const MeshFunctionType& rho,
+                      const MeshFunctionType& rhoVelX,
+                      const MeshFunctionType& rhoVelY,
+                      const MeshFunctionType& rhoVelZ)
+      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), rhoVelZ( rhoVelZ )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+         if (this->rho[ idx ]==0) return 0; else return std::sqrt( std::pow( this->rhoVelX[ idx ] / this->rho[ idx ], 2) + std::pow( this->rhoVelY[ idx ] / this->rho[ idx ], 2) + std::pow( this->rhoVelZ[ idx ] / this->rho[ idx ], 2) ) ;
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVelX;
+
+      const MeshFunctionType& rhoVelY;
+
+      const MeshFunctionType& rhoVelZ;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/EulerVelGetter.h~ b/examples/inviscid-flow-sw/3d/EulerVelGetter.h~
new file mode 100644
index 0000000000..888529954b
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/EulerVelGetter.h~
@@ -0,0 +1,60 @@
+#ifndef EulerVelGetter_H
+#define EulerVelGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelGetter( const MeshFunctionType& rho,
+                      const MeshFunctionType& rhoVelX,
+                      const MeshFunctionType& rhoVelY,
+                      const MeshFunctionType& rhoVelZ)
+      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), rhoVelZ( rhoVelZ )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+         if (this->rho[ idx ]==0) return 0; else return std::sqrt( std::pow( this->rhoVelX[ idx ] / this->rho[ idx ], 2) + std::pow( this->rhoVelY[ idx ] / this->rho[ idx ], 2) + std::pow( this->rhoVelZ[ idx ] / this->rho[ idx ], 2) ) ;
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVelX;
+
+      const MeshFunctionType& rhoVelY;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/EulerVelXGetter.h~ b/examples/inviscid-flow-sw/3d/EulerVelXGetter.h~
new file mode 100644
index 0000000000..54a29d6acc
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/EulerVelXGetter.h~
@@ -0,0 +1,56 @@
+#ifndef EulerVelXGetter_H
+#define EulerVelXGetter_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelXGetter
+: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      
+      EulerVelXGetter( const MeshFunctionType& rho,
+                      const MeshFunctionType& rhoVel)
+      : rho( rho ), rhoVel( rhoVel )
+      {}
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         return this->operator[]( entity.getIndex() );
+      }
+      
+      __cuda_callable__
+      Real operator[]( const IndexType& idx ) const
+      {
+          if (this->rho[ idx ]==0) return 0; else return this->rhoVel[ idx ] / this->rho[ idx ];
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+
+};
+
+} // namespace TNL
+
+#endif	/* EulerVelXGetter_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichs2D.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichs2D.h~
new file mode 100644
index 0000000000..447569fa44
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichs2D.h~
@@ -0,0 +1,41 @@
+#ifndef LaxFridrichs2D_H
+#define LaxFridrichs2D_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs2D
+{
+   public:
+      typedef Real RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > Continuity;
+      typedef LaxFridrichsMomentumX< Mesh, Real, Index > MomentumX;
+      typedef LaxFridrichsMomentumY< Mesh, Real, Index > MomentumY;
+      typedef LaxFridrichsMomentumZ< Mesh, Real, Index > MomentumZ;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > Energy;
+      typedef EulerVelXGetter< Mesh, Real, Index > VelocityX;
+      typedef EulerVelGetter< Mesh, Real, Index > Velocity;
+      typedef EulerPressureGetter< Mesh, Real, Index > Pressure;
+   
+};
+
+} //namespace TNL
+
+#endif	/* LaxFridrichs2D_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h b/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h
new file mode 100644
index 0000000000..57c9fe6b4e
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h
@@ -0,0 +1,41 @@
+#ifndef LaxFridrichs3D_H
+#define LaxFridrichs3D_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs3D
+{
+   public:
+      typedef Real RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > Continuity;
+      typedef LaxFridrichsMomentumX< Mesh, Real, Index > MomentumX;
+      typedef LaxFridrichsMomentumY< Mesh, Real, Index > MomentumY;
+      typedef LaxFridrichsMomentumZ< Mesh, Real, Index > MomentumZ;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > Energy;
+      typedef EulerVelXGetter< Mesh, Real, Index > VelocityX;
+      typedef EulerVelGetter< Mesh, Real, Index > Velocity;
+      typedef EulerPressureGetter< Mesh, Real, Index > Pressure;
+   
+};
+
+} //namespace TNL
+
+#endif	/* LaxFridrichs3D_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h~
new file mode 100644
index 0000000000..b67b594d8c
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichs3D.h~
@@ -0,0 +1,41 @@
+#ifndef LaxFridrichs3D_H
+#define LaxFridrichs3D_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs3D
+{
+   public:
+      typedef Real RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > Continuity;
+      typedef LaxFridrichsMomentumX< Mesh, Real, Index > MomentumX;
+      typedef LaxFridrichsMomentumY< Mesh, Real, Index > MomentumYl;
+      typedef LaxFridrichsMomentumZ< Mesh, Real, Index > MomentumZ;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > Energy;
+      typedef EulerVelXGetter< Mesh, Real, Index > VelocityX;
+      typedef EulerVelGetter< Mesh, Real, Index > Velocity;
+      typedef EulerPressureGetter< Mesh, Real, Index > Pressure;
+   
+};
+
+} //namespace TNL
+
+#endif	/* LaxFridrichs3D_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity.h~
new file mode 100644
index 0000000000..e60778edce
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity.h~
@@ -0,0 +1,210 @@
+#ifndef LaxFridrichsContinuity_H
+#define LaxFridrichsContinuity_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsContinuity
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+
+} //namespace TNL
+
+#include "LaxFridrichsContinuity_impl .h"
+
+#endif	/* LaxFridrichsContinuity_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h
new file mode 100644
index 0000000000..ac469a5240
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h	
@@ -0,0 +1,350 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+    const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+    const IndexType& center = entity.getIndex(); 
+    const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+    const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rho
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocityX[ east ] - u[ west ] * this->velocityX[ west ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ south ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+   const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ((1.0/6.0) / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] + u[ up ] + u[ down ] - 6.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocityX[ east ] - u[ west ] * this->velocityX[ west ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ south ] )
+          - 0.5 * hzInverse * ( u[ up ] * this->velocityZ[ up ] - u[ down ] * this->velocityZ[ down ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h~
new file mode 100644
index 0000000000..c76e2ec449
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsContinuity_impl .h~	
@@ -0,0 +1,350 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+    const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+    const IndexType& center = entity.getIndex(); 
+    const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+    const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rho
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocityX[ east ] - u[ west ] * this->velocityX[ west ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ suoth ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+   const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ((1.0/6.0) / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] + u[ up ] + u[ down ] - 6.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ east ] * this->velocityX[ east ] - u[ west ] * this->velocityX[ west ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ south ] )
+          - 0.5 * hzInverse * ( u[ up ] * this->velocityZ[ up ] - u[ down ] * this->velocityZ[ down ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h
new file mode 100644
index 0000000000..9083970ae4
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h
@@ -0,0 +1,237 @@
+#ifndef LaxFridrichsEnergy_H
+#define LaxFridrichsEnergy_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsEnergy
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+} //namespace TNL
+
+
+#include "LaxFridrichsEnergy_impl.h"
+
+#endif	/* LaxFridrichsEnergy_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h~
new file mode 100644
index 0000000000..d531664fd6
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy.h~
@@ -0,0 +1,219 @@
+#ifndef LaxFridrichsEnergy_H
+#define LaxFridrichsEnergy_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsEnergy
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+} //namespace TNL
+
+
+#include "LaxFridrichsEnergy_impl.h"
+
+#endif	/* LaxFridrichsEnergy_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy_impl.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy_impl.h~
new file mode 100644
index 0000000000..e52cfe4015
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsEnergy_impl.h~
@@ -0,0 +1,350 @@
+#ifndef LaxFridrichsEnergy_IMPL_H
+#define LaxFridrichsEnergy_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   //energy
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ((( u[ east ] + this->pressure[ east ] ) * this->velocityX[ east ] )
+			      -(( u[ west ] + this->pressure[ west ] ) * this->velocityX[ west ] ))
+          - 0.5 * hyInverse * ((( u[ north ] + this->pressure[ north ] ) * this->velocityY[ north ] )
+			      -(( u[ south ] + this->pressure[ south ] ) * this->velocityY[ south ] ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
+          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsEnergyIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h
new file mode 100644
index 0000000000..5d1cf91925
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h
@@ -0,0 +1,237 @@
+#ifndef LaxFridrichsMomentumX_H
+#define LaxFridrichsMomentumX_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumX
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+
+} // namespace TNL
+
+#include "LaxFridrichsMomentumX_impl.h"
+
+#endif	/* LaxFridrichsMomentumX_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h~
new file mode 100644
index 0000000000..c359072f09
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX.h~
@@ -0,0 +1,224 @@
+#ifndef LaxFridrichsMomentumX_H
+#define LaxFridrichsMomentumX_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumX
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+
+} // namespace TNL
+
+#include "LaxFridrichsMomentumX_impl.h"
+
+#endif	/* LaxFridrichsMomentumX_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX_impl.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX_impl.h~
new file mode 100644
index 0000000000..bc666db78e
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumX_impl.h~
@@ -0,0 +1,355 @@
+#ifndef LaxFridrichsMomentumX_IMPL_H
+#define LaxFridrichsMomentumX_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rhoVelX
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ east ] * this->velocityX[ east ] + this->pressure[ east ] )
+			      -( u[ west ] * this->velocityX[ west ] + this->pressure[ west ] ))
+          - 0.5 * hyInverse * (( u[ north ] * this->velocityY[ north ] )
+			      -( u[ south ] * this->velocityY[ south ] ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumX< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+   const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+return ((1.0/6.0) / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] + u[ up ] + u [ down ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ east ] * this->velocityX[ east ] + this->pressure[ east ] )
+			      -( u[ west ] * this->velocityX[ west ] + this->pressure[ west ] ))
+          - 0.5 * hyInverse * (( u[ north ] * this->velocityY[ north ] )
+			      -( u[ south ] * this->velocityY[ south ] ))
+          - 0.5 * hzInverse * (( u[ up ] * this->velocityZ[ up ] )
+			      -( u[ down ] * this->velocityZ[ down ] ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumX< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumX< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsMomentumXIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY.h~
new file mode 100644
index 0000000000..2799f2f2bc
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY.h~
@@ -0,0 +1,218 @@
+#ifndef LaxFridrichsMomentumY_H
+#define LaxFridrichsMomentumY_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumY
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+} // namespace TNL
+
+#include "LaxFridrichsMomentumY_impl.h"
+
+#endif	/* LaxFridrichsMomentumY_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY_impl.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY_impl.h~
new file mode 100644
index 0000000000..aaa3504323
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumY_impl.h~
@@ -0,0 +1,355 @@
+#ifndef LaxFridrichsMomentumY_IMPL_H
+#define LaxFridrichsMomentumY_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rhoVelY
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ east ] * this->velocityX[ east ] )
+			      -( u[ west ] * this->velocityX[ west ] ))
+          - 0.5 * hyInverse * (( u[ north ] * this->velocityY[ north ] + this->pressure[ north ] )
+			      -( u[ south ] * this->velocityY[ south ] + this->pressure[ south ]));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumY< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ((1.0/6.0) / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] + u[ up ] + u[ down ]- 6.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ east ] * this->velocityX[ east ] )
+			      -( u[ west ] * this->velocityX[ west ] ))
+          - 0.5 * hyInverse * (( u[ north ] * this->velocityY[ north ] + this->pressure[ north ] )
+			      -( u[ south ] * this->velocityY[ south ] + this->pressure[ south ]))
+          - 0.5 * hzInverse * (( u[ up ] * this->velocityZ[ up ] )
+			      -( u[ down ] * this->velocityZ[ down ] ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumY< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumY< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsMomentumYIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h
new file mode 100644
index 0000000000..0d7882f6de
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h
@@ -0,0 +1,236 @@
+#ifndef LaxFridrichsMomentumZ_H
+#define LaxFridrichsMomentumZ_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumZ
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+} // namespace TNL
+
+#include "LaxFridrichsMomentumZ_impl.h"
+
+#endif	/* LaxFridrichsMomentumZ_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h~
new file mode 100644
index 0000000000..816da05aa2
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ.h~
@@ -0,0 +1,236 @@
+#ifndef LaxFridrichsMomentumY_H
+#define LaxFridrichsMomentumY_H
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumY
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static String getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType velocityZ;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(MeshFunctionType& velocityX)
+      {
+          this->velocityX.bind(velocityX);
+      };
+
+      void setVelocityY(MeshFunctionType& velocityY)
+      {
+          this->velocityY.bind(velocityY);
+      };
+
+      void setVelocityZ(MeshFunctionType& velocityZ)
+      {
+          this->velocityZ.bind(velocityZ);
+      };
+
+      void setPressure(MeshFunctionType& pressure)
+      {
+          this->pressure.bind(pressure);
+      };
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const;
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;
+};
+
+} // namespace TNL
+
+#include "LaxFridrichsMomentumY_impl.h"
+
+#endif	/* LaxFridrichsMomentumY_H */
diff --git a/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ_impl.h~ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ_impl.h~
new file mode 100644
index 0000000000..0065f28b14
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/LaxFridrichsMomentumZ_impl.h~
@@ -0,0 +1,351 @@
+#ifndef LaxFridrichsMomentumZ_IMPL_H
+#define LaxFridrichsMomentumZ_IMPL_H
+
+namespace TNL {
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumZ< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) * hxSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); 
+   const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); 
+   matrixRow.setElement( 0, west,   - lambdaX );
+   matrixRow.setElement( 1, center, 2.0 * lambdaX );
+   matrixRow.setElement( 2, east,   - lambdaX );
+}
+
+/****
+ * 2D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumZ< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   //rhoVelY
+   const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+   const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   return (0.25 / this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ east ] * this->velocityX[ east ] )
+			      -( u[ west ] * this->velocityX[ west ] ))
+          - 0.5 * hyInverse * (( u[ north ] * this->velocityY[ north ] + this->pressure[ north ] )
+			      -( u[ south ] * this->velocityY[ south ] + this->pressure[ south ]));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >(); 
+   matrixRow.setElement( 0, south,  -lambdaY );
+   matrixRow.setElement( 1, west,   -lambdaX );
+   matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, east,   -lambdaX );
+   matrixRow.setElement( 4, north,  -lambdaY );
+}
+
+/****
+ * 3D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+String
+LaxFridrichsMomentumZ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return String( "LaxFridrichsMomentumZ< " ) +
+          MeshType::getType() + ", " +
+         TNL::getType< Real >() + ", " +
+         TNL::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumZ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   /****
+    * Implement your explicit form of the differential operator here.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+    static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); 
+    static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); 
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   return ( u[ west ] - 2.0 * u[ center ] + u[ east ]  ) * hxSquareInverse +
+          ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse +
+          ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentumZ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getLinearSystemRowLength( const MeshType& mesh,
+                          const IndexType& index,
+                          const MeshEntity& entity ) const
+{
+   /****
+    * Return a number of non-zero elements in a line (associated with given grid element) of
+    * the linear system.
+    * The following example is the Laplace operator approximated 
+    * by the Finite difference method.
+    */
+
+   return 2*Dimensions + 1;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+   template< typename MeshEntity, typename Vector, typename MatrixRow >
+__cuda_callable__
+void
+LaxFridrichsMomentumZ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+updateLinearSystem( const RealType& time,
+                    const RealType& tau,
+                    const MeshType& mesh,
+                    const IndexType& index,
+                    const MeshEntity& entity,
+                    const MeshFunctionType& u,
+                    Vector& b,
+                    MatrixRow& matrixRow ) const
+{
+   /****
+    * Setup the non-zero elements of the linear system here.
+    * The following example is the Laplace operator appriximated 
+    * by the Finite difference method.
+    */
+
+    const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); 
+   const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >(); 
+   const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >(); 
+   const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >(); 
+   const IndexType& center = entity.getIndex(); 
+   const IndexType& east  = neighbourEntities.template getEntityIndex<  1,  0,  0 >(); 
+   const IndexType& west  = neighbourEntities.template getEntityIndex< -1,  0,  0 >(); 
+   const IndexType& north = neighbourEntities.template getEntityIndex<  0,  1,  0 >(); 
+   const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1,  0 >(); 
+   const IndexType& up    = neighbourEntities.template getEntityIndex<  0,  0,  1 >(); 
+   const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >(); 
+   matrixRow.setElement( 0, down,   -lambdaZ );
+   matrixRow.setElement( 1, south,  -lambdaY );
+   matrixRow.setElement( 2, west,   -lambdaX );
+   matrixRow.setElement( 3, center, 2.0 * ( lambdaX + lambdaY + lambdaZ ) );
+   matrixRow.setElement( 4, east,   -lambdaX );
+   matrixRow.setElement( 5, north,  -lambdaY );
+   matrixRow.setElement( 6, up,     -lambdaZ );
+}
+
+} //namespace TNL
+
+#endif	/* LaxFridrichsMomentumZIMPL_H */
+
diff --git a/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h b/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h
new file mode 100644
index 0000000000..066600f483
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h
@@ -0,0 +1,175 @@
+// coppied and changed
+/***************************************************************************
+                          tnlMyMixedBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYMIXEDBOUNDARYCONDITIONS_H_
+#define MYMIXEDBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyMixedBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      float x0 = 0.5;
+      if( entity.getCoordinates().x() == 0 )
+      {
+         if ( entity.getCoordinates().y() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().y() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().y() == 0 )
+      {
+         if ( entity.getCoordinates().x() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().x() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().x() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+      else if( entity.getCoordinates().y() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+      else return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyMixedBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyMixed boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYMIXEDBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h~ b/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h~
new file mode 100644
index 0000000000..0cab175bb5
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/MyMixedBoundaryConditions.h~
@@ -0,0 +1,175 @@
+/*** coppied and changed
+/***************************************************************************
+                          tnlMyMixedBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYMIXEDBOUNDARYCONDITIONS_H_
+#define MYMIXEDBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyMixedBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      float x0 = 0.5;
+      if( entity.getCoordinates().x() == 0 )
+      {
+         if ( entity.getCoordinates().y() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().y() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().y() == 0 )
+      {
+         if ( entity.getCoordinates().x() < count * x0 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         else if( entity.getCoordinates().x() < count -1 )
+            return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+         else if( entity.getCoordinates().y() == count )
+            return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+      else if( entity.getCoordinates().x() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+      else if( entity.getCoordinates().y() == count ) 
+            return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+      else return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      return u[ neighbourEntities.template getEntityIndex< 0, 0 >() ];
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyMixedBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyMixed boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYMIXEDBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h b/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h
new file mode 100644
index 0000000000..7987b93160
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h
@@ -0,0 +1,157 @@
+//** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().x() == count-1 )
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+            else if( entity.getCoordinates().y() == 0 )
+               return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+               else return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h~ b/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h~
new file mode 100644
index 0000000000..6a1e361b46
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/MyNeumannBoundaryConditions.h~
@@ -0,0 +1,157 @@
+/*** coppied and changed
+/***************************************************************************
+                          tnlMyNeumannBoundaryConditions.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef MYNEUMANNBOUNDARYCONDITIONS_H_
+#define MYNEUMANNBOUNDARYCONDITIONS_H_
+
+#pragma once
+
+#include <TNL/Operators/Operator.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include <TNL/Functions/FunctionAdapter.h>
+#include <TNL/Functions/MeshFunction.h>
+
+namespace TNL {
+namespace Operators {
+
+template< typename Mesh,
+          typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >,
+          int MeshEntitiesDimensions = Mesh::getMeshDimensions(),
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class MyNeumannBoundaryConditions
+: public Operator< Mesh,
+                   Functions::MeshBoundaryDomain,
+                   MeshEntitiesDimensions,
+                   MeshEntitiesDimensions,
+                   Real,
+                   Index >
+{
+   public:
+
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+      
+      typedef SharedPointer< Mesh > MeshPointer;
+      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
+      }
+
+      void setFunction( const Function& function )
+      {
+         this->function = function;
+      }
+
+      Function& getFunction()
+      {
+         return this->function;
+      }
+ 
+      const Function& getFunction() const
+      {
+         return this->function;
+      }
+
+      template< typename EntityType,
+                typename MeshFunction >
+      __cuda_callable__
+      const RealType operator()( const MeshFunction& u,
+                                 const EntityType& entity,                            
+                                 const RealType& time = 0 ) const
+      {
+      const MeshType& mesh = entity.getMesh();
+      const auto& neighbourEntities = entity.getNeighbourEntities();
+      typedef typename MeshType::Cell Cell;
+      int count = mesh.template getEntitiesCount< Cell >();
+      count = std::sqrt(count);
+      if( entity.getCoordinates().x() == 0 )
+         return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ];
+         else if( entity.getCoordinates().x() == count-1 )
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ];
+            else if( entity.getCoordinates().y() == 0 )
+               return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ];
+               else return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ];
+         //tady se asi delaji okrajove podminky
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      IndexType getLinearSystemRowLength( const MeshType& mesh,
+                                          const IndexType& index,
+                                          const EntityType& entity ) const
+      {
+         return 1;
+      }
+
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
+      __cuda_callable__
+      void setMatrixElements( const PreimageFunction& u,
+                              const MeshEntity& entity,
+                              const RealType& time,
+                              const RealType& tau,
+                              Matrix& matrix,
+                              Vector& b ) const
+      {
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( entity.getIndex() );
+         const IndexType& index = entity.getIndex();
+         matrixRow.setElement( 0, index, 1.0 );
+         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
+
+   protected:
+
+      Function function;
+ 
+   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+};
+
+
+template< typename Mesh,
+          typename Function >
+std::ostream& operator << ( std::ostream& str, const MyNeumannBoundaryConditions< Mesh, Function >& bc )
+{
+   str << "MyNeumann boundary conditions: vector = " << bc.getVector();
+   return str;
+}
+
+} // namespace Operators
+} // namespace TNL
+
+#endif /* MYNEUMANNBOUNDARYCONDITIONS_H_ */
diff --git a/examples/inviscid-flow-sw/3d/euler-cuda.cu b/examples/inviscid-flow-sw/3d/euler-cuda.cu
new file mode 100644
index 0000000000..4d76005cb1
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/euler-cuda.cu
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow-sw/3d/euler.cpp b/examples/inviscid-flow-sw/3d/euler.cpp
new file mode 100644
index 0000000000..4d76005cb1
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/euler.cpp
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow-sw/3d/euler.h b/examples/inviscid-flow-sw/3d/euler.h
new file mode 100644
index 0000000000..d5550d0c72
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/euler.h
@@ -0,0 +1,170 @@
+#include <TNL/tnlConfig.h>
+#include <TNL/Solvers/Solver.h>
+#include <TNL/Solvers/BuildConfigTags.h>
+#include <TNL/Operators/DirichletBoundaryConditions.h>
+#include <TNL/Operators/NeumannBoundaryConditions.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include "eulerProblem.h"
+#include "LaxFridrichs3D.h"
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+#include "MyMixedBoundaryConditions.h"
+#include "MyNeumannBoundaryConditions.h"
+
+using namespace TNL;
+
+typedef eulerBuildConfigTag BuildConfig;
+
+/****
+ * Uncoment the following (and comment the previous line) for the complete build.
+ * This will include support for all floating point precisions, all indexing types
+ * and more solvers. You may then choose between them from the command line.
+ * The compile time may, however, take tens of minutes or even several hours,
+ * esppecially if CUDA is enabled. Use this, if you want, only for the final build,
+ * not in the development phase.
+ */
+//typedef tnlDefaultConfigTag BuildConfig;
+
+template< typename ConfigTag >class eulerConfig
+{
+   public:
+      static void configSetup( Config::ConfigDescription & config )
+      {
+         config.addDelimiter( "euler2D settings:" );
+         config.addEntry< String >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< String >( "dirichlet" );
+            config.addEntryEnum< String >( "neumann" );
+            config.addEntryEnum< String >( "mymixed" );
+            config.addEntryEnum< String >( "myneumann" );
+         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
+         config.addEntry< double >( "NWU-density", "This sets a value of northwest up density." );
+         config.addEntry< double >( "NWU-velocityX", "This sets a value of northwest up x velocity." );
+         config.addEntry< double >( "NWU-velocityY", "This sets a value of northwest up y velocity." );
+         config.addEntry< double >( "NWU-velocityZ", "This sets a value of northwest up z velocity." );
+         config.addEntry< double >( "NWU-pressure", "This sets a value of northwest up pressure." );
+         config.addEntry< double >( "SWU-density", "This sets a value of southwest up density." );
+         config.addEntry< double >( "SWU-velocityX", "This sets a value of southwest up x velocity." );
+         config.addEntry< double >( "SWU-velocityY", "This sets a value of southwest up y velocity." );
+         config.addEntry< double >( "SWU-velocityZ", "This sets a value of southwest up z velocity." );
+         config.addEntry< double >( "SWU-pressure", "This sets a value of southwest up pressure." );
+         config.addEntry< double >( "NWD-density", "This sets a value of northwest down density." );
+         config.addEntry< double >( "NWD-velocityX", "This sets a value of northwest down x velocity." );
+         config.addEntry< double >( "NWD-velocityY", "This sets a value of northwest down y velocity." );
+         config.addEntry< double >( "NWD-velocityZ", "This sets a value of northwest down z velocity." );
+         config.addEntry< double >( "NWD-pressure", "This sets a value of northwest down pressure." );
+         config.addEntry< double >( "SWD-density", "This sets a value of southwest down density." );
+         config.addEntry< double >( "SWD-velocityX", "This sets a value of southwest down x velocity." );
+         config.addEntry< double >( "SWD-velocityY", "This sets a value of southwest down y velocity." );
+         config.addEntry< double >( "SWF-velocityZ", "This sets a value of southwest down z velocity." );
+         config.addEntry< double >( "SWD-pressure", "This sets a value of southwest down pressure." );
+         config.addEntry< double >( "riemann-border", "This sets a position of discontinuity cross." );
+         config.addEntry< double >( "NEU-density", "This sets a value of northeast up density." );
+         config.addEntry< double >( "NEU-velocityX", "This sets a value of northeast up x velocity." );
+         config.addEntry< double >( "NEU-velocityY", "This sets a value of northeast up y velocity." );
+         config.addEntry< double >( "NEU-velocityZ", "This sets a value of northeast up z velocity." );
+         config.addEntry< double >( "NEU-pressure", "This sets a value of northeast up pressure." );
+         config.addEntry< double >( "SEU-density", "This sets a value of southeast up density." );
+         config.addEntry< double >( "SEU-velocityX", "This sets a value of southeast up x velocity." );
+         config.addEntry< double >( "SEU-velocityY", "This sets a value of southeast up y velocity." );
+         config.addEntry< double >( "SEU-velocityZ", "This sets a value of southeast up z velocity." );
+         config.addEntry< double >( "SEU-pressure", "This sets a value of southeast up pressure." );
+         config.addEntry< double >( "NED-density", "This sets a value of northeast down density." );
+         config.addEntry< double >( "NED-velocityX", "This sets a value of northeast down x velocity." );
+         config.addEntry< double >( "NED-velocityY", "This sets a value of northeast down y velocity." );
+         config.addEntry< double >( "NED-velocityZ", "This sets a value of northeast down z velocity." );
+         config.addEntry< double >( "NED-pressure", "This sets a value of northeast down pressure." );
+         config.addEntry< double >( "SED-density", "This sets a value of southeast down density." );
+         config.addEntry< double >( "SED-velocityX", "This sets a value of southeast down x velocity." );
+         config.addEntry< double >( "SED-velocityY", "This sets a value of southeast down y velocity." );
+         config.addEntry< double >( "SED-velocityZ", "This sets a value of southeast down z velocity." );
+         config.addEntry< double >( "SED-pressure", "This sets a value of southeast down pressure." );
+         config.addEntry< double >( "gamma", "This sets a value of gamma constant." );
+
+         /****
+          * Add definition of your solver command line arguments.
+          */
+
+      }
+};
+
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename MeshType,
+          typename ConfigTag,
+          typename SolverStarter >
+class eulerSetter
+{
+   public:
+
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+
+      static bool run( const Config::ParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs3D< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex;
+
+         /****
+          * Resolve the template arguments of your solver here.
+          * The following code is for the Dirichlet and the Neumann boundary conditions.
+          * Both can be constant or defined as descrete values of Vector.
+          */
+          String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef Functions::Analytic::Constant< Dimensions, Real > Constant;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef Functions::MeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "mymixed" )
+          {
+             typedef Operators::MyMixedBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "myneumann" )
+          {
+             typedef Operators::MyNeumannBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "neumann" )
+          {
+             typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+    return true;}
+};
+
+int main( int argc, char* argv[] )
+{
+   Solvers::Solver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
diff --git a/examples/inviscid-flow-sw/3d/euler.h~ b/examples/inviscid-flow-sw/3d/euler.h~
new file mode 100644
index 0000000000..600653ecc7
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/euler.h~
@@ -0,0 +1,162 @@
+#include <TNL/tnlConfig.h>
+#include <TNL/Solvers/Solver.h>
+#include <TNL/Solvers/BuildConfigTags.h>
+#include <TNL/Operators/DirichletBoundaryConditions.h>
+#include <TNL/Operators/NeumannBoundaryConditions.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include "eulerProblem.h"
+#include "LaxFridrichs3D.h"
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+#include "MyMixedBoundaryConditions.h"
+#include "MyNeumannBoundaryConditions.h"
+
+using namespace TNL;
+
+typedef eulerBuildConfigTag BuildConfig;
+
+/****
+ * Uncoment the following (and comment the previous line) for the complete build.
+ * This will include support for all floating point precisions, all indexing types
+ * and more solvers. You may then choose between them from the command line.
+ * The compile time may, however, take tens of minutes or even several hours,
+ * esppecially if CUDA is enabled. Use this, if you want, only for the final build,
+ * not in the development phase.
+ */
+//typedef tnlDefaultConfigTag BuildConfig;
+
+template< typename ConfigTag >class eulerConfig
+{
+   public:
+      static void configSetup( Config::ConfigDescription & config )
+      {
+         config.addDelimiter( "euler2D settings:" );
+         config.addEntry< String >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< String >( "dirichlet" );
+            config.addEntryEnum< String >( "neumann" );
+            config.addEntryEnum< String >( "mymixed" );
+            config.addEntryEnum< String >( "myneumann" );
+         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
+         config.addEntry< double >( "NWU-density", "This sets a value of northwest up density." );
+         config.addEntry< double >( "NWU-velocityX", "This sets a value of northwest up x velocity." );
+         config.addEntry< double >( "NWU-velocityY", "This sets a value of northwest up y velocity." );
+         config.addEntry< double >( "NWU-pressure", "This sets a value of northwest up pressure." );
+         config.addEntry< double >( "SWU-density", "This sets a value of southwest up density." );
+         config.addEntry< double >( "SWU-velocityX", "This sets a value of southwest up x velocity." );
+         config.addEntry< double >( "SWU-velocityY", "This sets a value of southwest up y velocity." );
+         config.addEntry< double >( "SWU-pressure", "This sets a value of southwest up pressure." );
+         config.addEntry< double >( "NWD-density", "This sets a value of northwest down density." );
+         config.addEntry< double >( "NWD-velocityX", "This sets a value of northwest down x velocity." );
+         config.addEntry< double >( "NWD-velocityY", "This sets a value of northwest down y velocity." );
+         config.addEntry< double >( "NWD-pressure", "This sets a value of northwest down pressure." );
+         config.addEntry< double >( "SWD-density", "This sets a value of southwest down density." );
+         config.addEntry< double >( "SWD-velocityX", "This sets a value of southwest down x velocity." );
+         config.addEntry< double >( "SWD-velocityY", "This sets a value of southwest down y velocity." );
+         config.addEntry< double >( "SWD-pressure", "This sets a value of southwest down pressure." );
+         config.addEntry< double >( "riemann-border", "This sets a position of discontinuity cross." );
+         config.addEntry< double >( "NEU-density", "This sets a value of northeast up density." );
+         config.addEntry< double >( "NEU-velocityX", "This sets a value of northeast up x velocity." );
+         config.addEntry< double >( "NEU-velocityY", "This sets a value of northeast up y velocity." );
+         config.addEntry< double >( "NEU-pressure", "This sets a value of northeast up pressure." );
+         config.addEntry< double >( "SEU-density", "This sets a value of southeast up density." );
+         config.addEntry< double >( "SEU-velocityX", "This sets a value of southeast up x velocity." );
+         config.addEntry< double >( "SEU-velocityY", "This sets a value of southeast up y velocity." );
+         config.addEntry< double >( "SEU-pressure", "This sets a value of southeast up pressure." );
+         config.addEntry< double >( "NED-density", "This sets a value of northeast down density." );
+         config.addEntry< double >( "NED-velocityX", "This sets a value of northeast down x velocity." );
+         config.addEntry< double >( "NED-velocityY", "This sets a value of northeast down y velocity." );
+         config.addEntry< double >( "NED-pressure", "This sets a value of northeast down pressure." );
+         config.addEntry< double >( "SED-density", "This sets a value of southeast down density." );
+         config.addEntry< double >( "SED-velocityX", "This sets a value of southeast down x velocity." );
+         config.addEntry< double >( "SED-velocityY", "This sets a value of southeast down y velocity." );
+         config.addEntry< double >( "SED-pressure", "This sets a value of southeast down pressure." );
+         config.addEntry< double >( "gamma", "This sets a value of gamma constant." );
+
+         /****
+          * Add definition of your solver command line arguments.
+          */
+
+      }
+};
+
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename MeshType,
+          typename ConfigTag,
+          typename SolverStarter >
+class eulerSetter
+{
+   public:
+
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+
+      static bool run( const Config::ParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs3D< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex;
+
+         /****
+          * Resolve the template arguments of your solver here.
+          * The following code is for the Dirichlet and the Neumann boundary conditions.
+          * Both can be constant or defined as descrete values of Vector.
+          */
+          String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef Functions::Analytic::Constant< Dimensions, Real > Constant;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef Functions::MeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "mymixed" )
+          {
+             typedef Operators::MyMixedBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "myneumann" )
+          {
+             typedef Operators::MyNeumannBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "neumann" )
+          {
+             typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+    return true;}
+};
+
+int main( int argc, char* argv[] )
+{
+   Solvers::Solver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
diff --git a/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h b/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h
new file mode 100644
index 0000000000..b3727450de
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h
@@ -0,0 +1,52 @@
+#ifndef eulerBUILDCONFIGTAG_H_
+#define eulerBUILDCONFIGTAG_H_
+
+#include <TNL/Solvers/BuildConfigTags.h>
+
+namespace TNL {
+
+class eulerBuildConfigTag{};
+
+namespace Solvers {
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct ConfigTagReal< eulerBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct ConfigTagReal< eulerBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct ConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct ConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; };
+
+template< int Dimensions > struct ConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 2 ) }; };
+
+/****
+ * Use of Grid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+template< int Dimensions, typename Real, typename Device, typename Index >
+   struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > >
+      { enum { enabled = ConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled  &&
+                         ConfigTagReal< eulerBuildConfigTag, Real >::enabled &&
+                         ConfigTagDevice< eulerBuildConfigTag, Device >::enabled &&
+                         ConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, ExplicitEulerSolverTag >{ enum { enabled = true }; };
+
+} // namespace Solvers
+} // namespace TNL
+
+
+#endif /* eulerBUILDCONFIGTAG_H_ */
diff --git a/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h~ b/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h~
new file mode 100644
index 0000000000..286a2cae8b
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerBuildConfigTag.h~
@@ -0,0 +1,52 @@
+#ifndef eulerBUILDCONFIGTAG_H_
+#define eulerBUILDCONFIGTAG_H_
+
+#include <TNL/Solvers/BuildConfigTags.h>
+
+namespace TNL {
+
+class eulerBuildConfigTag{};
+
+namespace Solvers {
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct ConfigTagReal< eulerBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct ConfigTagReal< eulerBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct ConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct ConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; };
+
+template< int Dimensions > struct ConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 2 ) }; };
+
+/****
+ * Use of Grid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+template< int Dimensions, typename Real, typename Device, typename Index >
+   struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > >
+      { enum { enabled = ConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled  &&
+                         ConfigTagReal< eulerBuildConfigTag, Real >::enabled &&
+                         ConfigTagDevice< eulerBuildConfigTag, Device >::enabled &&
+                         ConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = true }; };
+
+} // namespace Solvers
+} // namespace TNL
+
+
+#endif /* eulerBUILDCONFIGTAG_H_ */
diff --git a/examples/inviscid-flow-sw/3d/eulerProblem.h b/examples/inviscid-flow-sw/3d/eulerProblem.h
new file mode 100644
index 0000000000..6869dcb525
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerProblem.h
@@ -0,0 +1,119 @@
+#pragma once
+
+#include <TNL/Problems/PDEProblem.h>
+#include <TNL/Functions/MeshFunction.h>
+
+using namespace TNL::Problems;
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+           typename DifferentialOperator >
+class eulerProblem:
+   public PDEProblem< Mesh,
+                         typename DifferentialOperator::RealType,
+                         typename Mesh::DeviceType,
+                         typename DifferentialOperator::IndexType >
+{
+   public:
+
+      typedef typename DifferentialOperator::RealType RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef typename DifferentialOperator::IndexType IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
+      typedef SharedPointer< DifferentialOperator > DifferentialOperatorPointer;
+      typedef SharedPointer< BoundaryCondition > BoundaryConditionPointer;
+      typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
+      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;      
+      
+      using typename BaseType::MeshType;
+      using typename BaseType::MeshPointer;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::DofVectorPointer;
+      using typename BaseType::MeshDependentDataType;
+      using typename BaseType::MeshDependentDataPointer;
+
+      typedef typename DifferentialOperator::Continuity Continuity;
+      typedef typename DifferentialOperator::MomentumX MomentumX;
+      typedef typename DifferentialOperator::MomentumY MomentumY;
+      typedef typename DifferentialOperator::MomentumZ MomentumZ;
+      typedef typename DifferentialOperator::Energy Energy;
+      typedef typename DifferentialOperator::Velocity Velocity;
+      typedef typename DifferentialOperator::VelocityX VelocityX;
+      typedef typename DifferentialOperator::Pressure Pressure;
+
+      static String getTypeStatic();
+
+      String getPrologHeader() const;
+
+      void writeProlog( Logger& logger,
+                        const Config::ParameterContainer& parameters ) const;
+
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" );
+
+      bool setInitialCondition( const Config::ParameterContainer& parameters,
+                                const MeshPointer& mesh,
+                                DofVectorPointer& dofs,
+                                MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshPointer& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshPointer& mesh,
+                         DofVectorPointer& dofs,
+                         MeshDependentDataPointer& meshDependentData );
+
+      IndexType getDofs( const MeshPointer& mesh ) const;
+
+      void bindDofs( const MeshPointer& mesh,
+                     DofVectorPointer& dofs );
+
+      void getExplicitRHS( const RealType& time,
+                           const RealType& tau,
+                           const MeshPointer& mesh,
+                           DofVectorPointer& _u,
+                           DofVectorPointer& _fu,
+                           MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshPointer& mesh,
+                                 DofVectorPointer& dofs,
+                                 Matrix& matrix,
+                                 DofVectorPointer& rightHandSide,
+                                 MeshDependentDataPointer& meshDependentData );
+
+      bool postIterate( const RealType& time,
+                        const RealType& tau,
+                        const MeshPointer& mesh,
+                        DofVectorPointer& dofs,
+                        MeshDependentDataPointer& meshDependentData );
+
+   protected:
+
+      DifferentialOperatorPointer differentialOperatorPointer;
+      BoundaryConditionPointer boundaryConditionPointer;
+      RightHandSidePointer rightHandSidePointer;
+
+      MeshFunctionPointer uRho, uRhoVelocityX, uRhoVelocityY, uRhoVelocityZ, uEnergy;
+      MeshFunctionPointer fuRho, fuRhoVelocityX, fuRhoVelocityY, fuRhoVelocityZ, fuEnergy;
+      
+      MeshFunctionPointer pressure, velocity, velocityX, velocityY, velocityZ;
+      
+      RealType gamma;
+
+};
+
+} // namespace TNL
+
+#include "eulerProblem_impl.h"
+
diff --git a/examples/inviscid-flow-sw/3d/eulerProblem.h~ b/examples/inviscid-flow-sw/3d/eulerProblem.h~
new file mode 100644
index 0000000000..c838b101e2
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerProblem.h~
@@ -0,0 +1,118 @@
+#pragma once
+
+#include <TNL/Problems/PDEProblem.h>
+#include <TNL/Functions/MeshFunction.h>
+
+using namespace TNL::Problems;
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+           typename DifferentialOperator >
+class eulerProblem:
+   public PDEProblem< Mesh,
+                         typename DifferentialOperator::RealType,
+                         typename Mesh::DeviceType,
+                         typename DifferentialOperator::IndexType >
+{
+   public:
+
+      typedef typename DifferentialOperator::RealType RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef typename DifferentialOperator::IndexType IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
+      typedef SharedPointer< DifferentialOperator > DifferentialOperatorPointer;
+      typedef SharedPointer< BoundaryCondition > BoundaryConditionPointer;
+      typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
+      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;      
+      
+      using typename BaseType::MeshType;
+      using typename BaseType::MeshPointer;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::DofVectorPointer;
+      using typename BaseType::MeshDependentDataType;
+      using typename BaseType::MeshDependentDataPointer;
+
+      typedef typename DifferentialOperator::Continuity Continuity;
+      typedef typename DifferentialOperator::MomentumX MomentumX;
+      typedef typename DifferentialOperator::MomentumY MomentumY;
+      typedef typename DifferentialOperator::Energy Energy;
+      typedef typename DifferentialOperator::Velocity Velocity;
+      typedef typename DifferentialOperator::VelocityX VelocityX;
+      typedef typename DifferentialOperator::Pressure Pressure;
+
+      static String getTypeStatic();
+
+      String getPrologHeader() const;
+
+      void writeProlog( Logger& logger,
+                        const Config::ParameterContainer& parameters ) const;
+
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" );
+
+      bool setInitialCondition( const Config::ParameterContainer& parameters,
+                                const MeshPointer& mesh,
+                                DofVectorPointer& dofs,
+                                MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshPointer& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshPointer& mesh,
+                         DofVectorPointer& dofs,
+                         MeshDependentDataPointer& meshDependentData );
+
+      IndexType getDofs( const MeshPointer& mesh ) const;
+
+      void bindDofs( const MeshPointer& mesh,
+                     DofVectorPointer& dofs );
+
+      void getExplicitRHS( const RealType& time,
+                           const RealType& tau,
+                           const MeshPointer& mesh,
+                           DofVectorPointer& _u,
+                           DofVectorPointer& _fu,
+                           MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshPointer& mesh,
+                                 DofVectorPointer& dofs,
+                                 Matrix& matrix,
+                                 DofVectorPointer& rightHandSide,
+                                 MeshDependentDataPointer& meshDependentData );
+
+      bool postIterate( const RealType& time,
+                        const RealType& tau,
+                        const MeshPointer& mesh,
+                        DofVectorPointer& dofs,
+                        MeshDependentDataPointer& meshDependentData );
+
+   protected:
+
+      DifferentialOperatorPointer differentialOperatorPointer;
+      BoundaryConditionPointer boundaryConditionPointer;
+      RightHandSidePointer rightHandSidePointer;
+
+      MeshFunctionPointer uRho, uRhoVelocityX, uRhoVelocityY, uRhoVelocityZ, uEnergy;
+      MeshFunctionPointer fuRho, fuRhoVelocityX, fuRhoVelocityY, fuRhoVelocityZ, fuEnergy;
+      
+      MeshFunctionPointer pressure, velocity, velocityX, velocityY, velocityZ;
+      
+      RealType gamma;
+
+};
+
+} // namespace TNL
+
+#include "eulerProblem_impl.h"
+
diff --git a/examples/inviscid-flow-sw/3d/eulerProblem_impl.h b/examples/inviscid-flow-sw/3d/eulerProblem_impl.h
new file mode 100644
index 0000000000..b01979b87c
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerProblem_impl.h
@@ -0,0 +1,579 @@
+#include <TNL/FileName.h>
+#include <TNL/Matrices/MatrixSetter.h>
+#include <TNL/Solvers/PDE/ExplicitUpdater.h>
+#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
+#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return String( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return String( "euler3D" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{
+   /****
+    * Add data you want to have in the computation report (log) as follows:
+    * logger.writeParameter< double >( "Parameter description", parameter );
+    */
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setup( const MeshPointer& meshPointer,
+       const Config::ParameterContainer& parameters,
+       const String& prefix )
+{
+   if( //! this->boundaryConditionPointer->setup( meshPointer, parameters, prefix + "boundary-conditions-" ) ||
+       ! this->rightHandSidePointer->setup( parameters, prefix + "right-hand-side-" ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+typename eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getDofs( const MeshPointer& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */
+   return 5*mesh->template getEntitiesCount< typename MeshType::Cell >();
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+bindDofs( const MeshPointer& mesh,
+          DofVectorPointer& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const Config::ParameterContainer& parameters,
+                     const MeshPointer& mesh,
+                     DofVectorPointer& dofs,
+                     MeshDependentDataPointer& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   gamma = parameters.getParameter< RealType >( "gamma" );
+   RealType rhoNWU = parameters.getParameter< RealType >( "NWU-density" );
+   RealType velNWUX = parameters.getParameter< RealType >( "NWU-velocityX" );
+   RealType velNWUY = parameters.getParameter< RealType >( "NWU-velocityY" );
+   RealType velNWUZ = parameters.getParameter< RealType >( "NWU-velocityZ" );
+   RealType preNWU = parameters.getParameter< RealType >( "NWU-pressure" );
+   //RealType eNWU = ( preNWU / ( rhoNWU * (gamma - 1) ) );
+   RealType eNWU = ( preNWU / (gamma - 1) ) + 0.5 * rhoNWU * (std::pow(velNWUX,2)+std::pow(velNWUY,2)+std::pow(velNWUZ,2));
+   RealType rhoSWU = parameters.getParameter< RealType >( "SWU-density" );
+   RealType velSWUX = parameters.getParameter< RealType >( "SWU-velocityX" );
+   RealType velSWUY = parameters.getParameter< RealType >( "SWU-velocityY" );
+   RealType velSWUZ = parameters.getParameter< RealType >( "SWU-velocityZ" );
+   RealType preSWU = parameters.getParameter< RealType >( "SWU-pressure" );
+   //RealType eSWU = ( preSWU / ( rhoSWU * (gamma - 1) ) );
+   RealType eSWU = ( preSWU / (gamma - 1) ) + 0.5 * rhoSWU * (std::pow(velSWUX,2)+std::pow(velSWUY,2)+std::pow(velSWUZ,2));
+   RealType rhoNWD = parameters.getParameter< RealType >( "NWD-density" );
+   RealType velNWDX = parameters.getParameter< RealType >( "NWD-velocityX" );
+   RealType velNWDY = parameters.getParameter< RealType >( "NWD-velocityY" );
+   RealType velNWDZ = parameters.getParameter< RealType >( "NWD-velocityZ" );
+   RealType preNWD = parameters.getParameter< RealType >( "NWD-pressure" );
+   //RealType eNWD = ( preNWD / ( rhoNWD * (gamma - 1) ) );
+   RealType eNWD = ( preNWD / (gamma - 1) ) + 0.5 * rhoNWD * (std::pow(velNWDX,2)+std::pow(velNWDY,2)+std::pow(velNWDZ,2));
+   RealType rhoSWD = parameters.getParameter< RealType >( "SWD-density" );
+   RealType velSWDX = parameters.getParameter< RealType >( "SWD-velocityX" );
+   RealType velSWDY = parameters.getParameter< RealType >( "SWD-velocityY" );
+   RealType velSWDZ = parameters.getParameter< RealType >( "SWD-velocityZ" );
+   RealType preSWD = parameters.getParameter< RealType >( "SWD-pressure" );
+   //RealType eSWD = ( preSWD / ( rhoSWD * (gamma - 1) ) );
+   RealType eSWD = ( preSWD / (gamma - 1) ) + 0.5 * rhoSWD * (std::pow(velSWDX,2)+std::pow(velSWDY,2)+std::pow(velSWDZ,2));
+   RealType rhoNEU = parameters.getParameter< RealType >( "NEU-density" );
+   RealType velNEUX = parameters.getParameter< RealType >( "NEU-velocityX" );
+   RealType velNEUY = parameters.getParameter< RealType >( "NEU-velocityY" );
+   RealType velNEUZ = parameters.getParameter< RealType >( "NEU-velocityZ" );
+   RealType preNEU = parameters.getParameter< RealType >( "NEU-pressure" );
+   //RealType eNEU = ( preNEU / ( rhoNEU * (gamma - 1) ) );
+   RealType eNEU = ( preNEU / (gamma - 1) ) + 0.5 * rhoNEU * (std::pow(velNEUX,2)+std::pow(velNEUY,2)+std::pow(velNEUZ,2));
+   RealType rhoSEU = parameters.getParameter< RealType >( "SEU-density" );
+   RealType velSEUX = parameters.getParameter< RealType >( "SEU-velocityX" );
+   RealType velSEUY = parameters.getParameter< RealType >( "SEU-velocityY" );
+   RealType velSEUZ = parameters.getParameter< RealType >( "SEU-velocityZ" );
+   RealType preSEU = parameters.getParameter< RealType >( "SEU-pressure" );
+   //RealType eSEU = ( preSEU / ( rhoSEU * (gamma - 1) ) );
+   RealType eSEU = ( preSEU / (gamma - 1) ) + 0.5 * rhoSEU * (std::pow(velSEUX,2)+std::pow(velSEUY,2)+std::pow(velSEUZ,2));
+   RealType rhoNED = parameters.getParameter< RealType >( "NED-density" );
+   RealType velNEDX = parameters.getParameter< RealType >( "NED-velocityX" );
+   RealType velNEDY = parameters.getParameter< RealType >( "NED-velocityY" );
+   RealType velNEDZ = parameters.getParameter< RealType >( "NED-velocityZ" );
+   RealType preNED = parameters.getParameter< RealType >( "NED-pressure" );
+   //RealType eNED = ( preNED / ( rhoNED * (gamma - 1) ) );
+   RealType eNED = ( preNED / (gamma - 1) ) + 0.5 * rhoNED * (std::pow(velNEDX,2)+std::pow(velNEDY,2)+std::pow(velNEDZ,2));
+   RealType rhoSED = parameters.getParameter< RealType >( "SED-density" );
+   RealType velSEDX = parameters.getParameter< RealType >( "SED-velocityX" );
+   RealType velSEDY = parameters.getParameter< RealType >( "SED-velocityY" );
+   RealType velSEDZ = parameters.getParameter< RealType >( "SED-velocityZ" );
+   RealType preSED = parameters.getParameter< RealType >( "SED-pressure" );
+   //RealType eSED = ( preSED / ( rhoSED * (gamma - 1) ) );
+   RealType eSED = ( preSED / (gamma - 1) ) + 0.5 * rhoSED * (std::pow(velSEDX,2)+std::pow(velSEDY,2)+std::pow(velSEDZ,2));
+   RealType x0 = parameters.getParameter< RealType >( "riemann-border" );
+   int size = mesh->template getEntitiesCount< Cell >();
+   uRho->bind(mesh, dofs, 0);
+   uRhoVelocityX->bind(mesh, dofs, size);
+   uRhoVelocityY->bind(mesh, dofs, 2*size);
+   uRhoVelocityZ->bind(mesh, dofs, 3*size);
+   uEnergy->bind(mesh, dofs, 4*size);
+   Containers::Vector< RealType, DeviceType, IndexType > data;
+   data.setSize(5*size);
+   pressure->bind(mesh, data, 0);
+   velocity->bind(mesh, data, size);
+   velocityX->bind(mesh, data, 2*size);
+   velocityY->bind(mesh, data, 3*size);
+   velocityZ->bind(mesh, data, 4*size);
+   int count = std::pow(size, (1.0/3.0));
+   for(IndexType i = 0; i < count; i++)   
+      for(IndexType j = 0; j < count; j++)
+	 for(IndexType k = 0; k < count; k++)
+            if ((i <= x0 * count)&&(j <= x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSWD;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDY;
+		  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSWD;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSWDX,2)+std::pow(velSWDY,2)+std::pow(velSWDZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSWDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSWDY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velSWDZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSWD;
+               }
+            else
+            if ((i <= x0 * count)&&(j <= x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSED;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSED * velSEDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSED * velSEDY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoSED * velSEDZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSED;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSEDX,2)+std::pow(velSEDY,2)+std::pow(velSEDZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSEDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSEDY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velSEDZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSED;
+               }
+            else
+            if ((i <= x0 * count)&&(j > x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNWD;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNWD * velNWDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNWD * velNWDY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoNWD * velNWDZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNWD;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNWDX,2)+std::pow(velNWDY,2)+std::pow(velNWDZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNWDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNWDY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velNWDZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNWD;
+               }
+            else
+            if ((i <= x0 * count)&&(j > x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNED;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNED * velNEDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNED * velNEDY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoNED * velNEDZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNED;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNEDX,2)+std::pow(velNEDY,2)+std::pow(velNEDZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNEDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNEDY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velNEDZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNED;
+               }
+            else
+            if ((i > x0 * count)&&(j <= x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSWU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSWU * velSWUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSWU * velSWUY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoSWU * velSWUZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSWU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSWUX,2)+std::pow(velSWUY,2)+std::pow(velSWUZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSWUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSWUY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velSWUZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSWU;
+               }
+            else
+            if ((i > x0 * count)&&(j <= x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSEU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSEU * velSEUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSEU * velSEUY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoSEU * velSEUZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSEU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSEUX,2)+std::pow(velSEUY,2)+std::pow(velSEUZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSEUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSEUY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velSEUZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSEU;
+               }
+            else
+            if ((i > x0 * count)&&(j > x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNWU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNWU * velNWUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNWU * velNWUY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoNWU * velNWUZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNWU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNWUX,2)+std::pow(velNWUY,2)+std::pow(velNWUZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNWUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNWUY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velNWUZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNWU;
+               }
+            else
+            if ((i > x0 * count)&&(j > x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNEU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNEU * velNEUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNEU * velNEUY;
+                  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoNEU * velNEUZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNEU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNEUX,2)+std::pow(velNEUY,2)+std::pow(velNEUZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNEUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNEUY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velNEUZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNEU;
+               };
+   return true; 
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshPointer& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
+   matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh,
+                                                                          differentialOperator,
+                                                                          boundaryCondition,
+                                                                          rowLengths );
+   matrix.setDimensions( dofs, dofs );
+   if( ! matrix.setCompressedRowsLengths( rowLengths ) )
+      return false;*/
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshPointer& mesh,
+              DofVectorPointer& dofs,
+              MeshDependentDataPointer& meshDependentData )
+{
+  std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+   FileName fileName;
+   fileName.setExtension( "tnl" );
+   fileName.setIndex( step );
+   fileName.setFileNameBase( "rho-" );
+   if( ! uRho->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelX-" );
+   if( ! uRhoVelocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelY-" );
+   if( ! uRhoVelocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelZ-" );
+   if( ! uRhoVelocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "energy-" );
+   if( ! uEnergy->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityX-" );
+   if( ! velocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityY-" );
+   if( ! velocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityZ-" );
+   if( ! velocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocity-" );
+   if( ! velocity->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "pressue-" );
+   if( ! pressure->save( fileName.getFileName() ) )
+      return false;
+
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getExplicitRHS( const RealType& time,
+                const RealType& tau,
+                const MeshPointer& mesh,
+                DofVectorPointer& _u,
+                DofVectorPointer& _fu,
+                MeshDependentDataPointer& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   int count = mesh->template getEntitiesCount< Cell >();
+   fuRho->bind( mesh, _fu, 0 );
+   fuRhoVelocityX->bind( mesh, _fu, count );
+   fuRhoVelocityY->bind( mesh, _fu, 2*count );
+   fuRhoVelocityZ->bind( mesh, _fu, 3*count );
+   fuEnergy->bind( mesh, _fu, 4*count );
+   SharedPointer< Continuity > lF3DContinuity;
+   SharedPointer< MomentumX > lF3DMomentumX;
+   SharedPointer< MomentumY > lF3DMomentumY;
+   SharedPointer< MomentumZ > lF3DMomentumZ;
+   SharedPointer< Energy > lF3DEnergy;
+
+   this->bindDofs( mesh, _u );
+   //rho
+   lF3DContinuity->setTau(tau);
+   lF3DContinuity->setVelocityX( *velocityX );
+   lF3DContinuity->setVelocityY( *velocityY );
+   lF3DContinuity->setVelocityZ( *velocityZ );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; 
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DContinuity,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRho,
+                                                           fuRho );
+
+   //rhoVelocityX
+   lF3DMomentumX->setTau(tau);
+   lF3DMomentumX->setVelocityX( *velocityX );
+   lF3DMomentumX->setVelocityY( *velocityY );
+   lF3DMomentumX->setVelocityZ( *velocityZ );
+   lF3DMomentumX->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumX, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; 
+   explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumX,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityX,
+                                                           fuRhoVelocityX );
+
+   //rhoVelocityY
+   lF3DMomentumY->setTau(tau);
+   lF3DMomentumY->setVelocityX( *velocityX );
+   lF3DMomentumY->setVelocityY( *velocityY );
+   lF3DMomentumY->setVelocityZ( *velocityZ );
+   lF3DMomentumY->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumY, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY;
+   explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumY,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityY,
+                                                           fuRhoVelocityY );
+ 
+   //rhoVelocityZ
+   lF3DMomentumZ->setTau(tau);
+   lF3DMomentumZ->setVelocityX( *velocityX );
+   lF3DMomentumZ->setVelocityY( *velocityY );
+   lF3DMomentumZ->setVelocityZ( *velocityZ );
+   lF3DMomentumZ->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumZ, BoundaryCondition, RightHandSide > explicitUpdaterMomentumZ;
+   explicitUpdaterMomentumZ.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumZ,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityZ,
+                                                           fuRhoVelocityZ );
+  
+   //energy
+   lF3DEnergy->setTau(tau);
+   lF3DEnergy->setVelocityX( *velocityX ); 
+   lF3DEnergy->setVelocityY( *velocityY );
+   lF3DEnergy->setVelocityZ( *velocityZ );
+   lF3DEnergy->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DEnergy,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uEnergy,
+                                                           fuEnergy );
+
+/*
+cout << "rho " << uRho.getData() << endl;
+getchar();
+cout << "rhoVelX " << uRhoVelocityX.getData() << endl;
+getchar();
+cout << "rhoVelY " << uRhoVelocityY.getData() << endl;
+getchar();
+cout << "Energy " << uEnergy.getData() << endl;
+getchar();
+cout << "velocity " << velocity.getData() << endl;
+getchar();
+cout << "velocityX " << velocityX.getData() << endl;
+getchar();
+cout << "velocityY " << velocityY.getData() << endl;
+getchar();
+cout << "pressure " << pressure.getData() << endl;
+getchar();
+*/
+
+
+/*
+   BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; 
+   boundaryConditionsSetter.template apply< typename Mesh::Cell >( 
+      this->boundaryCondition, 
+      time + tau, 
+       u );*/
+ }
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshPointer& mesh,
+                      DofVectorPointer& _u,
+                      Matrix& matrix,
+                      DofVectorPointer& b,
+                      MeshDependentDataPointer& meshDependentData )
+{
+/*   LinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             BackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   MeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+postIterate( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& mesh,
+             DofVectorPointer& dofs,
+             MeshDependentDataPointer& meshDependentData )
+{
+
+   //velocityX
+   this->velocityX->setMesh( mesh );
+   VelocityX velocityXGetter( *uRho, *uRhoVelocityX );
+   *this->velocityX = velocityXGetter;
+
+   //velocityY
+   this->velocityY->setMesh( mesh );
+   VelocityX velocityYGetter( *uRho, *uRhoVelocityY );
+   *this->velocityY = velocityYGetter;
+
+   //velocityY
+   this->velocityZ->setMesh( mesh );
+   VelocityX velocityZGetter( *uRho, *uRhoVelocityZ );
+   *this->velocityZ = velocityZGetter;
+
+   //velocity
+   this->velocity->setMesh( mesh );
+   Velocity velocityGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY, *uRhoVelocityZ);
+   *this->velocity = velocityGetter;
+
+   //pressure
+   this->pressure->setMesh( mesh );
+   Pressure pressureGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY, *uRhoVelocityZ, *uEnergy, gamma );
+   *this->pressure = pressureGetter;
+
+   return true;
+}
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/3d/eulerProblem_impl.h~ b/examples/inviscid-flow-sw/3d/eulerProblem_impl.h~
new file mode 100644
index 0000000000..9f0dbf56be
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerProblem_impl.h~
@@ -0,0 +1,565 @@
+#include <TNL/FileName.h>
+#include <TNL/Matrices/MatrixSetter.h>
+#include <TNL/Solvers/PDE/ExplicitUpdater.h>
+#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
+#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+#include "EulerPressureGetter.h"
+#include "Euler2DVelXGetter.h"
+#include "EulerVelGetter.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return String( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return String( "euler3D" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{
+   /****
+    * Add data you want to have in the computation report (log) as follows:
+    * logger.writeParameter< double >( "Parameter description", parameter );
+    */
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setup( const MeshPointer& meshPointer,
+       const Config::ParameterContainer& parameters,
+       const String& prefix )
+{
+   if( //! this->boundaryConditionPointer->setup( meshPointer, parameters, prefix + "boundary-conditions-" ) ||
+       ! this->rightHandSidePointer->setup( parameters, prefix + "right-hand-side-" ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+typename eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getDofs( const MeshPointer& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */
+   return 5*mesh->template getEntitiesCount< typename MeshType::Cell >();
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+bindDofs( const MeshPointer& mesh,
+          DofVectorPointer& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const Config::ParameterContainer& parameters,
+                     const MeshPointer& mesh,
+                     DofVectorPointer& dofs,
+                     MeshDependentDataPointer& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   gamma = parameters.getParameter< RealType >( "gamma" );
+   RealType rhoNWU = parameters.getParameter< RealType >( "NWU-density" );
+   RealType velNWUX = parameters.getParameter< RealType >( "NWU-velocityX" );
+   RealType velNWUY = parameters.getParameter< RealType >( "NWU-velocityY" );
+   RealType velNWUZ = parameters.getParameter< RealType >( "NWU-velocityZ" );
+   RealType preNWU = parameters.getParameter< RealType >( "NWU-pressure" );
+   //RealType eNWU = ( preNWU / ( rhoNWU * (gamma - 1) ) );
+   RealType eNWU = ( preNWU / (gamma - 1) ) + 0.5 * rhoNWU * (std::pow(velNWUX,2)+std::pow(velNWUY,2)+std::pow(velNWUZ,2));
+   RealType rhoSWU = parameters.getParameter< RealType >( "SWU-density" );
+   RealType velSWUX = parameters.getParameter< RealType >( "SWU-velocityX" );
+   RealType velSWUY = parameters.getParameter< RealType >( "SWU-velocityY" );
+   RealType velSWUZ = parameters.getParameter< RealType >( "SWU-velocityZ" );
+   RealType preSWU = parameters.getParameter< RealType >( "SWU-pressure" );
+   //RealType eSWU = ( preSWU / ( rhoSWU * (gamma - 1) ) );
+   RealType eSWU = ( preSWU / (gamma - 1) ) + 0.5 * rhoSWU * (std::pow(velSWUX,2)+std::pow(velSWUY,2)+std::pow(velSWUZ,2));
+   RealType rhoNWD = parameters.getParameter< RealType >( "NWD-density" );
+   RealType velNWDX = parameters.getParameter< RealType >( "NWD-velocityX" );
+   RealType velNWDY = parameters.getParameter< RealType >( "NWD-velocityY" );
+   RealType velNWDZ = parameters.getParameter< RealType >( "NWD-velocityZ" );
+   RealType preNWD = parameters.getParameter< RealType >( "NWD-pressure" );
+   //RealType eNWD = ( preNWD / ( rhoNWD * (gamma - 1) ) );
+   RealType eNWD = ( preNWD / (gamma - 1) ) + 0.5 * rhoNWD * (std::pow(velNWDX,2)+std::pow(velNWDY,2)+std::pow(velNWDZ,2));
+   RealType rhoSWD = parameters.getParameter< RealType >( "SWD-density" );
+   RealType velSWDX = parameters.getParameter< RealType >( "SWD-velocityX" );
+   RealType velSWDY = parameters.getParameter< RealType >( "SWD-velocityY" );
+   RealType velSWDZ = parameters.getParameter< RealType >( "SWD-velocityZ" );
+   RealType preSWD = parameters.getParameter< RealType >( "SWD-pressure" );
+   //RealType eSWD = ( preSWD / ( rhoSWD * (gamma - 1) ) );
+   RealType eSWD = ( preSWD / (gamma - 1) ) + 0.5 * rhoSWD * (std::pow(velSWDX,2)+std::pow(velSWDY,2)+std::pow(velSWDZ,2));
+   RealType rhoNEU = parameters.getParameter< RealType >( "NEU-density" );
+   RealType velNEUX = parameters.getParameter< RealType >( "NEU-velocityX" );
+   RealType velNEUY = parameters.getParameter< RealType >( "NEU-velocityY" );
+   RealType velNEUZ = parameters.getParameter< RealType >( "NEU-velocityZ" );
+   RealType preNEU = parameters.getParameter< RealType >( "NEU-pressure" );
+   //RealType eNEU = ( preNEU / ( rhoNEU * (gamma - 1) ) );
+   RealType eNEU = ( preNEU / (gamma - 1) ) + 0.5 * rhoNEU * (std::pow(velNEUX,2)+std::pow(velNEUY,2)+std::pow(velNEUZ,2));
+   RealType rhoSEU = parameters.getParameter< RealType >( "SEU-density" );
+   RealType velSEUX = parameters.getParameter< RealType >( "SEU-velocityX" );
+   RealType velSEUY = parameters.getParameter< RealType >( "SEU-velocityY" );
+   RealType velSEUZ = parameters.getParameter< RealType >( "SEU-velocityZ" );
+   RealType preSEU = parameters.getParameter< RealType >( "SEU-pressure" );
+   //RealType eSEU = ( preSEU / ( rhoSEU * (gamma - 1) ) );
+   RealType eSEU = ( preSEU / (gamma - 1) ) + 0.5 * rhoSEU * (std::pow(velSEUX,2)+std::pow(velSEUY,2)+std::pow(velSEUZ,2));
+   RealType rhoNED = parameters.getParameter< RealType >( "NED-density" );
+   RealType velNEDX = parameters.getParameter< RealType >( "NED-velocityX" );
+   RealType velNEDY = parameters.getParameter< RealType >( "NED-velocityY" );
+   RealType velNEDZ = parameters.getParameter< RealType >( "NED-velocityZ" );
+   RealType preNED = parameters.getParameter< RealType >( "NED-pressure" );
+   //RealType eNED = ( preNED / ( rhoNED * (gamma - 1) ) );
+   RealType eNED = ( preNED / (gamma - 1) ) + 0.5 * rhoNED * (std::pow(velNEDX,2)+std::pow(velNEDY,2)+std::pow(velNEDZ,2));
+   RealType rhoSED = parameters.getParameter< RealType >( "SED-density" );
+   RealType velSEDX = parameters.getParameter< RealType >( "SED-velocityX" );
+   RealType velSEDY = parameters.getParameter< RealType >( "SED-velocityY" );
+   RealType velSEDZ = parameters.getParameter< RealType >( "SED-velocityZ" );
+   RealType preSED = parameters.getParameter< RealType >( "SED-pressure" );
+   //RealType eSED = ( preSED / ( rhoSED * (gamma - 1) ) );
+   RealType eSED = ( preSED / (gamma - 1) ) + 0.5 * rhoSED * (std::pow(velSEDX,2)+std::pow(velSEDY,2)+std::pow(velSEDZ,2));
+   RealType x0 = parameters.getParameter< RealType >( "riemann-border" );
+   int size = mesh->template getEntitiesCount< Cell >();
+   uRho->bind(mesh, dofs, 0);
+   uRhoVelocityX->bind(mesh, dofs, size);
+   uRhoVelocityY->bind(mesh, dofs, 2*size);
+   uRhoVelocityZ->bind(mesh, dofs, 3*size);
+   uEnergy->bind(mesh, dofs, 4*size);
+   Containers::Vector< RealType, DeviceType, IndexType > data;
+   data.setSize(5*size);
+   pressure->bind(mesh, data, 0);
+   velocity->bind(mesh, data, size);
+   velocityX->bind(mesh, data, 2*size);
+   velocityY->bind(mesh, data, 3*size);
+   velocityZ->bind(mesh, data, 4*size);
+   int count = std::pow(size, (1.0/3.0));
+   for(IndexType i = 0; i < count; i++)   
+      for(IndexType j = 0; j < count; j++)
+	 for(IndexType k = 0; k < count; k++)
+            if ((i <= x0 * count)&&(j <= x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSWD;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDY;
+		  (* uRhoVelocityZ)[i*std::pow(count,2)+j*count+k] = rhoSWD * velSWDZ;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSWD;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSWDX,2)+std::pow(velSWDY,2)+std::pow(velSWDZ,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSWDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSWDY;
+                  (* velocityZ)[i*std::pow(count,2)+j*count+k] = velSWDZ;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSWD;
+               }
+            else
+            if ((i <= x0 * count)&&(j <= x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSED;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSED * velSEDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSED * velSEDY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSED;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSEDX,2)+std::pow(velSEDY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSEDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSEDY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSED;
+               }
+            else
+            if ((i <= x0 * count)&&(j > x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNWD;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNWD * velNWDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNWD * velNWDY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNWD;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNWDX,2)+std::pow(velNWDY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNWDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNWDY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNWD;
+               }
+            else
+            if ((i <= x0 * count)&&(j > x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNED;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNED * velNEDX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNED * velNEDY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNED;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNEDX,2)+std::pow(velNEDY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNEDX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNEDY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNED;
+               }
+            else
+            if ((i > x0 * count)&&(j <= x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSWU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSWU * velSWUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSWU * velSWUY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSWU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSWUX,2)+std::pow(velSWUY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSWUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSWUY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSWU;
+               }
+            else
+            if ((i > x0 * count)&&(j <= x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoSEU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoSEU * velSEUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoSEU * velSEUY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eSEU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velSEUX,2)+std::pow(velSEUY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velSEUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velSEUY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preSEU;
+               }
+            else
+            if ((i > x0 * count)&&(j > x0 * count)&&(k <= x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNWU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNWU * velNWUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNWU * velNWUY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNWU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNWUX,2)+std::pow(velNWUY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNWUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNWUY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNWU;
+               }
+            else
+            if ((i > x0 * count)&&(j > x0 * count)&&(k > x0 * count) )
+               {
+                  (* uRho)[i*std::pow(count,2)+j*count+k] = rhoNEU;
+                  (* uRhoVelocityX)[i*std::pow(count,2)+j*count+k] = rhoNEU * velNEUX;
+                  (* uRhoVelocityY)[i*std::pow(count,2)+j*count+k] = rhoNEU * velNEUY;
+                  (* uEnergy)[i*std::pow(count,2)+j*count+k] = eNEU;
+                  (* velocity)[i*std::pow(count,2)+j*count+k] = std::sqrt(std::pow(velNEUX,2)+std::pow(velNEUY,2));
+                  (* velocityX)[i*std::pow(count,2)+j*count+k] = velNEUX;
+                  (* velocityY)[i*std::pow(count,2)+j*count+k] = velNEUY;
+                  (* pressure)[i*std::pow(count,2)+j*count+k] = preNEU;
+               };
+   return true; 
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshPointer& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
+   matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh,
+                                                                          differentialOperator,
+                                                                          boundaryCondition,
+                                                                          rowLengths );
+   matrix.setDimensions( dofs, dofs );
+   if( ! matrix.setCompressedRowsLengths( rowLengths ) )
+      return false;*/
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshPointer& mesh,
+              DofVectorPointer& dofs,
+              MeshDependentDataPointer& meshDependentData )
+{
+  std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+   FileName fileName;
+   fileName.setExtension( "tnl" );
+   fileName.setIndex( step );
+   fileName.setFileNameBase( "rho-" );
+   if( ! uRho->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelX-" );
+   if( ! uRhoVelocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelY-" );
+   if( ! uRhoVelocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "rhoVelZ-" );
+   if( ! uRhoVelocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "energy-" );
+   if( ! uEnergy->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityX-" );
+   if( ! velocityX->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityY-" );
+   if( ! velocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocityZ-" );
+   if( ! velocityY->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "velocity-" );
+   if( ! velocity->save( fileName.getFileName() ) )
+      return false;
+   fileName.setFileNameBase( "pressue-" );
+   if( ! pressure->save( fileName.getFileName() ) )
+      return false;
+
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getExplicitRHS( const RealType& time,
+                const RealType& tau,
+                const MeshPointer& mesh,
+                DofVectorPointer& _u,
+                DofVectorPointer& _fu,
+                MeshDependentDataPointer& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   int count = mesh->template getEntitiesCount< Cell >();
+   fuRho->bind( mesh, _fu, 0 );
+   fuRhoVelocityX->bind( mesh, _fu, count );
+   fuRhoVelocityY->bind( mesh, _fu, 2*count );
+   fuRhoVelocityZ->bind( mesh, _fu, 3*count );
+   fuEnergy->bind( mesh, _fu, 4*count );
+   SharedPointer< Continuity > lF3DContinuity;
+   SharedPointer< MomentumX > lF3DMomentumX;
+   SharedPointer< MomentumY > lF3DMomentumY;
+   SharedPointer< MomentumZ > lF3DMomentumZ;
+   SharedPointer< Energy > lF3DEnergy;
+
+   this->bindDofs( mesh, _u );
+   //rho
+   lF3DContinuity->setTau(tau);
+   lF3DContinuity->setVelocityX( *velocityX );
+   lF3DContinuity->setVelocityY( *velocityY );
+   lF3DContinuity->setVelocityZ( *velocityZ );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; 
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DContinuity,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRho,
+                                                           fuRho );
+
+   //rhoVelocityX
+   lF3DMomentumX->setTau(tau);
+   lF3DMomentumX->setVelocityX( *velocityX );
+   lF3DMomentumX->setVelocityY( *velocityY );
+   lF3DMomentumX->setVelocityZ( *velocityZ );
+   lF3DMomentumX->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumX, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; 
+   explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumX,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityX,
+                                                           fuRhoVelocityX );
+
+   //rhoVelocityY
+   lF3DMomentumY->setTau(tau);
+   lF3DMomentumY->setVelocityX( *velocityX );
+   lF3DMomentumY->setVelocityY( *velocityY );
+   lF3DMomentumY->setVelocityZ( *velocityZ );
+   lF3DMomentumY->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumY, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY;
+   explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumY,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityY,
+                                                           fuRhoVelocityY );
+ 
+   //rhoVelocityZ
+   lF3DMomentumZ->setTau(tau);
+   lF3DMomentumZ->setVelocityX( *velocityX );
+   lF3DMomentumZ->setVelocityY( *velocityY );
+   lF3DMomentumZ->setVelocityZ( *velocityZ );
+   lF3DMomentumZ->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumZ, BoundaryCondition, RightHandSide > explicitUpdaterMomentumZ;
+   explicitUpdaterMomentumZ.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DMomentumZ,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uRhoVelocityZ,
+                                                           fuRhoVelocityZ );
+  
+   //energy
+   lF3DEnergy->setTau(tau);
+   lF3DEnergy->setVelocityX( *velocityX ); 
+   lF3DEnergy->setVelocityY( *velocityY );
+   lF3DEnergy->setVelocityZ( *velocityZ );
+   lF3DEnergy->setPressure( *pressure );
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF3DEnergy,
+                                                           this->boundaryConditionPointer,
+                                                           this->rightHandSidePointer,
+                                                           uEnergy,
+                                                           fuEnergy );
+
+/*
+cout << "rho " << uRho.getData() << endl;
+getchar();
+cout << "rhoVelX " << uRhoVelocityX.getData() << endl;
+getchar();
+cout << "rhoVelY " << uRhoVelocityY.getData() << endl;
+getchar();
+cout << "Energy " << uEnergy.getData() << endl;
+getchar();
+cout << "velocity " << velocity.getData() << endl;
+getchar();
+cout << "velocityX " << velocityX.getData() << endl;
+getchar();
+cout << "velocityY " << velocityY.getData() << endl;
+getchar();
+cout << "pressure " << pressure.getData() << endl;
+getchar();
+*/
+
+
+/*
+   BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; 
+   boundaryConditionsSetter.template apply< typename Mesh::Cell >( 
+      this->boundaryCondition, 
+      time + tau, 
+       u );*/
+ }
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshPointer& mesh,
+                      DofVectorPointer& _u,
+                      Matrix& matrix,
+                      DofVectorPointer& b,
+                      MeshDependentDataPointer& meshDependentData )
+{
+/*   LinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             BackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   MeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+postIterate( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& mesh,
+             DofVectorPointer& dofs,
+             MeshDependentDataPointer& meshDependentData )
+{
+
+   //velocityX
+   this->velocityX->setMesh( mesh );
+   VelocityX velocityXGetter( *uRho, *uRhoVelocityX );
+   *this->velocityX = velocityXGetter;
+
+   //velocityY
+   this->velocityY->setMesh( mesh );
+   VelocityX velocityYGetter( *uRho, *uRhoVelocityY );
+   *this->velocityY = velocityYGetter;
+
+   //velocityY
+   this->velocityZ->setMesh( mesh );
+   VelocityX velocityZGetter( *uRho, *uRhoVelocityZ );
+   *this->velocityZ = velocityZGetter;
+
+   //velocity
+   this->velocity->setMesh( mesh );
+   Velocity velocityGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY, *uRhoVelocityZ);
+   *this->velocity = velocityGetter;
+
+   //pressure
+   this->pressure->setMesh( mesh );
+   Pressure pressureGetter( *uRho, *uRhoVelocityX, *uRhoVelocityY, *uRhoVelocityZ, *uEnergy, gamma );
+   *this->pressure = pressureGetter;
+
+   return true;
+}
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/3d/eulerRhs.h b/examples/inviscid-flow-sw/3d/eulerRhs.h
new file mode 100644
index 0000000000..1b46dc831f
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/eulerRhs.h
@@ -0,0 +1,35 @@
+#ifndef eulerRHS_H_
+#define eulerRHS_H_
+
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh, typename Real >class eulerRhs
+  : public Functions::Domain< Mesh::meshDimensions, Functions::MeshDomain > 
+ {
+   public:
+
+      typedef Mesh MeshType;
+      typedef Real RealType;
+
+      bool setup( const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return true;
+      }
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const Real& time = 0.0 ) const
+      {
+         typedef typename MeshEntity::MeshType::VertexType VertexType;
+         VertexType v = entity.getCenter();
+         return 0.0;
+      }
+};
+
+} //namespace TNL
+
+#endif /* eulerRHS_H_ */
diff --git a/examples/inviscid-flow-sw/3d/run-euler b/examples/inviscid-flow-sw/3d/run-euler
new file mode 100644
index 0000000000..f68b98a840
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/run-euler
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 1.0 \
+               --proportions-y 1.0 \
+               --size-x 100 \
+               --size-y 100
+
+tnl-init --test-function sin-wave \
+         --output-file init.tnl
+./euler --time-discretisation explicit \
+              --boundary-conditions-constant 0 \
+              --discrete-solver merson \
+              --snapshot-period 0.01 \
+              --final-time 1.0
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/inviscid-flow-sw/3d/tnl-run-euler-2d b/examples/inviscid-flow-sw/3d/tnl-run-euler-2d
new file mode 100644
index 0000000000..5af33a1a79
--- /dev/null
+++ b/examples/inviscid-flow-sw/3d/tnl-run-euler-2d
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 1.0 \
+               --proportions-y 1.0 \
+               --size-x 100 \
+               --size-y 100
+
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+#              --boundary-conditions-type neumann \
+#              --boundary-conditions-constant 0 \
+
+tnl-euler-2d-dbg --time-discretisation explicit \
+              --time-step 1.0e-3 \
+              --boundary-conditions-type mymixed \
+              --discrete-solver euler \
+              --snapshot-period 0.1 \
+              --final-time 1.0 \
+              --left-density 1.0 \
+              --left-velocityX 0.75 \
+              --left-velocityY 0.75 \
+              --left-pressure 1.0 \
+              --right-density 0.125 \
+              --right-velocityX 0 \
+              --right-velocityY 0 \
+              --right-pressure 0.1 \
+              --gamma 1.4 \
+              --riemann-border 0.3 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/inviscid-flow-sw/CMakeLists.txt b/examples/inviscid-flow-sw/CMakeLists.txt
new file mode 100644
index 0000000000..7cd87c5139
--- /dev/null
+++ b/examples/inviscid-flow-sw/CMakeLists.txt
@@ -0,0 +1,23 @@
+set( tnl_inviscid_flow_sw_HEADERS
+     CompressibleConservativeVariables.h )
+
+set( tnl_inviscid_flow_sw_SOURCES     
+     euler.cpp
+     euler.cu )
+               
+IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE(tnl-euler-sw${debugExt} euler.cu)
+   target_link_libraries (tnl-euler-sw${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+   ADD_EXECUTABLE(tnl-euler-sw${debugExt} euler.cpp)     
+   target_link_libraries (tnl-euler-sw${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
+
+
+INSTALL( TARGETS tnl-euler-sw${debugExt}
+         RUNTIME DESTINATION bin
+         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+        
+INSTALL( FILES run-euler-sw
+               ${tnl_inviscid_flow_SOURCES}
+         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow-sw )
diff --git a/examples/inviscid-flow-sw/CompressibleConservativeVariables.h b/examples/inviscid-flow-sw/CompressibleConservativeVariables.h
new file mode 100644
index 0000000000..a3afc84536
--- /dev/null
+++ b/examples/inviscid-flow-sw/CompressibleConservativeVariables.h
@@ -0,0 +1,147 @@
+/***************************************************************************
+                          CompressibleConservativeVariables.h  -  description
+                             -------------------
+    begin                : Feb 12, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Functions/MeshFunction.h>
+#include <TNL/Functions/VectorField.h>
+#include <TNL/SharedPointer.h>
+
+namespace TNL {
+
+template< typename Mesh >
+class CompressibleConservativeVariables
+{
+   public:
+      typedef Mesh MeshType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshType > MeshPointer;      
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > MomentumFieldPointer;
+      
+      CompressibleConservativeVariables(){};
+      
+      CompressibleConservativeVariables( const MeshPointer& meshPointer )
+      : density( meshPointer ),
+        momentum( meshPointer ),
+        //pressure( meshPointer ),
+        energy( meshPointer ){};
+        
+      void setMesh( const MeshPointer& meshPointer )
+      {
+         this->density->setMesh( meshPointer );
+         this->momentum->setMesh( meshPointer );
+         //this->pressure.setMesh( meshPointer );
+         this->energy->setMesh( meshPointer );
+      }
+      
+      template< typename Vector >
+      void bind( const MeshPointer& meshPointer,
+                 const Vector& data,
+                 IndexType offset = 0 )
+      {
+         IndexType currentOffset( offset );
+         this->density->bind( meshPointer, data, currentOffset );
+         currentOffset += this->density->getDofs( meshPointer );
+         for( IndexType i = 0; i < Dimensions; i++ )
+         {
+            ( *this->momentum )[ i ]->bind( meshPointer, data, currentOffset );
+            currentOffset += ( *this->momentum )[ i ]->getDofs( meshPointer );
+         }
+         this->energy->bind( meshPointer, data, currentOffset );
+      }
+      
+      IndexType getDofs( const MeshPointer& meshPointer ) const
+      {
+         return this->density->getDofs( meshPointer ) + 
+            this->momentum->getDofs( meshPointer ) +
+            this->energy->getDofs( meshPointer );
+      }
+      
+      MeshFunctionPointer& getDensity()
+      {
+         return this->density;
+      }
+
+      const MeshFunctionPointer& getDensity() const
+      {
+         return this->density;
+      }
+      
+      void setDensity( MeshFunctionPointer& density )
+      {
+         this->density = density;
+      }
+      
+      MomentumFieldPointer& getMomentum()
+      {
+         return this->momentum;
+      }
+      
+      const MomentumFieldPointer& getMomentum() const
+      {
+         return this->momentum;
+      }
+      
+      void setMomentum( MomentumFieldPointer& momentum )
+      {
+         this->momentum = momentum;
+      }
+      
+      /*MeshFunctionPointer& getPressure()
+      {
+         return this->pressure;
+      }
+      
+      const MeshFunctionPointer& getPressure() const
+      {
+         return this->pressure;
+      }
+      
+      void setPressure( MeshFunctionPointer& pressure )
+      {
+         this->pressure = pressure;
+      }*/
+      
+      MeshFunctionPointer& getEnergy()
+      {
+         return this->energy;
+      }
+      
+      const MeshFunctionPointer& getEnergy() const
+      {
+         return this->energy;
+      }
+      
+      void setEnergy( MeshFunctionPointer& energy )
+      {
+         this->energy = energy;
+      }
+      
+      void getVelocityField( VelocityFieldType& velocityField )
+      {
+         
+      }
+
+   protected:
+      
+      MeshFunctionPointer density;
+      MomentumFieldPointer momentum;
+      MeshFunctionPointer energy;
+      
+};
+
+} // namespace TN
\ No newline at end of file
diff --git a/examples/inviscid-flow-sw/LaxFridrichs.h b/examples/inviscid-flow-sw/LaxFridrichs.h
new file mode 100644
index 0000000000..cdf32899f6
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichs.h
@@ -0,0 +1,141 @@
+/***************************************************************************
+                          LaxFridrichs.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/VectorField.h>
+
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "LaxFridrichsMomentumZ.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs
+{
+   public:
+      typedef Mesh MeshType;
+      typedef Real RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      static const int Dimensions = Mesh::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VectorFieldType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > ContinuityOperatorType;
+      typedef LaxFridrichsMomentumX< Mesh, Real, Index > MomentumXOperatorType;
+      typedef LaxFridrichsMomentumY< Mesh, Real, Index > MomentumYOperatorType;
+      typedef LaxFridrichsMomentumZ< Mesh, Real, Index > MomentumZOperatorType;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > EnergyOperatorType;
+
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VectorFieldType > VectorFieldPointer;
+      typedef SharedPointer< MeshType > MeshPointer;
+      
+      typedef SharedPointer< ContinuityOperatorType > ContinuityOperatorPointer;
+      typedef SharedPointer< MomentumXOperatorType > MomentumXOperatorPointer;
+      typedef SharedPointer< MomentumYOperatorType > MomentumYOperatorPointer;      
+      typedef SharedPointer< MomentumZOperatorType > MomentumZOperatorPointer;      
+      typedef SharedPointer< EnergyOperatorType > EnergyOperatorPointer;
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+      }
+      
+      LaxFridrichs()
+         : artificialViscosity( 1.0 ) {}
+      
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+         this->continuityOperatorPointer->setArtificialViscosity( artificialViscosity );
+         this->momentumXOperatorPointer->setArtificialViscosity( artificialViscosity );
+         this->momentumYOperatorPointer->setArtificialViscosity( artificialViscosity );
+         this->momentumZOperatorPointer->setArtificialViscosity( artificialViscosity );
+         this->energyOperatorPointer->setArtificialViscosity( artificialViscosity );
+         
+         return true;
+      }
+      
+      void setTau( const RealType& tau )
+      {
+         this->continuityOperatorPointer->setTau( tau );
+         this->momentumXOperatorPointer->setTau( tau );
+         this->momentumYOperatorPointer->setTau( tau );
+         this->momentumZOperatorPointer->setTau( tau );
+         this->energyOperatorPointer->setTau( tau );
+      }
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+         this->momentumXOperatorPointer->setPressure( pressure );
+         this->momentumYOperatorPointer->setPressure( pressure );
+         this->momentumZOperatorPointer->setPressure( pressure );
+         this->energyOperatorPointer->setPressure( pressure );
+      }
+      
+      void setVelocity( const VectorFieldPointer& velocity )
+      {
+         this->continuityOperatorPointer->setVelocity( velocity );
+         this->momentumXOperatorPointer->setVelocity( velocity );
+         this->momentumYOperatorPointer->setVelocity( velocity );
+         this->momentumZOperatorPointer->setVelocity( velocity );
+         this->energyOperatorPointer->setVelocity( velocity );
+      }
+      
+      const ContinuityOperatorPointer& getContinuityOperator() const
+      {
+         return this->continuityOperatorPointer;
+      }
+      
+      const MomentumXOperatorPointer& getMomentumXOperator() const
+      {
+         return this->momentumXOperatorPointer;
+      }
+
+      const MomentumYOperatorPointer& getMomentumYOperator() const
+      {
+         return this->momentumYOperatorPointer;
+      }
+      
+      const MomentumZOperatorPointer& getMomentumZOperator() const
+      {
+         return this->momentumZOperatorPointer;
+      }
+      
+      const EnergyOperatorPointer& getEnergyOperator() const
+      {
+         return this->energyOperatorPointer;
+      }
+
+   protected:
+      
+      ContinuityOperatorPointer continuityOperatorPointer;
+      MomentumXOperatorPointer momentumXOperatorPointer;
+      MomentumYOperatorPointer momentumYOperatorPointer;
+      MomentumZOperatorPointer momentumZOperatorPointer;
+      EnergyOperatorPointer energyOperatorPointer;  
+      
+      RealType artificialViscosity;
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/LaxFridrichsContinuity.h b/examples/inviscid-flow-sw/LaxFridrichsContinuity.h
new file mode 100644
index 0000000000..45ad4d52b1
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsContinuity.h
@@ -0,0 +1,288 @@
+/***************************************************************************
+                          LaxFridrichsContinuity.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/VectorField.h>
+#include <TNL/SharedPointer.h>
+
+namespace TNL {
+
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsContinuityBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+
+      LaxFridrichsContinuityBase()
+       : artificialViscosity( 1.0 ){};
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsContinuity< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+      void setArtificialViscosity( const RealType& artificialViscosity )
+      {
+         this->artificialViscosity = artificialViscosity;
+      }
+
+
+      protected:
+         
+         RealType tau;
+         
+         VelocityFieldPointer velocity;
+         
+         RealType artificialViscosity;
+};
+
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsContinuity
+{
+};
+
+
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsContinuityBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         return 1.0 / ( 2.0 * this->tau ) * this->artificialViscosity * ( u[ west ] - 2.0 * u[ center ]  + u[ east ] ) 
+               - 0.5 * ( u[ east ] * velocity_x_east - u[ west ] * velocity_x_west ) * hxInverse;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsContinuityBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+         //rho
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >();
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         
+         return 1.0 / ( 4.0 * this->tau ) * this->artificialViscosity * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+                       - 0.5 * ( ( u[ east ] * velocity_x_east - u[ west ] * velocity_x_west ) * hxInverse
+                               + ( u[ north ] * velocity_y_north - u[ south ] * velocity_y_south ) * hyInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsContinuityBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+
+         //rho
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& velocity_x_west  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up    = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];
+         
+         return 1.0 / ( 6.0 * this->tau ) * this->artificialViscosity *
+                ( u[ west ] + u[ east ] + u[ south ] + u[ north ] + u[ up ] + u[ down ]- 6.0 * u[ center ] ) 
+                - 0.5 * ( ( u[ east ] * velocity_x_east - u[ west ] * velocity_x_west ) * hxInverse
+                        + ( u[ north ] * velocity_y_north - u[ south ] * velocity_y_south ) * hyInverse
+                        + ( u[ up ] * velocity_z_up - u[ down ] * velocity_z_down ) * hzInverse );
+         
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/LaxFridrichsEnergy.h b/examples/inviscid-flow-sw/LaxFridrichsEnergy.h
new file mode 100644
index 0000000000..18c824762b
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsEnergy.h
@@ -0,0 +1,309 @@
+/***************************************************************************
+                          LaxFridrichsEnergy.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsEnergyBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      
+      LaxFridrichsEnergyBase()
+       : artificialViscosity( 1.0 ){};
+
+      static String getType()
+      {
+         return String( "LaxFridrichsEnergy< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+          this->pressure = pressure;
+      };
+      
+      void setArtificialViscosity( const RealType& artificialViscosity )
+      {
+         this->artificialViscosity = artificialViscosity;
+      }      
+
+      protected:
+         
+         RealType tau;
+         
+         VelocityFieldPointer velocity;
+         
+         MeshFunctionPointer pressure;
+         
+         RealType artificialViscosity;
+};
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsEnergy
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsEnergyBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& e,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         return 1.0 / ( 2.0 * this->tau ) * this->artificialViscosity * ( e[ west ] - 2.0 * e[ center ]  + e[ east ] ) 
+                - 0.5 * ( ( e[ east ] + pressure_east ) * velocity_x_east  
+                        - ( e[ west ] + pressure_west ) * velocity_x_west ) * hxInverse;
+  
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsEnergyBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& e,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >();
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];         
+         
+         return 1.0 / ( 4.0 * this->tau ) * this->artificialViscosity * ( e[ west ] + e[ east ] + e[ south ] + e[ north ] - 4.0 * e[ center ] ) 
+                - 0.5 * ( ( ( ( e[ east ] + pressure_east ) * velocity_x_east )
+                          -( ( e[ west ] + pressure_west ) * velocity_x_west ) ) * hxInverse
+                        + ( ( ( e[ north ] + pressure_north ) * velocity_y_north )
+                          -( ( e[ south ] + pressure_south ) * velocity_y_south ) ) * hyInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsEnergyBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& e,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_west  = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east  = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up    = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down  = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_east  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up    = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];         
+         
+         return 1.0 / ( 6.0 * this->tau ) * this->artificialViscosity *
+                 ( e[ west ] + e[ east ] + e[ south ] + e[ north ] + e[ up ] + e[ down ] - 6.0 * e[ center ] ) 
+                - 0.5 * ( ( ( ( e[ east ] + pressure_east ) * velocity_x_east )
+                           -( ( e[ west ] + pressure_west ) * velocity_x_west ) ) * hxInverse
+                        + ( ( ( e[ north ] + pressure_north ) * velocity_y_north )
+                           -( ( e[ south ] + pressure_south ) * velocity_y_south ) ) * hyInverse
+                        + ( ( ( e[ up ] + pressure_up ) * velocity_z_up )
+                           -( ( e[ down ] + pressure_down ) * velocity_z_down ) ) * hzInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/LaxFridrichsMomentumBase.h b/examples/inviscid-flow-sw/LaxFridrichsMomentumBase.h
new file mode 100644
index 0000000000..67dae9fdf8
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsMomentumBase.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+                          LaxFridrichsMomentumBase.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      
+      LaxFridrichsMomentumBase()
+       : artificialViscosity( 1.0 ){};
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+          this->pressure = pressure;
+      };
+
+      void setArtificialViscosity( const RealType& artificialViscosity )
+      {
+         this->artificialViscosity = artificialViscosity;
+      }
+
+      protected:
+         
+         RealType tau;
+         
+         VelocityFieldPointer velocity;
+         
+         MeshFunctionPointer pressure;
+         
+         RealType artificialViscosity;
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/LaxFridrichsMomentumX.h b/examples/inviscid-flow-sw/LaxFridrichsMomentumX.h
new file mode 100644
index 0000000000..63def12d31
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsMomentumX.h
@@ -0,0 +1,276 @@
+/***************************************************************************
+                          LaxFridrichsMomentumX.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumX
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         
+         return 1.0 / ( 2.0 * this->tau ) * this->artificialViscosity * ( rho_u[ west ]  + rho_u[ east ]  - 2.0 * rho_u[ center ] ) 
+                - 0.5 * ( ( rho_u[ east ] * velocity_x_east + pressure_east ) 
+                         -( rho_u[ west ] * velocity_x_west + pressure_west ) ) * hxInverse;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >();
+         
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];         
+         
+         return 1.0 / ( 4.0 * this->tau ) * this->artificialViscosity * ( rho_u[ west ] + rho_u[ east ] + rho_u[ south ] + rho_u[ north ] - 4.0 * rho_u[ center ] ) 
+                - 0.5 * ( ( ( rho_u[ east ] * velocity_x_east + pressure_east )
+                          - ( rho_u[ west ] * velocity_x_west + pressure_west ) ) * hxInverse
+                        + ( ( rho_u[ north ] * velocity_y_north )
+                          - ( rho_u[ south ] * velocity_y_south ) ) * hyInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_west  = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east  = this->pressure.template getData< DeviceType >()[ east ];
+         //const RealType& pressure_north = this->pressure.template getData< DeviceType >()[ north ];
+         //const RealType& pressure_south = this->pressure.template getData< DeviceType >()[ south ];
+         //const RealType& pressure_up    = this->pressure.template getData< DeviceType >()[ up ];
+         //const RealType& pressure_down  = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_east  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up    = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];
+         return 1.0 / ( 6.0 * this->tau ) * this->artificialViscosity *
+                   ( rho_u[ west ] + rho_u[ east ] + rho_u[ south ] + rho_u[ north ] + rho_u[ up ] + rho_u[ down ] - 6.0 * rho_u[ center ] ) 
+                - 0.5 * ( ( ( rho_u[ east ] * velocity_x_east + pressure_east )
+                          - ( rho_u[ west ] * velocity_x_west + pressure_west ) )* hxInverse
+                        + ( ( rho_u[ north ] * velocity_y_north )
+                          - ( rho_u[ south ] * velocity_y_south ) )* hyInverse
+                        + ( ( rho_u[ up ] * velocity_z_up )
+                          - ( rho_u[ down ] * velocity_z_down ) )* hzInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/LaxFridrichsMomentumY.h b/examples/inviscid-flow-sw/LaxFridrichsMomentumY.h
new file mode 100644
index 0000000000..8ce42282dd
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsMomentumY.h
@@ -0,0 +1,260 @@
+/***************************************************************************
+                          LaxFridrichsMomentumY.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumY
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_v,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_v,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1 >();
+         
+         const RealType& pressure_north = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south = this->pressure.template getData< DeviceType >()[ south ];         
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];         
+         
+         return 1.0 / ( 4.0 * this->tau ) * this->artificialViscosity * ( rho_v[ west ] + rho_v[ east ] + rho_v[ south ] + rho_v[ north ] - 4.0 * rho_v[ center ] ) 
+                - 0.5 * ( ( ( rho_v[ east ] * velocity_x_east )
+                           - ( rho_v[ west ] * velocity_x_west ) )* hxInverse
+                        + ( ( rho_v[ north ] * velocity_y_north + pressure_north )
+                          - ( rho_v[ south ] * velocity_y_south + pressure_south ) )* hyInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumY< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_v,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_north = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_east  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up    = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];
+         return 1.0 / ( 6.0 * this->tau ) * this->artificialViscosity * 
+                   ( rho_v[ west ] + rho_v[ east ] + rho_v[ south ] + rho_v[ north ] + rho_v[ up ] + rho_v[ down ] - 6.0 * rho_v[ center ] ) 
+                - 0.5 * ( ( ( rho_v[ east ] * velocity_x_east )
+                          - ( rho_v[ west ] * velocity_x_west ) ) * hxInverse
+                        + ( ( rho_v[ north ] * velocity_y_north + pressure_north )
+                          - ( rho_v[ south ] * velocity_y_south + pressure_south ) ) * hyInverse
+                        + ( ( rho_v[ up ] * velocity_z_up )
+                          - ( rho_v[ down ] * velocity_z_down ) ) * hzInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/LaxFridrichsMomentumZ.h b/examples/inviscid-flow-sw/LaxFridrichsMomentumZ.h
new file mode 100644
index 0000000000..a67e862cef
--- /dev/null
+++ b/examples/inviscid-flow-sw/LaxFridrichsMomentumZ.h
@@ -0,0 +1,240 @@
+/***************************************************************************
+                          LaxFridrichsMomentumZ.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "LaxFridrichsMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentumZ
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_w,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_w,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentumZ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public LaxFridrichsMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef LaxFridrichsMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "LaxFridrichsMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_w,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east  = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west  = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up    = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down  = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_up    = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down  = this->pressure.template getData< DeviceType >()[ down ];
+         const RealType& velocity_x_east  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up    = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];
+         return 1.0 / ( 6.0 * this->tau ) * this->artificialViscosity *
+                    ( rho_w[ west ] + rho_w[ east ] + rho_w[ south ] + rho_w[ north ] + rho_w[ up ] + rho_w[ down ] - 6.0 * rho_w[ center ] ) 
+                -0.5 * ( ( ( rho_w[ east ] * velocity_x_east )
+                         - ( rho_w[ west ] * velocity_x_west ) )* hxInverse
+                       + ( ( rho_w[ north ] * velocity_y_north )
+                         - ( rho_w[ south ] * velocity_y_south ) )* hyInverse
+                       + ( ( rho_w[ up ] * velocity_z_up + pressure_up )
+                         - ( rho_w[ down ] * velocity_z_down + pressure_down ) )* hzInverse );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/PhysicalVariablesGetter.h b/examples/inviscid-flow-sw/PhysicalVariablesGetter.h
new file mode 100644
index 0000000000..f1ba6bd122
--- /dev/null
+++ b/examples/inviscid-flow-sw/PhysicalVariablesGetter.h
@@ -0,0 +1,122 @@
+/***************************************************************************
+                          CompressibleConservativeVariables.h  -  description
+                             -------------------
+    begin                : Feb 12, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/SharedPointer.h>
+#include <TNL/Functions/MeshFunction.h>
+#include <TNL/Functions/VectorField.h>
+#include <TNL/Functions/MeshFunctionEvaluator.h>
+#include "CompressibleConservativeVariables.h"
+
+namespace TNL {
+   
+template< typename Mesh >
+class PhysicalVariablesGetter
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef CompressibleConservativeVariables< MeshType > ConservativeVariablesType;
+      typedef SharedPointer< ConservativeVariablesType > ConservativeVariablesPointer;
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      
+      class VelocityGetter : public Functions::Domain< Dimensions, Functions::MeshDomain >
+      {
+         public:
+            typedef typename MeshType::RealType RealType;
+            
+            VelocityGetter( MeshFunctionPointer density, 
+                            MeshFunctionPointer momentum )
+            : density( density ), momentum( momentum ) {}
+            
+            template< typename EntityType >
+            __cuda_callable__
+            RealType operator()( const EntityType& meshEntity,
+                                        const RealType& time = 0.0 ) const
+            {
+               if( density.template getData< DeviceType >()( meshEntity ) == 0.0 )
+                  return 0;
+               else
+                  return momentum.template getData< DeviceType >()( meshEntity ) / 
+                         density.template getData< DeviceType >()( meshEntity );
+            }
+            
+         protected:
+            const MeshFunctionPointer density, momentum;
+      };
+      
+      class PressureGetter : public Functions::Domain< Dimensions, Functions::MeshDomain >
+      {
+         public:
+            typedef typename MeshType::RealType RealType;
+            
+            PressureGetter( MeshFunctionPointer density,
+                            MeshFunctionPointer energy, 
+                            VelocityFieldPointer momentum,
+                            const RealType& gamma )
+            : density( density ), energy( energy ), momentum( momentum ), gamma( gamma ) {}
+            
+            template< typename EntityType >
+            __cuda_callable__
+            RealType operator()( const EntityType& meshEntity,
+                                 const RealType& time = 0.0 ) const
+            {
+               const RealType e = energy.template getData< DeviceType >()( meshEntity );
+               const RealType rho = density.template getData< DeviceType >()( meshEntity );
+               const RealType momentumNorm = momentum.template getData< DeviceType >().getVector( meshEntity ).lpNorm( 2.0 );
+               if( rho == 0.0 )
+                  return 0;
+               else
+                  return ( gamma - 1.0 ) * ( e - 0.5 * momentumNorm * momentumNorm / rho );
+            }
+            
+         protected:
+            const MeshFunctionPointer density, energy;
+            const VelocityFieldPointer momentum;
+            const RealType gamma;
+      };      
+
+      
+      void getVelocity( const ConservativeVariablesPointer& conservativeVariables,
+                        VelocityFieldPointer& velocity )
+      {
+         Functions::MeshFunctionEvaluator< MeshFunctionType, VelocityGetter > evaluator;
+         for( int i = 0; i < Dimensions; i++ )
+         {
+            SharedPointer< VelocityGetter, DeviceType > velocityGetter( conservativeVariables->getDensity(),
+                                                                        ( *conservativeVariables->getMomentum() )[ i ] );
+            evaluator.evaluate( ( *velocity )[ i ], velocityGetter );
+         }
+      }
+      
+      void getPressure( const ConservativeVariablesPointer& conservativeVariables,
+                        const RealType& gamma,
+                        MeshFunctionPointer& pressure )
+      {
+         Functions::MeshFunctionEvaluator< MeshFunctionType, PressureGetter > evaluator;
+         SharedPointer< PressureGetter, DeviceType > pressureGetter( conservativeVariables->getDensity(),
+                                                                     conservativeVariables->getEnergy(),
+                                                                     conservativeVariables->getMomentum(),
+                                                                     gamma );
+         evaluator.evaluate( pressure, pressureGetter );
+      }
+      
+};
+   
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/RiemannProblemInitialCondition.h b/examples/inviscid-flow-sw/RiemannProblemInitialCondition.h
new file mode 100644
index 0000000000..a036747f25
--- /dev/null
+++ b/examples/inviscid-flow-sw/RiemannProblemInitialCondition.h
@@ -0,0 +1,1417 @@
+/***************************************************************************
+                          RiemannProblemInitialCondition.h  -  description
+                             -------------------
+    begin                : Feb 13, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/Containers/StaticVector.h>
+#include <TNL/Operators/Analytic/Sign.h>
+#include <TNL/Functions/MeshFunctionEvaluator.h>
+#include <TNL/Operators/Analytic/Sign.h>
+#include <TNL/Meshes/Grid.h>
+#include "CompressibleConservativeVariables.h"
+
+namespace TNL {
+template <typename Mesh>
+class RiemannProblemInitialConditionSetter
+{
+   
+};
+
+template <typename MeshReal,
+          typename Device,
+          typename MeshIndex>
+class RiemannProblemInitialConditionSetter< Meshes::Grid< 1,MeshReal, Device, MeshIndex > >
+{
+   public:
+      
+      typedef Meshes::Grid< 1,MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Containers::StaticVector< Dimensions, RealType > PointType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
+//       for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
+//       typedef typename MeshType::Cell CellType
+//       typedef typename MeshType::CoordinatesType CoordinatesType
+//       Celltype cell(mesh, CoordinatesType(i,j))
+//       p59stup do density setElement(mesh.template getEntityIndex< CellType >(cell), hodnota, kterou budu zapisovat)
+//       pomocn8 t59da, kterou budu specialiyovat p5es r;zn0 dimenze gridu
+
+      void setDiscontinuity(PointType discontinuityPlacement)
+      {
+         this->discontinuityPlacement = discontinuityPlacement;
+      };
+      void setDensity(RealType NWUDensity,
+                      RealType NEUDensity,
+                      RealType SWUDensity,
+                      RealType SEUDensity,
+                      RealType NWDDensity,
+                      RealType NEDDensity,
+                      RealType SWDDensity,
+                      RealType SEDDensity)
+      {
+         this->NWUDensity = NWUDensity;
+         this->NEUDensity = NEUDensity;
+         this->SWUDensity = SWUDensity;
+         this->SEUDensity = SEUDensity;
+         this->NWDDensity = NWDDensity;
+         this->NEDDensity = NEDDensity;
+         this->SWDDensity = SWDDensity;
+         this->SEDDensity = SEDDensity;
+      };
+
+      void setMomentum(PointType NWUMomentum,
+                       PointType NEUMomentum,
+                       PointType SWUMomentum,
+                       PointType SEUMomentum,
+                       PointType NWDMomentum,
+                       PointType NEDMomentum,
+                       PointType SWDMomentum,
+                       PointType SEDMomentum)
+      {
+         this->NWUMomentum = NWUMomentum;
+         this->NEUMomentum = NEUMomentum;
+         this->SWUMomentum = SWUMomentum;
+         this->SEUMomentum = SEUMomentum;
+         this->NWDMomentum = NWDMomentum;
+         this->NEDMomentum = NEDMomentum;
+         this->SWDMomentum = SWDMomentum;
+         this->SEDMomentum = SEDMomentum;
+      };
+
+      void setEnergy(RealType NWUEnergy,
+                     RealType NEUEnergy,
+                     RealType SWUEnergy,
+                     RealType SEUEnergy,
+                     RealType NWDEnergy,
+                     RealType NEDEnergy,
+                     RealType SWDEnergy,
+                     RealType SEDEnergy)
+      {
+         this->NWUEnergy = NWUEnergy;
+         this->NEUEnergy = NEUEnergy;
+         this->SWUEnergy = SWUEnergy;
+         this->SEUEnergy = SEUEnergy;
+         this->NWDEnergy = NWDEnergy;
+         this->NEDEnergy = NEDEnergy;
+         this->SWDEnergy = SWDEnergy;
+         this->SEDEnergy = SEDEnergy;
+      };
+
+      void setGamma(RealType gamma)
+      {
+         this->gamma = gamma;
+      };
+            
+      void placeDensity(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            if ( i < this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* conservativeVariables.getDensity()).setValue(cell, this->SWDDensity);
+               }
+            else
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* conservativeVariables.getDensity()).setValue(cell, this->SEDDensity);
+               }
+      };
+
+      void placeMomentum(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            if ( i < this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SWDMomentum[ 0 ]);
+               }
+            else
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SEDMomentum[ 0 ]);
+               }
+      };
+
+      void placeEnergy(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            if ( i < this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* conservativeVariables.getEnergy()).setValue(cell, this->SWDEnergy);
+               }
+            else
+               {
+                  CellType cell(mesh, CoordinatesType(i));
+                  cell.refresh();
+                  (* conservativeVariables.getEnergy()).setValue(cell, this->SEDEnergy);
+               }
+      };
+
+      PointType discontinuityPlacement;
+      RealType  NWUDensity, NEUDensity, SWUDensity, SEUDensity, NWDDensity, NEDDensity, SWDDensity, SEDDensity;
+      RealType  NWUEnergy, NEUEnergy, SWUEnergy, SEUEnergy, NWDEnergy, NEDEnergy, SWDEnergy, SEDEnergy;
+      PointType NWUMomentum, NEUMomentum, SWUMomentum, SEUMomentum, NWDMomentum, NEDMomentum, SWDMomentum, SEDMomentum;
+      RealType gamma;
+};
+
+
+template <typename MeshReal,
+          typename Device,
+          typename MeshIndex>
+class RiemannProblemInitialConditionSetter< Meshes::Grid< 2, MeshReal, Device, MeshIndex > >
+{
+   public:
+      
+      typedef Meshes::Grid< 2,MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Containers::StaticVector< Dimensions, RealType > PointType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
+//       for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
+//       typedef typename MeshType::Cell CellType
+//       typedef typename MeshType::CoordinatesType CoordinatesType
+//       Celltype cell(mesh, CoordinatesType(i,j))
+//       p59stup do density setElement(mesh.template getEntityIndex< CellType >(cell), hodnota, kterou budu zapisovat)
+//       pomocn8 t59da, kterou budu specialiyovat p5es r;zn0 dimenze gridu
+
+      void setDiscontinuity(PointType discontinuityPlacement)
+      {
+         this->discontinuityPlacement = discontinuityPlacement;
+      };
+      void setDensity(RealType NWUDensity,
+                      RealType NEUDensity,
+                      RealType SWUDensity,
+                      RealType SEUDensity,
+                      RealType NWDDensity,
+                      RealType NEDDensity,
+                      RealType SWDDensity,
+                      RealType SEDDensity)
+      {
+         this->NWUDensity = NWUDensity;
+         this->NEUDensity = NEUDensity;
+         this->SWUDensity = SWUDensity;
+         this->SEUDensity = SEUDensity;
+         this->NWDDensity = NWDDensity;
+         this->NEDDensity = NEDDensity;
+         this->SWDDensity = SWDDensity;
+         this->SEDDensity = SEDDensity;
+      };
+
+      void setMomentum(PointType NWUMomentum,
+                       PointType NEUMomentum,
+                       PointType SWUMomentum,
+                       PointType SEUMomentum,
+                       PointType NWDMomentum,
+                       PointType NEDMomentum,
+                       PointType SWDMomentum,
+                       PointType SEDMomentum)
+      {
+         this->NWUMomentum = NWUMomentum;
+         this->NEUMomentum = NEUMomentum;
+         this->SWUMomentum = SWUMomentum;
+         this->SEUMomentum = SEUMomentum;
+         this->NWDMomentum = NWDMomentum;
+         this->NEDMomentum = NEDMomentum;
+         this->SWDMomentum = SWDMomentum;
+         this->SEDMomentum = SEDMomentum;
+      };
+
+      void setEnergy(RealType NWUEnergy,
+                     RealType NEUEnergy,
+                     RealType SWUEnergy,
+                     RealType SEUEnergy,
+                     RealType NWDEnergy,
+                     RealType NEDEnergy,
+                     RealType SWDEnergy,
+                     RealType SEDEnergy)
+      {
+         this->NWUEnergy = NWUEnergy;
+         this->NEUEnergy = NEUEnergy;
+         this->SWUEnergy = SWUEnergy;
+         this->SEUEnergy = SEUEnergy;
+         this->NWDEnergy = NWDEnergy;
+         this->NEDEnergy = NEDEnergy;
+         this->SWDEnergy = SWDEnergy;
+         this->SEDEnergy = SEDEnergy;
+      };
+
+      void setGamma(RealType gamma)
+      {
+         this->gamma = gamma;
+      };
+            
+      void placeDensity(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getDensity()).setValue(cell, this->SWDDensity);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getDensity()).setValue(cell, this->SEDDensity);
+                  }
+               else
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getDensity()).setValue(cell, this->NWDDensity);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getDensity()).setValue(cell, this->NEDDensity);
+                  }
+      };
+
+      void placeMomentum(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SWDMomentum[ 0 ]);
+                     (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SWDMomentum[ 1 ]);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SEDMomentum[ 0 ]);
+                     (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SEDMomentum[ 1 ]);
+                  }
+               else
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->NWDMomentum[ 0 ]);
+                     (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->NWDMomentum[ 1 ]);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->NEDMomentum[ 0 ]);
+                     (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->NEDMomentum[ 1 ]);
+                  }
+      };
+
+      void placeEnergy(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getEnergy()).setValue(cell, this->SWDEnergy);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getEnergy()).setValue(cell, this->SEDEnergy);
+                  }
+               else
+               if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getEnergy()).setValue(cell, this->NWDEnergy);
+                  }
+               else
+               if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                 && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() ) )
+                  {
+                     CellType cell(mesh, CoordinatesType(i,j));
+                     cell.refresh();
+                     (* conservativeVariables.getEnergy()).setValue(cell, this->NEDEnergy);
+                  }
+      };
+
+      PointType discontinuityPlacement;
+      RealType  NWUDensity, NEUDensity, SWUDensity, SEUDensity, NWDDensity, NEDDensity, SWDDensity, SEDDensity;
+      RealType  NWUEnergy, NEUEnergy, SWUEnergy, SEUEnergy, NWDEnergy, NEDEnergy, SWDEnergy, SEDEnergy;
+      PointType NWUMomentum, NEUMomentum, SWUMomentum, SEUMomentum, NWDMomentum, NEDMomentum, SWDMomentum, SEDMomentum;
+      RealType gamma;
+};
+
+template <typename MeshReal,
+          typename Device,
+          typename MeshIndex>
+class RiemannProblemInitialConditionSetter< Meshes::Grid< 3, MeshReal, Device, MeshIndex > >
+{
+   public:
+      
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Containers::StaticVector< Dimensions, RealType > PointType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
+//       for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
+//       typedef typename MeshType::Cell CellType
+//       typedef typename MeshType::CoordinatesType CoordinatesType
+//       Celltype cell(mesh, CoordinatesType(i,j))
+//       p59stup do density setElement(mesh.template getEntityIndex< CellType >(cell), hodnota, kterou budu zapisovat)
+//       pomocn8 t59da, kterou budu specialiyovat p5es r;zn0 dimenze gridu
+
+      void setDiscontinuity(PointType discontinuityPlacement)
+      {
+         this->discontinuityPlacement = discontinuityPlacement;
+      };
+      void setDensity(RealType NWUDensity,
+                      RealType NEUDensity,
+                      RealType SWUDensity,
+                      RealType SEUDensity,
+                      RealType NWDDensity,
+                      RealType NEDDensity,
+                      RealType SWDDensity,
+                      RealType SEDDensity)
+      {
+         this->NWUDensity = NWUDensity;
+         this->NEUDensity = NEUDensity;
+         this->SWUDensity = SWUDensity;
+         this->SEUDensity = SEUDensity;
+         this->NWDDensity = NWDDensity;
+         this->NEDDensity = NEDDensity;
+         this->SWDDensity = SWDDensity;
+         this->SEDDensity = SEDDensity;
+      };
+
+      void setMomentum(PointType NWUMomentum,
+                       PointType NEUMomentum,
+                       PointType SWUMomentum,
+                       PointType SEUMomentum,
+                       PointType NWDMomentum,
+                       PointType NEDMomentum,
+                       PointType SWDMomentum,
+                       PointType SEDMomentum)
+      {
+         this->NWUMomentum = NWUMomentum;
+         this->NEUMomentum = NEUMomentum;
+         this->SWUMomentum = SWUMomentum;
+         this->SEUMomentum = SEUMomentum;
+         this->NWDMomentum = NWDMomentum;
+         this->NEDMomentum = NEDMomentum;
+         this->SWDMomentum = SWDMomentum;
+         this->SEDMomentum = SEDMomentum;
+      };
+
+      void setEnergy(RealType NWUEnergy,
+                     RealType NEUEnergy,
+                     RealType SWUEnergy,
+                     RealType SEUEnergy,
+                     RealType NWDEnergy,
+                     RealType NEDEnergy,
+                     RealType SWDEnergy,
+                     RealType SEDEnergy)
+      {
+         this->NWUEnergy = NWUEnergy;
+         this->NEUEnergy = NEUEnergy;
+         this->SWUEnergy = SWUEnergy;
+         this->SEUEnergy = SEUEnergy;
+         this->NWDEnergy = NWDEnergy;
+         this->NEDEnergy = NEDEnergy;
+         this->SWDEnergy = SWDEnergy;
+         this->SEDEnergy = SEDEnergy;
+      };
+
+      void setGamma(RealType gamma)
+      {
+         this->gamma = gamma;
+      };
+            
+      void placeDensity(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               for ( int k = 0; k < mesh.getDimensions().z(); k++)
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SWDDensity);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SEDDensity);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->NWDDensity);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->NEDDensity);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SWUDensity);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SEUDensity);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SWUDensity);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getDensity()).setValue(cell, this->SEUDensity);
+                     }
+      };
+
+      void placeMomentum(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               for ( int k = 0; k < mesh.getDimensions().z(); k++)
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SWDMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SWDMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SWDMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SEDMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SEDMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SEDMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->NWDMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->NWDMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->NWDMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->NEDMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->NEDMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->NEDMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SWUMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SWUMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SWUMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SEUMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SEUMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SEUMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SWUMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SWUMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SWUMomentum[ 2 ]);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* (* conservativeVariables.getMomentum())[ 0 ]).setValue(cell, this->SEUMomentum[ 0 ]);
+                        (* (* conservativeVariables.getMomentum())[ 1 ]).setValue(cell, this->SEUMomentum[ 1 ]);
+                        (* (* conservativeVariables.getMomentum())[ 2 ]).setValue(cell, this->SEUMomentum[ 2 ]);
+                     }
+      };
+
+      void placeEnergy(CompressibleConservativeVariables< MeshType >& conservativeVariables)
+      {
+      typedef typename MeshType::Cell CellType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      MeshType mesh = (* conservativeVariables.getDensity()).getMesh();
+         for( int i = 0; i < mesh.getDimensions().x(); i++)
+            for( int j = 0; j < mesh.getDimensions().y(); j++)
+               for ( int k = 0; k < mesh.getDimensions().z(); k++)
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SWDEnergy);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SEDEnergy);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->NWDEnergy);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k <= this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->NEDEnergy);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SWUEnergy);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j <= this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SEUEnergy);
+                     }
+                  else
+                  if ( ( i <= this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SWUEnergy);
+                     }
+                  else
+                  if ( ( i > this->discontinuityPlacement[ 0 ] * mesh.getDimensions().x() )
+                    && ( j > this->discontinuityPlacement[ 1 ] * mesh.getDimensions().y() )
+                    && ( k > this->discontinuityPlacement[ 2 ] * mesh.getDimensions().z() ) )
+                     {
+                        CellType cell(mesh, CoordinatesType(i,j,k));
+                        cell.refresh();
+                        (* conservativeVariables.getEnergy()).setValue(cell, this->SEUEnergy);
+                     }
+      };
+
+      PointType discontinuityPlacement;
+      RealType  NWUDensity, NEUDensity, SWUDensity, SEUDensity, NWDDensity, NEDDensity, SWDDensity, SEDDensity;
+      RealType  NWUEnergy, NEUEnergy, SWUEnergy, SEUEnergy, NWDEnergy, NEDEnergy, SWDEnergy, SEDEnergy;
+      PointType NWUMomentum, NEUMomentum, SWUMomentum, SEUMomentum, NWDMomentum, NEDMomentum, SWDMomentum, SEDMomentum;
+      RealType gamma;
+};
+
+template< typename Mesh >
+class RiemannProblemInitialCondition
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef typename MeshType::RealType RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::IndexType IndexType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Containers::StaticVector< Dimensions, RealType > PointType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
+      
+      RiemannProblemInitialCondition()
+         : discontinuityPlacement( 0.5 ),
+           leftDensity( 1.0 ), rightDensity( 1.0 ),
+           leftVelocity( -2.0 ), rightVelocity( 2.0 ),
+           leftPressure( 0.4 ), rightPressure( 0.4 ),
+           gamma( 1.67 ){}
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         config.addEntry< double >( prefix + "discontinuity-placement-0", "x-coordinate of the discontinuity placement.", 0.5 );
+         config.addEntry< double >( prefix + "discontinuity-placement-1", "y-coordinate of the discontinuity placement.", 0.5 );
+         config.addEntry< double >( prefix + "discontinuity-placement-2", "z-coordinate of the discontinuity placement.", 0.5 );
+/*
+         config.addEntry< double >( prefix + "left-density", "Density on the left side of the discontinuity.", 1.0 );
+         config.addEntry< double >( prefix + "right-density", "Density on the right side of the discontinuity.", 0.0 );
+         config.addEntry< double >( prefix + "left-velocity-0", "x-coordinate of the velocity on the left side of the discontinuity.", 1.0 );
+         config.addEntry< double >( prefix + "left-velocity-1", "y-coordinate of the velocity on the left side of the discontinuity.", 1.0 );
+         config.addEntry< double >( prefix + "left-velocity-2", "z-coordinate of the velocity on the left side of the discontinuity.", 1.0 );
+         config.addEntry< double >( prefix + "right-velocity-0", "x-coordinate of the velocity on the right side of the discontinuity.", 0.0 );
+         config.addEntry< double >( prefix + "right-velocity-1", "y-coordinate of the velocity on the right side of the discontinuity.", 0.0 );
+         config.addEntry< double >( prefix + "right-velocity-2", "z-coordinate of the velocity on the right side of the discontinuity.", 0.0 );
+         config.addEntry< double >( prefix + "left-pressure", "Pressure on the left side of the discontinuity.", 1.0 );
+         config.addEntry< double >( prefix + "right-pressure", "Pressure on the right side of the discontinuity.", 0.0 );
+*/
+         config.addEntry< double >( prefix + "NWU-density", "This sets a value of northwest up density.", 1.0  );
+         config.addEntry< double >( prefix + "NWU-velocity-0", "This sets a value of northwest up x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWU-velocity-1", "This sets a value of northwest up y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWU-velocity-2", "This sets a value of northwest up z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWU-pressure", "This sets a value of northwest up pressure.", 1.0  );
+         config.addEntry< double >( prefix + "SWU-density", "This sets a value of southwest up density.", 1.0  );
+         config.addEntry< double >( prefix + "SWU-velocity-0", "This sets a value of southwest up x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWU-velocity-1", "This sets a value of southwest up y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWU-velocity-2", "This sets a value of southwest up z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWU-pressure", "This sets a value of southwest up pressure.", 1.0  );
+         config.addEntry< double >( prefix + "NWD-density", "This sets a value of northwest down density.", 1.0  );
+         config.addEntry< double >( prefix + "NWD-velocity-0", "This sets a value of northwest down x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWD-velocity-1", "This sets a value of northwest down y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWD-velocity-2", "This sets a value of northwest down z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NWD-pressure", "This sets a value of northwest down pressure.", 1.0  );
+         config.addEntry< double >( prefix + "SWD-density", "This sets a value of southwest down density.", 1.0  );
+         config.addEntry< double >( prefix + "SWD-velocity-0", "This sets a value of southwest down x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWD-velocity-1", "This sets a value of southwest down y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWD-velocity-2", "This sets a value of southwest down z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SWD-pressure", "This sets a value of southwest down pressure.", 1.0  );
+         config.addEntry< double >( prefix + "NEU-density", "This sets a value of northeast up density.", 1.0  );
+         config.addEntry< double >( prefix + "NEU-velocity-0", "This sets a value of northeast up x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NEU-velocity-1", "This sets a value of northeast up y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NEU-velocity-2", "This sets a value of northeast up z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NEU-pressure", "This sets a value of northeast up pressure.", 1.0  );
+         config.addEntry< double >( prefix + "SEU-density", "This sets a value of southeast up density.", 1.0  );
+         config.addEntry< double >( prefix + "SEU-velocity-0", "This sets a value of southeast up x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SEU-velocity-1", "This sets a value of southeast up y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SEU-velocity-2", "This sets a value of southeast up z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SEU-pressure", "This sets a value of southeast up pressure.", 1.0  );
+         config.addEntry< double >( prefix + "NED-density", "This sets a value of northeast down density.", 1.0  );
+         config.addEntry< double >( prefix + "NED-velocity-0", "This sets a value of northeast down x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NED-velocity-1", "This sets a value of northeast down y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NED-velocity-2", "This sets a value of northeast down z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "NED-pressure", "This sets a value of northeast down pressure.", 1.0  );
+         config.addEntry< double >( prefix + "SED-density", "This sets a value of southeast down density.", 1.0  );
+         config.addEntry< double >( prefix + "SED-velocity-0", "This sets a value of southeast down x velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SED-velocity-1", "This sets a value of southeast down y velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SED-velocity-2", "This sets a value of southeast down z velocity.", 1.0  );
+         config.addEntry< double >( prefix + "SED-pressure", "This sets a value of southeast down pressure.", 1.0  );
+         config.addEntry< double >( prefix + "gamma", "Gamma in the ideal gas state equation.", 1.4 );
+
+         config.addEntry< String >( prefix + "initial", " One of predefined initial condition.", "none");
+            config.addEntryEnum< String >( "none" );
+            config.addEntryEnum< String >( "1D_2" );
+            config.addEntryEnum< String >( "1D_3a" );
+            config.addEntryEnum< String >( "1D_4" );
+            config.addEntryEnum< String >( "1D_5" );
+            config.addEntryEnum< String >( "1D_6" );
+            config.addEntryEnum< String >( "1D_Noh" );
+            config.addEntryEnum< String >( "1D_peak" );
+            config.addEntryEnum< String >( "2D_3" );
+            config.addEntryEnum< String >( "2D_4" );
+            config.addEntryEnum< String >( "2D_6" );
+            config.addEntryEnum< String >( "2D_12" );
+            config.addEntryEnum< String >( "2D_15" );
+            config.addEntryEnum< String >( "2D_17" );
+      }      
+      
+      bool setup( const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         String initial = parameters.getParameter< String >( prefix + "initial" );
+         if(initial == prefix + "none")
+            {
+               this->discontinuityPlacement.setup( parameters, prefix + "discontinuity-placement-" );
+               this->gamma = parameters.getParameter< double >( prefix + "gamma" );
+/*
+               this->leftVelocity.setup( parameters, prefix + "left-velocity-" );
+               this->rightVelocity.setup( parameters, prefix + "right-velocity-" );
+               this->leftDensity = parameters.getParameter< double >( prefix + "left-density" );
+               this->rightDensity = parameters.getParameter< double >( prefix + "right-density" );
+               this->leftPressure = parameters.getParameter< double >( prefix + "left-pressure" );
+               this->rightPressure = parameters.getParameter< double >( prefix + "right-pressure" );
+*/
+
+               this->NWUDensity = parameters.getParameter< RealType >( prefix + "NWU-density" );
+               this->NWUVelocity.setup( parameters, prefix + "NWU-velocity-" );
+               this->NWUPressure = parameters.getParameter< RealType >( prefix + "NWU-pressure" );
+               this->NWUEnergy = Energy( NWUDensity, NWUPressure, gamma, NWUVelocity); 
+               this->NWUMomentum = NWUVelocity * NWUDensity;
+
+               this->SWUDensity = parameters.getParameter< RealType >( prefix + "SWU-density" );
+               this->SWUVelocity.setup( parameters, prefix + "SWU-velocity-" );
+               this->SWUPressure = parameters.getParameter< RealType >( prefix + "SWU-pressure" );
+               this->SWUEnergy = Energy( SWUDensity, SWUPressure, gamma, SWUVelocity);
+               this->SWUMomentum = SWUVelocity * SWUDensity;
+
+               this->NWDDensity = parameters.getParameter< RealType >( prefix + "NWD-density" );
+               this->NWDVelocity.setup( parameters, prefix + "NWD-velocity-" );
+               this->NWDPressure = parameters.getParameter< RealType >( prefix + "NWD-pressure" );
+               this->SWUEnergy = Energy( NWDDensity, NWDPressure, gamma, NWDVelocity);
+               this->NWDMomentum = NWDVelocity * NWDDensity;
+
+               this->SWDDensity = parameters.getParameter< RealType >( prefix + "SWD-density" );
+               this->SWDVelocity.setup( parameters, prefix + "SWD-velocity-" );
+               this->SWDPressure = parameters.getParameter< RealType >( prefix + "SWD-pressure" );
+               this->SWDEnergy = Energy( SWDDensity, SWDPressure, gamma, SWDVelocity);
+               this->SWDMomentum = SWDVelocity * SWDDensity;
+
+               this->NEUDensity = parameters.getParameter< RealType >( prefix + "NEU-density" );
+               this->NEUVelocity.setup( parameters, prefix + "NEU-velocity-" );
+               this->NEUPressure = parameters.getParameter< RealType >( prefix + "NEU-pressure" );
+               this->NEUEnergy = Energy( NEUDensity, NEUPressure, gamma, NEUVelocity);
+               this->NEUMomentum = NEUVelocity * NEUDensity;
+
+               this->SEUDensity = parameters.getParameter< RealType >( prefix + "SEU-density" );
+               this->SEUVelocity.setup( parameters, prefix + "SEU-velocity-" );
+               this->SEUPressure = parameters.getParameter< RealType >( prefix + "SEU-pressure" );
+               this->SEUEnergy = Energy( SEUDensity, SEUPressure, gamma, SEUVelocity);
+               this->SEUMomentum = SEUVelocity * SEUDensity;
+
+               this->NEDDensity = parameters.getParameter< RealType >( prefix + "NED-density" );
+               this->NEDVelocity.setup(parameters, prefix + "NED-velocity-" );
+               this->NEDPressure = parameters.getParameter< RealType >( prefix + "NED-pressure" );
+               this->NEDEnergy = Energy( NEDDensity, NEDPressure, gamma, NEDVelocity);
+               this->NEDMomentum = NEDVelocity * NEDDensity;
+
+               this->SEDDensity = parameters.getParameter< RealType >( prefix + "SED-density" );
+               this->SEDVelocity.setup( parameters, prefix + "SED-velocity-" );
+               this->SEDPressure = parameters.getParameter< RealType >( prefix + "SED-pressure" );
+               this->SEDEnergy = Energy( SEDDensity, SEDPressure, gamma, SEDVelocity);
+               this->SEDMomentum = SEDVelocity * SEDDensity;
+ 
+           }
+         if(initial == prefix + "1D_2")
+           predefinedInitialCondition( 1.4, 0.5, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 1.0, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 0.4, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 0.4, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       -2.0, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       2.0, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_3a")
+           predefinedInitialCondition( 1.4, 0.8, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 1.0, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 1000.0, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 0.01, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       -19.59745, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       -19.57945, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_4")
+           predefinedInitialCondition( 1.666, 0.4, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 5.99924, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 5.99242, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 460.894, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 46.095, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       19.5975, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       -6.19633, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_5")
+           predefinedInitialCondition( 1.4, 0.5, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 1.4, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.0, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_6")
+           predefinedInitialCondition( 1.4, 0.5, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 1.4, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 0.1, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 0.1, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       1.0, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       1.0, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_Noh")
+           predefinedInitialCondition( 1.4, 0.5, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 1.0, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 0.000001, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 0.000001, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       1.0, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       -1.0, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "1D_peak")
+           predefinedInitialCondition( 1.4, 0.5, 0.0, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.0, 0.12612, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.0, 6.5915, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.0, 782.929, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.0, 3.15449, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       8.90470, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       2.26542, 0.0, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "2D_3")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.5323, 0.138, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 1.5, 0.5323, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.3, 0.029, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 1.5, 0.3, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       1.206, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       1.206, 1.206, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.0, 1.206, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "2D_4")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.5065, 1.1, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 1.1, 0.5065, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.35, 1.1, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 1.1, 0.35, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.8939, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       0.8939, 0.8939, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.0, 0.8939, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+
+      if(initial == prefix + "2D_6")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 2.0, 1.0, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 1.0, 3.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 1.0, 1.0, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 1.0, 1.0, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.75, 0.5, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       -0.75, 0.5, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.75, -0.5, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       -0.75, -0.5, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "2D_12")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 1.0, 0.8, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 0.5313, 1.0, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 1.0, 1.0, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 0.4, 1.0, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.7276, 0.0, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.0, 0.7276, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+
+      if(initial == prefix + "2D_15")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 0.5197, 0.8, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 1.0, 0.5313, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 0.4, 0.4, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 1.0, 0.4, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       -0.6259, -0.3, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       0.1, -0.3, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.1, -0.3, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.1, 0.4276, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+      if(initial == prefix + "2D_17")
+           predefinedInitialCondition( 1.666, 0.5, 0.5, 0.0, // double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       0.0, 0.0, 2.0, 1.0625, //double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       0.0, 0.0, 1.0, 0.5197, //double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       0.0, 0.0, 1.0, 0.4, //double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       0.0, 0.0, 1.0, 0.4, //double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       0.0, 0.0, 0.0, //double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       0.0, -0.3, 0.0, //double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       0.0, 0.2145, 0.0, //double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       0.0, 0.0, 0.0, //double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       0.0, 0.0, 0.0, //double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       0.0, -0.4, 0.0, //double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       0.0, 1.1259, 0.0 //double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       );
+         return true;
+      }
+      
+      void setDiscontinuityPlacement( const PointType& v )
+      {
+         this->discontinuityPlacement = v;
+      }
+      
+      const PointType& getDiscontinuityPlasement() const
+      {
+         return this->discontinuityPlacement;
+      }
+      
+      void setLeftDensity( const RealType& leftDensity )
+      {
+         this->leftDensity = leftDensity;
+      }
+      
+      const RealType& getLeftDensity() const
+      {
+         return this->leftDensity;
+      }
+      
+      void setRightDensity( const RealType& rightDensity )
+      {
+         this->rightDensity = rightDensity;
+      }
+      
+      const RealType& getRightDensity() const
+      {
+         return this->rightDensity;
+      }
+
+      void setLeftVelocity( const PointType& leftVelocity )
+      {
+         this->leftVelocity = leftVelocity;
+      }
+      
+      const PointType& getLeftVelocity() const
+      {
+         return this->leftVelocity;
+      }
+      
+      void setRightVelocity( const RealType& rightVelocity )
+      {
+         this->rightVelocity = rightVelocity;
+      }
+      
+      const PointType& getRightVelocity() const
+      {
+         return this->rightVelocity;
+      }
+
+      void setLeftPressure( const RealType& leftPressure )
+      {
+         this->leftPressure = leftPressure;
+      }
+      
+      const RealType& getLeftPressure() const
+      {
+         return this->leftPressure;
+      }
+      
+      void setRightPressure( const RealType& rightPressure )
+      {
+         this->rightPressure = rightPressure;
+      }
+      
+      const RealType& getRightPressure() const
+      {
+         return this->rightPressure;
+      }
+
+
+      void predefinedInitialCondition( double preGamma,       double preDiscX,       double preDiscY,       double preDiscZ,
+                                       double preNWUDensity,  double preSWUDensity,  double preNWDDensity,  double preSWDDensity, 
+                                       double preNEUDensity,  double preSEUDensity,  double preNEDDensity,  double preSEDDensity, 
+                                       double preNWUPressure, double preSWUPressure, double preNWDPressure, double preSWDPressure, 
+                                       double preNEUPressure, double preSEUPressure, double preNEDPressure, double preSEDPressure, 
+                                       double preNWUVelocityX, double preNWUVelocityY,double preNWUVelocityZ,
+                                       double preSWUVelocityX, double preSWUVelocityY,double preSWUVelocityZ,
+                                       double preNWDVelocityX, double preNWDVelocityY,double preNWDVelocityZ,
+                                       double preSWDVelocityX, double preSWDVelocityY,double preSWDVelocityZ,
+                                       double preNEUVelocityX, double preNEUVelocityY,double preNEUVelocityZ,
+                                       double preSEUVelocityX, double preSEUVelocityY,double preSEUVelocityZ,
+                                       double preNEDVelocityX, double preNEDVelocityY,double preNEDVelocityZ,
+                                       double preSEDVelocityX, double preSEDVelocityY,double preSEDVelocityZ
+                                       )
+
+      {
+         this->discontinuityPlacement = PointLoad(preDiscX, preDiscY, preDiscZ);
+         this->gamma = preGamma;
+
+         this->NWUDensity = preNWUDensity;
+         this->NWUVelocity = PointLoad(preNWUVelocityX, preNWUVelocityY, preNWUVelocityZ);
+         this->NWUPressure = preNWUPressure;
+         this->NWUEnergy = Energy( NWUDensity, NWUPressure, gamma, NWUVelocity); 
+         this->NWUMomentum = NWUVelocity * NWUDensity;
+
+         this->SWUDensity = preNWUDensity;
+         this->SWUVelocity = PointLoad(preSWUVelocityX, preSWUVelocityY, preSWUVelocityZ);
+         this->SWUPressure = preSWUPressure;
+         this->SWUEnergy = Energy( SWUDensity, SWUPressure, gamma, SWUVelocity);
+         this->SWUMomentum = SWUVelocity * SWUDensity;
+
+         this->NWDDensity = preNWDDensity;
+         this->NWDVelocity = PointLoad(preNWDVelocityX, preNWDVelocityY, preNWDVelocityZ);
+         this->NWDPressure = preNWDPressure;
+         this->NWDEnergy = Energy( NWDDensity, NWDPressure, gamma, NWDVelocity); 
+         this->NWDMomentum = NWDVelocity * NWDDensity;
+
+         this->SWDDensity = preSWDDensity;
+         this->SWDVelocity = PointLoad(preSWDVelocityX, preSWDVelocityY, preSWDVelocityZ);
+         this->SWDPressure = preSWDPressure;
+         this->SWDEnergy = Energy( SWDDensity, SWDPressure, gamma, SWDVelocity); 
+         this->SWDMomentum = SWDVelocity * SWDDensity;
+
+         this->NEUDensity = preNEUDensity;
+         this->NEUVelocity = PointLoad(preNEUVelocityX, preNEUVelocityY, preNEUVelocityZ);
+         this->NEUPressure = preNEUPressure;
+         this->NEUEnergy = Energy( NEUDensity, NEUPressure, gamma, NEUVelocity); 
+         this->NEUMomentum = NEUVelocity * NEUDensity;
+
+         this->SEUDensity = preSEUDensity;
+         this->SEUVelocity = PointLoad(preSEUVelocityX, preSEUVelocityY, preSEUVelocityZ);
+         this->SEUPressure = preSEUPressure;
+         this->SEUEnergy = Energy( SEUDensity, SEUPressure, gamma, SEUVelocity); 
+         this->SEUMomentum = SEUVelocity * SEUDensity;
+
+         this->NEDDensity = preNEDDensity;
+         this->NEDVelocity = PointLoad(preNEDVelocityX, preNEDVelocityY, preNEDVelocityZ);
+         this->NEDPressure = preNEDPressure;
+         this->NEDEnergy = Energy( NEDDensity, NEDPressure, gamma, NEDVelocity); 
+         this->NEDMomentum = NEDVelocity * NEDDensity;
+
+         this->SEDDensity = preSEDDensity;
+         this->SEDVelocity = PointLoad(preSEDVelocityX, preSEDVelocityY, preSEDVelocityZ);
+         this->SEDPressure = preSEDPressure;
+         this->SEDEnergy = Energy( SEDDensity, SEDPressure, gamma, SEDVelocity); 
+         this->SEDMomentum = SEDVelocity * SEDDensity;
+
+         std::cout << this->SEDEnergy;
+         std::cout << this->SWDEnergy;
+ 
+      }
+
+      PointType PointLoad( RealType ValueX, RealType ValueY, RealType ValueZ)
+      {
+         PointType point; 
+         switch (Dimensions)
+         {
+            case 1: point[ 0 ] = ValueX;
+                    break;
+            case 2: point[ 0 ] = ValueX;
+                    point[ 1 ] = ValueY;
+                    break;
+            case 3: point[ 0 ] = ValueX;
+                    point[ 1 ] = ValueY;                  
+                    point[ 2 ] = ValueZ;
+                    break;
+         }
+         return point;
+      }
+
+      RealType Energy( RealType Density, RealType Pressure, RealType gamma, PointType Velocity)
+      {
+         RealType energy;
+         switch (Dimensions)
+         {
+            case 1: energy = (Pressure / (gamma -1.0) + 0.5 * Density * (std::pow(Velocity[ 0 ], 2 )));
+                    break;
+            case 2: energy = (Pressure / (gamma -1.0) + 0.5 * Density * (std::pow(Velocity[ 0 ], 2 ) + std::pow(Velocity[ 1 ], 2 )));
+                    break;
+            case 3: energy = (Pressure / (gamma -1.0) + 0.5 * Density * (std::pow(Velocity[ 0 ], 2 ) + std::pow(Velocity[ 1 ], 2 ) + std::pow(Velocity[ 3 ], 2 )));
+                    break; // druhou mocninu ps8t jako sou4in
+         }
+         return energy;
+      }
+      
+      void setInitialCondition( CompressibleConservativeVariables< MeshType >& conservativeVariables,
+                                const PointType& center = PointType( 0.0 ) )
+      {
+         RiemannProblemInitialConditionSetter<MeshType>* variablesSetter = new RiemannProblemInitialConditionSetter<MeshType>;
+         variablesSetter->setGamma(this->gamma);
+         variablesSetter->setDensity(this->NWUDensity,
+                                     this->NEUDensity,
+                                     this->SWUDensity,
+                                     this->SEUDensity,
+                                     this->NWDDensity,
+                                     this->NEDDensity,
+                                     this->SWDDensity,
+                                     this->SEDDensity);
+         variablesSetter->setMomentum(this->NWUMomentum,
+                                      this->NEUMomentum,
+                                      this->SWUMomentum,
+                                      this->SEUMomentum,
+                                      this->NWDMomentum,
+                                      this->NEDMomentum,
+                                      this->SWDMomentum,
+                                      this->SEDMomentum);
+         variablesSetter->setEnergy(this->NWUEnergy,
+                                    this->NEUEnergy,
+                                    this->SWUEnergy,
+                                    this->SEUEnergy,
+                                    this->NWDEnergy,
+                                    this->NEDEnergy,
+                                    this->SWDEnergy,
+                                    this->SEDEnergy);
+         variablesSetter->setDiscontinuity(this->discontinuityPlacement);
+         variablesSetter->placeDensity(conservativeVariables);
+         variablesSetter->placeMomentum(conservativeVariables);
+         variablesSetter->placeEnergy(conservativeVariables);
+
+//       for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
+//       typedef typename MeshType::Cell CellType
+//       typedef typename MeshType::CoordinatesType CoordinatesType
+//       Celltype cell(mesh, CoordinatesType(i,j))
+//       p59stup do density setElement(mesh.template getEntityIndex< CellType >(cell), hodnota, kterou budu zapisovat)
+//       pomocn8 t59da, kterou budu specialiyovat p5es r;zn0 dimenze gridu
+
+/*
+         typedef Functions::Analytic::VectorNorm< Dimensions, RealType > VectorNormType;
+         typedef Operators::Analytic::Sign< Dimensions, RealType > SignType;
+         typedef Functions::OperatorFunction< SignType, VectorNormType > InitialConditionType;
+         typedef SharedPointer< InitialConditionType, DeviceType > InitialConditionPointer;
+         
+         InitialConditionPointer initialCondition;
+         initialCondition->getFunction().setCenter( center );
+         initialCondition->getFunction().setMaxNorm( true );
+         initialCondition->getFunction().setRadius( discontinuityPlacement[ 0 ] );
+         discontinuityPlacement *= 1.0 / discontinuityPlacement[ 0 ];
+         for( int i = 1; i < Dimensions; i++ )
+            discontinuityPlacement[ i ] = 1.0 / discontinuityPlacement[ i ];
+         initialCondition->getFunction().setAnisotropy( discontinuityPlacement );
+         initialCondition->getFunction().setMultiplicator( -1.0 );
+         
+         Functions::MeshFunctionEvaluator< MeshFunctionType, InitialConditionType > evaluator;
+*/
+         /****
+          * Density
+          */
+/*
+         conservativeVariables.getDensity()->write( "density.gplt", "gnuplot" );
+*/
+/*         
+         initialCondition->getOperator().setPositiveValue( leftDensity );
+         initialCondition->getOperator().setNegativeValue( rightDensity );
+         evaluator.evaluate( conservativeVariables.getDensity(), initialCondition );
+         conservativeVariables.getDensity()->write( "density.gplt", "gnuplot" );
+*/         
+         /****
+          * Momentum
+          */
+
+/*
+         for( int i = 0; i < Dimensions; i++ )
+         {
+            initialCondition->getOperator().setPositiveValue( leftDensity * leftVelocity[ i ] );
+            initialCondition->getOperator().setNegativeValue( rightDensity * rightVelocity[ i ] );
+            evaluator.evaluate( conservativeVariables.getMomentum()[ i ], initialCondition );
+         }
+*/      
+         /****
+          * Energy
+          */
+/*
+         conservativeVariables.getEnergy()->write( "energy-init", "gnuplot" );
+*/
+/*
+         const RealType leftKineticEnergy = leftVelocity.lpNorm( 2.0 );
+         const RealType rightKineticEnergy = rightVelocity.lpNorm( 2.0 );
+         const RealType leftEnergy = leftPressure / ( gamma - 1.0 ) + 0.5 * leftDensity * leftKineticEnergy * leftKineticEnergy;
+         const RealType rightEnergy = rightPressure / ( gamma - 1.0 ) + 0.5 * rightDensity * rightKineticEnergy * rightKineticEnergy;
+         initialCondition->getOperator().setPositiveValue( leftEnergy );
+         initialCondition->getOperator().setNegativeValue( rightEnergy );
+         evaluator.evaluate( (* conservativeVariables.getEnergy()), initialCondition );
+         (* conservativeVariables.getEnergy())->write( "energy-init", "gnuplot" );
+*/
+      }
+      
+      
+   protected:
+      
+      PointType discontinuityPlacement;
+      PointType NWUVelocity, NEUVelocity, SWUVelocity, SEUVelocity, NWDVelocity, NEDVelocity, SWDVelocity, SEDVelocity;
+      RealType  NWUDensity, NEUDensity, SWUDensity, SEUDensity, NWDDensity, NEDDensity, SWDDensity, SEDDensity;
+      RealType  NWUPressure, NEUPressure, SWUPressure, SEUPressure, NWDPressure, NEDPressure, SWDPressure, SEDPressure;
+      RealType  NWUEnergy, NEUEnergy, SWUEnergy, SEUEnergy, NWDEnergy, NEDEnergy, SWDEnergy, SEDEnergy;
+      PointType NWUMomentum, NEUMomentum, SWUMomentum, SEUMomentum, NWDMomentum, NEDMomentum, SWDMomentum, SEDMomentum;
+      RealType  leftDensity, rightDensity;
+      PointType leftVelocity, rightVelocity;
+      RealType  leftPressure, rightPressure;
+      
+      RealType gamma; // gamma in the ideal gas state equation
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/Upwind.h b/examples/inviscid-flow-sw/Upwind.h
new file mode 100644
index 0000000000..3e2140da8f
--- /dev/null
+++ b/examples/inviscid-flow-sw/Upwind.h
@@ -0,0 +1,136 @@
+/***************************************************************************
+                          Upwind.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/VectorField.h>
+
+#include "UpwindContinuity.h"
+#include "UpwindEnergy.h"
+#include "UpwindMomentumX.h"
+#include "UpwindMomentumY.h"
+#include "UpwindMomentumZ.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class Upwind
+{
+   public:
+      typedef Mesh MeshType;
+      typedef Real RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef Index IndexType;
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      static const int Dimensions = Mesh::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VectorFieldType;
+ 
+      typedef UpwindContinuity< Mesh, Real, Index > ContinuityOperatorType;
+      typedef UpwindMomentumX< Mesh, Real, Index > MomentumXOperatorType;
+      typedef UpwindMomentumY< Mesh, Real, Index > MomentumYOperatorType;
+      typedef UpwindMomentumZ< Mesh, Real, Index > MomentumZOperatorType;
+      typedef UpwindEnergy< Mesh, Real, Index > EnergyOperatorType;
+
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VectorFieldType > VectorFieldPointer;
+      typedef SharedPointer< MeshType > MeshPointer;
+      
+      typedef SharedPointer< ContinuityOperatorType > ContinuityOperatorPointer;
+      typedef SharedPointer< MomentumXOperatorType > MomentumXOperatorPointer;
+      typedef SharedPointer< MomentumYOperatorType > MomentumYOperatorPointer;      
+      typedef SharedPointer< MomentumZOperatorType > MomentumZOperatorPointer;      
+      typedef SharedPointer< EnergyOperatorType > EnergyOperatorPointer;
+
+      static void configSetup( Config::ConfigDescription& config,
+                               const String& prefix = "" )
+      {
+         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+      }
+      
+      Upwind()
+         : artificialViscosity( 1.0 ) {}
+      
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+         return true;
+      }
+      
+      void setTau( const RealType& tau )
+      {
+         this->continuityOperatorPointer->setTau( tau );
+         this->momentumXOperatorPointer->setTau( tau );
+         this->momentumYOperatorPointer->setTau( tau );
+         this->momentumZOperatorPointer->setTau( tau );
+         this->energyOperatorPointer->setTau( tau );
+      }
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+         this->continuityOperatorPointer->setPressure( pressure );
+         this->momentumXOperatorPointer->setPressure( pressure );
+         this->momentumYOperatorPointer->setPressure( pressure );
+         this->momentumZOperatorPointer->setPressure( pressure );
+         this->energyOperatorPointer->setPressure( pressure );
+      }
+      
+      void setVelocity( const VectorFieldPointer& velocity )
+      {
+         this->continuityOperatorPointer->setVelocity( velocity );
+         this->momentumXOperatorPointer->setVelocity( velocity );
+         this->momentumYOperatorPointer->setVelocity( velocity );
+         this->momentumZOperatorPointer->setVelocity( velocity );
+         this->energyOperatorPointer->setVelocity( velocity );
+      }
+      
+      const ContinuityOperatorPointer& getContinuityOperator() const
+      {
+         return this->continuityOperatorPointer;
+      }
+      
+      const MomentumXOperatorPointer& getMomentumXOperator() const
+      {
+         return this->momentumXOperatorPointer;
+      }
+
+      const MomentumYOperatorPointer& getMomentumYOperator() const
+      {
+         return this->momentumYOperatorPointer;
+      }
+      
+      const MomentumZOperatorPointer& getMomentumZOperator() const
+      {
+         return this->momentumZOperatorPointer;
+      }
+      
+      const EnergyOperatorPointer& getEnergyOperator() const
+      {
+         return this->energyOperatorPointer;
+      }
+
+   protected:
+      
+      ContinuityOperatorPointer continuityOperatorPointer;
+      MomentumXOperatorPointer momentumXOperatorPointer;
+      MomentumYOperatorPointer momentumYOperatorPointer;
+      MomentumZOperatorPointer momentumZOperatorPointer;
+      EnergyOperatorPointer energyOperatorPointer;  
+      
+      RealType artificialViscosity;
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/UpwindContinuity.h b/examples/inviscid-flow-sw/UpwindContinuity.h
new file mode 100644
index 0000000000..5184163ae8
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindContinuity.h
@@ -0,0 +1,353 @@
+/***************************************************************************
+                          UpwindContinuity.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include <TNL/Functions/VectorField.h>
+#include <TNL/SharedPointer.h>
+
+namespace TNL {
+
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindContinuityBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+
+      static String getType()
+      {
+         return String( "UpwindContinuity< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+          this->pressure = pressure;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+
+      protected:
+         
+         RealType tau;
+
+         RealType gamma;
+         
+         VelocityFieldPointer velocity;
+
+         MeshFunctionPointer pressure;
+         
+};
+
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindContinuity
+{
+};
+
+
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindContinuity< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindContinuityBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1 >();
+
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+
+         return -hxInverse * ( 
+//                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+//                                - u[ west   ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_west   + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                - u[ center ] / ( 2 * this->gamma ) * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                + u[ east   ] / ( 2 * this->gamma ) * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) )
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindContinuity< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindContinuityBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+         //rho
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1 >();
+
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         
+         return -hxInverse * ( 
+                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                - u[ west   ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_west   + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                - u[ center ] * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ east   ] * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                             )
+                -hyInverse * ( 
+                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                - u[ south  ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_y_south  + std::sqrt( this->gamma * pressure_south  / u[ south ]  ) )
+                                - u[ center ] * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ north  ] * ( velocity_y_north  - std::sqrt( this->gamma * pressure_north / u[ north ]  ) ) / ( 2 * this->gamma )
+                             ); 
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindContinuity< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindContinuityBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindContinuityBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+
+         //rho
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];
+         
+         return -hxInverse * ( 
+                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                - u[ west ]   / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_x_west   + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                - u[ center ] * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ east ]   * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                             )
+                -hyInverse * ( 
+                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                - u[ south ]  / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_y_south  + std::sqrt( this->gamma * pressure_south  / u[ south ]  ) )
+                                - u[ center ] * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ north ]  * ( velocity_y_north  - std::sqrt( this->gamma * pressure_north  / u[ north ]  ) ) / ( 2 * this->gamma )
+                             )
+                -hzInverse * ( 
+                                  u[ center ] / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                - u[ down ]   / ( 2 * this->gamma ) * ( ( 2 * this->gamma - 1 ) * velocity_z_down   + std::sqrt( this->gamma * pressure_down   / u[ down ]   ) )
+                                - u[ center ] * ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ up ]     * ( velocity_z_up     - std::sqrt( this->gamma * pressure_up     / u[ up ]     ) ) / ( 2 * this->gamma )
+                             );
+         
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/UpwindEnergy.h b/examples/inviscid-flow-sw/UpwindEnergy.h
new file mode 100644
index 0000000000..494fdbbe56
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindEnergy.h
@@ -0,0 +1,593 @@
+/***************************************************************************
+                          UpwindEnergy.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+
+namespace TNL {
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindEnergyBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      
+      UpwindEnergyBase()
+       : artificialViscosity( 1.0 ){};
+
+      static String getType()
+      {
+         return String( "UpwindEnergy< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+          this->pressure = pressure;
+      };
+      
+      void setArtificialViscosity( const RealType& artificialViscosity )
+      {
+         this->artificialViscosity = artificialViscosity;
+      }      
+
+      protected:
+         
+         RealType tau;
+
+         RealType gamma;
+         
+         VelocityFieldPointer velocity;
+         
+         MeshFunctionPointer pressure;
+         
+         RealType artificialViscosity;
+};
+   
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindEnergy
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindEnergy< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindEnergyBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >();
+ 
+         const IndexType& center = entity.getIndex();
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+
+         return -hxInverse * ( 
+                                   ( u[ center ] / ( 2 * this->gamma ) ) 
+                                     * ( 
+                                         ( this->gamma - 1 ) * velocity_x_center * velocity_x_center * velocity_x_center
+                                       + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                       * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                       * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                       / 2
+                                       + ( 3 - this->gamma )
+                                       / ( 2 * ( this->gamma - 1 ) )
+                                       * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                       * ( this->gamma * pressure_center / u[ center ] )      
+                                       )
+                                - ( u[ west   ] / ( 2 * this->gamma ) ) 
+                                    * ( 
+                                        ( 2 * this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                      + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                       / 2
+                                       + ( 3 - this->gamma )
+                                       / ( 2 * ( this->gamma - 1 ) )
+                                       * ( velocity_x_west   + std::sqrt( this->gamma * pressure_center / u[ west ]   ) )
+                                       * ( this->gamma * pressure_west   / u[ west   ] ) 
+                                      )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( 
+                                      ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                    * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                    / 2
+                                    + ( 3 - this->gamma )
+                                    / (this->gamma - 1 )
+                                    * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                    / 2
+                                    ) 
+                                + u[ east   ] / ( 2 * this->gamma )
+                                  * (
+                                      ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                                    * ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                                    / 2
+                                    + ( 3 - this->gamma )
+                                    / (this->gamma - 1 )
+                                    * ( velocity_x_east   + std::sqrt( this->gamma * pressure_east   / u[ east ]   ) )
+                                    / 2
+                                    )
+                             );  
+  
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindEnergy< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindEnergyBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1 >();
+
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];         
+         
+         return -hxInverse * (
+                               ( u[ center ] / ( 2 * this->gamma ) )
+                               * (
+                                   ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center ) / 2
+                                 + velocity_x_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 + this->gamma * pressure_center / u[ center ] 
+                                 * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ west ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 * ( velocity_x_west * velocity_x_west + velocity_y_west * velocity_y_west ) / 2
+                                 + velocity_x_west * std::sqrt( this->gamma * pressure_west / u[ west ] )
+                                 * ( velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 + this->gamma * pressure_west / u[ west ]
+                                 * ( velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center ) / 2
+                                 + velocity_x_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( std::sqrt( this->gamma * pressure_center / u[ center ] ) - velocity_x_center )
+                                 + this->gamma * pressure_center / u[ center ]
+                                 * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             + ( u[ east  ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_x_east  - std::sqrt( this->gamma * pressure_east  / u[ east  ] ) )
+                                 * ( velocity_x_east  * velocity_x_east  + velocity_y_east  * velocity_y_east  ) / 2
+                                 + velocity_x_east  * std::sqrt( this->gamma * pressure_east  / u[ east  ] )
+                                 * ( std::sqrt( this->gamma * pressure_east  / u[ east  ] ) - velocity_x_east  )
+                                 + this->gamma * pressure_east  / u[ east  ]
+                                 * ( velocity_x_east  - std::sqrt( this->gamma * pressure_east  / u[ east  ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             ) 
+                -hyInverse * (
+                               ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center ) / 2
+                                 + velocity_y_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 + this->gamma * pressure_center / u[ center ] 
+                                 * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ south ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 * ( velocity_x_south * velocity_x_south + velocity_y_south * velocity_y_south ) / 2
+                                 + velocity_y_south * std::sqrt( this->gamma * pressure_south / u[ south ] )
+                                 * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 + this->gamma * pressure_south / u[ south ]
+                                 * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center ) / 2
+                                 + velocity_y_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( std::sqrt( this->gamma * pressure_center / u[ center ] ) - velocity_y_center )
+                                 + this->gamma * pressure_center / u[ center ]
+                                 * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             + ( u[ north ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_y_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                                 * ( velocity_x_north * velocity_x_north + velocity_y_north * velocity_y_north ) / 2
+                                 + velocity_y_north * std::sqrt( this->gamma * pressure_north / u[ north ] )
+                                 * ( std::sqrt( this->gamma * pressure_north / u[ north ] ) - velocity_y_north )
+                                 + this->gamma * pressure_north / u[ north ]
+                                 * ( velocity_y_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             );     
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindEnergy< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindEnergyBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindEnergyBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_up     = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_x_down   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_y_up     = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_y_down   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_east   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_z_west   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_z_north  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_z_south  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ];         
+         
+         return -hxInverse * (
+                               ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_x_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 + this->gamma * pressure_center / u[ center ] 
+                                 * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ west ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 * ( velocity_x_west * velocity_x_west + velocity_y_west * velocity_y_west + velocity_z_west * velocity_z_west ) / 2
+                                 + velocity_x_west * std::sqrt( this->gamma * pressure_west / u[ west ] )
+                                 * ( velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 + this->gamma * pressure_west / u[ west ]
+                                 * ( velocity_x_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_x_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( std::sqrt( this->gamma * pressure_center / u[ center ] ) - velocity_x_center )
+                                 + this->gamma * pressure_center / u[ center ]
+                                 * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             + ( u[ east  ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_x_east  - std::sqrt( this->gamma * pressure_east  / u[ east  ] ) )
+                                 * ( velocity_x_east  * velocity_x_east  + velocity_y_east  * velocity_y_east + velocity_z_east * velocity_z_east  ) / 2
+                                 + velocity_x_east  * std::sqrt( this->gamma * pressure_east  / u[ east  ] )
+                                 * ( std::sqrt( this->gamma * pressure_east  / u[ east  ] ) - velocity_x_east  )
+                                 + this->gamma * pressure_east  / u[ east  ]
+                                 * ( velocity_x_east  - std::sqrt( this->gamma * pressure_east  / u[ east  ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             ) 
+                -hyInverse * (
+                               ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_y_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 + this->gamma * pressure_center / u[ center ] 
+                                 * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ south ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 * ( velocity_x_south * velocity_x_south + velocity_y_south * velocity_y_south + velocity_z_south * velocity_z_south ) / 2
+                                 + velocity_y_south * std::sqrt( this->gamma * pressure_south / u[ south ] )
+                                 * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 + this->gamma * pressure_south / u[ south ]
+                                 * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_y_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( std::sqrt( this->gamma * pressure_center / u[ center ] ) - velocity_y_center )
+                                 + this->gamma * pressure_center / u[ center ]
+                                 * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             + ( u[ north ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_y_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                                 * ( velocity_x_north * velocity_x_north + velocity_y_north * velocity_y_north + velocity_z_north * velocity_z_north ) / 2
+                                 + velocity_y_north * std::sqrt( this->gamma * pressure_north / u[ north ] )
+                                 * ( std::sqrt( this->gamma * pressure_north / u[ north ] ) - velocity_y_north )
+                                 + this->gamma * pressure_north / u[ north ]
+                                 * ( velocity_y_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             ) 
+                -hzInverse * (
+                               ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_z_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 + this->gamma * pressure_center / u[ center ] 
+                                 * ( velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ down ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( ( 2 * this->gamma - 1 ) * velocity_z_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                                 * ( velocity_x_down * velocity_x_down + velocity_y_down * velocity_y_down + velocity_z_down * velocity_z_down ) / 2
+                                 + velocity_z_down * std::sqrt( this->gamma * pressure_down / u[ down ] )
+                                 * ( velocity_z_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                                 + this->gamma * pressure_down / u[ down ]
+                                 * ( velocity_z_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             - ( u[ center ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 * ( velocity_x_center * velocity_x_center + velocity_y_center * velocity_y_center + velocity_z_center * velocity_z_center ) / 2
+                                 + velocity_z_center * std::sqrt( this->gamma * pressure_center / u[ center ] )
+                                 * ( std::sqrt( this->gamma * pressure_center / u[ center ] ) - velocity_z_center )
+                                 + this->gamma * pressure_center / u[ center ]
+                                 * ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             + ( u[ up ] / ( 2 * this->gamma ) )
+                               * ( 
+                                   ( velocity_z_up - std::sqrt( this->gamma * pressure_up / u[ up ] ) )
+                                 * ( velocity_x_up * velocity_x_up + velocity_y_up * velocity_y_up + velocity_z_up * velocity_z_up ) / 2
+                                 + velocity_z_up * std::sqrt( this->gamma * pressure_up / u[ up ] )
+                                 * ( std::sqrt( this->gamma * pressure_up / u[ up ] ) - velocity_z_up )
+                                 + this->gamma * pressure_up / u[ up ]
+                                 * ( velocity_z_up - std::sqrt( this->gamma * pressure_up / u[ up ] ) )
+                                 / ( this->gamma - 1 )
+                                 )
+                             );
+; 
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/UpwindMomentumBase.h b/examples/inviscid-flow-sw/UpwindMomentumBase.h
new file mode 100644
index 0000000000..818d6cc56d
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindMomentumBase.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+                          UpwindMomentumBase.h  -  description
+                             -------------------
+    begin                : Feb 17, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindMomentumBase
+{
+   public:
+      
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef Mesh MeshType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      static const int Dimensions = MeshType::getMeshDimension();
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType > MeshFunctionPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+      
+      void setVelocity( const VelocityFieldPointer& velocity )
+      {
+          this->velocity = velocity;
+      };
+      
+      void setPressure( const MeshFunctionPointer& pressure )
+      {
+          this->pressure = pressure;
+      };
+
+      protected:
+         
+         RealType tau;
+
+         RealType gamma;
+         
+         VelocityFieldPointer velocity;
+         
+         MeshFunctionPointer pressure;
+
+};
+
+} //namespace TNL
diff --git a/examples/inviscid-flow-sw/UpwindMomentumX.h b/examples/inviscid-flow-sw/UpwindMomentumX.h
new file mode 100644
index 0000000000..347306fa8a
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindMomentumX.h
@@ -0,0 +1,394 @@
+/***************************************************************************
+                          UpwindMomentumX.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "UpwindMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindMomentumX
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         
+         return -hxInverse * ( 
+                                   ( u[ center ] / ( 2 * this->gamma ) ) 
+                                     * ( 
+                                         2 * ( this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                       + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                       * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                       )
+                                - ( u[ west   ] / ( 2 * this->gamma ) ) 
+                                    * ( 
+                                        2 * ( this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                      + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      )  
+                                - u[ center ] 
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ east   ] 
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];          
+         
+         return -hxInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( 2 * ( this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                   + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ west   ] / ( 2 * this->gamma )
+                                   * ( 2 * ( this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                     + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ east   ] / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) )
+                             )
+                -hyInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_x_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                               * velocity_y_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             + u[ north ] / ( 2 * this->gamma )
+                               * ( velocity_x_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                               * velocity_y_north
+                             );
+
+                                      
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_up     = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_x_down   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_y_up     = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_y_down   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_east   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_z_west   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_z_north  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_z_south  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ]; 
+
+         return -hxInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( 2 * ( this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                   + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ west   ] / ( 2 * this->gamma )
+                                   * ( 2 * ( this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                     + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ east   ] / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                             )
+                -hyInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_x_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                               * velocity_y_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             + u[ north ] / ( 2 * this->gamma )
+                               * ( velocity_x_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                               * velocity_y_north
+                             )
+                -hzInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_x_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                               * velocity_z_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             + u[ up ] / ( 2 * this->gamma )
+                               * ( velocity_x_up - std::sqrt( this->gamma * pressure_up / u[ up ] ) )
+                               * velocity_z_up
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/UpwindMomentumX.h~ b/examples/inviscid-flow-sw/UpwindMomentumX.h~
new file mode 100644
index 0000000000..9b20007e1d
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindMomentumX.h~
@@ -0,0 +1,396 @@
+/***************************************************************************
+                          UpwindMomentumX.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "UpwindMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindMomentumX
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); 
+         const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+         const RealType& rho_center = this->rho.template getData< DeviceType >()[ center ];
+         const RealType& rho_west = this->rho.template getData< DeviceType >()[ west ];
+         const RealType& rho_east = this->rho.template getData< DeviceType >()[ east ];
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_east = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         
+         return -hxInverse * ( 
+                                   ( u[ center ] / ( 2 * this->gamma ) ) 
+                                     * ( 
+                                         ( 2 * this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                       + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                       * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                       )
+                                - ( u[ west   ] / ( 2 * this->gamma ) ) 
+                                    * ( 
+                                        ( 2 * this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                      + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                      )  
+                                - u[ center ] 
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) ) / ( 2 * this->gamma )
+                                + u[ east   ] 
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) ) / ( 2 * this->gamma )
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];          
+         
+         return -hxInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( ( 2 * this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                   + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ west   ] / ( 2 * this->gamma )
+                                   * ( ( 2 * this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                     + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ east   ] / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_east / u[ east   ] ) )
+                             )
+                -hyInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                               * velocity_y_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             + u[ north ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                               * velocity_y_north
+                             );
+
+                                      
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumX< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_up     = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_x_down   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ souh ];
+         const RealType& velocity_y_up     = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_y_down   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_east   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_z_west   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_z_north  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_z_south  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ]; 
+
+         return -hxInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( ( 2 * this->gamma - 1 ) * velocity_x_center * velocity_x_center
+                                   + ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ west   ] / ( 2 * this->gamma )
+                                   * ( ( 2 * this->gamma - 1 ) * velocity_x_west    * velocity_x_west
+                                     + ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     * ( velocity_x_west    + std::sqrt( this->gamma * pressure_west   / u[ west ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ east   ] / ( 2 * this->gamma )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                                  * ( velocity_x_east   - std::sqrt( this->gamma * pressure_center / u[ east   ] ) )
+                             )
+                -hyInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                               * velocity_y_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             + u[ north ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                               * velocity_y_north
+                             )
+                -hzInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * this->velocity_x_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                               * velocity_z_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             + u[ up ] / ( 2 * this->gamma )
+                               * ( this->velocity_x_up - std::sqrt( this->gamma * pressure_up / u[ up ] ) )
+                               * velocity_z_up
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/UpwindMomentumY.h b/examples/inviscid-flow-sw/UpwindMomentumY.h
new file mode 100644
index 0000000000..5d3a015c6d
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindMomentumY.h
@@ -0,0 +1,362 @@
+/***************************************************************************
+                          UpwindMomentumY.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "UpwindMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindMomentumY
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumY< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_v,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumY< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); 
+
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];          
+         
+         return -hxInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             - u[ west ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_y_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                               * velocity_x_west
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             + u[ east ] / ( 2 * this->gamma )
+                               * ( velocity_y_east - std::sqrt( this->gamma * pressure_east / u[ east ] ) )
+                               * velocity_x_east
+                             )
+                -hyInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( 2 * ( this->gamma - 1 ) * velocity_y_center * velocity_y_center
+                                   + ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ south ] / ( 2 * this->gamma )
+                                   * ( 2 * ( this->gamma - 1 ) * velocity_y_south * velocity_y_south
+                                     + ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ]   ) )
+                                     * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ north   ] / ( 2 * this->gamma )
+                                  * ( velocity_y_north   - std::sqrt( this->gamma * pressure_north / u[ north   ] ) )
+                                  * ( velocity_y_north   - std::sqrt( this->gamma * pressure_north / u[ north   ] ) )
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumY< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumY< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_up     = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_x_down   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_y_up     = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_y_down   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_east   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_z_west   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_z_north  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_z_south  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ]; 
+
+         return -hxInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             - u[ west ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_y_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                               * velocity_x_west
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             + u[ east ] / ( 2 * this->gamma )
+                               * ( velocity_y_east - std::sqrt( this->gamma * pressure_east / u[ east ] ) )
+                               * velocity_x_east
+                             )
+                -hyInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( 2 * ( this->gamma - 1 ) * velocity_y_center * velocity_y_center
+                                   + ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ south ] / ( 2 * this->gamma )
+                                   * ( 2 * ( this->gamma - 1 ) * velocity_y_south * velocity_y_south
+                                     + ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ]   ) )
+                                     * ( velocity_y_south + std::sqrt( this->gamma * pressure_south / u[ south ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ north   ] / ( 2 * this->gamma )
+                                  * ( velocity_y_north   - std::sqrt( this->gamma * pressure_north / u[ north   ] ) )
+                                  * ( velocity_y_north   - std::sqrt( this->gamma * pressure_north / u[ north   ] ) )
+                             )
+                -hzInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( 2 * ( this->gamma - 1 ) * velocity_y_down + std::sqrt( this->gamma * pressure_down / u[ down ] ) )
+                               * velocity_z_down
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_z_center
+                             + u[ up ] / ( 2 * this->gamma )
+                               * ( velocity_y_up - std::sqrt( this->gamma * pressure_up / u[ up ] ) )
+                               * velocity_z_up
+                             );
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/UpwindMomentumZ.h b/examples/inviscid-flow-sw/UpwindMomentumZ.h
new file mode 100644
index 0000000000..64842a79f2
--- /dev/null
+++ b/examples/inviscid-flow-sw/UpwindMomentumZ.h
@@ -0,0 +1,304 @@
+/***************************************************************************
+                          UpwindMomentumZ.h  -  description
+                             -------------------
+    begin                : Feb 18, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <TNL/Containers/Vector.h>
+#include <TNL/Meshes/Grid.h>
+#include "UpwindMomentumBase.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class UpwindMomentumZ
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumZ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+
+      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }
+      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_w,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumZ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& rho_w,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); 
+         //const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); 
+
+         return 0.0;
+      }
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class UpwindMomentumZ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+   : public UpwindMomentumBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef UpwindMomentumBase< MeshType, Real, Index > BaseType;
+      
+      using typename BaseType::RealType;
+      using typename BaseType::IndexType;
+      using typename BaseType::DeviceType;
+      using typename BaseType::CoordinatesType;
+      using typename BaseType::MeshFunctionType;
+      using typename BaseType::MeshFunctionPointer;
+      using typename BaseType::VelocityFieldType;
+      using typename BaseType::VelocityFieldPointer;
+      using BaseType::Dimensions;      
+      
+      static String getType()
+      {
+         return String( "UpwindMomentumZ< " ) +
+             MeshType::getType() + ", " +
+             TNL::getType< Real >() + ", " +
+             TNL::getType< Index >() + " >"; 
+      }      
+
+      template< typename MeshFunction, typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshFunction& u,
+                       const MeshEntity& entity,
+                       const RealType& time = 0.0 ) const
+      {
+         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
+         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
+         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+ 
+         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0,  0 >(); 
+         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1,  0 >(); 
+         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0,  0, -1 >();
+ 
+         const IndexType& center = entity.getIndex(); 
+         const IndexType& east   = neighborEntities.template getEntityIndex<  1,  0,  0 >(); 
+         const IndexType& west   = neighborEntities.template getEntityIndex< -1,  0,  0 >(); 
+         const IndexType& north  = neighborEntities.template getEntityIndex<  0,  1,  0 >(); 
+         const IndexType& south  = neighborEntities.template getEntityIndex<  0, -1,  0 >();
+         const IndexType& up     = neighborEntities.template getEntityIndex<  0,  0,  1 >(); 
+         const IndexType& down   = neighborEntities.template getEntityIndex<  0,  0, -1 >();
+         
+         const RealType& pressure_center = this->pressure.template getData< DeviceType >()[ center ];
+         const RealType& pressure_west   = this->pressure.template getData< DeviceType >()[ west ];
+         const RealType& pressure_east   = this->pressure.template getData< DeviceType >()[ east ];
+         const RealType& pressure_north  = this->pressure.template getData< DeviceType >()[ north ];
+         const RealType& pressure_south  = this->pressure.template getData< DeviceType >()[ south ];
+         const RealType& pressure_up     = this->pressure.template getData< DeviceType >()[ up ];
+         const RealType& pressure_down   = this->pressure.template getData< DeviceType >()[ down ];
+         
+         const RealType& velocity_x_center = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_x_east   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_x_west   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_x_north  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_x_south  = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_x_up     = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_x_down   = this->velocity.template getData< DeviceType >()[ 0 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_y_center = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_y_east   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_y_west   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_y_north  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_y_south  = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_y_up     = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_y_down   = this->velocity.template getData< DeviceType >()[ 1 ].template getData< DeviceType >()[ down ];
+
+         const RealType& velocity_z_center = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ center ];
+         const RealType& velocity_z_east   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ east ];
+         const RealType& velocity_z_west   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ west ];
+         const RealType& velocity_z_north  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ north ];
+         const RealType& velocity_z_south  = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ south ];
+         const RealType& velocity_z_up     = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ up ];
+         const RealType& velocity_z_down   = this->velocity.template getData< DeviceType >()[ 2 ].template getData< DeviceType >()[ down ]; 
+
+         return -hxInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_y_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             - u[ west ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_y_west + std::sqrt( this->gamma * pressure_west / u[ west ] ) )
+                               * velocity_x_west
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_y_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_x_center
+                             + u[ east ] / ( 2 * this->gamma )
+                               * ( velocity_y_east - std::sqrt( this->gamma * pressure_east / u[ east ] ) )
+                               * velocity_x_east
+                             )
+                -hyInverse * ( 
+                               u[ center ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             - u[ south ] / ( 2 * this->gamma )
+                               * ( ( 2 * this->gamma - 1 ) * velocity_z_south + std::sqrt( this->gamma * pressure_south / u[ south ] ) )
+                               * velocity_y_south
+                             - u[ center ] / ( 2 * this->gamma )
+                               * ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                               * velocity_y_center
+                             + u[ north ] / ( 2 * this->gamma )
+                               * ( velocity_z_north - std::sqrt( this->gamma * pressure_north / u[ north ] ) )
+                               * velocity_y_north
+                             )
+                -hyInverse * ( 
+                                 u[ center ] / ( 2 * this->gamma )
+                                 * ( ( 2 * this->gamma - 1 ) * velocity_z_center * velocity_z_center
+                                   + ( velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) ) 
+                                   * ( velocity_z_center + std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                   )
+                               - u[ down ] / ( 2 * this->gamma )
+                                   * ( ( 2 * this->gamma - 1 ) * velocity_z_down * velocity_z_down
+                                     + ( velocity_z_down + std::sqrt( this->gamma * pressure_down / u[ down ]   ) )
+                                     * ( velocity_z_down + std::sqrt( this->gamma * pressure_down / u[ down ]   ) )
+                                     )  
+                                - u[ center ] / ( 2 * this->gamma )
+                                  * ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                  * ( velocity_z_center - std::sqrt( this->gamma * pressure_center / u[ center ] ) )
+                                + u[ up   ] / ( 2 * this->gamma )
+                                  * ( velocity_z_up   - std::sqrt( this->gamma * pressure_up / u[ up   ] ) )
+                                  * ( velocity_z_up   - std::sqrt( this->gamma * pressure_up / u[ up   ] ) )
+                             );
+      }
+
+
+      /*template< typename MeshEntity >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const MeshEntity& entity ) const;
+
+      template< typename MeshEntity, typename Vector, typename MatrixRow >
+      __cuda_callable__
+      void updateLinearSystem( const RealType& time,
+                               const RealType& tau,
+                               const MeshType& mesh,
+                               const IndexType& index,
+                               const MeshEntity& entity,
+                               const MeshFunctionType& u,
+                               Vector& b,
+                               MatrixRow& matrixRow ) const;*/
+};
+
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/euler.cpp b/examples/inviscid-flow-sw/euler.cpp
new file mode 100644
index 0000000000..4d76005cb1
--- /dev/null
+++ b/examples/inviscid-flow-sw/euler.cpp
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow-sw/euler.cu b/examples/inviscid-flow-sw/euler.cu
new file mode 100644
index 0000000000..4d76005cb1
--- /dev/null
+++ b/examples/inviscid-flow-sw/euler.cu
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow-sw/euler.h b/examples/inviscid-flow-sw/euler.h
new file mode 100644
index 0000000000..b0e21ffe41
--- /dev/null
+++ b/examples/inviscid-flow-sw/euler.h
@@ -0,0 +1,116 @@
+#include <TNL/tnlConfig.h>
+#include <TNL/Solvers/Solver.h>
+#include <TNL/Solvers/BuildConfigTags.h>
+#include <TNL/Operators/DirichletBoundaryConditions.h>
+#include <TNL/Operators/NeumannBoundaryConditions.h>
+#include <TNL/Functions/Analytic/Constant.h>
+#include "eulerProblem.h"
+#include "Upwind.h"
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+
+#include "RiemannProblemInitialCondition.h"
+
+using namespace TNL;
+
+typedef eulerBuildConfigTag BuildConfig;
+
+/****
+ * Uncomment the following (and comment the previous line) for the complete build.
+ * This will include support for all floating point precisions, all indexing types
+ * and more solvers. You may then choose between them from the command line.
+ * The compile time may, however, take tens of minutes or even several hours,
+ * especially if CUDA is enabled. Use this, if you want, only for the final build,
+ * not in the development phase.
+ */
+//typedef tnlDefaultConfigTag BuildConfig;
+
+template< typename ConfigTag >class eulerConfig
+{
+   public:
+      static void configSetup( Config::ConfigDescription & config )
+      {
+         config.addDelimiter( "Inviscid flow settings:" );
+         config.addEntry< String >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< String >( "dirichlet" );
+            config.addEntryEnum< String >( "neumann" );
+         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
+         typedef Meshes::Grid< 3 > Mesh;
+         RiemannProblemInitialCondition< Mesh >::configSetup( config );
+
+         /****
+          * Add definition of your solver command line arguments.
+          */
+
+      }
+};
+
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename MeshType,
+          typename ConfigTag,
+          typename SolverStarter >
+class eulerSetter
+{
+   public:
+
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+
+      static bool run( const Config::ParameterContainer & parameters )
+      {
+          enum { Dimension = MeshType::getMeshDimension() };
+          typedef Upwind< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point;
+
+         /****
+          * Resolve the template arguments of your solver here.
+          * The following code is for the Dirichlet and the Neumann boundary conditions.
+          * Both can be constant or defined as descrete values of Vector.
+          */
+          String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef Functions::Analytic::Constant< Dimension, Real > Constant;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef Functions::MeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          if( boundaryConditionsType == "neumann" )
+          {
+             typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+
+      return true;}
+
+};
+
+int main( int argc, char* argv[] )
+{
+   Solvers::Solver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
diff --git a/examples/inviscid-flow-sw/eulerBuildConfigTag.h b/examples/inviscid-flow-sw/eulerBuildConfigTag.h
new file mode 100644
index 0000000000..fd639c4adf
--- /dev/null
+++ b/examples/inviscid-flow-sw/eulerBuildConfigTag.h
@@ -0,0 +1,51 @@
+#ifndef eulerBUILDCONFIGTAG_H_
+#define eulerBUILDCONFIGTAG_H_
+
+#include <TNL/Solvers/BuildConfigTags.h>
+
+namespace TNL {
+
+class eulerBuildConfigTag{};
+
+namespace Solvers {
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct ConfigTagReal< eulerBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct ConfigTagReal< eulerBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct ConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct ConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; };
+
+//template< int Dimension > struct ConfigTagDimension< eulerBuildConfigTag, Dimension >{ enum { enabled = ( Dimension == 1 ) }; };
+
+/****
+ * Use of Grid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+template< int Dimension, typename Real, typename Device, typename Index >
+   struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > >
+      { enum { enabled = ConfigTagDimension< eulerBuildConfigTag, Dimension >::enabled  &&
+                         ConfigTagReal< eulerBuildConfigTag, Real >::enabled &&
+                         ConfigTagDevice< eulerBuildConfigTag, Device >::enabled &&
+                         ConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, ExplicitEulerSolverTag >{ enum { enabled = true }; };
+
+} // namespace Solvers
+} // namespace TNL
+
+#endif /* eulerBUILDCONFIGTAG_H_ */
diff --git a/examples/inviscid-flow-sw/eulerProblem.h b/examples/inviscid-flow-sw/eulerProblem.h
new file mode 100644
index 0000000000..ea9e315564
--- /dev/null
+++ b/examples/inviscid-flow-sw/eulerProblem.h
@@ -0,0 +1,130 @@
+/***************************************************************************
+                          eulerProblem.h  -  description
+                             -------------------
+    begin                : Feb 13, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/Problems/PDEProblem.h>
+#include <TNL/Functions/MeshFunction.h>
+#include "CompressibleConservativeVariables.h"
+
+
+using namespace TNL::Problems;
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+class eulerProblem:
+   public PDEProblem< Mesh,
+                      typename InviscidOperators::RealType,
+                      typename Mesh::DeviceType,
+                      typename InviscidOperators::IndexType >
+{
+   public:
+      
+      typedef typename InviscidOperators::RealType RealType;
+      typedef typename Mesh::DeviceType DeviceType;
+      typedef typename InviscidOperators::IndexType IndexType;
+      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+      
+      using typename BaseType::MeshType;
+      using typename BaseType::MeshPointer;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::DofVectorPointer;
+      using typename BaseType::MeshDependentDataType;
+      using typename BaseType::MeshDependentDataPointer;
+
+      static const int Dimensions = Mesh::getMeshDimension();      
+
+      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+      typedef CompressibleConservativeVariables< MeshType > ConservativeVariablesType;
+      typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
+      typedef SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
+      typedef SharedPointer< ConservativeVariablesType > ConservativeVariablesPointer;
+      typedef SharedPointer< VelocityFieldType > VelocityFieldPointer;
+      typedef SharedPointer< InviscidOperators > InviscidOperatorsPointer;
+      typedef SharedPointer< BoundaryCondition > BoundaryConditionPointer;
+      typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
+
+      static String getTypeStatic();
+
+      String getPrologHeader() const;
+
+      void writeProlog( Logger& logger,
+                        const Config::ParameterContainer& parameters ) const;
+
+      bool setup( const MeshPointer& meshPointer,
+                  const Config::ParameterContainer& parameters,
+                  const String& prefix = "" );
+
+      bool setInitialCondition( const Config::ParameterContainer& parameters,
+                                const MeshPointer& mesh,
+                                DofVectorPointer& dofs,
+                                MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshPointer& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshPointer& mesh,
+                         DofVectorPointer& dofs,
+                         MeshDependentDataPointer& meshDependentData );
+
+      IndexType getDofs( const MeshPointer& mesh ) const;
+
+      void bindDofs( const MeshPointer& mesh,
+                     DofVectorPointer& dofs );
+
+      void getExplicitUpdate( const RealType& time,
+                           const RealType& tau,
+                           const MeshPointer& mesh,
+                           DofVectorPointer& _u,
+                           DofVectorPointer& _fu,
+                           MeshDependentDataPointer& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshPointer& mesh,
+                                 DofVectorPointer& dofs,
+                                 Matrix& matrix,
+                                 DofVectorPointer& rightHandSide,
+                                 MeshDependentDataPointer& meshDependentData );
+
+      bool postIterate( const RealType& time,
+                        const RealType& tau,
+                        const MeshPointer& mesh,
+                        DofVectorPointer& dofs,
+                        MeshDependentDataPointer& meshDependentData );
+
+   protected:
+
+      InviscidOperatorsPointer inviscidOperatorsPointer;
+         
+      BoundaryConditionPointer boundaryConditionPointer;
+      RightHandSidePointer rightHandSidePointer;
+      
+      ConservativeVariablesPointer conservativeVariables,
+                                   conservativeVariablesRHS;
+      
+      VelocityFieldPointer velocity;
+      MeshFunctionPointer pressure;
+      
+      RealType gamma;          
+};
+
+} // namespace TNL
+
+#include "eulerProblem_impl.h"
+
diff --git a/examples/inviscid-flow-sw/eulerProblem_impl.h b/examples/inviscid-flow-sw/eulerProblem_impl.h
new file mode 100644
index 0000000000..2e2cda9a25
--- /dev/null
+++ b/examples/inviscid-flow-sw/eulerProblem_impl.h
@@ -0,0 +1,416 @@
+/***************************************************************************
+                          eulerProblem_impl.h  -  description
+                             -------------------
+    begin                : Feb 13, 2017
+    copyright            : (C) 2017 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+#include <TNL/FileName.h>
+#include <TNL/Matrices/MatrixSetter.h>
+#include <TNL/Solvers/PDE/ExplicitUpdater.h>
+#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
+#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>
+#include <TNL/Functions/Analytic/VectorNorm.h>
+
+#include "RiemannProblemInitialCondition.h"
+#include "CompressibleConservativeVariables.h"
+#include "PhysicalVariablesGetter.h"
+#include "eulerProblem.h"
+
+#include "UpwindContinuity.h"
+#include "UpwindEnergy.h"
+#include "UpwindMomentumX.h"
+#include "UpwindMomentumY.h"
+#include "UpwindMomentumZ.h"
+
+namespace TNL {
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+getTypeStatic()
+{
+   return String( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+String
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+getPrologHeader() const
+{
+   return String( "Inviscid flow solver" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{
+   /****
+    * Add data you want to have in the computation report (log) as follows:
+    * logger.writeParameter< double >( "Parameter description", parameter );
+    */
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+setup( const MeshPointer& meshPointer,
+       const Config::ParameterContainer& parameters,
+       const String& prefix )
+{
+   if( ! this->inviscidOperatorsPointer->setup( meshPointer, parameters, prefix + "inviscid-operators-" ) ||
+       ! this->boundaryConditionPointer->setup( meshPointer, parameters, prefix + "boundary-conditions-" ) ||
+       ! this->rightHandSidePointer->setup( parameters, prefix + "right-hand-side-" ) )
+      return false;
+   this->gamma = parameters.getParameter< double >( "gamma" );
+   velocity->setMesh( meshPointer );
+   pressure->setMesh( meshPointer );
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+typename eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::IndexType
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+getDofs( const MeshPointer& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */
+   return this->conservativeVariables->getDofs( mesh );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+bindDofs( const MeshPointer& mesh,
+          DofVectorPointer& dofVector )
+{
+   this->conservativeVariables->bind( mesh, dofVector );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+setInitialCondition( const Config::ParameterContainer& parameters,
+                     const MeshPointer& mesh,
+                     DofVectorPointer& dofs,
+                     MeshDependentDataPointer& meshDependentData )
+{
+   CompressibleConservativeVariables< MeshType > conservativeVariables;
+   conservativeVariables.bind( mesh, dofs );
+   const String& initialConditionType = parameters.getParameter< String >( "initial-condition" );
+   if( initialConditionType == "riemann-problem" )
+   {
+      RiemannProblemInitialCondition< MeshType > initialCondition;
+      if( ! initialCondition.setup( parameters ) )
+         return false;
+      initialCondition.setInitialCondition( conservativeVariables );
+      return true;
+   }
+   std::cerr << "Unknown initial condition " << initialConditionType << std::endl;
+   return false;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+setupLinearSystem( const MeshPointer& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowLengthsVector CompressedRowLengthsVectorType;
+   CompressedRowLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter;
+   matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh,
+                                                                          differentialOperator,
+                                                                          boundaryCondition,
+                                                                          rowLengths );
+   matrix.setDimensions( dofs, dofs );
+   if( ! matrix.setCompressedRowLengths( rowLengths ) )
+      return false;*/
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshPointer& mesh,
+              DofVectorPointer& dofs,
+              MeshDependentDataPointer& meshDependentData )
+{
+  std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+  
+  this->bindDofs( mesh, dofs );
+  PhysicalVariablesGetter< MeshType > physicalVariablesGetter;
+  physicalVariablesGetter.getVelocity( this->conservativeVariables, this->velocity );
+  physicalVariablesGetter.getPressure( this->conservativeVariables, this->gamma, this->pressure );
+  
+   FileName fileName;
+   fileName.setExtension( "tnl" );
+   fileName.setIndex( step );
+   fileName.setFileNameBase( "density-" );
+   if( ! this->conservativeVariables->getDensity()->save( fileName.getFileName() ) )
+      return false;
+   
+   fileName.setFileNameBase( "velocity-" );
+   if( ! this->velocity->save( fileName.getFileName() ) )
+      return false;
+
+   fileName.setFileNameBase( "pressure-" );
+   if( ! this->pressure->save( fileName.getFileName() ) )
+      return false;
+
+//   fileName.setFileNameBase( "energy-" );
+//   if( ! this->conservativeVariables->getEnergy()->save( fileName.getFileName() ) )
+//      return false;
+   
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+getExplicitUpdate( const RealType& time,
+                   const RealType& tau,
+                   const MeshPointer& mesh,
+                   DofVectorPointer& _u,
+                   DofVectorPointer& _fu,
+                   MeshDependentDataPointer& meshDependentData )
+{
+    typedef typename MeshType::Cell Cell;
+    
+    /****
+     * Bind DOFs
+     */
+    this->conservativeVariables->bind( mesh, _u );
+    this->conservativeVariablesRHS->bind( mesh, _fu );
+    this->velocity->setMesh( mesh );
+    this->pressure->setMesh( mesh );
+    
+    /****
+     * Resolve the physical variables
+     */
+    PhysicalVariablesGetter< typename MeshPointer::ObjectType > physicalVariables;
+    physicalVariables.getVelocity( this->conservativeVariables, this->velocity );
+    physicalVariables.getPressure( this->conservativeVariables, this->gamma, this->pressure );
+    
+   /****
+    * Set-up operators
+    */
+   typedef typename InviscidOperators::ContinuityOperatorType ContinuityOperatorType;
+   typedef typename InviscidOperators::MomentumXOperatorType MomentumXOperatorType;
+   typedef typename InviscidOperators::MomentumYOperatorType MomentumYOperatorType;
+   typedef typename InviscidOperators::MomentumZOperatorType MomentumZOperatorType;
+   typedef typename InviscidOperators::EnergyOperatorType EnergyOperatorType;
+    
+    this->inviscidOperatorsPointer->setTau( tau );
+    this->inviscidOperatorsPointer->setVelocity( this->velocity );
+    this->inviscidOperatorsPointer->setPressure( this->pressure );
+
+   /****
+    * Continuity equation
+    */ 
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, ContinuityOperatorType, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; 
+   explicitUpdaterContinuity.setDifferentialOperator( this->inviscidOperatorsPointer->getContinuityOperator() );
+   explicitUpdaterContinuity.setBoundaryConditions( this->boundaryConditionPointer );
+   explicitUpdaterContinuity.setRightHandSide( this->rightHandSidePointer );
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time, tau, mesh, 
+                                                                     this->conservativeVariables->getDensity(),
+                                                                     this->conservativeVariablesRHS->getDensity() );
+
+   /****
+    * Momentum equations
+    */
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumXOperatorType, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; 
+   explicitUpdaterMomentumX.setDifferentialOperator( this->inviscidOperatorsPointer->getMomentumXOperator() );
+   explicitUpdaterMomentumX.setBoundaryConditions( this->boundaryConditionPointer );
+   explicitUpdaterMomentumX.setRightHandSide( this->rightHandSidePointer );   
+   explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time, tau, mesh,
+                                                              this->conservativeVariables->getDensity(), // uRhoVelocityX,
+                                                           ( *this->conservativeVariablesRHS->getMomentum() )[ 0 ] ); //, fuRhoVelocityX );
+
+   if( Dimensions > 1 )
+   {
+      Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumYOperatorType, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY;
+      explicitUpdaterMomentumY.setDifferentialOperator( this->inviscidOperatorsPointer->getMomentumYOperator() );
+      explicitUpdaterMomentumY.setBoundaryConditions( this->boundaryConditionPointer );
+      explicitUpdaterMomentumY.setRightHandSide( this->rightHandSidePointer );         
+      explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time, tau, mesh,
+                                                                 this->conservativeVariables->getDensity(), // uRhoVelocityX,
+                                                              ( *this->conservativeVariablesRHS->getMomentum() )[ 1 ] ); //, fuRhoVelocityX );
+   }
+   
+   if( Dimensions > 2 )
+   {
+      Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumZOperatorType, BoundaryCondition, RightHandSide > explicitUpdaterMomentumZ;
+      explicitUpdaterMomentumZ.setDifferentialOperator( this->inviscidOperatorsPointer->getMomentumZOperator() );
+      explicitUpdaterMomentumZ.setBoundaryConditions( this->boundaryConditionPointer );
+      explicitUpdaterMomentumZ.setRightHandSide( this->rightHandSidePointer );               
+      explicitUpdaterMomentumZ.template update< typename Mesh::Cell >( time, tau, mesh,
+                                                                 this->conservativeVariables->getDensity(), // uRhoVelocityX,
+                                                              ( *this->conservativeVariablesRHS->getMomentum() )[ 2 ] ); //, fuRhoVelocityX );
+   }
+   
+  
+   /****
+    * Energy equation
+    */
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, EnergyOperatorType, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.setDifferentialOperator( this->inviscidOperatorsPointer->getEnergyOperator() );
+   explicitUpdaterEnergy.setBoundaryConditions( this->boundaryConditionPointer );
+   explicitUpdaterEnergy.setRightHandSide( this->rightHandSidePointer );                  
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time, tau, mesh,
+                                                           this->conservativeVariables->getDensity(), // uRhoVelocityX,
+                                                           this->conservativeVariablesRHS->getEnergy() ); //, fuRhoVelocityX );
+   
+   /*this->conservativeVariablesRHS->getDensity()->write( "density", "gnuplot" );
+   this->conservativeVariablesRHS->getEnergy()->write( "energy", "gnuplot" );
+   this->conservativeVariablesRHS->getMomentum()->write( "momentum", "gnuplot", 0.05 );
+   getchar();*/
+
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+   template< typename Matrix >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshPointer& mesh,
+                      DofVectorPointer& _u,
+                      Matrix& matrix,
+                      DofVectorPointer& b,
+                      MeshDependentDataPointer& meshDependentData )
+{
+/*   LinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             InviscidOperators,
+                             BoundaryCondition,
+                             RightHandSide,
+                             BackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   MeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename InviscidOperators >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, InviscidOperators >::
+postIterate( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& mesh,
+             DofVectorPointer& dofs,
+             MeshDependentDataPointer& meshDependentData )
+{
+   /*
+    typedef typename MeshType::Cell Cell;
+    int count = mesh->template getEntitiesCount< Cell >()/4;
+	//bind _u
+    this->_uRho.bind( *dofs, 0, count);
+    this->_uRhoVelocityX.bind( *dofs, count, count);
+    this->_uRhoVelocityY.bind( *dofs, 2 * count, count);
+    this->_uEnergy.bind( *dofs, 3 * count, count);
+
+   MeshFunctionType velocity( mesh, this->velocity );
+   MeshFunctionType velocityX( mesh, this->velocityX );
+   MeshFunctionType velocityY( mesh, this->velocityY );
+   MeshFunctionType pressure( mesh, this->pressure );
+   MeshFunctionType uRho( mesh, _uRho ); 
+   MeshFunctionType uRhoVelocityX( mesh, _uRhoVelocityX ); 
+   MeshFunctionType uRhoVelocityY( mesh, _uRhoVelocityY ); 
+   MeshFunctionType uEnergy( mesh, _uEnergy ); 
+   //Generating differential operators
+   Velocity euler2DVelocity;
+   VelocityX euler2DVelocityX;
+   VelocityY euler2DVelocityY;
+   Pressure euler2DPressure;
+
+   //velocityX
+   euler2DVelocityX.setRhoVelX(uRhoVelocityX);
+   euler2DVelocityX.setRho(uRho);
+//   OperatorFunction< VelocityX, MeshFunction, void, true > OFVelocityX;
+//   velocityX = OFVelocityX;
+
+   //velocityY
+   euler2DVelocityY.setRhoVelY(uRhoVelocityY);
+   euler2DVelocityY.setRho(uRho);
+//   OperatorFunction< VelocityY, MeshFunction, void, time > OFVelocityY;
+//   velocityY = OFVelocityY;
+
+   //velocity
+   euler2DVelocity.setVelX(velocityX);
+   euler2DVelocity.setVelY(velocityY);
+//   OperatorFunction< Velocity, MeshFunction, void, time > OFVelocity;
+//   velocity = OFVelocity;
+
+   //pressure
+   euler2DPressure.setGamma(gamma);
+   euler2DPressure.setVelocity(velocity);
+   euler2DPressure.setEnergy(uEnergy);
+   euler2DPressure.setRho(uRho);
+//   OperatorFunction< euler2DPressure, MeshFunction, void, time > OFPressure;
+//   pressure = OFPressure;
+    */
+   return true;
+}
+
+} // namespace TNL
+
diff --git a/examples/inviscid-flow-sw/eulerRhs.h b/examples/inviscid-flow-sw/eulerRhs.h
new file mode 100644
index 0000000000..51d4e02439
--- /dev/null
+++ b/examples/inviscid-flow-sw/eulerRhs.h
@@ -0,0 +1,35 @@
+#ifndef eulerRHS_H_
+#define eulerRHS_H_
+
+#include <TNL/Functions/Domain.h>
+
+namespace TNL {
+
+template< typename Mesh, typename Real >class eulerRhs
+  : public Functions::Domain< Mesh::getMeshDimension(), Functions::MeshDomain > 
+ {
+   public:
+
+      typedef Mesh MeshType;
+      typedef Real RealType;
+
+      bool setup( const Config::ParameterContainer& parameters,
+                  const String& prefix = "" )
+      {
+         return true;
+      }
+
+      template< typename MeshEntity >
+      __cuda_callable__
+      Real operator()( const MeshEntity& entity,
+                       const Real& time = 0.0 ) const
+      {
+         typedef typename MeshEntity::MeshType::PointType PointType;
+         PointType v = entity.getCenter();
+         return 0.0;
+      }
+};
+
+} //namespace TNL
+
+#endif /* eulerRHS_H_ */
diff --git a/examples/inviscid-flow-sw/run-euler b/examples/inviscid-flow-sw/run-euler
new file mode 100644
index 0000000000..9ebf9cbb55
--- /dev/null
+++ b/examples/inviscid-flow-sw/run-euler
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 1.0 \
+               --proportions-y 1.0 \
+               --size-x 100 \
+               --size-y 100
+
+tnl-init --test-function sin-wave \
+         --output-file init.tnl
+tnl-euler-2d --initial-condition riemann-problem \
+             --discontinuity-placement-0 0.3 \
+             --discontinuity-placement-1 0.3 \
+             --discontinuity-placement-2 0.3 \
+             --time-discretisation explicit \
+             --boundary-conditions-type neumann \
+             --boundary-conditions-constant 0 \
+             --discrete-solver euler \
+             --time-step 0.0001 \
+             --snapshot-period 0.01 \
+             --final-time 1.0
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
-- 
GitLab