diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c7083a177261b1928e9a0cabccbe988739e722f..791bf47bd962571cc12ada04358c23689e72f41f 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@
 # Vladimir Klement
 # Jakub Klinkovsky
 
-cmake_minimum_required( VERSION 3.0 )
+cmake_minimum_required( VERSION 3.4 )
 
 project( tnl )
 
@@ -45,6 +45,7 @@ endif()
 set( CMAKE_CXX_FLAGS "-std=c++11" )
 set( CMAKE_CXX_FLAGS_DEBUG "-g" )
 set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG" )
+#set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
 # pass -rdynamic only in Debug mode
 set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
 set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
@@ -110,15 +111,26 @@ if( WITH_CUDA STREQUAL "yes" )
         set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} )
         # TODO: this is necessary only due to a bug in cmake
         set( CUDA_ADD_LIBRARY_OPTIONS -shared )
+        # TODO: workaround for a bug in cmake 3.5.0 (fixed in 3.5.1)
+        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -ccbin "${CMAKE_CXX_COMPILER}" )
+        set( CUDA_HOST_COMPILER "" )
 
         ####
         # Check for cuBLAS
         #
-        if( WITH_CUBLAS STREQUAL "yes" ) 
-            message( "Enabling CUBLAS." )
-            set( HAVE_CUBLAS TRUE)
-            set( HAVE_CUBLAS "#define HAVE_CUBLAS 1" )
-        endif( WITH_CUBLAS STREQUAL "yes" )       
+        if( NOT WITH_CUBLAS STREQUAL "no" )
+            find_path( CUBLAS_INCLUDE_DIR cublas_v2.h
+                       /usr/local/cuda/include
+                       ${CUDA_INCLUDE_DIR}
+                       DOC "CUBLAS headers." )
+            if( ${CUBLAS_INCLUDE_DIR} STREQUAL "CUBLAS_INCLUDE_DIR-NOTFOUND" )
+                message( "CUBLAS not found." )
+                set( HAVE_CUBLAS "//#define HAVE_CUBLAS 1" )
+            else()
+                message( "CUBLAS found. -- ${CUBLAS_INCLUDE_DIR}" )
+                set( HAVE_CUBLAS "#define HAVE_CUBLAS 1" )
+            endif()
+        endif( NOT WITH_CUBLAS STREQUAL "no" )
 
         ####
         # Check for CUSP
@@ -138,7 +150,6 @@ if( WITH_CUDA STREQUAL "yes" )
         # Check for CUSPARSE
         #
         if( NOT WITH_CUSPARSE STREQUAL "no" )
-        
            find_path( CUSPARSE_INCLUDE_DIR cusparse.h
                       /usr/local/cuda/include                   
                       ${CUDA_INCLUDE_DIR}  
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 0c6aa922b54674218991eeca4058dd3a89631a5a..0000000000000000000000000000000000000000
--- a/COPYING
+++ /dev/null
@@ -1 +0,0 @@
-/usr/local/share/automake-1.11/COPYING
\ No newline at end of file
diff --git a/Copyright b/Copyright
new file mode 100644
index 0000000000000000000000000000000000000000..1acdabf71aab5f9fa39db4324b5df03c2d4628f8
--- /dev/null
+++ b/Copyright
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2004-2016 Tomáš Oberhuber et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/TODO b/TODO
index 7619d268836f5bf97700a437fa452c3f83055ff9..3f427388a1ec4b4ccb2818f3532ca98bb16b0708 100644
--- a/TODO
+++ b/TODO
@@ -10,6 +10,11 @@ TODO:
  - data by se na hostu preskupila do souvisleho bloku dat a ten se prenesl najednou
 
 
+TODO:
+ - zrejme bude potreba udrzovat ke kazdemu objektu jeho obraz na GPU/MIC
+ - to by zarizovala metoda syncToDevice() napr. kazdy objekt by mel promennou modified, ktera by rikala, jestli se zmenil a zda je nutne ho
+   prekopirovavat
+
 TODO:
  - zavest namespaces
 
@@ -21,11 +26,6 @@ TODO: CUDA unified memory
 se s nimi pracovat postaru
  - bylo by dobre to obalit unique poinetry, aby se nemusela delat dealokace rucne
 
-TODO: shared pointery
- - mohli bysme pomoci nich odstranit Shared objekty
- - asi by bylo lepsi datcounter z shared pointeru primo do array a tento counter by se alokoval az po porvnim sdileni dat
- - diky tomu by se array mohlo vytvaret i na gpu bez nutnosti dynamicke alokace, jen by nebylo mozne delat bind (nebo nejaky zjednoduseny)
-
 TODO: Mesh
  * vsechny traits zkusit presunout do jednotneho MeshTraits, tj. temer MeshConfigTraits ale pojmenovat jako MeshTraits
  * omezit tnlDimesnionsTag - asi to ale nepujde
diff --git a/build b/build
index 60e787a6be6f91dfbda466c6d00a5dcd809f50dc..8e3944caed3aca8e563d236ce74491e8151d78b1 100755
--- a/build
+++ b/build
@@ -6,7 +6,6 @@ WITH_CUDA="yes"
 WITH_TESTS="yes"
 
 WITH_CUDA_ARCH="auto"
-WITH_CUBLAS="no"
 WITH_TEMPLATE_INSTANTIATION="yes"
 INSTANTIATE_LONG_INT="no"
 INSTANTIATE_INT="yes"
@@ -28,7 +27,6 @@ do
         --build=*                        ) BUILD="${option#*=}" ;;
         --with-tests=*                   ) WITH_TESTS="${option#*=}" ;;
         --with-cuda=*                    ) WITH_CUDA="${option#*=}" ;;
-        --with-cublas=*                  ) WITH_CUBLAS="${option#*=}" ;;
         --with-cuda-arch=*               ) WITH_CUDA_ARCH="${option#*=}";;
         --with-templates-instantiation=* ) WITH_TEMPLATE_INSTANTIATION="${option#*=}" ;;
         --instantiate-long-int=*         ) INSTANTIATE_LONG_INT="${option#*=}" ;;
@@ -82,7 +80,6 @@ ${CMAKE} ${ROOT_DIR} \
          -DCMAKE_INSTALL_PREFIX=${PREFIX} \
          -DWITH_CUDA=${WITH_CUDA} \
          -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH} \
-         -DWITH_CUBLAS=${WITH_CUBLAS} \
          -DWITH_TESTS=${WITH_TESTS} \
          -DPETSC_DIR=${PETSC_DIR} \
          -DDCMTK_DIR=${DCMTK_DIR} \
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index b0d5d7f7d3f32843b3981c157aee52e5bff13fd5..0f00654e037cfb1ab253fa4276a57fc1f0f25126 100755
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,3 +1,5 @@
 add_subdirectory( heat-equation )
 add_subdirectory( navier-stokes )
+add_subdirectory( advection )
+add_subdirectory( inviscid-flow )
 #add_subdirectory( mean-curvature-flow )
diff --git a/examples/advection/CMakeLists.txt b/examples/advection/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a09abadcdf99acf50e41f0909dfe02f4dfc31ea9
--- /dev/null
+++ b/examples/advection/CMakeLists.txt
@@ -0,0 +1,20 @@
+set( tnl_heat_equation_SOURCES     
+     advection.cpp
+     advection.cu )
+               
+IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE( tnl-advection${debugExt} advection.cu)   
+   target_link_libraries( tnl-advection${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+   ADD_EXECUTABLE( tnl-advection${debugExt} advection.cpp)     
+   target_link_libraries( tnl-advection${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
+
+
+INSTALL( TARGETS tnl-advection${debugExt}
+         RUNTIME DESTINATION bin
+         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+        
+INSTALL( FILES tnl-run-advection
+               ${tnl_heat_equation_SOURCES}
+         DESTINATION share/tnl-${tnlVersion}/examples/advection )
diff --git a/examples/advection/LaxFridrichs.h b/examples/advection/LaxFridrichs.h
new file mode 100644
index 0000000000000000000000000000000000000000..4247058d05e67a9abc426684f06e59424fa59a18
--- /dev/null
+++ b/examples/advection/LaxFridrichs.h
@@ -0,0 +1,218 @@
+#ifndef LaxFridrichs_H
+#define LaxFridrichs_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichs< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+      Real tau;
+      Real artificalViscosity;
+      Real advectionSpeedX;
+      Real advectionSpeedY;
+
+      void setAdvectionSpeedY(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedY = advectionSpeed;
+      }
+
+
+      void setAdvectionSpeedX(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedX = advectionSpeed;
+      }
+
+      void setViscosity(const Real& artificalViscosity)
+      {
+	   this->artificalViscosity = artificalViscosity;
+      }
+      
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      static tnlString getType();
+
+      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 LaxFridrichs< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+      Real tau;
+      Real artificalViscosity;
+      Real advectionSpeedX;
+      Real advectionSpeedY;
+
+      void setAdvectionSpeedY(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedY = advectionSpeed;
+      }
+
+
+      void setAdvectionSpeedX(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedX = advectionSpeed;
+      }
+
+      void setViscosity(const Real& artificalViscosity)
+      {
+	   this->artificalViscosity = artificalViscosity;
+      }
+      
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      static tnlString getType();
+
+      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 LaxFridrichs< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+      Real tau;
+      Real artificalViscosity;
+      Real advectionSpeedX;
+      Real advectionSpeedY;
+
+      void setAdvectionSpeedY(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedY = advectionSpeed;
+      }
+
+
+      void setAdvectionSpeedX(const Real& advectionSpeed)
+      {
+	   this->advectionSpeedX = advectionSpeed;
+      }
+
+      void setViscosity(const Real& artificalViscosity)
+      {
+	   this->artificalViscosity = artificalViscosity;
+      }
+      
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      static tnlString getType();
+
+      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;
+};
+
+
+#include "LaxFridrichs_impl.h"
+
+#endif	/* LaxFridrichs_H */
diff --git a/examples/advection/LaxFridrichs_impl.h b/examples/advection/LaxFridrichs_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc487e28187910cbbdfc037a21ba3327d167c311
--- /dev/null
+++ b/examples/advection/LaxFridrichs_impl.h
@@ -0,0 +1,357 @@
+#ifndef LaxFridrichs_IMPL_H
+#define LaxFridrichs_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichs< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichs< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichs< tnlGrid< 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& 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 >(); 
+   double a;
+   a = this->advectionSpeedX;
+   return   (0.5 / this->tau ) * this->artificalViscosity *
+	    ( u[ west ]- 2.0 * u[ center ] + u[ east ] )
+            - (a = this->advectionSpeedX * ( u[ east ] - u[west] ) ) * hxInverse * 0.5;
+
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichs< tnlGrid< 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
+LaxFridrichs< tnlGrid< 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 >
+tnlString
+LaxFridrichs< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichs< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichs< tnlGrid< 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& 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 >(); 
+   double a;
+   double b;
+   a = this->advectionSpeedX;
+   b = this->advectionSpeedY;
+   return ( 0.25 / this->tau ) * this->artificalViscosity * 
+          ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4 * u[ center ] ) -
+          (a * ( u[ east ] - u[west] ) ) * hxInverse * 0.5 - 
+          (b * ( u[ north ] - u[ south ] ) ) * hyInverse * 0.5;
+
+
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichs< tnlGrid< 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
+LaxFridrichs< tnlGrid< 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 >
+tnlString
+LaxFridrichs< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichs< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichs< tnlGrid< 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
+LaxFridrichs< tnlGrid< 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
+LaxFridrichs< tnlGrid< 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 );*/
+}
+
+#endif	/* LaxFridrichsIMPL_H */
+
diff --git a/examples/advection/advection.cpp b/examples/advection/advection.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..374d4714086168f7ebf1ed2a62664c4aaae0c4b7
--- /dev/null
+++ b/examples/advection/advection.cpp
@@ -0,0 +1 @@
+#include "advection.h"
diff --git a/examples/advection/advection.cu b/examples/advection/advection.cu
new file mode 100644
index 0000000000000000000000000000000000000000..374d4714086168f7ebf1ed2a62664c4aaae0c4b7
--- /dev/null
+++ b/examples/advection/advection.cu
@@ -0,0 +1 @@
+#include "advection.h"
diff --git a/examples/advection/advection.h b/examples/advection/advection.h
new file mode 100644
index 0000000000000000000000000000000000000000..3be5232725225cc15a40bc2487eede9cbc8412ef
--- /dev/null
+++ b/examples/advection/advection.h
@@ -0,0 +1,120 @@
+#include <tnlConfig.h>
+#include <solvers/tnlSolver.h>
+#include <solvers/tnlBuildConfigTags.h>
+#include <operators/tnlDirichletBoundaryConditions.h>
+#include <operators/tnlNeumannBoundaryConditions.h>
+#include <functions/tnlConstantFunction.h>
+#include "advectionProblem.h"
+#include "LaxFridrichs.h"
+#include "advectionRhs.h"
+#include "advectionBuildConfigTag.h"
+
+typedef advectionBuildConfigTag 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 advectionConfig
+{
+   public:
+      static void configSetup( tnlConfigDescription & config )
+      {
+         config.addDelimiter( "advection settings:" );
+         config.addEntry< tnlString >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< tnlString >( "dirichlet" );
+            config.addEntryEnum< tnlString >( "neumann" );
+         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
+	 config.addEntry< double >( "artifical-viscosity", "This sets value of artifical viscosity (default 1)", 1.0);
+	 config.addEntry< tnlString >( "begin", "choose begin type", "sin");
+	    config.addEntryEnum< tnlString >( "sin");
+	    config.addEntryEnum< tnlString >( "sin_square");
+	 config.addEntry< double >( "advection-speedX", "This sets value of advection speed in X direction (default 1)" , 1.0);
+	 config.addEntry< double >( "advection-speedY", "This sets value of advection speed in Y direction (default 1)" , 1.0);
+	 config.addEntry< tnlString >( "move", "choose movement type", "advection");
+	    config.addEntryEnum< tnlString >( "advection");
+	    config.addEntryEnum< tnlString >( "rotation");
+	 config.addEntry< int >( "dimension", "choose movement typeproblem dimension", 1);
+	    config.addEntryEnum< int >( 1 );
+	    config.addEntryEnum< int >( 2 );
+	 config.addEntry< double >( "realSize", "Real size of scheme", 1.0);
+
+         /****
+          * Add definition of your solver command line arguments.
+          */
+
+      }
+};
+
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename MeshType,
+          typename ConfigTag,
+          typename SolverStarter >
+class advectionSetter
+{
+   public:
+
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+
+      static bool run( const tnlParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator;
+          typedef advectionRhs< MeshType, Real > RightHandSide;
+          typedef tnlStaticVector < 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 tnlVector.
+          */
+          tnlString boundaryConditionsType = parameters.getParameter< tnlString >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef tnlDirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
+             typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlMeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef tnlDirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlNeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+          typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+          SolverStarter solverStarter;
+          return solverStarter.template run< Problem >( parameters );
+      }
+
+};
+
+int main( int argc, char* argv[] )
+{
+   tnlSolver< advectionSetter, advectionConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
+
diff --git a/examples/advection/advectionBuildConfigTag.h b/examples/advection/advectionBuildConfigTag.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8ea6ddef4eba8fa8802a3ae41f7ceefe1628273
--- /dev/null
+++ b/examples/advection/advectionBuildConfigTag.h
@@ -0,0 +1,43 @@
+#ifndef advectionBUILDCONFIGTAG_H_
+#define advectionBUILDCONFIGTAG_H_
+
+#include <solvers/tnlBuildConfigTags.h>
+
+class advectionBuildConfigTag{};
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct tnlConfigTagReal< advectionBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct tnlConfigTagReal< advectionBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct tnlConfigTagIndex< advectionBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct tnlConfigTagIndex< advectionBuildConfigTag, long int >{ enum { enabled = false }; };
+
+/****
+ * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+
+template< int Dimensions, typename Real, typename Device, typename Index >
+   struct tnlConfigTagMesh< advectionBuildConfigTag, tnlGrid< Dimensions, Real, Device, Index > >
+      { enum { enabled = tnlConfigTagDimensions< advectionBuildConfigTag, Dimensions >::enabled  &&
+                         tnlConfigTagReal< advectionBuildConfigTag, Real >::enabled &&
+                         tnlConfigTagDevice< advectionBuildConfigTag, Device >::enabled &&
+                         tnlConfigTagIndex< advectionBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct tnlConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct tnlConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct tnlConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct tnlConfigTagExplicitSolver< advectionBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = true }; };
+
+#endif /* advectionBUILDCONFIGTAG_H_ */
diff --git a/examples/advection/advectionProblem.h b/examples/advection/advectionProblem.h
new file mode 100644
index 0000000000000000000000000000000000000000..64ae07480c584cacf3647d09c5bf075ad0f67ce8
--- /dev/null
+++ b/examples/advection/advectionProblem.h
@@ -0,0 +1,83 @@
+#ifndef advectionPROBLEM_H_
+#define advectionPROBLEM_H_
+
+#include <problems/tnlPDEProblem.h>
+#include <functions/tnlMeshFunction.h>
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+           typename DifferentialOperator >
+class advectionProblem:
+   public tnlPDEProblem< 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 tnlMeshFunction< Mesh > MeshFunctionType;
+      typedef tnlPDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+
+      using typename BaseType::MeshType;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::MeshDependentDataType;
+      tnlString velocityType;
+      static tnlString getTypeStatic();
+
+      tnlString getPrologHeader() const;
+
+      void writeProlog( tnlLogger& logger,
+                        const tnlParameterContainer& parameters ) const;
+
+      bool setup( const tnlParameterContainer& parameters );
+
+      bool setInitialCondition( const tnlParameterContainer& parameters,
+                                const MeshType& mesh,
+                                DofVectorType& dofs,
+                                MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshType& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshType& mesh,
+                         DofVectorType& dofs,
+                         MeshDependentDataType& meshDependentData );
+
+      IndexType getDofs( const MeshType& mesh ) const;
+
+      void bindDofs( const MeshType& mesh,
+                     DofVectorType& dofs );
+
+      void getExplicitRHS( const RealType& time,
+                           const RealType& tau,
+                           const MeshType& mesh,
+                           DofVectorType& _u,
+                           DofVectorType& _fu,
+                           MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshType& mesh,
+                                 DofVectorType& dofs,
+                                 Matrix& matrix,
+                                 DofVectorType& rightHandSide,
+                                 MeshDependentDataType& meshDependentData );
+
+   protected:
+
+      DifferentialOperator differentialOperator;
+      BoundaryCondition boundaryCondition;
+      RightHandSide rightHandSide;
+};
+
+#include "advectionProblem_impl.h"
+
+#endif /* advectionPROBLEM_H_ */
diff --git a/examples/advection/advectionProblem_impl.h b/examples/advection/advectionProblem_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cb64dd3115df8856ca2c1aa94bf8b801f76e15e
--- /dev/null
+++ b/examples/advection/advectionProblem_impl.h
@@ -0,0 +1,325 @@
+#ifndef advectionPROBLEM_IMPL_H_
+#define advectionPROBLEM_IMPL_H_
+
+#include <core/mfilename.h>
+#include <matrices/tnlMatrixSetter.h>
+#include <solvers/pde/tnlExplicitUpdater.h>
+#include <solvers/pde/tnlLinearSystemAssembler.h>
+#include <solvers/pde/tnlBackwardTimeDiscretisation.h>
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return tnlString( "advectionProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return tnlString( "advection" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( tnlLogger& logger, const tnlParameterContainer& 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
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setup( const tnlParameterContainer& parameters )
+{
+   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
+       ! this->rightHandSide.setup( parameters, "right-hand-side-" ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+typename advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getDofs( const MeshType& mesh ) const
+{
+   /****
+    * Return number of  DOFs (degrees of freedom) i.e. number
+    * of unknowns to be resolved by the main solver.
+    */
+   return mesh.template getEntitiesCount< typename MeshType::Cell >();
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+bindDofs( const MeshType& mesh,
+          DofVectorType& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const tnlParameterContainer& parameters,
+                     const MeshType& mesh,
+                     DofVectorType& dofs,
+                     MeshDependentDataType& meshDependentData )
+{
+   cout << "vaules adding";
+   typedef typename MeshType::Cell Cell;
+   int dimensions = parameters.getParameter< int >( "dimension" );
+   int count = mesh.template getEntitiesCount< Cell >();
+   const RealType& size = parameters.getParameter< double >( "realSize" ) / pow(count, 1.0/dimensions);
+   const tnlString& beginChoice = parameters.getParameter< tnlString >( "begin" );
+   cout << beginChoice << " " << dimensions << "   " << size << "   " << count << "   "<< 1/dimensions << endl;
+   getchar();
+   if (beginChoice == "sin_square")
+      {
+	   double constantFunction;
+	   if (dimensions == 1)
+	       {
+                   cout << "adding DOFS" << endl;
+		   dofs[0] = 0;
+		   double expValue;
+		   for (IndexType i = 1; i < count-2; i++)
+		   {
+			expValue = exp(-pow(size*i-2,2));
+			if ((i>0.4*count) && (i<0.5*count)) constantFunction=1; else constantFunction=0;
+			if (expValue>constantFunction) dofs[i] = expValue; else dofs[i] = constantFunction;
+		   };
+		   dofs[count-1] = 0;
+		}
+	    else if (dimensions == 2)
+	       {
+                   count = sqrt(count);
+		   double expValue;
+		   for (IndexType i = 0; i < count-1; i++)
+                      for (IndexType j = 0; j < count-1; j++)
+		      {
+			expValue = exp(-pow(size*i-2,2)-pow(size*j-2,2));
+			if ((i>0.4*count) && (i<0.5*count) && (j>0.4*count) && (j<0.5*count)) constantFunction=1; else constantFunction=0;
+			if (expValue>constantFunction) dofs[i * count + j] = expValue; else dofs[i * count + j] = constantFunction;
+		      };
+		};
+       }
+   else if (beginChoice == "sin")
+      {
+	   if (dimensions == 1)
+	      {
+		   dofs[0] = 0;
+		   for (IndexType i = 1; i < count-2; i++)
+		   {
+			dofs[i] = exp(-pow(size*i-2,2));
+		   };
+		   dofs[count-1] = 0;
+		}
+	    else if (dimensions == 2)
+	       {
+                   count = sqrt(count);
+		   for (IndexType i = 1; i < count-1; i++)
+		      for (IndexType j = 1; j < count-1; j++)
+		      {
+			   dofs[i * count + j] = exp(-pow(size*i-2,2)-pow(size*j-2,2));
+		      };
+		};
+     };
+   //setting velocity field
+   cout << dofs << endl;
+   getchar();
+   /*const tnlString& initialConditionFile = parameters.getParameter< tnlString >( "initial-condition" );
+   if( ! dofs.load( initialConditionFile ) )
+   {
+      cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl;
+      return false;
+   }
+   return true;*/
+   dofs.save( "dofs.tnl" );
+   this->velocityType = parameters.getParameter< tnlString >( "move" );
+   const double artificalViscosity = parameters.getParameter< double >( "artifical-viscosity" );
+   differentialOperator.setViscosity(artificalViscosity);
+   const double advectionSpeedX = parameters.getParameter< double >( "advection-speedX" );
+   differentialOperator.setAdvectionSpeedX(advectionSpeedX);
+   const double advectionSpeedY = parameters.getParameter< double >( "advection-speedY" );
+   differentialOperator.setAdvectionSpeedY(advectionSpeedY);
+   cout << "vaules added";
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshType& mesh,
+                   Matrix& matrix )
+{
+   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   tnlMatrixSetter< 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
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+makeSnapshot( const RealType& time,
+              const IndexType& step,
+              const MeshType& mesh,
+              DofVectorType& dofs,
+              MeshDependentDataType& meshDependentData )
+{
+   cout << endl << "Writing output at time " << time << " step " << step << "." << endl;
+   this->bindDofs( mesh, dofs );
+   tnlString fileName;
+   FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName );
+   if( ! dofs.save( fileName ) )
+      return false;
+   return true;
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getExplicitRHS( const RealType& time,
+                const RealType& tau,
+                const MeshType& mesh,
+                DofVectorType& _u,
+                DofVectorType& _fu,
+                MeshDependentDataType& meshDependentData )
+{
+   /****
+    * If you use an explicit solver like tnlEulerSolver or tnlMersonSolver, you
+    * need to implement this method. Compute the right-hand side of
+    *
+    *   d/dt u(x) = fu( x, u )
+    *
+    * You may use supporting mesh dependent data if you need.
+    */
+   typedef typename MeshType::Cell Cell;
+   int count = sqrt(mesh.template getEntitiesCount< Cell >());
+//   const RealType& size = parameters.getParameter< double >( "realSize" ) / pow(count, 0.5);
+/*   if (this->velocityType == "rotation")
+   {
+      double radius;
+      for (int i =1; i < count; i++)
+         for (int j =1; j < count; j++)
+            {
+               radius = sqrt(pow(i-1-(count/2.0),2) + pow(j-1-(count/2.0),2));
+            if (radius != 0.0)
+               _fu[(i-1)*count+j-1] =(0.25*tau)*differentialOperator.artificalViscosity*			//smoothening part
+               (_u[(i-1)*count-2+j]+_u[(i-1)*count+j]+
+               _u[i*count+j-1]+_u[(i-2)*count+j-1]- 
+               4.0*_u[(i-1)*count+j-1])
+               -((1.0/(2.0*count))*differentialOperator.advectionSpeedX						//X addition
+               *radius*(-1)*((j-1-(count/2.0))/radius)
+	       *(_u[(i-1)*count+j]-_u[(i-1)*count+j-2])) 
+	       -((1.0/(2.0*count))*differentialOperator.advectionSpeedY						//Y addition
+               *radius*((i-1-(count/2.0))/radius)
+	       *(_u[i*count+j-1]-_u[(i-2)*count+j-1]))
+            ;}
+  }
+   else if (this->velocityType == "advection")
+*/  { 
+   this->bindDofs( mesh, _u );
+   tnlExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
+   MeshFunctionType u( mesh, _u ); 
+   MeshFunctionType fu( mesh, _fu );
+   differentialOperator.setTau(tau); 
+   explicitUpdater.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           this->differentialOperator,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           u,
+                                                           fu );
+/*   tnlBoundaryConditionsSetter< 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
+advectionProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+assemblyLinearSystem( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      DofVectorType& _u,
+                      Matrix& matrix,
+                      DofVectorType& b,
+                      MeshDependentDataType& meshDependentData )
+{
+   /*tnlLinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             tnlBackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   tnlMeshFunction< Mesh > u( mesh, _u );
+   systemAssembler.template assembly< typename Mesh::Cell >( time,
+                                                             tau,
+                                                             mesh,
+                                                             this->differentialOperator,
+                                                             this->boundaryCondition,
+                                                             this->rightHandSide,
+                                                             u,
+                                                             matrix,
+                                                             b );*/
+}
+
+#endif /* advectionPROBLEM_IMPL_H_ */
diff --git a/examples/advection/advectionRhs.h b/examples/advection/advectionRhs.h
new file mode 100644
index 0000000000000000000000000000000000000000..3bd2c294e142cac0779f66bdc99da51dc572222b
--- /dev/null
+++ b/examples/advection/advectionRhs.h
@@ -0,0 +1,29 @@
+#ifndef advectionRHS_H_
+#define advectionRHS_H_
+#include<functions/tnlDomain.h>
+template< typename Mesh, typename Real >class advectionRhs
+  : public tnlDomain< Mesh::meshDimensions, MeshDomain > 
+ {
+   public:
+
+      typedef Mesh MeshType;
+      typedef Real RealType;
+
+      bool setup( const tnlParameterContainer& parameters,
+                  const tnlString& 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;
+      };
+};
+
+#endif /* advectionRHS_H_ */
diff --git a/examples/advection/tnl-run-advection b/examples/advection/tnl-run-advection
new file mode 100644
index 0000000000000000000000000000000000000000..4ce2c6be3f3aea3c49e3619155cc489335bb2e25
--- /dev/null
+++ b/examples/advection/tnl-run-advection
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 1 \
+               --origin-x 0.0 \
+               --proportions-x 10.0 \
+               --size-x 500 \
+ 
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+tnl-advection-dbg --time-discretisation explicit \
+	      --time-step 1.0e-3 \
+              --boundary-conditions-constant 0 \
+              --discrete-solver merson \
+              --snapshot-period 0.1 \
+              --final-time 1.0 \
+	      --artifical-viscosity 1.0 \
+	      --begin sin \
+	      --advection-speedX 2.0 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/advection/tnl-run-advection1 b/examples/advection/tnl-run-advection1
new file mode 100644
index 0000000000000000000000000000000000000000..fb5e81faf2e19ab8e6b19c02c0c441dd96a9c807
--- /dev/null
+++ b/examples/advection/tnl-run-advection1
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 10.0 \
+               --proportions-y 10.0 \
+               --size-x 500 \
+               --size-y 500 \
+ 
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+./advection --time-discretisation explicit \
+	      --time-step 1.0e-3 \
+              --boundary-conditions-constant 0 \
+              --discrete-solver euler \
+              --snapshot-period 0.1 \
+              --final-time 1.0 \
+	      --artifical-viscosity 0.2 \
+	      --begin sin_square \
+	      --advection-speedX 2.0 \
+	      --advection-speedY 2.0 \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/advection/tnl-run-advectionrot1 b/examples/advection/tnl-run-advectionrot1
new file mode 100644
index 0000000000000000000000000000000000000000..5d3e3990a98ef64233a6b629b4002cc50b26a923
--- /dev/null
+++ b/examples/advection/tnl-run-advectionrot1
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+tnl-grid-setup --dimensions 2 \
+               --origin-x 0.0 \
+               --origin-y 0.0 \
+               --proportions-x 10.0 \
+               --proportions-y 10.0 \
+               --size-x 100 \
+               --size-y 100 \
+ 
+#tnl-init --test-function sin-wave \
+#         --output-file init.tnl
+./advection --time-discretisation explicit \
+	      --time-step 1.0e-2 \
+              --boundary-conditions-constant 0 \
+              --discrete-solver euler \
+              --snapshot-period 0.1 \
+              --final-time 1.0 \
+	      --artifical-viscosity 5.0 \
+	      --begin sin_square \
+	      --advection-speedX 2.0 \
+	      --advection-speedY 2.0 \
+              --move rotation \
+
+tnl-view --mesh mesh.tnl --input-files *tnl     
diff --git a/examples/heat-equation/tnl-heat-equation-eoc.cpp b/examples/heat-equation/tnl-heat-equation-eoc.cpp
index b1681a5b7e3ea797ad651d2196dc5b607eb6ed42..2b7737e78391a2b41925ce17094f739c8b54d5cf 100644
--- a/examples/heat-equation/tnl-heat-equation-eoc.cpp
+++ b/examples/heat-equation/tnl-heat-equation-eoc.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-heat-equation-eoc.h"
 
diff --git a/examples/heat-equation/tnl-heat-equation-eoc.cu b/examples/heat-equation/tnl-heat-equation-eoc.cu
index aacfabfa4134ad41a89e8252d196a00ebfb50a9a..bcbcb5a79662d8f31228d8d7d98b9798bafa11d6 100644
--- a/examples/heat-equation/tnl-heat-equation-eoc.cu
+++ b/examples/heat-equation/tnl-heat-equation-eoc.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnl-heat-equation-eoc.h"
\ No newline at end of file
+#include "tnl-heat-equation-eoc.h"
diff --git a/examples/heat-equation/tnl-heat-equation-eoc.h b/examples/heat-equation/tnl-heat-equation-eoc.h
index b0f436a06e8244478174faa6e6f4ad4471b46a67..12ae8f86399917a8ee1200a4fac1f6dc1fe5cad5 100644
--- a/examples/heat-equation/tnl-heat-equation-eoc.h
+++ b/examples/heat-equation/tnl-heat-equation-eoc.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_HEAT_EQUATION_EOC_H_
 #define TNL_HEAT_EQUATION_EOC_H_
diff --git a/examples/heat-equation/tnl-heat-equation.cpp b/examples/heat-equation/tnl-heat-equation.cpp
index 2f6ba10d469fb192c19132cb00503f24cc5f7704..900d80bbc40912b8400d39c3ca93bc3ca6fe487a 100644
--- a/examples/heat-equation/tnl-heat-equation.cpp
+++ b/examples/heat-equation/tnl-heat-equation.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-heat-equation.h"
diff --git a/examples/heat-equation/tnl-heat-equation.cu b/examples/heat-equation/tnl-heat-equation.cu
index 720d8508271e3eb7658b5d69677098969c089b6e..230f817ab0a5808b74c20226761abaa88302d2f1 100644
--- a/examples/heat-equation/tnl-heat-equation.cu
+++ b/examples/heat-equation/tnl-heat-equation.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnl-heat-equation.h"
\ No newline at end of file
+#include "tnl-heat-equation.h"
diff --git a/examples/heat-equation/tnl-heat-equation.h b/examples/heat-equation/tnl-heat-equation.h
index 9ceff5cb11a1aa7a43006a3bd7ecf2fec4489494..11b8d2b7d5f2c541693757b2b062b3ecad9e1ee4 100644
--- a/examples/heat-equation/tnl-heat-equation.h
+++ b/examples/heat-equation/tnl-heat-equation.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_HEAT_EQUATION_H_
 #define TNL_HEAT_EQUATION_H_
diff --git a/examples/inviscid-flow/1d/CMakeLists.txt b/examples/inviscid-flow/1d/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6fe0766eec90a76d7888c56f615122804abf4bcc
--- /dev/null
+++ b/examples/inviscid-flow/1d/CMakeLists.txt
@@ -0,0 +1,20 @@
+set( tnl_heat_equation_SOURCES     
+     euler.cpp
+     euler.cu )
+               
+IF( BUILD_CUDA )
+   CUDA_ADD_EXECUTABLE(tnl-euler-1d${debugExt} euler.cu)
+   target_link_libraries (tnl-euler-1d${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+   ADD_EXECUTABLE(tnl-euler-1d${debugExt} euler.cpp)     
+   target_link_libraries (tnl-euler-1d${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
+
+
+INSTALL( TARGETS tnl-euler-1d${debugExt}
+         RUNTIME DESTINATION bin
+         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+        
+INSTALL( FILES tnl-run-euler-1d
+               ${tnl_heat_equation_SOURCES}
+         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow-1d )
diff --git a/examples/inviscid-flow/1d/EulerPressureGetter.h b/examples/inviscid-flow/1d/EulerPressureGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff007850870e130bacbd9e5fe7d54089b59f88d8
--- /dev/null
+++ b/examples/inviscid-flow/1d/EulerPressureGetter.h
@@ -0,0 +1,58 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+#include <functions/tnlDomain.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      
+      EulerPressureGetter( const MeshFunctionType& velocity,
+                           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
+      {
+         return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rhoVel[ idx ] * this->rhoVel[ idx ] / this->rho[ idx ]);
+      }
+
+      
+   protected:
+      
+      Real gamma;
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+      
+      const MeshFunctionType& energy;
+
+};
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow/1d/EulerVelGetter.h b/examples/inviscid-flow/1d/EulerVelGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a838627e80389e52cbe522814d3fddf0f2cb2f7
--- /dev/null
+++ b/examples/inviscid-flow/1d/EulerVelGetter.h
@@ -0,0 +1,51 @@
+#ifndef EulerVelGetter_H
+#define EulerVelGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelGetter
+: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
+{
+   public:
+      
+      typedef Mesh MeshType;
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      
+      EulerVelGetter( 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
+      {
+         return this->rho[ idx ] / this->rhoVel[ idx ];
+      }
+
+      
+   protected:
+      
+      const MeshFunctionType& rho;
+      
+      const MeshFunctionType& rhoVel;
+
+};
+
+#endif	/* EulerVelGetter_H */
diff --git a/examples/inviscid-flow/1d/LaxFridrichs.h b/examples/inviscid-flow/1d/LaxFridrichs.h
new file mode 100644
index 0000000000000000000000000000000000000000..eada21a9522638082da55a81e32df35d40cffcdd
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichs.h
@@ -0,0 +1,31 @@
+#ifndef LaxFridrichs_H
+#define LaxFridrichs_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsMomentum.h"
+#include "LaxFridrichsEnergy.h"
+#include "EulerVelGetter.h"
+#include "EulerPressureGetter.h"
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs
+{
+   public:
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< Mesh > MeshFunctionType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > Continuity;
+      typedef LaxFridrichsMomentum< Mesh, Real, Index > Momentum;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > Energy;
+      typedef EulerVelGetter< Mesh, Real, Index > Velocity;
+      typedef EulerPressureGetter< Mesh, Real, Index > Pressure;
+   
+};
+
+#endif	/* LaxFridrichs_H */
diff --git a/examples/inviscid-flow/1d/LaxFridrichsContinuity.h b/examples/inviscid-flow/1d/LaxFridrichsContinuity.h
new file mode 100644
index 0000000000000000000000000000000000000000..6622d01e1c720c26a2fc42cd15bfe757086999c6
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsContinuity.h
@@ -0,0 +1,181 @@
+#ifndef LaxFridrichsContinuity_H
+#define LaxFridrichsContinuity_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType velocity)
+      {
+          //this->velocity = velocity;
+      };
+
+      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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+	  this->velocity = velocity;
+      };
+
+
+      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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+
+      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;
+};
+
+
+#include "LaxFridrichsContinuity_impl.h"
+
+#endif	/* LaxFridrichsContinuity_H */
diff --git a/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h b/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..59a5e420e4ce112fefc81229a493fdc30d179ff7
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h
@@ -0,0 +1,341 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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[ west ] * this->velocity[ west ] - u[ east ] * this->velocity[ east ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow/1d/LaxFridrichsEnergy.h b/examples/inviscid-flow/1d/LaxFridrichsEnergy.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4f668ec845d4e51d5bb6fca7d73a436a4313192
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsEnergy.h
@@ -0,0 +1,197 @@
+#ifndef LaxFridrichsEnergy_H
+#define LaxFridrichsEnergy_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+	  this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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;
+};
+
+
+#include "LaxFridrichsEnergy_impl.h"
+
+#endif	/* LaxFridrichsEnergy_H */
diff --git a/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h b/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ffdb9e4b1e66a78c03418c928371aa2c85cbee0
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h
@@ -0,0 +1,348 @@
+#ifndef LaxFridrichsEnergy_IMPL_H
+#define LaxFridrichsEnergy_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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(); 
+
+   //energy
+   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[ west ] + this->pressure[ west ] ) * velocity[ west ]  
+          - (u[ east ] + this->pressure[ east ] ) * velocity[ east ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsEnergy< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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
+LaxFridrichsEnergy< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsEnergyIMPL_H */
+
diff --git a/examples/inviscid-flow/1d/LaxFridrichsMomentum.h b/examples/inviscid-flow/1d/LaxFridrichsMomentum.h
new file mode 100644
index 0000000000000000000000000000000000000000..e13232471ce4e643f330630f6db7d6a7f4338d38
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsMomentum.h
@@ -0,0 +1,197 @@
+#ifndef LaxFridrichsMomentum_H
+#define LaxFridrichsMomentum_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichsMomentum
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class LaxFridrichsMomentum< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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 LaxFridrichsMomentum< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+	  this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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 LaxFridrichsMomentum< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocity;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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;
+};
+
+
+#include "LaxFridrichsMomentum_impl.h"
+
+#endif	/* LaxFridrichsMomentum_H */
diff --git a/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h b/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..30f42f22180bc7e6383354198d36b846facc8e46
--- /dev/null
+++ b/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h
@@ -0,0 +1,343 @@
+#ifndef LaxFridrichsMomentum_IMPL_H
+#define LaxFridrichsMomentum_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsMomentum< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< tnlGrid< 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[ west ] * this -> velocity[ west ] + this -> pressure [ west ] ) 
+          - (u[ east ] * this -> velocity[ east ] + this -> pressure [ east ] ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsMomentum< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentum< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentum< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentum< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentum< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsMomentumIMPL_H */
+
diff --git a/examples/inviscid-flow/1d/euler.cpp b/examples/inviscid-flow/1d/euler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d76005cb1f70724be978ff0fa6fec63c4a8a76f
--- /dev/null
+++ b/examples/inviscid-flow/1d/euler.cpp
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow/1d/euler.cu b/examples/inviscid-flow/1d/euler.cu
new file mode 100644
index 0000000000000000000000000000000000000000..4d76005cb1f70724be978ff0fa6fec63c4a8a76f
--- /dev/null
+++ b/examples/inviscid-flow/1d/euler.cu
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow/1d/euler.h b/examples/inviscid-flow/1d/euler.h
new file mode 100644
index 0000000000000000000000000000000000000000..8e8d584b572c5d2b527ffeae70093ea5678e08b5
--- /dev/null
+++ b/examples/inviscid-flow/1d/euler.h
@@ -0,0 +1,116 @@
+#include <tnlConfig.h>
+#include <solvers/tnlSolver.h>
+#include <solvers/tnlBuildConfigTags.h>
+#include <operators/tnlDirichletBoundaryConditions.h>
+#include <operators/tnlNeumannBoundaryConditions.h>
+#include <functions/tnlConstantFunction.h>
+#include "eulerProblem.h"
+#include "LaxFridrichs.h"
+
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+
+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( tnlConfigDescription & config )
+      {
+         config.addDelimiter( "euler settings:" );
+         config.addEntry< tnlString >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< tnlString >( "dirichlet" );
+            config.addEntryEnum< tnlString >( "neumann" );
+         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 tnlParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef tnlStaticVector < 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 tnlVector.
+          */
+          tnlString boundaryConditionsType = parameters.getParameter< tnlString >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef tnlDirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlMeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef tnlDirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlNeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+          typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+          SolverStarter solverStarter;
+          return solverStarter.template run< Problem >( parameters );
+      }
+
+};
+
+int main( int argc, char* argv[] )
+{
+   tnlSolver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
+
diff --git a/examples/inviscid-flow/1d/eulerBuildConfigTag.h b/examples/inviscid-flow/1d/eulerBuildConfigTag.h
new file mode 100644
index 0000000000000000000000000000000000000000..f0fc2953ad7f66124a5824a35a873bbf850ec5ab
--- /dev/null
+++ b/examples/inviscid-flow/1d/eulerBuildConfigTag.h
@@ -0,0 +1,44 @@
+#ifndef eulerBUILDCONFIGTAG_H_
+#define eulerBUILDCONFIGTAG_H_
+
+#include <solvers/tnlBuildConfigTags.h>
+
+class eulerBuildConfigTag{};
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct tnlConfigTagReal< eulerBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct tnlConfigTagReal< eulerBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct tnlConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct tnlConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; };
+
+template< int Dimensions > struct tnlConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 1 ) }; };
+
+/****
+ * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+template< int Dimensions, typename Real, typename Device, typename Index >
+   struct tnlConfigTagMesh< eulerBuildConfigTag, tnlGrid< Dimensions, Real, Device, Index > >
+      { enum { enabled = tnlConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled  &&
+                         tnlConfigTagReal< eulerBuildConfigTag, Real >::enabled &&
+                         tnlConfigTagDevice< eulerBuildConfigTag, Device >::enabled &&
+                         tnlConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct tnlConfigTagExplicitSolver< eulerBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = true }; };
+
+#endif /* eulerBUILDCONFIGTAG_H_ */
diff --git a/examples/inviscid-flow/1d/eulerProblem.h b/examples/inviscid-flow/1d/eulerProblem.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bce37a02c4713f80343f8f40b05d08647851f11
--- /dev/null
+++ b/examples/inviscid-flow/1d/eulerProblem.h
@@ -0,0 +1,107 @@
+#ifndef eulerPROBLEM_H_
+#define eulerPROBLEM_H_
+
+#include <problems/tnlPDEProblem.h>
+#include <functions/tnlMeshFunction.h>
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+           typename DifferentialOperator >
+class eulerProblem:
+   public tnlPDEProblem< 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 tnlMeshFunction< Mesh > MeshFunctionType;
+      typedef tnlPDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+
+      using typename BaseType::MeshType;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::MeshDependentDataType;
+      typedef tnlMeshFunction<Mesh,Mesh::getMeshDimensions(),RealType>MeshFunction;
+      
+      typedef typename DifferentialOperator::Continuity Continuity;
+      typedef typename DifferentialOperator::Momentum Momentum;
+      typedef typename DifferentialOperator::Energy Energy;
+      typedef typename DifferentialOperator::Velocity Velocity;
+      typedef typename DifferentialOperator::Pressure Pressure;
+      
+
+
+      static tnlString getTypeStatic();
+
+      tnlString getPrologHeader() const;
+
+      void writeProlog( tnlLogger& logger,
+                        const tnlParameterContainer& parameters ) const;
+
+      bool setup( const tnlParameterContainer& parameters );
+
+      bool setInitialCondition( const tnlParameterContainer& parameters,
+                                const MeshType& mesh,
+                                DofVectorType& dofs,
+                                MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshType& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshType& mesh,
+                         DofVectorType& dofs,
+                         MeshDependentDataType& meshDependentData );
+
+      IndexType getDofs( const MeshType& mesh ) const;
+
+      void bindDofs( const MeshType& mesh,
+                     DofVectorType& dofs );
+
+      void getExplicitRHS( const RealType& time,
+                           const RealType& tau,
+                           const MeshType& mesh,
+                           DofVectorType& _u,
+                           DofVectorType& _fu,
+                           MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshType& mesh,
+                                 DofVectorType& dofs,
+                                 Matrix& matrix,
+                                 DofVectorType& rightHandSide,
+                                 MeshDependentDataType& meshDependentData );
+      
+      bool postIterate( const RealType& time,
+                        const RealType& tau,
+                        const MeshType& mesh,
+                        DofVectorType& dofs,
+                        MeshDependentDataType& meshDependentData );
+
+   protected:
+
+      DifferentialOperator differentialOperator;
+      BoundaryCondition boundaryCondition;
+      RightHandSide rightHandSide;
+      
+      MeshFunctionType uRho, uRhoVelocity, uEnergy;
+      MeshFunctionType fuRho, fuRhoVelocity, fuEnergy;
+      
+      MeshFunctionType pressure, velocity, rho, rhoVel, energy;
+      
+      RealType gamma;
+
+
+};
+
+#include "eulerProblem_impl.h"
+
+#endif /* eulerPROBLEM_H_ */
diff --git a/examples/inviscid-flow/1d/eulerProblem_impl.h b/examples/inviscid-flow/1d/eulerProblem_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..66768ef112e833fb7cc18172ba2d78860b184de7
--- /dev/null
+++ b/examples/inviscid-flow/1d/eulerProblem_impl.h
@@ -0,0 +1,374 @@
+#ifndef eulerPROBLEM_IMPL_H_
+#define eulerPROBLEM_IMPL_H_
+
+#include <core/mfilename.h>
+#include <matrices/tnlMatrixSetter.h>
+#include <solvers/pde/tnlExplicitUpdater.h>
+#include <solvers/pde/tnlLinearSystemAssembler.h>
+#include <solvers/pde/tnlBackwardTimeDiscretisation.h>
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsMomentum.h"
+#include "LaxFridrichsEnergy.h"
+#include "EulerVelGetter.h"
+#include "EulerPressureGetter.h"
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return tnlString( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return tnlString( "euler" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( tnlLogger& logger, const tnlParameterContainer& 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 tnlParameterContainer& parameters )
+{
+   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
+       ! this->rightHandSide.setup( parameters, "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 MeshType& 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 MeshType& mesh,
+          DofVectorType& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const tnlParameterContainer& parameters,
+                     const MeshType& mesh,
+                     DofVectorType& dofs,
+                     MeshDependentDataType& meshDependentData )
+{
+   cout << endl << "get conditions from CML";
+   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 / (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 / (gamma - 1) ) + 0.5 * rhoR * velR * velR;
+   RealType x0 = parameters.getParameter< RealType >( "riemann-border" );
+   cout <<endl << gamma << " " << rhoL << " " << velL << " " << preL << " " << eL << " " << rhoR << " " << velR << " " << preR << " " << eR << " " << x0 << " " << gamma << endl;
+   int count = mesh.template getEntitiesCount< Cell >();
+cout << count << endl;
+   uRho.bind(mesh, dofs, 0);
+   uRhoVelocity.bind(mesh, dofs, count);
+   uEnergy.bind(mesh, dofs, 2 * count);
+   tnlVector < RealType, DeviceType, IndexType > data;
+   data.setSize(2*count);
+   velocity.bind( mesh, data, 0);
+   pressure.bind( mesh, data, count );
+   cout << endl << "set conditions from CML"<< 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;
+         };
+   cout << "dofs = " << dofs << endl;
+   getchar();
+  
+   
+   /*
+   const tnlString& initialConditionFile = parameters.getParameter< tnlString >( "initial-condition" );
+   if( ! dofs.load( initialConditionFile ) )
+   {
+      cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << 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 MeshType& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   tnlMatrixSetter< 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 MeshType& mesh,
+              DofVectorType& dofs,
+              MeshDependentDataType& meshDependentData )
+{
+   cout << endl << "Writing output at time " << time << " step " << step << "." << endl;
+   this->bindDofs( mesh, dofs );
+   tnlString fileName;
+   typedef typename MeshType::Cell Cell;
+   int count = mesh.template getEntitiesCount< Cell >();
+   ofstream vysledek;
+/*   cout << "pressure:" << endl;
+   for (IndexType i = 0; i<count; i++) cout << this->pressure[i] << " " << i ;
+      vysledek.open("pressure" + to_string(step) + ".txt");
+   for (IndexType i = 0; i<count; i++)
+      vysledek << 0.01*i << " " << pressure[i] << endl;
+   vysledek.close();
+   cout << " " << endl;
+   cout << "velocity:" << endl;
+   for (IndexType i = 0; i<count; i++) cout << this->velocity[i] << " " ;
+      vysledek.open("velocity" + to_string(step) + ".txt");
+   for (IndexType i = 0; i<count; i++)
+      vysledek << 0.01*i << " " << pressure[i] << endl;
+   vysledek.close();
+   cout << "energy:" << endl;
+   for (IndexType i = 0; i<count; i++) cout << this->uEnergy[i] << " " ;
+      vysledek.open("energy" + to_string(step) + ".txt");
+   for (IndexType i = 0; i<count; i++)
+      vysledek << 0.01*i << " " << uEnergy[i] << endl;
+   vysledek.close();
+   cout << " " << endl;
+   cout << "density:" << endl;
+   for (IndexType i = 0; i<count; i++) cout << this->uRho[i] << " " ;
+      vysledek.open("density" + to_string(step) + ".txt");
+   for (IndexType i = 0; i<count; i++)
+      vysledek << 0.01*i << " " << uRho[i] << endl;
+   vysledek.close();
+*/   getchar();
+
+   FileNameBaseNumberEnding( "rho-", step, 5, ".tnl", fileName );
+   if( ! uRho.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "rhoVel-", step, 5, ".tnl", fileName );
+   if( ! uRhoVelocity.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "energy-", step, 5, ".tnl", fileName );
+   if( ! uEnergy.save( fileName ) )
+      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 MeshType& mesh,
+                DofVectorType& _u,
+                DofVectorType& _fu,
+                MeshDependentDataType& meshDependentData )
+{
+    cout << "explicitRHS" << endl;
+    typedef typename MeshType::Cell Cell;
+    int count = mesh.template getEntitiesCount< Cell >();
+	//bind _u
+    this->uRho.bind(mesh, _u, 0);
+    this->uRhoVelocity.bind(mesh, _u ,count);
+    this->uEnergy.bind(mesh, _u, 2 * count);
+		
+	//bind _fu
+    this->fuRho.bind(mesh, _u, 0);
+    this->fuRhoVelocity.bind(mesh, _u, count);
+    this->fuEnergy.bind(mesh, _u, 2 * count);
+
+   //generating Differential operator object
+   Continuity lF1DContinuity;
+   Momentum lF1DMomentum;
+   Energy lF1DEnergy;
+
+   
+   
+   cout << "explicitRHSrho" << endl;   
+   //rho
+   this->bindDofs( mesh, _u );
+   lF1DContinuity.setTau(tau);
+   lF1DContinuity.setVelocity(velocity);
+   /*tnlExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity;
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DContinuity,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uRho,
+                                                           fuRho );*/
+
+   cout << "explicitRHSrhovel" << endl;
+   //rhoVelocity
+   lF1DMomentum.setTau(tau);
+   lF1DMomentum.setVelocity(velocity);
+   lF1DMomentum.setPressure(pressure);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, Momentum, BoundaryCondition, RightHandSide > explicitUpdaterMomentum;
+   explicitUpdaterMomentum.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DMomentum,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uRhoVelocity,
+                                                           fuRhoVelocity );
+   
+   cout << "explicitRHSenergy" << endl;
+   //energy
+   lF1DEnergy.setTau(tau);
+   lF1DEnergy.setPressure(pressure);
+   lF1DEnergy.setVelocity(velocity);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF1DEnergy,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           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 MeshType& mesh,
+                      DofVectorType& _u,
+                      Matrix& matrix,
+                      DofVectorType& b,
+                      MeshDependentDataType& meshDependentData )
+{
+/*   tnlLinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             tnlBackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   tnlMeshFunction< 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 MeshType& mesh,
+             DofVectorType& dofs,
+             MeshDependentDataType& 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;
+}
+
+#endif /* eulerPROBLEM_IMPL_H_ */
diff --git a/examples/inviscid-flow/1d/eulerRhs.h b/examples/inviscid-flow/1d/eulerRhs.h
new file mode 100644
index 0000000000000000000000000000000000000000..582dc36413ae36d78aa06a03be2ad745325263d6
--- /dev/null
+++ b/examples/inviscid-flow/1d/eulerRhs.h
@@ -0,0 +1,29 @@
+#ifndef eulerRHS_H_
+#define eulerRHS_H_
+#include<functions/tnlDomain.h>
+template< typename Mesh, typename Real >class eulerRhs
+  : public tnlDomain< Mesh::meshDimensions, MeshDomain > 
+ {
+   public:
+
+      typedef Mesh MeshType;
+      typedef Real RealType;
+
+      bool setup( const tnlParameterContainer& parameters,
+                  const tnlString& 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;
+      };
+};
+
+#endif /* eulerRHS_H_ */
diff --git a/examples/inviscid-flow/1d/tnl-run-euler-1d b/examples/inviscid-flow/1d/tnl-run-euler-1d
new file mode 100644
index 0000000000000000000000000000000000000000..a45f664042d2f4dab646319e506dd130b6238cfc
--- /dev/null
+++ b/examples/inviscid-flow/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 1.0e-3 \
+              --boundary-conditions-constant 0 \
+              --discrete-solver euler \
+              --snapshot-period 0.1 \
+              --final-time 1.0 \
+              --left-density 1.0 \
+              --left-velocity 0.75 \
+              --left-pressure 1.0 \
+              --right-density 0.125 \
+              --right-velocity 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/2d/CMakeLists.txt b/examples/inviscid-flow/2d/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d753d50afcc11a2fccbe04e30410c77e8a5c1f81
--- /dev/null
+++ b/examples/inviscid-flow/2d/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/2d/EulerPressureGetter.h b/examples/inviscid-flow/2d/EulerPressureGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..f58813e712cc194c25f867616844bee34557e06d
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerPressureGetter.h
@@ -0,0 +1,218 @@
+#ifndef EulerPressureGetter_H
+#define EulerPressureGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerPressureGetter
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class EulerPressureGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real gamma;
+      MeshFunctionType velocity;
+      MeshFunctionType rho;
+      MeshFunctionType energy;
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      void setEnergy(const MeshFunctionType& energy)
+      {
+          this->energy = energy;
+      };
+
+
+      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 EulerPressureGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real gamma;
+      MeshFunctionType velocity;
+      MeshFunctionType rho;
+      MeshFunctionType energy;
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      void setEnergy(const MeshFunctionType& energy)
+      {
+          this->energy = energy;
+      };
+
+
+      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 EulerPressureGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real gamma;
+      MeshFunctionType velocity;
+      MeshFunctionType rho;
+      MeshFunctionType energy;
+
+      void setGamma(const Real& gamma)
+      {
+          this->gamma = gamma;
+      };
+
+      void setVelocity(const MeshFunctionType& velocity)
+      {
+          this->velocity = velocity;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      void setEnergy(const MeshFunctionType& energy)
+      {
+          this->energy = energy;
+      };
+
+
+      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;
+};
+
+
+#include "EulerPressureGetter_impl.h"
+
+#endif	/* EulerPressureGetter_H */
diff --git a/examples/inviscid-flow/2d/EulerPressureGetter_impl.h b/examples/inviscid-flow/2d/EulerPressureGetter_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..481fe580f150f57cbeeaf10ac64da1840ce7debd
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerPressureGetter_impl.h
@@ -0,0 +1,334 @@
+#ifndef EulerPressureGetter_IMPL_H
+#define EulerPressureGetter_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+EulerPressureGetter< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerPressureGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerPressureGetter< tnlGrid< 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
+EulerPressureGetter< tnlGrid< 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
+EulerPressureGetter< tnlGrid< 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 >
+tnlString
+EulerPressureGetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerPressureGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerPressureGetter< tnlGrid< 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.
+    */
+   //pressure
+   const IndexType& center = entity.getIndex(); 
+
+   return ( this->gamma - 1 ) * ( energy[ center ] - 0.5 * rho[ center ] * pow( velocity[ center ],2 ));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+EulerPressureGetter< tnlGrid< 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
+EulerPressureGetter< tnlGrid< 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 >
+tnlString
+EulerPressureGetter< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerPressureGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerPressureGetter< tnlGrid< 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
+EulerPressureGetter< tnlGrid< 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
+EulerPressureGetter< tnlGrid< 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 );
+}
+
+#endif	/* EulerPressureGetterIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/EulerVelGetter.h b/examples/inviscid-flow/2d/EulerVelGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b9ed8201f0a6ecdd146784d26e1335d78107154
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelGetter.h
@@ -0,0 +1,179 @@
+#ifndef EulerVelGetter_H
+#define EulerVelGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelGetter
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class EulerVelGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType velX;
+      MeshFunctionType velY;
+
+      void setVelX(const MeshFunctionType& velX)
+      {
+          this->velX = velX;
+      };
+
+      void setVelY(const MeshFunctionType& velY)
+      {
+          this->velY = velY;
+      };
+
+      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 EulerVelGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType velX;
+      MeshFunctionType velY;
+
+      void setVelX(const MeshFunctionType& velX)
+      {
+          this->velX = velX;
+      };
+
+      void setVelY(const MeshFunctionType& velY)
+      {
+          this->velY = velY;
+      };
+
+      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 EulerVelGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType velX;
+      MeshFunctionType velY;
+
+      void setVelX(const MeshFunctionType& velX)
+      {
+          this->velX = velX;
+      };
+
+      void setVelY(const MeshFunctionType& velY)
+      {
+          this->velY = velY;
+      };
+
+      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;
+};
+
+
+#include "EulerVelGetter_impl.h"
+
+#endif	/* EulerVelGetter_H */
diff --git a/examples/inviscid-flow/2d/EulerVelGetter_impl.h b/examples/inviscid-flow/2d/EulerVelGetter_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb0fdbc2baf31b12fd7a5a5a21df444caa643331
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelGetter_impl.h
@@ -0,0 +1,336 @@
+#ifndef EulerVelGetter_IMPL_H
+#define EulerVelGetter_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+EulerVelGetter< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelGetter< tnlGrid< 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
+EulerVelGetter< tnlGrid< 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
+EulerVelGetter< tnlGrid< 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 >
+tnlString
+EulerVelGetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelGetter< tnlGrid< 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(); 
+   //vel
+   const IndexType& center = entity.getIndex(); 
+   return sqrt(pow( velX[ center ],2)+pow( velY[ center ],2));
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+EulerVelGetter< tnlGrid< 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
+EulerVelGetter< tnlGrid< 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 >
+tnlString
+EulerVelGetter< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelGetter< tnlGrid< 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
+EulerVelGetter< tnlGrid< 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
+EulerVelGetter< tnlGrid< 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 );
+}
+
+#endif	/* EulerVelGetterIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/EulerVelXGetter.h b/examples/inviscid-flow/2d/EulerVelXGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d3a17b4601668322c3806657cc90313262c3285
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelXGetter.h
@@ -0,0 +1,180 @@
+#ifndef EulerVelXGetter_H
+#define EulerVelXGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelXGetter
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class EulerVelXGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelX;
+      MeshFunctionType rho;
+
+      void setRhoVelX(const MeshFunctionType& rhoVelX)
+      {
+          this->rhoVelX = rhoVelX;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+
+      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 EulerVelXGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelX;
+      MeshFunctionType rho;
+
+      void setRhoVelX(const MeshFunctionType& rhoVelX)
+      {
+          this->rhoVelX = rhoVelX;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      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 EulerVelXGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelX;
+      MeshFunctionType rho;
+
+      void setRhoVelX(const MeshFunctionType& rhoVelX)
+      {
+          this->rhoVelX = rhoVelX;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      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;
+};
+
+
+#include "EulerVelXGetter_impl.h"
+
+#endif	/* EulerVelXGetter_H */
diff --git a/examples/inviscid-flow/2d/EulerVelXGetter_impl.h b/examples/inviscid-flow/2d/EulerVelXGetter_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..bca8de8f557e0e3843dcc9af34e0acc990ac1b12
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelXGetter_impl.h
@@ -0,0 +1,336 @@
+#ifndef EulerVelXGetter_IMPL_H
+#define EulerVelXGetter_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+EulerVelXGetter< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelXGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelXGetter< tnlGrid< 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
+EulerVelXGetter< tnlGrid< 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
+EulerVelXGetter< tnlGrid< 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 >
+tnlString
+EulerVelXGetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelXGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelXGetter< tnlGrid< 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(); 
+   //velX
+   const IndexType& center = entity.getIndex(); 
+   return ( rhoVelX[ center ] / rho[ center ]);
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+EulerVelXGetter< tnlGrid< 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
+EulerVelXGetter< tnlGrid< 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 >
+tnlString
+EulerVelXGetter< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelXGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelXGetter< tnlGrid< 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
+EulerVelXGetter< tnlGrid< 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
+EulerVelXGetter< tnlGrid< 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 );
+}
+
+#endif	/* EulerVelXGetterIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/EulerVelYGetter.h b/examples/inviscid-flow/2d/EulerVelYGetter.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4f5689e9c12c1f14a611bf2d6b9bd10af730562
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelYGetter.h
@@ -0,0 +1,179 @@
+#ifndef EulerVelYGetter_H
+#define EulerVelYGetter_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class EulerVelYGetter
+{
+};
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+class EulerVelYGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelY;
+      MeshFunctionType rho;
+
+      void setRhoVelY(const MeshFunctionType& rhoVelY)
+      {
+          this->rhoVelY = rhoVelY;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      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 EulerVelYGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelY;
+      MeshFunctionType rho;
+
+      void setRhoVelY(const MeshFunctionType& rhoVelY)
+      {
+          this->rhoVelY = rhoVelY;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      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 EulerVelYGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      MeshFunctionType rhoVelY;
+      MeshFunctionType rho;
+
+      void setRhoVelY(const MeshFunctionType& rhoVelY)
+      {
+          this->rhoVelY = rhoVelY;
+      };
+
+      void setRho(const MeshFunctionType& rho)
+      {
+          this->rho = rho;
+      };
+
+      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;
+};
+
+
+#include "EulerVelYGetter_impl.h"
+
+#endif	/* EulerVelYGetter_H */
diff --git a/examples/inviscid-flow/2d/EulerVelYGetter_impl.h b/examples/inviscid-flow/2d/EulerVelYGetter_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..3d1ce93bb81f6434592e5b47af7e094aeacc4944
--- /dev/null
+++ b/examples/inviscid-flow/2d/EulerVelYGetter_impl.h
@@ -0,0 +1,328 @@
+#ifndef EulerVelYGetter_IMPL_H
+#define EulerVelYGetter_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+EulerVelYGetter< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelYGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelYGetter< tnlGrid< 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
+EulerVelYGetter< tnlGrid< 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
+EulerVelYGetter< tnlGrid< 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 >
+tnlString
+EulerVelYGetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelYGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelYGetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+operator()( const MeshFunction& u,
+            const MeshEntity& entity,
+            const Real& time ) const
+{
+   //velY
+   const IndexType& center = entity.getIndex(); 
+   return ( rhoVelY[ center ] / rho[ center ]);
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+EulerVelYGetter< tnlGrid< 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
+EulerVelYGetter< tnlGrid< 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 >
+tnlString
+EulerVelYGetter< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "EulerVelYGetter< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+EulerVelYGetter< tnlGrid< 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
+EulerVelYGetter< tnlGrid< 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
+EulerVelYGetter< tnlGrid< 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 );
+}
+
+#endif	/* EulerVelYGetterIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/LaxFridrichs.h b/examples/inviscid-flow/2d/LaxFridrichs.h
new file mode 100644
index 0000000000000000000000000000000000000000..82ebc703cf344d3c4bdf826dd7b3282f1c03c6d8
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichs.h
@@ -0,0 +1,37 @@
+#ifndef LaxFridrichs_H
+#define LaxFridrichs_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "EulerPressureGetter.h"
+#include "EulerVelXGetter.h"
+#include "EulerVelYGetter.h"
+#include "EulerVelGetter.h"
+
+template< typename Mesh,
+          typename Real = typename Mesh::RealType,
+          typename Index = typename Mesh::IndexType >
+class LaxFridrichs
+{
+   public:
+      typedef Real RealType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< Mesh > MeshFunctionType;
+ 
+      typedef LaxFridrichsContinuity< Mesh, Real, Index > Continuity;
+      typedef LaxFridrichsMomentumX< Mesh, Real, Index > MomentumX;
+      typedef LaxFridrichsMomentumY< Mesh, Real, Index > MomentumY;
+      typedef LaxFridrichsEnergy< Mesh, Real, Index > Energy;
+      typedef EulerVelXGetter< Mesh, Real, Index > VelocityX;
+      typedef EulerVelYGetter< Mesh, Real, Index > VelocityY;
+      typedef EulerVelGetter< Mesh, Real, Index > Velocity;
+      typedef EulerPressureGetter< Mesh, Real, Index > Pressure;
+   
+};
+
+#endif	/* LaxFridrichs_H */
diff --git a/examples/inviscid-flow/2d/LaxFridrichsContinuity.h b/examples/inviscid-flow/2d/LaxFridrichsContinuity.h
new file mode 100644
index 0000000000000000000000000000000000000000..49d77403832c25973b2a1cd78540d9ac83f550bf
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsContinuity.h
@@ -0,0 +1,200 @@
+#ifndef LaxFridrichsContinuity_H
+#define LaxFridrichsContinuity_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = 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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = 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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = 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;
+};
+
+
+#include "LaxFridrichsContinuity_impl .h"
+
+#endif	/* LaxFridrichsContinuity_H */
diff --git a/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h b/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h
new file mode 100644
index 0000000000000000000000000000000000000000..91d9301311cd8124a4f6224099661f0b88b3c5e0
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h	
@@ -0,0 +1,345 @@
+#ifndef LaxFridrichsContinuity_IMPL_H
+#define LaxFridrichsContinuity_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ( u[ west ] * this->velocityX[ west ] - u[ east ] * this->velocityX[ east ] )
+          - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ east ] );
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshEntity >
+__cuda_callable__
+Index
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsContinuity< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsContinuity< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsContinuity< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsContinuityIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/LaxFridrichsEnergy.h b/examples/inviscid-flow/2d/LaxFridrichsEnergy.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9bc36c52e7a6503924c984ef7aa4e08cb715750
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsEnergy.h
@@ -0,0 +1,215 @@
+#ifndef LaxFridrichsEnergy_H
+#define LaxFridrichsEnergy_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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;
+};
+
+
+#include "LaxFridrichsEnergy_impl.h"
+
+#endif	/* LaxFridrichsEnergy_H */
diff --git a/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h b/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..1758be462709573188225a45f824909ce31b2492
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h
@@ -0,0 +1,346 @@
+#ifndef LaxFridrichsEnergy_IMPL_H
+#define LaxFridrichsEnergy_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * ((( u[ west ] + this->pressure[ west ] ) * this->velocityX[ west ] )
+			      -(( u[ east ] + this->pressure[ east ] ) * this->velocityX[ east ] ))
+          - 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsEnergy< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsEnergy< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsEnergy< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsEnergyIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c22302031f3096a7f0f8e084889f919cad1749e
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h
@@ -0,0 +1,216 @@
+#ifndef LaxFridrichsMomentumX_H
+#define LaxFridrichsMomentumX_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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;
+};
+
+
+#include "LaxFridrichsMomentumX_impl.h"
+
+#endif	/* LaxFridrichsMomentumX_H */
diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..14de7f4f6381c5858096dff791589324d9c1e2be
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h
@@ -0,0 +1,347 @@
+#ifndef LaxFridrichsMomentumX_IMPL_H
+#define LaxFridrichsMomentumX_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsMomentumX< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentumX< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< tnlGrid< 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.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hxInverse * (( u[ west ] * this->velocityX[ west ] + this->pressure[ west ] )
+			      -( u[ east ] * this->velocityX[ east ] + this->pressure[ east ] ))
+          - 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentumX< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumX< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumX< tnlGrid< 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
+LaxFridrichsMomentumX< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsMomentumXIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h
new file mode 100644
index 0000000000000000000000000000000000000000..199f43ca240a788af5c397e352e1efa12502d0fa
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h
@@ -0,0 +1,215 @@
+#ifndef LaxFridrichsMomentumY_H
+#define LaxFridrichsMomentumY_H
+
+#include <core/vectors/tnlVector.h>
+#include <mesh/tnlGrid.h>
+
+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< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
+      typedef tnlMeshFunction< MeshType > MeshFunctionType;
+      enum { Dimensions = MeshType::getMeshDimensions() };
+
+      static tnlString getType();
+      Real tau;
+      MeshFunctionType velocityX;
+      MeshFunctionType velocityY;
+      MeshFunctionType pressure;
+
+      void setTau(const Real& tau)
+      {
+          this->tau = tau;
+      };
+
+      void setVelocityX(const MeshFunctionType& velocityX)
+      {
+          this->velocityX = velocityX;
+      };
+
+      void setVelocityY(const MeshFunctionType& velocityY)
+      {
+          this->velocityY = velocityY;
+      };
+
+      void setPressure(const MeshFunctionType& pressure)
+      {
+          this->pressure = 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;
+};
+
+
+#include "LaxFridrichsMomentumY_impl.h"
+
+#endif	/* LaxFridrichsMomentumY_H */
diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..478969ff8926198c0edad4ec503c108fb05077ca
--- /dev/null
+++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h
@@ -0,0 +1,347 @@
+#ifndef LaxFridrichsMomentumY_IMPL_H
+#define LaxFridrichsMomentumY_IMPL_H
+
+/****
+ * 1D problem
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+tnlString
+LaxFridrichsMomentumY< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< tnlGrid< 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentumY< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< tnlGrid< 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.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) 
+          - 0.5 * hyInverse * (( u[ west ] * this->velocityX[ west ] )
+			      -( u[ east ] * this->velocityX[ east ] ))
+          - 0.5 * hxInverse * (( 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< tnlGrid< 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< tnlGrid< 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 >
+tnlString
+LaxFridrichsMomentumY< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
+getType()
+{
+   return tnlString( "LaxFridrichsMomentumY< " ) +
+          MeshType::getType() + ", " +
+          ::getType< Real >() + ", " +
+          ::getType< Index >() + " >";
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real,
+          typename Index >
+template< typename MeshFunction, typename MeshEntity >
+__cuda_callable__
+Real
+LaxFridrichsMomentumY< tnlGrid< 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
+LaxFridrichsMomentumY< tnlGrid< 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< tnlGrid< 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 );
+}
+
+#endif	/* LaxFridrichsMomentumYIMPL_H */
+
diff --git a/examples/inviscid-flow/2d/euler-cuda.cu b/examples/inviscid-flow/2d/euler-cuda.cu
new file mode 100644
index 0000000000000000000000000000000000000000..4d76005cb1f70724be978ff0fa6fec63c4a8a76f
--- /dev/null
+++ b/examples/inviscid-flow/2d/euler-cuda.cu
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow/2d/euler.cpp b/examples/inviscid-flow/2d/euler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d76005cb1f70724be978ff0fa6fec63c4a8a76f
--- /dev/null
+++ b/examples/inviscid-flow/2d/euler.cpp
@@ -0,0 +1 @@
+#include "euler.h"
diff --git a/examples/inviscid-flow/2d/euler.h b/examples/inviscid-flow/2d/euler.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce35381216dbaaa170a3934247cb7e4d49a216d6
--- /dev/null
+++ b/examples/inviscid-flow/2d/euler.h
@@ -0,0 +1,117 @@
+#include <tnlConfig.h>
+#include <solvers/tnlSolver.h>
+#include <solvers/tnlBuildConfigTags.h>
+#include <operators/tnlDirichletBoundaryConditions.h>
+#include <operators/tnlNeumannBoundaryConditions.h>
+#include <functions/tnlConstantFunction.h>
+#include "eulerProblem.h"
+#include "LaxFridrichs.h"
+#include "eulerRhs.h"
+#include "eulerBuildConfigTag.h"
+
+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( tnlConfigDescription & config )
+      {
+         config.addDelimiter( "euler2D settings:" );
+         config.addEntry< tnlString >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
+            config.addEntryEnum< tnlString >( "dirichlet" );
+            config.addEntryEnum< tnlString >( "neumann" );
+         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-velocityX", "This sets a value of left_x velocity." );
+         config.addEntry< double >( "left-velocityY", "This sets a value of left_y 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-velocityX", "This sets a value of right_x velocity." );
+         config.addEntry< double >( "right-velocityY", "This sets a value of right_y 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 tnlParameterContainer & parameters )
+      {
+          enum { Dimensions = MeshType::getMeshDimensions() };
+          typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator;
+          typedef eulerRhs< MeshType, Real > RightHandSide;
+          typedef tnlStaticVector < 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 tnlVector.
+          */
+          tnlString boundaryConditionsType = parameters.getParameter< tnlString >( "boundary-conditions-type" );
+          if( parameters.checkParameter( "boundary-conditions-constant" ) )
+          {
+             typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
+             if( boundaryConditionsType == "dirichlet" )
+             {
+                typedef tnlDirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+                typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                SolverStarter solverStarter;
+                return solverStarter.template run< Problem >( parameters );
+             }
+             typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlMeshFunction< MeshType > MeshFunction;
+          if( boundaryConditionsType == "dirichlet" )
+          {
+             typedef tnlDirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
+             typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+             SolverStarter solverStarter;
+             return solverStarter.template run< Problem >( parameters );
+          }
+          typedef tnlNeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
+          typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+          SolverStarter solverStarter;
+          return solverStarter.template run< Problem >( parameters );
+      }
+
+};
+
+int main( int argc, char* argv[] )
+{
+   tnlSolver< eulerSetter, eulerConfig, BuildConfig > solver;
+   if( ! solver. run( argc, argv ) )
+      return EXIT_FAILURE;
+   return EXIT_SUCCESS;
+}
+
diff --git a/examples/inviscid-flow/2d/eulerBuildConfigTag.h b/examples/inviscid-flow/2d/eulerBuildConfigTag.h
new file mode 100644
index 0000000000000000000000000000000000000000..a03c260be27f0ab5915edde0de252935a31b0f0f
--- /dev/null
+++ b/examples/inviscid-flow/2d/eulerBuildConfigTag.h
@@ -0,0 +1,44 @@
+#ifndef eulerBUILDCONFIGTAG_H_
+#define eulerBUILDCONFIGTAG_H_
+
+#include <solvers/tnlBuildConfigTags.h>
+
+class eulerBuildConfigTag{};
+
+/****
+ * Turn off support for float and long double.
+ */
+template<> struct tnlConfigTagReal< eulerBuildConfigTag, float > { enum { enabled = false }; };
+template<> struct tnlConfigTagReal< eulerBuildConfigTag, long double > { enum { enabled = false }; };
+
+/****
+ * Turn off support for short int and long int indexing.
+ */
+template<> struct tnlConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; };
+template<> struct tnlConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; };
+
+template< int Dimensions > struct tnlConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 2 ) }; };
+
+/****
+ * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.
+ */
+template< int Dimensions, typename Real, typename Device, typename Index >
+   struct tnlConfigTagMesh< eulerBuildConfigTag, tnlGrid< Dimensions, Real, Device, Index > >
+      { enum { enabled = tnlConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled  &&
+                         tnlConfigTagReal< eulerBuildConfigTag, Real >::enabled &&
+                         tnlConfigTagDevice< eulerBuildConfigTag, Device >::enabled &&
+                         tnlConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; };
+
+/****
+ * Please, chose your preferred time discretisation  here.
+ */
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+template<> struct tnlConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; };
+
+/****
+ * Only the Runge-Kutta-Merson solver is enabled by default.
+ */
+template<> struct tnlConfigTagExplicitSolver< eulerBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = false }; };
+
+#endif /* eulerBUILDCONFIGTAG_H_ */
diff --git a/examples/inviscid-flow/2d/eulerProblem.h b/examples/inviscid-flow/2d/eulerProblem.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9acdf36adbbd24e63ec2ec0d1fd7bc4a7ee03ca
--- /dev/null
+++ b/examples/inviscid-flow/2d/eulerProblem.h
@@ -0,0 +1,120 @@
+#ifndef eulerPROBLEM_H_
+#define eulerPROBLEM_H_
+
+#include <problems/tnlPDEProblem.h>
+#include <functions/tnlMeshFunction.h>
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+           typename DifferentialOperator >
+class eulerProblem:
+   public tnlPDEProblem< 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 tnlMeshFunction< Mesh > MeshFunctionType;
+      typedef tnlPDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+
+      using typename BaseType::MeshType;
+      using typename BaseType::DofVectorType;
+      using typename BaseType::MeshDependentDataType;
+
+      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::VelocityY VelocityY;
+      typedef typename DifferentialOperator::Pressure Pressure;
+
+    //definition
+	tnlVector< RealType, DeviceType, IndexType > _uRho;
+	tnlVector< RealType, DeviceType, IndexType > _uRhoVelocityX;
+	tnlVector< RealType, DeviceType, IndexType > _uRhoVelocityY;
+	tnlVector< RealType, DeviceType, IndexType > _uEnergy;
+
+	tnlVector< RealType, DeviceType, IndexType > _fuRho;
+	tnlVector< RealType, DeviceType, IndexType > _fuRhoVelocityX;
+	tnlVector< RealType, DeviceType, IndexType > _fuRhoVelocityY;
+	tnlVector< RealType, DeviceType, IndexType > _fuEnergy;
+
+      tnlVector< RealType, DeviceType, IndexType > rho;
+      tnlVector< RealType, DeviceType, IndexType > rhoVelX;
+      tnlVector< RealType, DeviceType, IndexType > rhoVelY;
+      tnlVector< RealType, DeviceType, IndexType > energy;
+      tnlVector< RealType, DeviceType, IndexType > data;
+      tnlVector< RealType, DeviceType, IndexType > pressure;
+      tnlVector< RealType, DeviceType, IndexType > velocity;
+      tnlVector< RealType, DeviceType, IndexType > velocityX;
+      tnlVector< RealType, DeviceType, IndexType > velocityY;
+      double gamma;
+
+      static tnlString getTypeStatic();
+
+      tnlString getPrologHeader() const;
+
+      void writeProlog( tnlLogger& logger,
+                        const tnlParameterContainer& parameters ) const;
+
+      bool setup( const tnlParameterContainer& parameters );
+
+      bool setInitialCondition( const tnlParameterContainer& parameters,
+                                const MeshType& mesh,
+                                DofVectorType& dofs,
+                                MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      bool setupLinearSystem( const MeshType& mesh,
+                              Matrix& matrix );
+
+      bool makeSnapshot( const RealType& time,
+                         const IndexType& step,
+                         const MeshType& mesh,
+                         DofVectorType& dofs,
+                         MeshDependentDataType& meshDependentData );
+
+      IndexType getDofs( const MeshType& mesh ) const;
+
+      void bindDofs( const MeshType& mesh,
+                     DofVectorType& dofs );
+
+      void getExplicitRHS( const RealType& time,
+                           const RealType& tau,
+                           const MeshType& mesh,
+                           DofVectorType& _u,
+                           DofVectorType& _fu,
+                           MeshDependentDataType& meshDependentData );
+
+      template< typename Matrix >
+      void assemblyLinearSystem( const RealType& time,
+                                 const RealType& tau,
+                                 const MeshType& mesh,
+                                 DofVectorType& dofs,
+                                 Matrix& matrix,
+                                 DofVectorType& rightHandSide,
+                                 MeshDependentDataType& meshDependentData );
+
+      bool postIterate( const RealType& time,
+                        const RealType& tau,
+                        const MeshType& mesh,
+                        DofVectorType& dofs,
+                        MeshDependentDataType& meshDependentData );
+
+   protected:
+
+      DifferentialOperator differentialOperator;
+      BoundaryCondition boundaryCondition;
+      RightHandSide rightHandSide;
+};
+
+#include "eulerProblem_impl.h"
+
+#endif /* eulerPROBLEM_H_ */
diff --git a/examples/inviscid-flow/2d/eulerProblem_impl.h b/examples/inviscid-flow/2d/eulerProblem_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..e3a543d5807a1b4b03097755a046b4f4e7a9353c
--- /dev/null
+++ b/examples/inviscid-flow/2d/eulerProblem_impl.h
@@ -0,0 +1,434 @@
+#ifndef eulerPROBLEM_IMPL_H_
+#define eulerPROBLEM_IMPL_H_
+
+#include <core/mfilename.h>
+#include <matrices/tnlMatrixSetter.h>
+#include <solvers/pde/tnlExplicitUpdater.h>
+#include <solvers/pde/tnlLinearSystemAssembler.h>
+#include <solvers/pde/tnlBackwardTimeDiscretisation.h>
+
+#include "LaxFridrichsContinuity.h"
+#include "LaxFridrichsEnergy.h"
+#include "LaxFridrichsMomentumX.h"
+#include "LaxFridrichsMomentumY.h"
+#include "EulerPressureGetter.h"
+#include "EulerVelXGetter.h"
+#include "EulerVelYGetter.h"
+#include "EulerVelGetter.h"
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getTypeStatic()
+{
+   return tnlString( "eulerProblem< " ) + Mesh :: getTypeStatic() + " >";
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+tnlString
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+getPrologHeader() const
+{
+   return tnlString( "euler2D" );
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+void
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeProlog( tnlLogger& logger, const tnlParameterContainer& 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 tnlParameterContainer& parameters )
+{
+   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
+       ! this->rightHandSide.setup( parameters, "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 MeshType& 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 MeshType& mesh,
+          DofVectorType& dofVector )
+{
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setInitialCondition( const tnlParameterContainer& parameters,
+                     const MeshType& mesh,
+                     DofVectorType& dofs,
+                     MeshDependentDataType& meshDependentData )
+{
+   typedef typename MeshType::Cell Cell;
+   double gamma = parameters.getParameter< double >( "gamma" );
+   double rhoL = parameters.getParameter< double >( "left-density" );
+   double velLX = parameters.getParameter< double >( "left-velocityX" );
+   double velLY = parameters.getParameter< double >( "left-velocityY" );
+   double preL = parameters.getParameter< double >( "left-pressure" );
+   double eL = ( preL / (gamma - 1) ) + 0.5 * rhoL * pow(velLX,2)+pow(velLY,2);
+   double rhoR = parameters.getParameter< double >( "right-density" );
+   double velRX = parameters.getParameter< double >( "right-velocityX" );
+   double velRY = parameters.getParameter< double >( "right-velocityY" );
+   double preR = parameters.getParameter< double >( "right-pressure" );
+   double eR = ( preR / (gamma - 1) ) + 0.5 * rhoR * pow(velRX,2)+pow(velRY,2);
+   double x0 = parameters.getParameter< double >( "riemann-border" );
+   int size = mesh.template getEntitiesCount< Cell >();
+   int size2 = pow(size,2);
+   this->rho.bind(dofs,0,size2);
+   this->rhoVelX.bind(dofs,size2,size2);
+   this->rhoVelY.bind(dofs,2*size2,size2);
+   this->energy.bind(dofs,3*size2,size2);
+   this->data.setSize(4*size2);
+   this->pressure.bind(this->data,0,size2);
+   this->velocity.bind(this->data,size2,size2);
+   this->velocityX.bind(this->data,2*size2,size2);
+   this->velocityY.bind(this->data,3*size2,size2);
+   for(long int j = 0; j < size; j++)   
+      for(long int i = 0; i < size; i++)
+         if ((i < x0 * size)&&(j < x0 * size) )
+            {
+               this->rho[j*size+i] = rhoL;
+               this->rhoVelX[j*size+i] = rhoL * velLX;
+               this->rhoVelY[j*size+i] = rhoL * velLY;
+               this->energy[j*size+i] = eL;
+               this->velocity[j*size+i] = sqrt(pow(velLX,2)+pow(velLY,2));
+               this->velocityX[j*size+i] = velLX;
+               this->velocityY[j*size+i] = velLY;
+               this->pressure[j*size+i] = preL;
+            }
+         else
+            {
+               this->rho[j*size+i] = rhoR;
+               this->rhoVelX[j*size+i] = rhoR * velRX;
+               this->rhoVelY[j*size+i] = rhoR * velRY;
+               this->energy[j*size+i] = eR;
+               this->velocity[j*size+i] = sqrt(pow(velRX,2)+pow(velRY,2));
+               this->velocityX[j*size+i] = velRX;
+               this->velocityY[j*size+i] = velRY;
+               this->pressure[j*size+i] = preR;
+            };
+   this->gamma = gamma;
+   return true; 
+}
+
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+   template< typename Matrix >
+bool
+eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+setupLinearSystem( const MeshType& mesh,
+                   Matrix& matrix )
+{
+/*   const IndexType dofs = this->getDofs( mesh );
+   typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
+   CompressedRowsLengthsVectorType rowLengths;
+   if( ! rowLengths.setSize( dofs ) )
+      return false;
+   tnlMatrixSetter< 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 MeshType& mesh,
+              DofVectorType& dofs,
+              MeshDependentDataType& meshDependentData )
+{
+   cout << endl << "Writing output at time " << time << " step " << step << "." << endl;
+   this->bindDofs( mesh, dofs );
+   tnlString fileName;
+   FileNameBaseNumberEnding( "rho-", step, 5, ".tnl", fileName );
+   if( ! this->rho.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "rhoVelX-", step, 5, ".tnl", fileName );
+   if( ! this->rhoVelX.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "rhoVelY-", step, 5, ".tnl", fileName );
+   if( ! this->rhoVelY.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "energy-", step, 5, ".tnl", fileName );
+   if( ! this->energy.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "velocityX-", step, 5, ".tnl", fileName );
+   if( ! this->velocityX.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "velocityY-", step, 5, ".tnl", fileName );
+   if( ! this->velocityY.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "velocity-", step, 5, ".tnl", fileName );
+   if( ! this->velocity.save( fileName ) )
+      return false;
+   FileNameBaseNumberEnding( "pressure-", step, 5, ".tnl", fileName );
+   if( ! this->pressure.save( fileName ) )
+      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 MeshType& mesh,
+                DofVectorType& _u,
+                DofVectorType& _fu,
+                MeshDependentDataType& meshDependentData )
+{
+    typedef typename MeshType::Cell Cell;
+    int count = mesh.template getEntitiesCount< Cell >()/4;
+	//bind _u
+    this->_uRho.bind(_u,0,count);
+    this->_uRhoVelocityX.bind(_u,count,count);
+    this->_uRhoVelocityY.bind(_u,2 * count,count);
+    this->_uEnergy.bind(_u,3 * count,count);
+		
+	//bind _fu
+    this->_fuRho.bind(_u,0,count);
+    this->_fuRhoVelocityX.bind(_u,count,count);
+    this->_fuRhoVelocityY.bind(_u,2 * count,count);
+    this->_fuEnergy.bind(_u,3 * count,count);
+   //bind MeshFunctionType
+   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 fuRho( mesh, _fuRho );
+   MeshFunctionType uRhoVelocityX( mesh, _uRhoVelocityX ); 
+   MeshFunctionType fuRhoVelocityX( mesh, _fuRhoVelocityX );
+   MeshFunctionType uRhoVelocityY( mesh, _uRhoVelocityY ); 
+   MeshFunctionType fuRhoVelocityY( mesh, _fuRhoVelocityY );
+   MeshFunctionType uEnergy( mesh, _uEnergy ); 
+   MeshFunctionType fuEnergy( mesh, _fuEnergy );
+   //generate Operators
+   Continuity lF2DContinuity;
+   MomentumX lF2DMomentumX;
+   MomentumY lF2DMomentumY;
+   Energy lF2DEnergy;
+
+   this->bindDofs( mesh, _u );
+   //rho
+   lF2DContinuity.setTau(tau);
+   lF2DContinuity.setVelocityX(velocityX);
+   lF2DContinuity.setVelocityY(velocityY);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; 
+   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DContinuity,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uRho,
+                                                           fuRho );
+
+   //rhoVelocityX
+   lF2DMomentumX.setTau(tau);
+   lF2DMomentumX.setVelocityX(velocityX);
+   lF2DMomentumX.setVelocityY(velocityY);
+   lF2DMomentumX.setPressure(pressure);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, MomentumX, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; 
+   explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DMomentumX,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uRhoVelocityX,
+                                                           fuRhoVelocityX );
+
+   //rhoVelocityY
+   lF2DMomentumY.setTau(tau);
+   lF2DMomentumY.setVelocityX(velocityX);
+   lF2DMomentumY.setVelocityY(velocityY);
+   lF2DMomentumY.setPressure(pressure);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, MomentumY, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY;
+   explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DMomentumY,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uRhoVelocityY,
+                                                           fuRhoVelocityY );
+  
+   //energy
+   lF2DEnergy.setTau(tau);
+   lF2DEnergy.setVelocityX(velocityX); 
+   lF2DEnergy.setVelocityY(velocityY); 
+   lF2DEnergy.setPressure(pressure);
+   tnlExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
+   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
+                                                           mesh,
+                                                           lF2DEnergy,
+                                                           this->boundaryCondition,
+                                                           this->rightHandSide,
+                                                           uEnergy,
+                                                           fuEnergy );
+
+/*
+   tnlBoundaryConditionsSetter< 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 MeshType& mesh,
+                      DofVectorType& _u,
+                      Matrix& matrix,
+                      DofVectorType& b,
+                      MeshDependentDataType& meshDependentData )
+{
+/*   tnlLinearSystemAssembler< Mesh,
+                             MeshFunctionType,
+                             DifferentialOperator,
+                             BoundaryCondition,
+                             RightHandSide,
+                             tnlBackwardTimeDiscretisation,
+                             Matrix,
+                             DofVectorType > systemAssembler;
+
+   tnlMeshFunction< 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 MeshType& mesh,
+             DofVectorType& dofs,
+             MeshDependentDataType& 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);
+//   tnlOperatorFunction< VelocityX, MeshFunction, void, true > OFVelocityX;
+//   velocityX = OFVelocityX;
+
+   //velocityY
+   euler2DVelocityY.setRhoVelY(uRhoVelocityY);
+   euler2DVelocityY.setRho(uRho);
+//   tnlOperatorFunction< VelocityY, MeshFunction, void, time > OFVelocityY;
+//   velocityY = OFVelocityY;
+
+   //velocity
+   euler2DVelocity.setVelX(velocityX);
+   euler2DVelocity.setVelY(velocityY);
+//   tnlOperatorFunction< Velocity, MeshFunction, void, time > OFVelocity;
+//   velocity = OFVelocity;
+
+   //pressure
+   euler2DPressure.setGamma(gamma);
+   euler2DPressure.setVelocity(velocity);
+   euler2DPressure.setEnergy(uEnergy);
+   euler2DPressure.setRho(uRho);
+//   tnlOperatorFunction< euler2DPressure, MeshFunction, void, time > OFPressure;
+//   pressure = OFPressure;
+
+}
+
+#endif /* eulerPROBLEM_IMPL_H_ */
diff --git a/examples/inviscid-flow/2d/eulerRhs.h b/examples/inviscid-flow/2d/eulerRhs.h
new file mode 100644
index 0000000000000000000000000000000000000000..582dc36413ae36d78aa06a03be2ad745325263d6
--- /dev/null
+++ b/examples/inviscid-flow/2d/eulerRhs.h
@@ -0,0 +1,29 @@
+#ifndef eulerRHS_H_
+#define eulerRHS_H_
+#include<functions/tnlDomain.h>
+template< typename Mesh, typename Real >class eulerRhs
+  : public tnlDomain< Mesh::meshDimensions, MeshDomain > 
+ {
+   public:
+
+      typedef Mesh MeshType;
+      typedef Real RealType;
+
+      bool setup( const tnlParameterContainer& parameters,
+                  const tnlString& 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;
+      };
+};
+
+#endif /* eulerRHS_H_ */
diff --git a/examples/inviscid-flow/2d/run-euler b/examples/inviscid-flow/2d/run-euler
new file mode 100644
index 0000000000000000000000000000000000000000..f68b98a8406dea2f2142526283ec60248551c56d
--- /dev/null
+++ b/examples/inviscid-flow/2d/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/CMakeLists.txt b/examples/inviscid-flow/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..10af3c9c773bc36bca44191359b4a4e244d1faa4
--- /dev/null
+++ b/examples/inviscid-flow/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory( 1d )
+add_subdirectory( 2d )
diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cpp b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cpp
index a14c99e1f0b4f501705cc11ad6fddb7d6f6c1fcf..52e59c565250919f8779b47bbe435786a4cd4320 100644
--- a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cpp
+++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-mean-curvature-flow-eoc.h"
 
diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cu b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cu
index 7a8ffe883b1e535e1859e10286e4c41aee8240a4..97e06fee7d39b5988af1dfc6325f84f824b90b7f 100644
--- a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cu
+++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-mean-curvature-flow-eoc.h"
 
diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow.cpp b/examples/mean-curvature-flow/tnl-mean-curvature-flow.cpp
index f45e969fec72cf9829287f7e83cce01823fcf09d..e2e02b43fe1e51d1f552b6a3b804952e993cdc0e 100644
--- a/examples/mean-curvature-flow/tnl-mean-curvature-flow.cpp
+++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-mean-curvature-flow.h"
diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow.cu b/examples/mean-curvature-flow/tnl-mean-curvature-flow.cu
index b3f466845ce7332b2a2771b633da98f6eeb129d4..001503554a6d41c82a61a2d8ca8a1a01446b99bf 100644
--- a/examples/mean-curvature-flow/tnl-mean-curvature-flow.cu
+++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-mean-curvature-flow.h"
diff --git a/examples/navier-stokes/main.cpp b/examples/navier-stokes/main.cpp
index 78d27e70fea8bd40c8a39b0256039786e0b4f073..632b3136fc201c0fb659c7287df2533a3b726ff0 100644
--- a/examples/navier-stokes/main.cpp
+++ b/examples/navier-stokes/main.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <cstdlib>
 #include "navier-stokes-conf.h"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 677f8cfc1629f957aefcfa8cfec5c9cb6ae81892..6a39069a1710dd89a903ce9da7b1dea2201b39df 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,6 +10,8 @@ ADD_SUBDIRECTORY( problems )
 ADD_SUBDIRECTORY( solvers )
 ADD_SUBDIRECTORY( legacy )
 
+set (headers tnlObject.h )
+
 set( tnl_SOURCES ${tnl_functions_SOURCES}
                  ${tnl_config_SOURCES}
                  ${tnl_core_SOURCES}
@@ -19,6 +21,7 @@ set( tnl_SOURCES ${tnl_functions_SOURCES}
                  ${tnl_operators_SOURCES}
                  ${tnl_solvers_SOURCES}
                  ${tnl_problems_SOURCES}
+                 tnlObject.cpp
                   )
 
 set( tnl_CUDA__SOURCES ${tnl_functions_CUDA__SOURCES}
@@ -78,4 +81,6 @@ IF( BUILD_MPI )
                                                                 
 ENDIF()
 
+INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion} )
+
 
diff --git a/src/config/tnlConfigDelimiter.h b/src/config/tnlConfigDelimiter.h
index b006cf4ab32e0a107652180d6c1357ecf21cd44a..b5320c935ebfa78a29a51a258e0835085cb45274 100644
--- a/src/config/tnlConfigDelimiter.h
+++ b/src/config/tnlConfigDelimiter.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once 
 
-#ifndef TNLCONFIGDELIMITER_H_
-#define TNLCONFIGDELIMITER_H_
+namespace TNL {
 
 struct tnlConfigDelimiter : public tnlConfigEntryBase
 {
@@ -32,4 +26,4 @@ struct tnlConfigDelimiter : public tnlConfigEntryBase
    tnlString getUIEntryType() const { return ""; };
 };
 
-#endif /* TNLCONFIGDELIMITER_H_ */
+} //namespace TNL
diff --git a/src/config/tnlConfigDescription.cpp b/src/config/tnlConfigDescription.cpp
index 8512462a054896195ccadfd1b32c5ab60918817e..03fd40e1c31221cbafead320d872543e36b6ac9f 100644
--- a/src/config/tnlConfigDescription.cpp
+++ b/src/config/tnlConfigDescription.cpp
@@ -6,22 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <fstream>
 #include <iomanip>
-//#include <legacy/config/tnlConfigDescriptionParser.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
 #include <core/mfuncs.h>
 
+namespace TNL {
 
 tnlConfigDescription :: tnlConfigDescription()
 : currentEntry( 0 )
@@ -87,22 +80,7 @@ void tnlConfigDescription::printUsage( const char* program_name ) const
    }
    cout << endl;
 }
-//--------------------------------------------------------------------------
-/*bool tnlConfigDescription::parseConfigDescription( const char* file_name )
-{
-   tnlConfigDescriptionParser parser;
-   fstream in_file;
-   in_file. open( file_name, ios :: in );
-   if( ! in_file )
-   {
-      cerr << "Unable to open the file " << file_name << endl;
-      return false;
-   }
-   parser. setScanner( &in_file );
-   if( ! parser. runParsing( this ) ) return false;
-   return true;
-}*/
-//--------------------------------------------------------------------------
+
 void tnlConfigDescription :: addMissingEntries( tnlParameterContainer& parameter_container ) const
 {
    int i;
@@ -144,7 +122,7 @@ void tnlConfigDescription :: addMissingEntries( tnlParameterContainer& parameter
       }
    }
 }
-//--------------------------------------------------------------------------
+
 bool tnlConfigDescription :: checkMissingEntries( tnlParameterContainer& parameter_container,
                                                   bool printUsage,
                                                   const char* programName ) const
@@ -155,7 +133,7 @@ bool tnlConfigDescription :: checkMissingEntries( tnlParameterContainer& paramet
    for( i = 0; i < size; i ++ )
    {
       const char* entry_name = entries[ i ] -> name. getString();
-      if( entries[ i ] -> required && 
+      if( entries[ i ] -> required &&
           ! parameter_container. checkParameter( entry_name ) )
          missingParameters.Append( entry_name );
    }
@@ -173,3 +151,5 @@ bool tnlConfigDescription :: checkMissingEntries( tnlParameterContainer& paramet
    return true;
 }
 
+} // namespace TNL
+
diff --git a/src/config/tnlConfigDescription.h b/src/config/tnlConfigDescription.h
index ded3dec864be2bc83c2bb344dac85d39d241c4b4..4741311a4e6da7a21a8e085bd7a1294127c539c2 100644
--- a/src/config/tnlConfigDescription.h
+++ b/src/config/tnlConfigDescription.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef tnlConfigDescriptionH
-#define tnlConfigDescriptionH
+#pragma once
 
 #include <core/tnlString.h>
 #include <core/tnlList.h>
@@ -26,6 +18,8 @@
 #include <config/tnlConfigEntryList.h>
 #include <config/tnlConfigDelimiter.h>
 
+namespace TNL {
+
 class tnlParameterContainer;
 
 class tnlConfigDescription
@@ -49,7 +43,7 @@ class tnlConfigDescription
       currentEntry = new tnlConfigEntry< EntryType >( name, description, true );
       entries.Append( currentEntry );
    }
-   
+ 
    template< typename EntryType >
    void addEntry( const tnlString& name,
                   const tnlString& description,
@@ -117,7 +111,7 @@ class tnlConfigDescription
       return NULL;
    }
 
-   
+ 
    //! Returns empty string if given entry does not exist
    //const tnlString getEntryType( const char* name ) const;
 
@@ -136,7 +130,7 @@ class tnlConfigDescription
       cerr << "Asking for the default value of uknown parameter." << endl;
       return NULL;
    }
-   
+ 
    //! Returns zero pointer if there is no default value
    template< class T > T* getDefaultValue( const tnlString& name )
    {
@@ -177,5 +171,5 @@ class tnlConfigDescription
 
 };
 
+} //namespace TNL
 
-#endif
diff --git a/src/config/tnlConfigEntry.h b/src/config/tnlConfigEntry.h
index b2849eb762fc00b6162b9ec80080bfa6c16de318..83b057cd6f60f294a8684d0a72e61aae0f18402c 100644
--- a/src/config/tnlConfigEntry.h
+++ b/src/config/tnlConfigEntry.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONFIGENTRY_H_
-#define TNLCONFIGENTRY_H_
+#pragma once 
 
 #include <config/tnlConfigEntryBase.h>
 
+namespace TNL {
+
 template< typename EntryType >
 struct tnlConfigEntry : public tnlConfigEntryBase
 {
@@ -111,5 +105,4 @@ struct tnlConfigEntry : public tnlConfigEntryBase
    };
 };
 
-
-#endif /* TNLCONFIGENTRY_H_ */
+} // namespace TNL
diff --git a/src/config/tnlConfigEntryBase.h b/src/config/tnlConfigEntryBase.h
index 613ea39d994e993122290df5801de81f69fbd51e..15713f8fd19b2e61703e4c83388983dd5777e0a3 100644
--- a/src/config/tnlConfigEntryBase.h
+++ b/src/config/tnlConfigEntryBase.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLCONFIGENTRYBASE_H_
-#define TNLCONFIGENTRYBASE_H_
+namespace TNL {
 
 struct tnlConfigEntryBase
 {
@@ -49,4 +43,4 @@ struct tnlConfigEntryBase
    virtual void printEnumValues() const{};
 };
 
-#endif /* TNLCONFIGENTRYBASE_H_ */
+} // namespace TNL
diff --git a/src/config/tnlConfigEntryList.h b/src/config/tnlConfigEntryList.h
index 31f6a63730e80662471dc74c44026c190a3f0444..c9e3a3a318e01e244aa3b6be25b3ac965252b3ad 100644
--- a/src/config/tnlConfigEntryList.h
+++ b/src/config/tnlConfigEntryList.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONFIGENTRYLIST_H_
-#define TNLCONFIGENTRYLIST_H_
+#pragma once 
 
 #include <config/tnlConfigEntryBase.h>
 
+namespace TNL {
+
 template< typename EntryType >
 struct tnlConfigEntryList : public tnlConfigEntryBase
 {
@@ -116,5 +110,4 @@ struct tnlConfigEntryList : public tnlConfigEntryBase
    };
 };
 
-
-#endif /* TNLCONFIGENTRYLIST_H_ */
+} // namespace TNL
diff --git a/src/config/tnlConfigEntryType.h b/src/config/tnlConfigEntryType.h
index b1acab8ec8d3bcdd52ae2246216153d80ef237f9..e4bc2327e6d672be5b51a85f507d929c2b374b44 100644
--- a/src/config/tnlConfigEntryType.h
+++ b/src/config/tnlConfigEntryType.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once 
 
-#ifndef TNLCONFIGENTRYTYPE_H_
-#define TNLCONFIGENTRYTYPE_H_
+namespace TNL {
 
 template< typename EntryType >
 inline tnlString getUIEntryType() { return "Unknown type."; };
@@ -51,4 +45,4 @@ struct tnlConfigEntryType
    };
 };
 
-#endif /* TNLCONFIGENTRYTYPE_H_ */
+} // namespace TNL
diff --git a/src/config/tnlDefaultBasicTypesChecker.h b/src/config/tnlDefaultBasicTypesChecker.h
index 8050aa306e6a93b848bd2ccabefd637c0e30dcfa..0b2af36cd7c4de29ed0b8d9eedfff5a870f88942 100644
--- a/src/config/tnlDefaultBasicTypesChecker.h
+++ b/src/config/tnlDefaultBasicTypesChecker.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDEFAULTBASICTYPESCHECKER_H_
-#define TNLDEFAULTBASICTYPESCHECKER_H_
+#pragma once
 
 #include <core/tnlString.h>
 #include <config/tnlParameterContainer.h>
 
+namespace TNL {
+
 class tnlDefaultBasicTypesChecker
 {
    public:
@@ -35,6 +29,7 @@ class tnlDefaultBasicTypesChecker
                                       const tnlParameterContainer& parameters );
 };
 
+} // namespace TNL
+
 #include <implementation/config/tnlDefaultBasicTypesChecker_impl.h>
 
-#endif /* TNLDEFAULTBASICTYPESCHECKER_H_ */
diff --git a/src/config/tnlParameterContainer.cpp b/src/config/tnlParameterContainer.cpp
index 91599b03078339b5c62cb679788d59b4694f5fc9..a03bf9aaa4735fa5247fb477b059235dbde81ff7 100644
--- a/src/config/tnlParameterContainer.cpp
+++ b/src/config/tnlParameterContainer.cpp
@@ -6,21 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <ctype.h>
 #include <cstring>
 #include <stdio.h>
 
 #include "tnlParameterContainer.h"
-#include <core/tnlObject.h>
+#include <tnlObject.h>
+
+namespace TNL {
 
 bool matob( const char* value, bool& ret_val )
 {
@@ -69,8 +64,8 @@ setParameter( const tnlString& name,
          }
          else
          {
-            cerr << "Parameter " << name << " already exists with different type " 
-                 << parameters[ i ] -> type << " not " 
+            cerr << "Parameter " << name << " already exists with different type "
+                 << parameters[ i ] -> type << " not "
                  << ::getType< tnlString>() << endl;
             abort();
             return false;
@@ -102,7 +97,7 @@ void tnlParameterContainer :: MPIBcast( int root, MPI_Comm mpi_comm )
 #ifdef HAVE_MPI
    int i;
    int size = parameters. getSize();
-   :: MPIBcast( size, 1, root, mpi_comm ); 
+   :: MPIBcast( size, 1, root, mpi_comm );
    for( i = 0; i < size; i ++ )
    {
       if( MPIGetRank() == root )
@@ -137,28 +132,28 @@ void tnlParameterContainer :: MPIBcast( int root, MPI_Comm mpi_comm )
             tnlString val;
             val. MPIBcast( root, mpi_comm );
             addParameter< tnlString >( param_name. getString(),
-                                     val );           
+                                     val );
          }
          if( param_type == "bool" )
          {
             bool val;
             :: MPIBcast( val, 1, root, mpi_comm );
             addParameter< bool >( param_name. getString(),
-                                  val );           
+                                  val );
          }
          if( param_type == "int" )
          {
             int val;
             :: MPIBcast( val, 1, root, mpi_comm );
             addParameter< int >( param_name. getString(),
-                                 val );           
+                                 val );
          }
          if( param_type == "double" )
          {
             double val;
             :: MPIBcast( val, 1, root, mpi_comm );
             addParameter< double >( param_name. getString(),
-                                    val );           
+                                    val );
          }
 
       }
@@ -195,7 +190,7 @@ parseCommandLine( int argc, char* argv[],
          cerr << "Unknown parameter " << _option << "." << endl;
          parse_error = true;
       }
-      else 
+      else
       {
          const tnlString& entryType = entry->getEntryType();
          const char* value = argv[ ++ i ];
@@ -225,7 +220,7 @@ parseCommandLine( int argc, char* argv[],
                integer_list = new tnlList< int >;
             if( parsedEntryType[ 1 ] == "double" )
                real_list = new tnlList< double >;
-            
+ 
             while( i < argc && ( ( argv[ i ] )[ 0 ] != '-' || ( atof( argv[ i ] ) < 0.0 && ( integer_list || real_list ) ) ) )
             {
                const char* value = argv[ i ++ ];
@@ -342,3 +337,5 @@ parseCommandLine( int argc, char* argv[],
       return false;
    return ! parse_error;
 }
+
+} // namespace TNL
diff --git a/src/config/tnlParameterContainer.h b/src/config/tnlParameterContainer.h
index 20802ee425c0c71a7b55a9a9d206ff5896de852c..1753f66f44a1ad2955b3a928700042fda0b16cb9 100644
--- a/src/config/tnlParameterContainer.h
+++ b/src/config/tnlParameterContainer.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef tnlParameterContainerH
-#define tnlParameterContainerH
+#pragma once 
 
 #include <core/tnlList.h>
 #include <config/tnlConfigDescription.h>
 #include <core/mpi-supp.h>
 #include <core/param-types.h>
 
+namespace TNL {
+
 struct tnlParameterBase
 {
    tnlParameterBase( const tnlString& _name,
@@ -93,7 +87,7 @@ class tnlParameterContainer
       cerr << "Aborting the program." << endl;
       abort();
    }
-   
+ 
    //! Broadcast to other nodes in MPI cluster
    void MPIBcast( int root, MPI_Comm mpi_comm = MPI_COMM_WORLD );
 
@@ -136,14 +130,15 @@ setParameter( const tnlString& name,
          }
          else
          {
-            cerr << "Parameter " << name << " already exists with different type " 
+            cerr << "Parameter " << name << " already exists with different type "
                  << parameters[ i ] -> type << " not "
                  << getType( value ) << endl;
-            abort( ); 
+            abort( );
             return false;
          }
       }
    }
    return addParameter< T >( name, value );
 };
-#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index f98373d2327cf5fa20e561c789d988a314c2de59..0bc1513912c253014e198d0cf2798a4dbadc3e15 100755
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -22,13 +22,14 @@ set (headers tnlAssert.h
              tnlList.h
              tnlList_impl.h
              tnlLogger.h
-             tnlOmp.h
              tnlObject.h 
              tnlStack.h
              tnlStaticFor.h
              tnlStatistics.h 
              tnlString.h 
+             tnlSystemInfo.h
              tnlReal.h
+             tnlTimer.h
              tnlTimerCPU.h  
              tnlTimerRT.h    
              mfilename.h 
@@ -45,15 +46,15 @@ set( common_SOURCES
      ${CURRENT_DIR}/tnlFile.cpp
      ${CURRENT_DIR}/tnlFlopsCounter.cpp 
      ${CURRENT_DIR}/tnlLogger.cpp 
-     ${CURRENT_DIR}/tnlObject.cpp
      ${CURRENT_DIR}/tnlStatistics.cpp
      ${CURRENT_DIR}/tnlString.cpp 
+     ${CURRENT_DIR}/tnlSystemInfo.cpp 
+     ${CURRENT_DIR}/tnlTimer.cpp 
      ${CURRENT_DIR}/tnlTimerCPU.cpp      
      ${CURRENT_DIR}/mfilename.cpp 
      ${CURRENT_DIR}/mpi-supp.cpp 
      ${CURRENT_DIR}/tnlCuda.cpp
-     ${CURRENT_DIR}/tnlHost.cpp
-     ${CURRENT_DIR}/tnlOmp.cpp )
+     ${CURRENT_DIR}/tnlHost.cpp )
 
 IF( BUILD_CUDA )
    set( tnl_core_CUDA__SOURCES
diff --git a/src/core/arrays/tnlArray.h b/src/core/arrays/tnlArray.h
index afb85e3a751afc37ee9acb9d75173a2fe91738dd..2e00783e780ca6bcfc5e08cea6f9d275cd120897 100644
--- a/src/core/arrays/tnlArray.h
+++ b/src/core/arrays/tnlArray.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAY_H_
-#define TNLARRAY_H_
+#pragam once 
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/arrays/tnlSharedArray.h>
 
+namespace TNL {
+
 class tnlFile;
 class tnlHost;
 
@@ -29,7 +23,7 @@ class tnlSharedArray;
 
 /****
  * Array handles memory allocation and sharing of the same data between more Arrays.
- * 
+ *
  */
 template< typename Element,
           typename Device = tnlHost,
@@ -44,11 +38,11 @@ class tnlArray : public virtual tnlObject
       typedef tnlArray< Element, tnlHost, Index > HostType;
       typedef tnlArray< Element, tnlCuda, Index > CudaType;
       typedef tnlArray< Element, Device, Index > ThisType;
-      
+ 
       tnlArray();
-      
+ 
       tnlArray( const IndexType& size );
-      
+ 
       tnlArray( Element* data,
                 const IndexType& size );
 
@@ -131,15 +125,15 @@ class tnlArray : public virtual tnlObject
    #else
       template< typename IndexType2 = Index >
       void touch( IndexType2 touches = 1 ) const;
-   #endif      
+   #endif
 
       //! Method for saving the object to a file as a binary data.
       bool save( tnlFile& file ) const;
 
       //! Method for loading the object from a file as a binary data.
       bool load( tnlFile& file );
-      
-      //! This method loads data without reallocation. 
+ 
+      //! This method loads data without reallocation.
       /****
        * This is useful for loading data into shared arrays.
        * If the array was not initialize yet, common load is
@@ -147,9 +141,9 @@ class tnlArray : public virtual tnlObject
        * the size of array being loaded.
        */
       bool boundLoad( tnlFile& file );
-      
+ 
       bool boundLoad( const tnlString& fileName );
-      
+ 
       using tnlObject::load;
 
       using tnlObject::save;
@@ -157,7 +151,7 @@ class tnlArray : public virtual tnlObject
       ~tnlArray();
 
    protected:
-      
+ 
       void releaseData() const;
 
       //!Number of elements in array
@@ -167,7 +161,7 @@ class tnlArray : public virtual tnlObject
       mutable Element* data;
 
       /****
-       * Pointer to the originally allocated data. They might differ if one 
+       * Pointer to the originally allocated data. They might differ if one
        * long array is partitioned into more shorter arrays. Each of them
        * must know the pointer on allocated data because the last one must
        * deallocate the array. If outer data (not allocated by TNL) are bind
@@ -186,6 +180,7 @@ class tnlArray : public virtual tnlObject
 template< typename Element, typename Device, typename Index >
 ostream& operator << ( ostream& str, const tnlArray< Element, Device, Index >& v );
 
+} // namespace TNL
+
 #include <core/arrays/tnlArray_impl.h>
 
-#endif /* TNLARRAY_H_ */
diff --git a/src/core/arrays/tnlArrayIO.h b/src/core/arrays/tnlArrayIO.h
index 69b070c2007d2559432ba5d065e2ebbdb9658422..4fccab169d6e6b06f1de6a726e57af9d33a1b856 100644
--- a/src/core/arrays/tnlArrayIO.h
+++ b/src/core/arrays/tnlArrayIO.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAYIO_H_
-#define TNLARRAYIO_H_
+#pragma once
 
 #include <core/tnlDynamicTypeTag.h>
 #include <core/tnlFile.h>
 
+namespace TNL {
+
 template< typename Element,
           typename Device,
           typename Index,
@@ -32,7 +26,7 @@ template< typename Element,
           typename Device,
           typename Index >
 class tnlArrayIO< Element, Device, Index, true >
-{          
+{
    public:
 
    static bool save( tnlFile& file,
@@ -85,4 +79,4 @@ class tnlArrayIO< Element, Device, Index, false >
 
 };
 
-#endif /* TNLARRAYIO_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlArrayOperations.h b/src/core/arrays/tnlArrayOperations.h
index c769ed33bb2928fa5012bec7af5bc712d989f050..1d1394e1f7e1972b13130124d7af5c67ef7137d9 100644
--- a/src/core/arrays/tnlArrayOperations.h
+++ b/src/core/arrays/tnlArrayOperations.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAYOPERATIONS_H_
-#define TNLARRAYOPERATIONS_H_
+#pragma once
 
 #include <core/tnlHost.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename DestinationDevice,
           typename SourceDevice = DestinationDevice >
 class tnlArrayOperations{};
@@ -157,7 +151,7 @@ class tnlArrayOperations< tnlHost, tnlCuda >
                               const Index size );
 };
 
+} // namespace TNL
+
 #include <core/arrays/tnlArrayOperationsHost_impl.h>
 #include <core/arrays/tnlArrayOperationsCuda_impl.h>
-
-#endif /* TNLARRAYOPERATIONS_H_ */
diff --git a/src/core/arrays/tnlArrayOperationsCuda_impl.cpp b/src/core/arrays/tnlArrayOperationsCuda_impl.cpp
index 18cc3c6280e573e47c6b0a218bca034ac793d086..1bd60f02f2634f730ea48551e11e6d2d25be1ef8 100644
--- a/src/core/arrays/tnlArrayOperationsCuda_impl.cpp
+++ b/src/core/arrays/tnlArrayOperationsCuda_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArrayOperations.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template bool tnlArrayOperations< tnlCuda >::allocateMemory< char,        int >( char*& data, const int size );
@@ -294,6 +289,7 @@ template bool tnlArrayOperations< tnlCuda >::setMemory< long double, long int >(
 
 #endif
 
+}// namespace TNL
 
 
 
diff --git a/src/core/arrays/tnlArrayOperationsCuda_impl.cu b/src/core/arrays/tnlArrayOperationsCuda_impl.cu
index 38f97587561979873bb702f76e671ba5b25735df..8aac4cd2d6a7b1d0b415dc6272ff5f05773b3bcb 100644
--- a/src/core/arrays/tnlArrayOperationsCuda_impl.cu
+++ b/src/core/arrays/tnlArrayOperationsCuda_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArrayOperations.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template bool tnlArrayOperations< tnlCuda >::allocateMemory< char,        int >( char*& data, const int size );
@@ -293,3 +288,5 @@ template bool tnlArrayOperations< tnlCuda >::setMemory< long double, long int >(
 #endif
 
 #endif
+
+} // namespace TNL
diff --git a/src/core/arrays/tnlArrayOperationsCuda_impl.h b/src/core/arrays/tnlArrayOperationsCuda_impl.h
index 01b649c81c4bd8d6775854bbfcf64386bd187f4c..bd640abae57f1b9a7fbdb513bba4185488f11811 100644
--- a/src/core/arrays/tnlArrayOperationsCuda_impl.h
+++ b/src/core/arrays/tnlArrayOperationsCuda_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAYOPERATIONSCUDA_IMPL_H_
-#define TNLARRAYOPERATIONSCUDA_IMPL_H_
+#pragma once 
 
 #include <iostream>
 #include <tnlConfig.h>
@@ -24,6 +16,7 @@
 #include <core/cuda/cuda-reduction.h>
 #include <core/cuda/reduction-operations.h>
 
+namespace TNL {
 
 template< typename Element, typename Index >
 bool tnlArrayOperations< tnlCuda >::allocateMemory( Element*& data,
@@ -271,7 +264,7 @@ bool tnlArrayOperations< tnlHost, tnlCuda >::compareMemory( const Element1* dest
    }
    Index compared( 0 );
    while( compared < size )
-   {      
+   {
       Index transfer = Min( size - compared, tnlCuda::getGPUTransferBufferSize() );
       if( cudaMemcpy( ( void* ) host_buffer,
                       ( void* ) & ( source[ compared ] ),
@@ -649,4 +642,4 @@ extern template bool tnlArrayOperations< tnlCuda >::setMemory< long double, long
 
 #endif
 
-#endif /* TNLARRAYOPERATIONSCUDA_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlArrayOperationsHost_impl.cpp b/src/core/arrays/tnlArrayOperationsHost_impl.cpp
index c2688d84be3411a2bba1e6ac955afdea001e5de8..1814d7d881828e3ce2dfa500e2efc46214ca49ba 100644
--- a/src/core/arrays/tnlArrayOperationsHost_impl.cpp
+++ b/src/core/arrays/tnlArrayOperationsHost_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArrayOperations.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template bool tnlArrayOperations< tnlHost >::allocateMemory< char,        int >( char*& data, const int size );
@@ -197,3 +192,5 @@ template bool tnlArrayOperations< tnlHost >::setMemory< long double, long int >(
 #endif
 
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/arrays/tnlArrayOperationsHost_impl.cu b/src/core/arrays/tnlArrayOperationsHost_impl.cu
index 2f7e7e4ebfae0af37fd42863f6d40e740f0daa30..7aa5bb7a828a039606a9077eb11fe9a7d945bf70 100644
--- a/src/core/arrays/tnlArrayOperationsHost_impl.cu
+++ b/src/core/arrays/tnlArrayOperationsHost_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArrayOperations.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template bool tnlArrayOperations< tnlHost >::allocateMemory< char,        int >( char*& data, const int size );
@@ -197,3 +192,5 @@ template bool tnlArrayOperations< tnlHost >::setMemory< long double, long int >(
 #endif
 
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/arrays/tnlArrayOperationsHost_impl.h b/src/core/arrays/tnlArrayOperationsHost_impl.h
index dbf4818a915315e3f161cb474bb4b3deb501a4c9..27005e11e7971f4ab7d6d8bb521c0adea04daed1 100644
--- a/src/core/arrays/tnlArrayOperationsHost_impl.h
+++ b/src/core/arrays/tnlArrayOperationsHost_impl.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAYOPERATIONSHOST_IMPL_H_
-#define TNLARRAYOPERATIONSHOST_IMPL_H_
+#pragma once 
 
 #include <type_traits>
 #include <tnlConfig.h>
 #include <string.h>
 
+namespace TNL {
+
 template< typename Element, typename Index >
 bool tnlArrayOperations< tnlHost >::allocateMemory( Element*& data,
                                                       const Index size )
@@ -289,5 +283,4 @@ extern template bool tnlArrayOperations< tnlHost >::setMemory< long double, long
 
 #endif
 
-
-#endif /* TNLARRAYOPERATIONSHOST_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlArray_impl.cpp b/src/core/arrays/tnlArray_impl.cpp
index c021341d1618065fb9fdea67e551c8829a2c42ee..e1df43baa81353b74874e80bc7d45eaf608f46c6 100644
--- a/src/core/arrays/tnlArray_impl.cpp
+++ b/src/core/arrays/tnlArray_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -60,3 +55,5 @@ template class tnlArray< long double, tnlCuda, long int >;
 #endif
 
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/arrays/tnlArray_impl.cu b/src/core/arrays/tnlArray_impl.cu
index f6b42f22efcaa757fc27c80728fa379b46b35958..69e0f4297ce5efaf1984683e97d63c31aa08940b 100644
--- a/src/core/arrays/tnlArray_impl.cu
+++ b/src/core/arrays/tnlArray_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -42,3 +37,5 @@ template class tnlArray< long double, tnlCuda, long int >;
 #endif
 
 #endif
+
+} // namespace TNL
diff --git a/src/core/arrays/tnlArray_impl.h b/src/core/arrays/tnlArray_impl.h
index 0e0aa9c6a2dda92192e8ffd56e3d90948d41a314..c529ae79aed454be30cd696a3075c007f32b05ba 100644
--- a/src/core/arrays/tnlArray_impl.h
+++ b/src/core/arrays/tnlArray_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLARRAY_H_IMPLEMENTATION
-#define TNLARRAY_H_IMPLEMENTATION
+#pragma once
 
 #include <iostream>
 #include <core/tnlAssert.h>
@@ -28,7 +20,7 @@
 
 #include "tnlArray.h"
 
-using namespace std;
+namespace TNL {
 
 template< typename Element,
            typename Device,
@@ -65,7 +57,7 @@ tnlArray( Element* data,
   data( data ),
   allocationPointer( 0 ),
   referenceCounter( 0 )
-{   
+{
 }
 
 template< typename Element,
@@ -96,15 +88,15 @@ tnlArray( tnlArray< Element, Device, Index >& array,
       else
       {
          this->referenceCounter = array.referenceCounter = new int;
-         *this->referenceCounter = 2;            
+         *this->referenceCounter = 2;
       }
-   }   
+   }
 }
 
 template< typename Element,
           typename Device,
           typename Index >
-tnlString 
+tnlString
 tnlArray< Element, Device, Index >::
 getType()
 {
@@ -118,7 +110,7 @@ getType()
 template< typename Element,
            typename Device,
            typename Index >
-tnlString 
+tnlString
 tnlArray< Element, Device, Index >::
 getTypeVirtual() const
 {
@@ -138,7 +130,7 @@ getSerializationType()
 template< typename Element,
            typename Device,
            typename Index >
-tnlString 
+tnlString
 tnlArray< Element, Device, Index >::
 getSerializationTypeVirtual() const
 {
@@ -162,8 +154,8 @@ releaseData() const
       }
    }
    else
-      if( allocationPointer )      
-         tnlArrayOperations< Device >::freeMemory( this->allocationPointer );   
+      if( allocationPointer )
+         tnlArrayOperations< Device >::freeMemory( this->allocationPointer );
    this->allocationPointer = 0;
    this->data = 0;
    this->size = 0;
@@ -178,8 +170,8 @@ tnlArray< Element, Device, Index >::
 setSize( const Index size )
 {
    tnlAssert( size >= 0,
-              cerr << "You try to set size of tnlArray to negative value."
-                   << "New size: " << size << endl );
+              std::cerr << "You try to set size of tnlArray to negative value."
+                        << "New size: " << size << std::endl );
    if( this->size == size && allocationPointer && ! referenceCounter ) return true;
    this->releaseData();
    tnlArrayOperations< Device >::allocateMemory( this->allocationPointer, size );
@@ -187,11 +179,11 @@ setSize( const Index size )
    this->size = size;
    if( ! this->allocationPointer )
    {
-      cerr << "I am not able to allocate new array with size "
-           << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << endl;
+      std::cerr << "I am not able to allocate new array with size "
+                << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << std::endl;
       this->size = 0;
       return false;
-   }   
+   }
    return true;
 };
 
@@ -204,22 +196,22 @@ tnlArray< Element, Device, Index >::
 setLike( const Array& array )
 {
    tnlAssert( array. getSize() >= 0,
-              cerr << "You try to set size of tnlArray to negative value."
-                   << "Array size: " << array. getSize() << endl );
+              std::cerr << "You try to set size of tnlArray to negative value."
+                        << "Array size: " << array. getSize() << std::endl );
    return setSize( array.getSize() );
 };
 
 template< typename Element,
            typename Device,
            typename Index >
-void 
+void
 tnlArray< Element, Device, Index >::
 bind( Element* data,
       const Index size )
 {
    this->releaseData();
    this->data = data;
-   this->size = size;   
+   this->size = size;
 }
 
 template< typename Element,
@@ -235,7 +227,7 @@ bind( const tnlArray< Element, Device, Index >& array,
               std::cerr << " begin = " << begin << " array.getSize() = " << array.getSize() );
    tnlAssert( begin + size  <= array.getSize(),
               std::cerr << " begin = " << begin << " size = " << size <<  " array.getSize() = " << array.getSize() );
-   
+ 
    this->releaseData();
    if( size )
       this->size = size;
@@ -256,7 +248,7 @@ bind( const tnlArray< Element, Device, Index >& array,
          *this->referenceCounter = 2;
          //std::cerr << "Allocating reference counter " << this->referenceCounter << std::endl;
       }
-   }   
+   }
 }
 
 template< typename Element,
@@ -276,7 +268,7 @@ bind( tnlStaticArray< Size, Element >& array )
 template< typename Element,
           typename Device,
           typename Index >
-void 
+void
 tnlArray< Element, Device, Index >::
 swap( tnlArray< Element, Device, Index >& array )
 {
@@ -289,7 +281,7 @@ swap( tnlArray< Element, Device, Index >& array )
 template< typename Element,
           typename Device,
           typename Index >
-void 
+void
 tnlArray< Element, Device, Index >::
 reset()
 {
@@ -300,7 +292,7 @@ template< typename Element,
           typename Device,
           typename Index >
 __cuda_callable__
-Index 
+Index
 tnlArray< Element, Device, Index >::
 getSize() const
 {
@@ -315,9 +307,9 @@ tnlArray< Element, Device, Index >::
 setElement( const Index& i, const Element& x )
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for setElement method in tnlArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for setElement method in tnlArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return tnlArrayOperations< Device > :: setMemoryElement( &( this->data[ i ] ), x );
 };
 
@@ -329,9 +321,9 @@ tnlArray< Element, Device, Index >::
 getElement( const Index& i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for getElement method in tnlArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for getElement method in tnlArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return tnlArrayOperations< Device > :: getMemoryElement( & ( this->data[ i ] ) );
 };
 
@@ -344,9 +336,9 @@ tnlArray< Element, Device, Index >::
 operator[] ( const Index& i )
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for operator[] in tnlArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for operator[] in tnlArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return this->data[ i ];
 };
 
@@ -354,14 +346,14 @@ template< typename Element,
            typename Device,
            typename Index >
 __cuda_callable__
-inline const Element& 
+inline const Element&
 tnlArray< Element, Device, Index >::
 operator[] ( const Index& i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for operator[] in tnlArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for operator[] in tnlArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return this->data[ i ];
 };
 
@@ -373,9 +365,9 @@ tnlArray< Element, Device, Index >::
 operator = ( const tnlArray< Element, Device, Index >& array )
 {
    tnlAssert( array. getSize() == this->getSize(),
-           cerr << "Source size: " << array. getSize() << endl
-                << "Target size: " << this->getSize() << endl );
-   tnlArrayOperations< Device > :: 
+              std::cerr << "Source size: " << array. getSize() << std::endl
+                        << "Target size: " << this->getSize() << std::endl );
+   tnlArrayOperations< Device > ::
    template copyMemory< Element,
                         Element,
                         Index >
@@ -394,8 +386,8 @@ tnlArray< Element, Device, Index >::
 operator = ( const Array& array )
 {
    tnlAssert( array. getSize() == this->getSize(),
-           cerr << "Source size: " << array. getSize() << endl
-                << "Target size: " << this->getSize() << endl );
+              std::cerr << "Source size: " << array. getSize() << std::endl
+                        << "Target size: " << this->getSize() << std::endl );
    tnlArrayOperations< Device,
                        typename Array :: DeviceType > ::
     template copyMemory< Element,
@@ -492,14 +484,14 @@ bool tnlArray< Element, Device, Index > :: save( tnlFile& file ) const
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< const Index, tnlHost >( &this->size ) )
       return false;
-#else            
+#else
    if( ! file. write( &this->size ) )
       return false;
 #endif
    if( this->size != 0 && ! tnlArrayIO< Element, Device, Index >::save( file, this->data, this->size ) )
    {
-      cerr << "I was not able to save " << this->getType()
-           << " with size " << this->getSize() << endl;
+      std::cerr << "I was not able to save " << this->getType()
+                << " with size " << this->getSize() << std::endl;
       return false;
    }
    return true;
@@ -518,13 +510,13 @@ load( tnlFile& file )
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< Index, tnlHost >( &_size ) )
       return false;
-#else   
+#else
    if( ! file. read( &_size ) )
       return false;
-#endif      
+#endif
    if( _size < 0 )
    {
-      cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << endl;
+      std::cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << std::endl;
       return false;
    }
    setSize( _size );
@@ -532,8 +524,8 @@ load( tnlFile& file )
    {
       if( ! tnlArrayIO< Element, Device, Index >::load( file, this->data, this->size ) )
       {
-         cerr << "I was not able to load " << this->getType()
-                    << " with size " << this->getSize() << endl;
+         std::cerr << "I was not able to load " << this->getType()
+                   << " with size " << this->getSize() << std::endl;
          return false;
       }
    }
@@ -553,13 +545,13 @@ boundLoad( tnlFile& file )
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< Index, tnlHost >( &_size ) )
       return false;
-#else   
+#else
    if( ! file. read( &_size ) )
       return false;
-#endif      
+#endif
    if( _size < 0 )
    {
-      cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << endl;
+      std::cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << std::endl;
       return false;
    }
    if( this->getSize() != 0 )
@@ -576,8 +568,8 @@ boundLoad( tnlFile& file )
    {
       if( ! tnlArrayIO< Element, Device, Index >::load( file, this->data, this->size ) )
       {
-         cerr << "I was not able to load " << this->getType()
-                    << " with size " << this->getSize() << endl;
+         std::cerr << "I was not able to load " << this->getType()
+                   << " with size " << this->getSize() << std::endl;
          return false;
       }
    }
@@ -594,17 +586,17 @@ boundLoad( const tnlString& fileName )
    tnlFile file;
    if( ! file. open( fileName, tnlReadMode ) )
    {
-      cerr << "I am not bale to open the file " << fileName << " for reading." << endl;
+      std::cerr << "I am not bale to open the file " << fileName << " for reading." << std::endl;
       return false;
    }
    if( ! this->boundLoad( file ) )
       return false;
    if( ! file. close() )
    {
-      cerr << "An error occurred when I was closing the file " << fileName << "." << endl;
+      std::cerr << "An error occurred when I was closing the file " << fileName << "." << std::endl;
       return false;
    }
-   return true;   
+   return true;
 }
 
 template< typename Element,
@@ -667,4 +659,4 @@ extern template class tnlArray< long double, tnlHost, long int >;
 
 #endif
 
-#endif /* TNLARRAY_H_IMPLEMENTATION */
+} // namespace TNL
diff --git a/src/core/arrays/tnlConstSharedArray.h b/src/core/arrays/tnlConstSharedArray.h
index e107f9c4364a15204f330e1e3a46131d0e71372a..7cf7897be3fe5e1cfb569fc4369bccaa89ed7d0a 100644
--- a/src/core/arrays/tnlConstSharedArray.h
+++ b/src/core/arrays/tnlConstSharedArray.h
@@ -6,19 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once 
 
-#ifndef TNLCONSTSHAREDARRAY_H_
-#define TNLCONSTSHAREDARRAY_H_
+#include <tnlObject.h>
 
-#include <core/tnlObject.h>
+namespace TNL {
 
 class tnlFile;
 class tnlHost;
@@ -115,6 +109,8 @@ class tnlConstSharedArray : public tnlObject
 template< typename Element, typename Device, typename Index >
 ostream& operator << ( ostream& str, const tnlConstSharedArray< Element, Device, Index >& v );
 
+} // namespace TNL
+
 #include <core/arrays/tnlConstSharedArray_impl.h>
 
-#endif /* TNLCONSTSHAREDARRAY_H_ */
+
diff --git a/src/core/arrays/tnlConstSharedArray_impl.h b/src/core/arrays/tnlConstSharedArray_impl.h
index 5ede952e742d41af1dbfdb4ebb065aa7acd8e2e2..897f56f99c7200923142031fc4363ef707e15468 100644
--- a/src/core/arrays/tnlConstSharedArray_impl.h
+++ b/src/core/arrays/tnlConstSharedArray_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONSTSHAREDARRAY_IMPL_H_
-#define TNLCONSTSHAREDARRAY_IMPL_H_
+#pragma once
 
 #include <iostream>
 #include <core/tnlFile.h>
@@ -25,7 +17,7 @@
 #include <core/mfuncs.h>
 #include <core/param-types.h>
 
-using namespace std;
+namespace TNL {
 
 template< typename Element,
           typename Device,
@@ -77,10 +69,10 @@ void tnlConstSharedArray< Element, Device, Index > :: bind( const Element* data,
                                                             const Index size )
 {
    tnlAssert( size >= 0,
-              cerr << "You try to set size of tnlConstSharedArray to negative value."
-                   << "New size: " << size << endl );
+              std::cerr << "You try to set size of tnlConstSharedArray to negative value."
+                        << "New size: " << size << std::endl );
    tnlAssert( data != 0,
-              cerr << "You try to use null pointer to data for tnlConstSharedArray." );
+              std::cerr << "You try to use null pointer to data for tnlConstSharedArray." );
 
    this->size = size;
    this->data = data;
@@ -102,7 +94,7 @@ void tnlConstSharedArray< Element, Device, Index > :: bind( const Array& array,
       this->size = array. getSize();
    else
       this->size = size;
-   
+ 
 };
 
 template< typename Element,
@@ -138,9 +130,9 @@ template< typename Element,
 Element tnlConstSharedArray< Element, Device, Index > :: getElement( Index i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for getElement method in tnlConstSharedArray with name "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for getElement method in tnlConstSharedArray with name "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return tnlArrayOperations< Device >::getMemoryElement( &( this->data[ i ] ) );
 };
 
@@ -151,9 +143,9 @@ __cuda_callable__
 const Element& tnlConstSharedArray< Element, Device, Index > :: operator[] ( Index i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for operator[] in tnlConstSharedArray with name "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for operator[] in tnlConstSharedArray with name "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    // TODO: add static assert - this does not make sense for tnlCudaDevice
    return tnlArrayOperations< Device >::getArrayElementReference( this->data, i );
 };
@@ -237,7 +229,7 @@ template< typename Element,
 bool tnlConstSharedArray< Element, Device, Index > :: save( tnlFile& file ) const
 {
    tnlAssert( this->size != 0,
-              cerr << "You try to save empty array." );
+              std::cerr << "You try to save empty array." );
    if( ! tnlObject :: save( file ) )
       return false;
 #ifdef HAVE_NOT_CXX11
@@ -248,8 +240,8 @@ bool tnlConstSharedArray< Element, Device, Index > :: save( tnlFile& file ) cons
       return false;
    if( ! file. write< Element, Device, Index >( this->data, this->size ) )
    {
-      cerr << "I was not able to WRITE tnlConstSharedArray " 
-           << " with size " << this->getSize() << endl;
+      std::cerr << "I was not able to WRITE tnlConstSharedArray "
+                << " with size " << this->getSize() << std::endl;
       return false;
    }
    return true;
@@ -323,6 +315,4 @@ extern template class tnlConstSharedArray< long double, tnlCuda, long int >;
 
 #endif
 
-
-
-#endif /* TNLCONSTSHAREDARRAY_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray.h b/src/core/arrays/tnlMultiArray.h
index 0a9345d5b791152ec8c421ed0de1f62669e2d999..3d38c81fa750d5c1d301867fefe41bb5418a965d 100644
--- a/src/core/arrays/tnlMultiArray.h
+++ b/src/core/arrays/tnlMultiArray.h
@@ -6,23 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIARRAY_H_
-#define TNLMULTIARRAY_H_
+#pragma once
 
 #include <iostream>
 #include <core/arrays/tnlArray.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <core/tnlAssert.h>
 
+namespace TNL {
 
 template< int Dimensions, typename Element = double, typename Device = tnlHost, typename Index = int >
 class tnlMultiArray : public tnlArray< Element, Device, Index >
@@ -62,7 +55,7 @@ class tnlMultiArray< 1, Element, Device, Index > : public tnlArray< Element, Dev
    //! Set dimensions of the array using another array as a template
    template< typename MultiArray >
    bool setLike( const MultiArray& v );
-   
+ 
    void reset();
 
    __cuda_callable__ Index getElementIndex( const Index i ) const;
@@ -368,12 +361,15 @@ ostream& operator << ( ostream& str, const tnlMultiArray< 3, Element, device, In
 template< typename Element, typename device, typename Index >
 ostream& operator << ( ostream& str, const tnlMultiArray< 4, Element, device, Index >& array );
 
+} // namespace TNL
 
 #include <core/arrays/tnlMultiArray1D_impl.h>
 #include <core/arrays/tnlMultiArray2D_impl.h>
 #include <core/arrays/tnlMultiArray3D_impl.h>
 #include <core/arrays/tnlMultiArray4D_impl.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -457,4 +453,4 @@ extern template class tnlMultiArray< 4, double, tnlCuda, long int >;*/
 
 #endif
 
-#endif /* TNLMULTIARRAY_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray1D_impl.h b/src/core/arrays/tnlMultiArray1D_impl.h
index 943bace852349f27fd4c9fe313f428d54769c8ae..469f963c8a943c72b8095faf4b28255385fb3848 100644
--- a/src/core/arrays/tnlMultiArray1D_impl.h
+++ b/src/core/arrays/tnlMultiArray1D_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once 
 
-#ifndef TNLMULTIARRAY1D_IMPL_H_
-#define TNLMULTIARRAY1D_IMPL_H_
+namespace TNL {
 
 template< typename Element, typename Device, typename Index >
 tnlMultiArray< 1, Element, Device, Index > :: tnlMultiArray()
@@ -242,4 +236,4 @@ ostream& operator << ( ostream& str, const tnlMultiArray< 1, Element, Device, In
    return str;
 }
 
-#endif /* TNLMULTIARRAY1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray2D_impl.h b/src/core/arrays/tnlMultiArray2D_impl.h
index fb2de4d4e722869c6dcd07aa4eae799d38c9c6cc..7521afa03b94e8654c7a4c379ea5dac08a928a2c 100644
--- a/src/core/arrays/tnlMultiArray2D_impl.h
+++ b/src/core/arrays/tnlMultiArray2D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIARRAY2D_IMPL_H_
-#define TNLMULTIARRAY2D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Element, typename Device, typename Index >
 tnlMultiArray< 2, Element, Device, Index > :: tnlMultiArray()
@@ -258,4 +250,4 @@ ostream& operator << ( ostream& str, const tnlMultiArray< 2, Element, Device, In
    return str;
 }
 
-#endif /* TNLMULTIARRAY2D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray3D_impl.h b/src/core/arrays/tnlMultiArray3D_impl.h
index b8b30ad91ebc409c50437000d4a094fd9d3f1d33..5e5f02eba76b77cd2c31de276f33ec7e710ee55b 100644
--- a/src/core/arrays/tnlMultiArray3D_impl.h
+++ b/src/core/arrays/tnlMultiArray3D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIARRAY3D_IMPL_H_
-#define TNLMULTIARRAY3D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Element, typename Device, typename Index >
 tnlMultiArray< 3, Element, Device, Index > :: tnlMultiArray()
@@ -274,4 +266,4 @@ ostream& operator << ( ostream& str, const tnlMultiArray< 3, Element, Device, In
    return str;
 }
 
-#endif /* TNLMULTIARRAY3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray4D_impl.h b/src/core/arrays/tnlMultiArray4D_impl.h
index f03b942ddc5c691c6cf0c2b29b8e42262fba126f..ecb742251325d0bd73853059c03fc7ae9b6af840 100644
--- a/src/core/arrays/tnlMultiArray4D_impl.h
+++ b/src/core/arrays/tnlMultiArray4D_impl.h
@@ -6,19 +6,12 @@
     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 TNLMULTIARRAY4D_IMPL_H_
-#define TNLMULTIARRAY4D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
+   
 
 template< typename Element, typename Device, typename Index >
 tnlMultiArray< 4, Element, Device, Index > :: tnlMultiArray()
@@ -292,4 +285,4 @@ ostream& operator << ( ostream& str, const tnlMultiArray< 4, Element, Device, In
    return str;
 }
 
-#endif /* TNLMULTIARRAY4D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlMultiArray_impl.cpp b/src/core/arrays/tnlMultiArray_impl.cpp
index 39695db81e0eb208c56811beb023aa250ac855f6..d80ddcf7e0f0ea4b684485fc1cbd54360ae90550 100644
--- a/src/core/arrays/tnlMultiArray_impl.cpp
+++ b/src/core/arrays/tnlMultiArray_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlMultiArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -111,8 +106,9 @@ template class tnlMultiArray< 4, double, tnlCuda, long int >;
 
 #endif
 
-
 #endif
 
+} // namespace TNL
+
 
 
diff --git a/src/core/arrays/tnlMultiArray_impl.cu b/src/core/arrays/tnlMultiArray_impl.cu
index a0ac41bde5a89f13589a8dada3506e5ace09706a..82a021a66c5adebce9d96bade643599ba3f7f897 100644
--- a/src/core/arrays/tnlMultiArray_impl.cu
+++ b/src/core/arrays/tnlMultiArray_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlMultiArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -66,4 +61,6 @@ template class tnlMultiArray< 4, double, tnlCuda, long int >;
 
 #endif
 
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
diff --git a/src/core/arrays/tnlSharedArray.h b/src/core/arrays/tnlSharedArray.h
index a18fe9dae7cde32d3ee3374557187364ddd9a930..ad6710e9b7ef4c06883d34866e84f459cb67cc67 100644
--- a/src/core/arrays/tnlSharedArray.h
+++ b/src/core/arrays/tnlSharedArray.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSHAREDARRAY_H_
-#define TNLSHAREDARRAY_H_
+#pragma once 
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 class tnlFile;
 class tnlHost;
 class tnlCuda;
@@ -126,10 +120,10 @@ class tnlSharedArray : public tnlObject
 #ifdef HAVE_NOT_CXX11
    template< typename IndexType2 >
    void touch( IndexType2 touches = 1 ) const;
-#else   
+#else
    template< typename IndexType2 = Index >
    void touch( IndexType2 touches = 1 ) const;
-#endif   
+#endif
 
    //! Method for saving the object to a file as a binary data.
    bool save( tnlFile& file ) const;
@@ -152,6 +146,6 @@ class tnlSharedArray : public tnlObject
 template< typename Element, typename Device, typename Index >
 ostream& operator << ( ostream& str, const tnlSharedArray< Element, Device, Index >& v );
 
-#include <core/arrays/tnlSharedArray_impl.h>
+} // namespace TNL
 
-#endif /* TNLSHAREDARRAY_H_ */
+#include <core/arrays/tnlSharedArray_impl.h>
diff --git a/src/core/arrays/tnlSharedArray_impl.cpp b/src/core/arrays/tnlSharedArray_impl.cpp
index b0c92f0cfeafc61c74d40e5fe66175ad35e1dd9c..4af6a17340de354668905b9d52eba9b0c7d3a32b 100644
--- a/src/core/arrays/tnlSharedArray_impl.cpp
+++ b/src/core/arrays/tnlSharedArray_impl.cpp
@@ -6,16 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
 #include <core/arrays/tnlSharedArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -58,5 +54,6 @@ template class tnlSharedArray< long double, tnlCuda, long int >;
 
 #endif
 
+} // namespace TNL
 
 
diff --git a/src/core/arrays/tnlSharedArray_impl.cu b/src/core/arrays/tnlSharedArray_impl.cu
index 010e3ce01bb209093a4056acf182f4f422d3c5c1..6aadfb408d806276221c50963ed2750a971a8a37 100644
--- a/src/core/arrays/tnlSharedArray_impl.cu
+++ b/src/core/arrays/tnlSharedArray_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlSharedArray.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -39,4 +34,6 @@ extern template class tnlSharedArray< long double, tnlCuda, long int >;
 #endif
 #endif
 
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
diff --git a/src/core/arrays/tnlSharedArray_impl.h b/src/core/arrays/tnlSharedArray_impl.h
index a41fa22b4ca3bdc7443cf6ae2cf2b8fa1b9472ee..b21fa612a53419b7e204128880db082f5b683fc7 100644
--- a/src/core/arrays/tnlSharedArray_impl.h
+++ b/src/core/arrays/tnlSharedArray_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSHAREDARRAY_H_IMPLEMENTATION
-#define TNLSHAREDARRAY_H_IMPLEMENTATION
+#pragma once
 
 #include <iostream>
 #include <core/tnlFile.h>
@@ -26,7 +18,7 @@
 #include <core/mfuncs.h>
 #include <core/param-types.h>
 
-using namespace std;
+namespace TNL {
 
 template< typename Element,
           typename Device,
@@ -108,10 +100,10 @@ void tnlSharedArray< Element, Device, Index > :: bind( Element* data,
                                                        const Index size )
 {
    tnlAssert( size >= 0,
-              cerr << "You try to set size of tnlSharedArray to negative value."
-                   << "New size: " << size << endl );
+              std::cerr << "You try to set size of tnlSharedArray to negative value."
+                        << "New size: " << size << std::endl );
    tnlAssert( data != 0,
-              cerr << "You try to use null pointer to data for tnlSharedArray." );
+              std::cerr << "You try to use null pointer to data for tnlSharedArray." );
 
    this->size = size;
    this->data = data;
@@ -134,7 +126,7 @@ void tnlSharedArray< Element, Device, Index > :: bind( Array& array,
       this->size = array. getSize();
    else
       this->size = size;
-   
+ 
 };
 
 template< typename Element,
@@ -191,9 +183,9 @@ template< typename Element,
 void tnlSharedArray< Element, Device, Index > :: setElement( const Index& i, const Element& x )
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for setElement method in tnlSharedArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for setElement method in tnlSharedArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return tnlArrayOperations< Device >::setMemoryElement( & ( this->data[ i ] ), x );
 };
 
@@ -203,9 +195,9 @@ template< typename Element,
 Element tnlSharedArray< Element, Device, Index > :: getElement( const Index& i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for getElement method in tnlSharedArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for getElement method in tnlSharedArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return tnlArrayOperations< Device >::getMemoryElement( &( this->data[ i ] ) );
 };
 
@@ -216,9 +208,9 @@ __cuda_callable__
 Element& tnlSharedArray< Element, Device, Index > :: operator[] ( const Index& i )
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for operator[] in tnlSharedArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for operator[] in tnlSharedArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return this->data[ i ];
 };
 
@@ -229,9 +221,9 @@ __cuda_callable__
 const Element& tnlSharedArray< Element, Device, Index > :: operator[] ( const Index& i ) const
 {
    tnlAssert( 0 <= i && i < this->getSize(),
-              cerr << "Wrong index for operator[] in tnlSharedArray "
-                   << " index is " << i
-                   << " and array size is " << this->getSize() );
+              std::cerr << "Wrong index for operator[] in tnlSharedArray "
+                        << " index is " << i
+                        << " and array size is " << this->getSize() );
    return this->data[ i ];
 };
 
@@ -242,8 +234,8 @@ tnlSharedArray< Element, Device, Index >&
     tnlSharedArray< Element, Device, Index > :: operator = ( const tnlSharedArray< Element, Device, Index >& array )
 {
    tnlAssert( array. getSize() == this->getSize(),
-           cerr << "Source size: " << array. getSize() << endl
-                << "Target size: " << this->getSize() << endl );
+              std::cerr << "Source size: " << array. getSize() << std::endl
+                        << "Target size: " << this->getSize() << std::endl );
    tnlArrayOperations< Device > ::
    template copyMemory< Element,
                         Element,
@@ -261,8 +253,8 @@ template< typename Element,
 tnlSharedArray< Element, Device, Index >& tnlSharedArray< Element, Device, Index > :: operator = ( const Array& array )
 {
    tnlAssert( array. getSize() == this->getSize(),
-           cerr << "Source size: " << array. getSize() << endl
-                << "Target size: " << this->getSize() << endl );
+              std::cerr << "Source size: " << array. getSize() << std::endl
+                        << "Target size: " << this->getSize() << std::endl );
    tnlArrayOperations< typename Array :: DeviceType,
                        Device > ::
     template copyMemory< Element,
@@ -352,18 +344,18 @@ template< typename Element,
 bool tnlSharedArray< Element, Device, Index > :: save( tnlFile& file ) const
 {
    tnlAssert( this->size != 0,
-              cerr << "You try to save empty array." << endl );
+              std::cerr << "You try to save empty array." << std::endl );
    if( ! tnlObject :: save( file ) )
       return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< const Index, tnlHost >( &this->size ) )
-#else            
+#else
    if( ! file. write( &this->size ) )
-#endif      
+#endif
       return false;
    if( ! file. write< Element, Device, Index >( this->data, this->size ) )
    {
-      cerr << "I was not able to WRITE tnlSharedArray with size " << this->getSize() << endl;
+      std::cerr << "I was not able to WRITE tnlSharedArray with size " << this->getSize() << std::endl;
       return false;
    }
    return true;
@@ -394,15 +386,15 @@ bool tnlSharedArray< Element, Device, Index > :: load( tnlFile& file )
 #endif
    if( _size != this->size )
    {
-      cerr << "Error: The size " << _size << " of the data to be load is different from the " <<
-               "allocated array. This is not possible in the shared array." << endl;
+      std::cerr << "Error: The size " << _size << " of the data to be load is different from the " <<
+                   "allocated array. This is not possible in the shared array." << std::endl;
       return false;
    }
    if( _size )
    {
       if( ! file. read< Element, Device, Index >( this->data, this->size ) )
       {
-         cerr << "I was not able to READ tnlSharedArray with size " << this->getSize() << endl;
+         std::cerr << "I was not able to READ tnlSharedArray with size " << this->getSize() << std::endl;
          return false;
       }
    }
@@ -472,4 +464,4 @@ extern template class tnlSharedArray< double, tnlCuda, long int >;*/
 
 #endif
 
-#endif /* TNLSHAREDARRAY_H_IMPLEMENTATION */
+} // namespace TNL
diff --git a/src/core/arrays/tnlStaticArray.h b/src/core/arrays/tnlStaticArray.h
index 2288058804c51aad1b3579e09becd10976a4bd2e..a98529381b05e8ac2e410dfdbbbcd969ac96e069 100644
--- a/src/core/arrays/tnlStaticArray.h
+++ b/src/core/arrays/tnlStaticArray.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICARRAY_H_
-#define TNLSTATICARRAY_H_
+#pragma once 
 
 #include <core/tnlString.h>
 #include <core/tnlFile.h>
 
+namespace TNL {
+
 //! Aliases for the coordinates
 // TODO: Remove this - it is here only because of some legact code
 enum { tnlX = 0, tnlY, tnlZ };
@@ -78,7 +72,7 @@ class tnlStaticArray
    template< typename Array >
    __cuda_callable__
    inline bool operator != ( const Array& array ) const;
-         
+ 
    template< typename OtherElement >
    __cuda_callable__
    operator tnlStaticArray< Size, OtherElement >() const;
@@ -91,7 +85,7 @@ class tnlStaticArray
    bool load( tnlFile& file);
 
    void sort();
-   
+ 
    ostream& write( ostream& str, const char* separator = " " ) const;
 
    protected:
@@ -159,10 +153,10 @@ class tnlStaticArray< 1, Element >
    template< typename Array >
    __cuda_callable__
    inline bool operator != ( const Array& array ) const;
-   
+ 
    template< typename OtherElement >
    __cuda_callable__
-   operator tnlStaticArray< 1, OtherElement >() const;   
+   operator tnlStaticArray< 1, OtherElement >() const;
 
    __cuda_callable__
    inline
@@ -173,7 +167,7 @@ class tnlStaticArray< 1, Element >
    bool load( tnlFile& file);
 
    void sort();
-   
+ 
    ostream& write( ostream& str, const char* separator = " " ) const;
 
    protected:
@@ -252,11 +246,11 @@ class tnlStaticArray< 2, Element >
    template< typename Array >
    __cuda_callable__
    inline bool operator != ( const Array& array ) const;
-   
+ 
    template< typename OtherElement >
    __cuda_callable__
-   operator tnlStaticArray< 2, OtherElement >() const;   
-   
+   operator tnlStaticArray< 2, OtherElement >() const;
+ 
    __cuda_callable__
    inline void setValue( const ElementType& val );
 
@@ -265,7 +259,7 @@ class tnlStaticArray< 2, Element >
    bool load( tnlFile& file);
 
    void sort();
-   
+ 
    ostream& write( ostream& str, const char* separator = " " ) const;
 
    protected:
@@ -352,7 +346,7 @@ class tnlStaticArray< 3, Element >
    template< typename Array >
    __cuda_callable__
    inline bool operator != ( const Array& array ) const;
-   
+ 
    template< typename OtherElement >
    __cuda_callable__
    operator tnlStaticArray< 3, OtherElement >() const;
@@ -365,7 +359,7 @@ class tnlStaticArray< 3, Element >
    bool load( tnlFile& file);
 
    void sort();
-   
+ 
    ostream& write( ostream& str, const char* separator = " " ) const;
 
    protected:
@@ -376,9 +370,10 @@ class tnlStaticArray< 3, Element >
 template< int Size, typename Element >
 ostream& operator << ( ostream& str, const tnlStaticArray< Size, Element >& a );
 
+} // namespace TNL
+
 #include <core/arrays/tnlStaticArray_impl.h>
 #include <core/arrays/tnlStaticArray1D_impl.h>
 #include <core/arrays/tnlStaticArray2D_impl.h>
 #include <core/arrays/tnlStaticArray3D_impl.h>
 
-#endif /* TNLSTATICARRAY_H_ */
diff --git a/src/core/arrays/tnlStaticArray1D_impl.h b/src/core/arrays/tnlStaticArray1D_impl.h
index fc6c17b8e26f4dbdb41d6ea5c5ab87afda6396df..3266ef7e925af20308f8de38f12d2e2f53e90582 100644
--- a/src/core/arrays/tnlStaticArray1D_impl.h
+++ b/src/core/arrays/tnlStaticArray1D_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICARRAY1D_IMPL_H_
-#define TNLSTATICARRAY1D_IMPL_H_
+#pragma once
 
 #include <core/param-types.h>
 
+namespace TNL {
+
 template< typename Element >
 __cuda_callable__
 inline tnlStaticArray< 1, Element >::tnlStaticArray()
@@ -221,4 +215,4 @@ extern template class tnlStaticArray< 1, long double >;
 
 #endif
 
-#endif /* TNLSTATICARRAY1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlStaticArray2D_impl.h b/src/core/arrays/tnlStaticArray2D_impl.h
index f7194dd8a3fdabdfd32b009ca25e563f181c1171..ae587f28ae22d9f1184f5da07514e837851c8d90 100644
--- a/src/core/arrays/tnlStaticArray2D_impl.h
+++ b/src/core/arrays/tnlStaticArray2D_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICARRAY2D_IMPL_H_
-#define TNLSTATICARRAY2D_IMPL_H_
+#pragma once
 
 #include <core/param-types.h>
 
+namespace TNL {
+
 template< typename Element >
 __cuda_callable__
 inline tnlStaticArray< 2, Element >::tnlStaticArray()
@@ -248,5 +242,4 @@ extern template class tnlStaticArray< 2, long double >;
 
 #endif
 
-
-#endif /* TNLSTATICARRAY2D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlStaticArray3D_impl.h b/src/core/arrays/tnlStaticArray3D_impl.h
index b663fd24e278e00fca902e0d4e6deade6ac953a9..aab171a409b71a6716d16d1aead6194e43ec241a 100644
--- a/src/core/arrays/tnlStaticArray3D_impl.h
+++ b/src/core/arrays/tnlStaticArray3D_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICARRAY3D_IMPL_H_
-#define TNLSTATICARRAY3D_IMPL_H_
+#pragma once
 
 #include <core/param-types.h>
 
+namespace TNL {
+
 template< typename Element >
 __cuda_callable__
 inline tnlStaticArray< 3, Element >::tnlStaticArray()
@@ -276,5 +270,4 @@ extern template class tnlStaticArray< 3, long double >;
 
 #endif
 
-
-#endif /* TNLSTATICARRAY3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/arrays/tnlStaticArray_impl.cpp b/src/core/arrays/tnlStaticArray_impl.cpp
index 09a3d3b1d154aaa11896e427bd23017a162c920e..97200d7bd6ae5e5ffc680e1a4d8eef67053e7c27 100644
--- a/src/core/arrays/tnlStaticArray_impl.cpp
+++ b/src/core/arrays/tnlStaticArray_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlStaticArray.h>
 
+namespace TNL {
+
 #ifndef HAVE_CUDA
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -75,3 +70,5 @@ template class tnlStaticArray< 4, long double >;
 #endif
 #endif
 
+} // namespace TNL
+
diff --git a/src/core/arrays/tnlStaticArray_impl.cu b/src/core/arrays/tnlStaticArray_impl.cu
index 4010fc27d68ed4c1c8c72e66ca357abbb12077f2..76e77ef551790dbeff7049c28af006e8db1cad36 100644
--- a/src/core/arrays/tnlStaticArray_impl.cu
+++ b/src/core/arrays/tnlStaticArray_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/arrays/tnlStaticArray.h>
 
+namespace TNL {
+
 #ifndef HAVE_CUDA
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -73,4 +68,6 @@ template class tnlStaticArray< 4, long double >;
 #endif
 
 #endif
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/arrays/tnlStaticArray_impl.h b/src/core/arrays/tnlStaticArray_impl.h
index 3c2d2922d33ebcb20a7d9b00cc46ffbf627ac1a5..fd631014663b3fbd0593b2ff8275419164ceb83d 100644
--- a/src/core/arrays/tnlStaticArray_impl.h
+++ b/src/core/arrays/tnlStaticArray_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICARRAY_IMPL_H_
-#define TNLSTATICARRAY_IMPL_H_
+#pragma once
 
 #include <core/param-types.h>
 
+namespace TNL {
+
 template< int Size, typename Element >
 __cuda_callable__
 inline tnlStaticArray< Size, Element >::tnlStaticArray()
@@ -237,4 +231,4 @@ extern template class tnlStaticArray< 4, long double >;
 
 #endif
 
-#endif /* TNLSTATICARRAY_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/containers/tnlContainer.h b/src/core/containers/tnlContainer.h
index 5065a861544011e171176a834501b59ad47ecc74..4975be7231dbcfa09a54eb6be5a1d378504dcae9 100644
--- a/src/core/containers/tnlContainer.h
+++ b/src/core/containers/tnlContainer.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONTAINER_H_
-#define TNLCONTAINER_H_
+#pragma once
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/arrays/tnlArray.h>
 
+namespace TNL {
+
 template< typename Element, typename Device = tnlHost, typename Index = int >
 class tnlContainer : public tnlObject
 {
@@ -59,6 +53,6 @@ class tnlContainer : public tnlObject
    tnlArray< Element, Device, Index > data;
 };
 
-#include <core/containers/tnlContainer_impl.h>
+} // namespace TNL
 
-#endif /* TNLCONTAINER_H_ */
+#include <core/containers/tnlContainer_impl.h>
diff --git a/src/core/containers/tnlContainer_impl.cpp b/src/core/containers/tnlContainer_impl.cpp
index f062d7eb9adea3ef9c5ef5624f320fd81f132781..02aa3327fec3b7457ca0deeddcb6a9fc47473cb7 100644
--- a/src/core/containers/tnlContainer_impl.cpp
+++ b/src/core/containers/tnlContainer_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/containers/tnlContainer.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template class tnlContainer< float, tnlHost, int >;
@@ -33,4 +28,6 @@ template class tnlContainer< double, tnlCuda, long int >;
 
 #endif
 
+} // namespace TNL
+
 
diff --git a/src/core/containers/tnlContainer_impl.cu b/src/core/containers/tnlContainer_impl.cu
index afcc2a8b1ac0d07142788f0cddbf62b81c2f4419..2bc80fab49c2c599bdeda31c027066b68236d34d 100644
--- a/src/core/containers/tnlContainer_impl.cu
+++ b/src/core/containers/tnlContainer_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/containers/tnlContainer.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -26,4 +21,6 @@ template class tnlContainer< float, tnlCuda, long int >;
 template class tnlContainer< double, tnlCuda, long int >;
 #endif
 
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
diff --git a/src/core/containers/tnlContainer_impl.h b/src/core/containers/tnlContainer_impl.h
index 7a536a860e43ba433574a7809e1c5ae0827ef6ab..fa1b6e5f76f89f619e3a1fd4fe45bd2280f73f96 100644
--- a/src/core/containers/tnlContainer_impl.h
+++ b/src/core/containers/tnlContainer_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLCONTAINER_IMPL_H_
-#define TNLCONTAINER_IMPL_H_
+namespace TNL {
 
 template< typename Element, typename Device, typename Index >
 tnlContainer< Element, Device, Index >::tnlContainer()
@@ -124,4 +118,4 @@ extern template class tnlContainer< double, tnlCuda, long int >;*/
 
 #endif
 
-#endif /* TNLCONTAINER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/containers/tnlStaticContainer.h b/src/core/containers/tnlStaticContainer.h
index 051b8281a2723be6e6838c30d385f7e55007f23e..028472dda386af41f1f8d60b2edf121805e95e1f 100644
--- a/src/core/containers/tnlStaticContainer.h
+++ b/src/core/containers/tnlStaticContainer.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICCONTAINER_H_
-#define TNLSTATICCONTAINER_H_
+#pragma once
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/arrays/tnlStaticArray.h>
 
+namespace TNL {
+
 template< int Size, typename Element >
 class tnlStaticContainer : public tnlObject
 {
@@ -55,7 +49,7 @@ class tnlStaticContainer : public tnlObject
    tnlStaticArray< Size, Element > data;
 };
 
-#include <core/containers/tnlStaticContainer_impl.h>
+} // namespace TNL
 
+#include <core/containers/tnlStaticContainer_impl.h>
 
-#endif /* TNLSTATICCONTAINER_H_ */
diff --git a/src/core/containers/tnlStaticContainer_impl.cpp b/src/core/containers/tnlStaticContainer_impl.cpp
index 46ba56414d601b056dbf6dbe0af0905da7463bf8..86e72d0dba855b2a484a71ca04b92d8039a6bd6d 100644
--- a/src/core/containers/tnlStaticContainer_impl.cpp
+++ b/src/core/containers/tnlStaticContainer_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/containers/tnlStaticContainer.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifndef HAVE_CUDA
@@ -45,4 +40,6 @@ template class tnlStaticContainer< 4, double >;
 
 #endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
 
+} // namespace TNL
+
 
diff --git a/src/core/containers/tnlStaticContainer_impl.cu b/src/core/containers/tnlStaticContainer_impl.cu
index cee81ad068f229f79967b56565ee6a41c138e0aa..a37eb9a11736c4ef64cb1d9ab87a59555ae0e0bb 100644
--- a/src/core/containers/tnlStaticContainer_impl.cu
+++ b/src/core/containers/tnlStaticContainer_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/containers/tnlStaticContainer.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -43,4 +38,6 @@ template class tnlStaticContainer< 4, double >;
 
 #endif /* ! HAVE_CUDA */
 
-#endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
\ No newline at end of file
+#endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
+
+} // namespace TNL
diff --git a/src/core/containers/tnlStaticContainer_impl.h b/src/core/containers/tnlStaticContainer_impl.h
index 009e43b89947d7c6bf4a396eadb41908ec348865..dac33d6bfc31f82a8ca65a6cbfae5adea0f39d2e 100644
--- a/src/core/containers/tnlStaticContainer_impl.h
+++ b/src/core/containers/tnlStaticContainer_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLSTATICCONTAINER_IMPL_H_
-#define TNLSTATICCONTAINER_IMPL_H_
+namespace TNL {
 
 template< int Size, typename Element >
 tnlStaticContainer< Size, Element >::tnlStaticContainer()
@@ -116,4 +110,4 @@ extern template class tnlStaticContainer< 4, double >;
 #endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
 
 
-#endif /* TNLSTATICCONTAINER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/containers/tnlUniqueContainer.h b/src/core/containers/tnlUniqueContainer.h
index 0f93dcb784845e15eb811940058f94b4e3251086..d3908649cf08f71fdfee4c164f92cb48c2a95c10 100644
--- a/src/core/containers/tnlUniqueContainer.h
+++ b/src/core/containers/tnlUniqueContainer.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLUNIQUECONTAINER_H_
-#define TNLUNIQUECONTAINER_H_
+#pragma once
 
 #include <map>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
+
+namespace TNL {
 
 /****
  * Unique container (map) - stores each object at most once.
@@ -77,4 +71,4 @@ class tnlUniqueContainer : public tnlObject
    MapType map;
 };
 
-#endif /* TNLUNIQUECONTAINER_H_ */
+} // namespace TNL
diff --git a/src/core/containers/tnlUniqueContainer_impl.h b/src/core/containers/tnlUniqueContainer_impl.h
index 57eed16de1a79446733189dffc55913e1a37b156..c9d0b59c38bd017ef18a66f8a5bbcd11ae8ebe78 100644
--- a/src/core/containers/tnlUniqueContainer_impl.h
+++ b/src/core/containers/tnlUniqueContainer_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLUNIQUECONTAINER_IMPL_H_
-#define TNLUNIQUECONTAINER_IMPL_H_
+namespace TNL {
 
 template< typename Element, typename Key >
 class tnlUniqueContainer : public tnlObject
@@ -82,4 +76,4 @@ template< typename Element, typename Key >
 bool tnlUniqueContainer< Element, Key >::load( tnlFile& file );
 
 
-#endif /* TNLUNIQUECONTAINER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/cuda/cuda-prefix-sum.h b/src/core/cuda/cuda-prefix-sum.h
index 958e9ece87ffdd3222ff21236a0ddae1245cdc75..3ca105d0448e59a8dc4344feb84b9c14a8938032 100644
--- a/src/core/cuda/cuda-prefix-sum.h
+++ b/src/core/cuda/cuda-prefix-sum.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef CUDA_PREFIX_SUM_H_
-#define CUDA_PREFIX_SUM_H_
+#pragma once
+
+namespace TNL {
 
 enum enumPrefixSumType { exclusivePrefixSum = 0,
                          inclusivePrefixSum };
@@ -31,7 +25,6 @@ bool cudaPrefixSum( const Index size,
                     const Operation& operation,
                     const enumPrefixSumType prefixSumType = inclusivePrefixSum );
 
+} // namespace TNL
 
 #include <core/cuda/cuda-prefix-sum_impl.h>
-
-#endif /* CUDA_PREFIX_SUM_H_ */
diff --git a/src/core/cuda/cuda-prefix-sum_impl.cpp b/src/core/cuda/cuda-prefix-sum_impl.cpp
index ae2bd596e80e7fd2d546076d71c17180c9b833b1..ebce329454f166df941c143237f173d801ffe697 100644
--- a/src/core/cuda/cuda-prefix-sum_impl.cpp
+++ b/src/core/cuda/cuda-prefix-sum_impl.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 
diff --git a/src/core/cuda/cuda-prefix-sum_impl.cu b/src/core/cuda/cuda-prefix-sum_impl.cu
index 58393298d201ff66a4c379c5791f8f3ce9c50e26..97ecdb94a34cafea2ca36ddcedbe804755c5bdf6 100644
--- a/src/core/cuda/cuda-prefix-sum_impl.cu
+++ b/src/core/cuda/cuda-prefix-sum_impl.cu
@@ -6,19 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#include <core/cuda/cuda-prefix-sum.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
-#include <core/cuda/cuda-prefix-sum.h>
-         
 template bool cudaPrefixSum( const int size,
                              const int blockSize,
                              const int *deviceInput,
@@ -85,5 +80,7 @@ template bool cudaPrefixSum( const long int size,
                              tnlParallelReductionSum< long double, long int >& operation,
                              const enumPrefixSumType prefixSumType );
 #endif
-#endif 
 #endif
+#endif
+
+} // namespace TNL
diff --git a/src/core/cuda/cuda-prefix-sum_impl.h b/src/core/cuda/cuda-prefix-sum_impl.h
index 2c5644cc20855fd9cd7a897e3236997b7218693a..b0134809d8868374ee8b899fbc24e6783958b042 100644
--- a/src/core/cuda/cuda-prefix-sum_impl.h
+++ b/src/core/cuda/cuda-prefix-sum_impl.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef CUDA_PREFIX_SUM_IMPL_H_
-#define CUDA_PREFIX_SUM_IMPL_H_
+#pragma once
 
+namespace TNL {
+   
 #ifdef HAVE_CUDA
 
 #include <iostream>
@@ -218,7 +212,7 @@ bool cudaRecursivePrefixSum( const enumPrefixSumType prefixSumType,
    /****
     * Run the kernel.
     */
-   size_t sharedDataSize = elementsInBlock + 
+   size_t sharedDataSize = elementsInBlock +
                            elementsInBlock / tnlCuda::getNumberOfSharedMemoryBanks() + 2;
    size_t sharedMemory = ( sharedDataSize + blockSize + tnlCuda::getWarpSize()  ) * sizeof( DataType );
    cudaFirstPhaseBlockPrefixSum< DataType, Operation, Index >
@@ -425,4 +419,4 @@ extern template bool cudaPrefixSum( const long int size,
 
 #endif
 
-#endif /* CUDA_PREFIX_SUM_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/cuda/cuda-reduction-abs-max_impl.cu b/src/core/cuda/cuda-reduction-abs-max_impl.cu
index e69a225ada6cc40b06b76999336c629f3c0c51b0..5db31f7bece22330683a547958dd90e4490771ec 100644
--- a/src/core/cuda/cuda-reduction-abs-max_impl.cu
+++ b/src/core/cuda/cuda-reduction-abs-max_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -59,7 +54,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionAbsMax< long double, in
                                      const typename tnlParallelReductionAbsMax< long double, int > :: RealType* deviceInput1,
                                      const typename tnlParallelReductionAbsMax< long double, int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionAbsMax< long double, int> :: ResultType& result );
-#endif                                     
+#endif
 
 template bool reductionOnCudaDevice< tnlParallelReductionAbsMax< char, long int > >
                                    ( tnlParallelReductionAbsMax< char, long int >& operation,
@@ -100,4 +95,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionAbsMax< long double, lo
 #endif
 #endif
 
-#endif                                     
\ No newline at end of file
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-abs-min_impl.cu b/src/core/cuda/cuda-reduction-abs-min_impl.cu
index 21da19efa4345e2a1cb5251aef1bf2ee92607a67..6f2cfbbf7ece680d58566e701420d899fefa8d31 100644
--- a/src/core/cuda/cuda-reduction-abs-min_impl.cu
+++ b/src/core/cuda/cuda-reduction-abs-min_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -98,5 +93,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionAbsMin< long double, lo
                                      const typename tnlParallelReductionAbsMin< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionAbsMin< long double, long int> :: ResultType& result );
 #endif
-#endif                                    
-#endif                                     
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-abs-sum_impl.cu b/src/core/cuda/cuda-reduction-abs-sum_impl.cu
index 96c8ab7a9cca414b75a6cc4b4ec40eb36d81397d..100aa7b0b0c432400f3e56e2d098ac7f0928ef36 100644
--- a/src/core/cuda/cuda-reduction-abs-sum_impl.cu
+++ b/src/core/cuda/cuda-reduction-abs-sum_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -99,4 +94,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionAbsSum< long double, lo
                                      typename tnlParallelReductionAbsSum< long double, long int> :: ResultType& result );
 #endif
 #endif
-#endif                                     
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-and_impl.cu b/src/core/cuda/cuda-reduction-and_impl.cu
index 1baa1699f12b628fc8c8816f492934f9a421c186..b0665922dc7157831c9825692d85d0dbec511a94 100644
--- a/src/core/cuda/cuda-reduction-and_impl.cu
+++ b/src/core/cuda/cuda-reduction-and_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -97,5 +92,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionLogicalAnd< long double
                                      const typename tnlParallelReductionLogicalAnd< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionLogicalAnd< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-abs-max_impl.cu b/src/core/cuda/cuda-reduction-diff-abs-max_impl.cu
index a65ec09deeb1c76f398222acb6da5e8b6c7bb367..801277fc7dcb7b8ac0a311ecb3cb187f0bec4c06 100644
--- a/src/core/cuda/cuda-reduction-diff-abs-max_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-abs-max_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -98,5 +93,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffAbsMax< long double
                                      const typename tnlParallelReductionDiffAbsMax< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffAbsMax< long double, long int> :: ResultType& result );
 #endif
-#endif                        
-#endif             
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-abs-min_impl.cu b/src/core/cuda/cuda-reduction-diff-abs-min_impl.cu
index 9610ee2675e475d3a5fd82a07df93b82aada6f85..79b4cc21858ea83685dc39df88466ad4d14cbdb3 100644
--- a/src/core/cuda/cuda-reduction-diff-abs-min_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-abs-min_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 
@@ -99,5 +94,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffAbsMin< long double
                                      const typename tnlParallelReductionDiffAbsMin< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffAbsMin< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-abs-sum_impl.cu b/src/core/cuda/cuda-reduction-diff-abs-sum_impl.cu
index b70f953add3bb26af21820de4f55acb6223c034d..abe07d953ca2284833d3cbfb0d951061b5f6567f 100644
--- a/src/core/cuda/cuda-reduction-diff-abs-sum_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-abs-sum_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -98,5 +93,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffAbsSum< long double
                                      const typename tnlParallelReductionDiffAbsSum< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffAbsSum< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-l2-norm_impl.cu b/src/core/cuda/cuda-reduction-diff-l2-norm_impl.cu
index a6bfae5b949dc33bf6edfa2665201a7b6651713a..949bb1d7b17706acd68f1642cee95eca59cb9aaa 100644
--- a/src/core/cuda/cuda-reduction-diff-l2-norm_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-l2-norm_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -85,3 +80,5 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffL2Norm< long double
 #endif
 #endif
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-lp-norm_impl.cu b/src/core/cuda/cuda-reduction-diff-lp-norm_impl.cu
index a762c1d194db3debda0c4c6a0a740591d0df12aa..4551bc56eaeb97cd9f881a22b3d8de020c1af70a 100644
--- a/src/core/cuda/cuda-reduction-diff-lp-norm_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-lp-norm_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -85,3 +80,5 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffLpNorm< long double
 #endif
 #endif
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-max_impl.cu b/src/core/cuda/cuda-reduction-diff-max_impl.cu
index 822d9e779c5d15d3aedaee9b93390a7213d7417d..f3b945aaf3e8bd259b53f15927d0db110c568fd5 100644
--- a/src/core/cuda/cuda-reduction-diff-max_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-max_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -61,7 +56,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffMax< long double, i
                                      typename tnlParallelReductionDiffMax< long double, int> :: ResultType& result );
 #endif
 
-#ifdef INSTANTIATE_LONG_INT                                     
+#ifdef INSTANTIATE_LONG_INT
 template bool reductionOnCudaDevice< tnlParallelReductionDiffMax< char, long int > >
                                    ( tnlParallelReductionDiffMax< char, long int >& operation,
                                      const typename tnlParallelReductionDiffMax< char, long int > :: IndexType size,
@@ -98,5 +93,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffMax< long double, l
                                      const typename tnlParallelReductionDiffMax< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffMax< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-min_impl.cu b/src/core/cuda/cuda-reduction-diff-min_impl.cu
index 5973ad0bcf5a3ec65b49418125b14cffbc1d204b..aa7f409b06a57b44ddc2af6aad7c6f0e09ee53d1 100644
--- a/src/core/cuda/cuda-reduction-diff-min_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-min_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 
@@ -100,4 +95,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffMin< long double, l
                                      typename tnlParallelReductionDiffMin< long double, long int> :: ResultType& result );
 #endif
 #endif
-#endif                                     
\ No newline at end of file
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-diff-sum_impl.cu b/src/core/cuda/cuda-reduction-diff-sum_impl.cu
index 8f2eb27587117e1ce35ac8f39caf9cbb7891c90b..bf0c207ccfb0b9ed941ce74cd1035ee9a4114792 100644
--- a/src/core/cuda/cuda-reduction-diff-sum_impl.cu
+++ b/src/core/cuda/cuda-reduction-diff-sum_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -97,6 +92,8 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffSum< long double, l
                                      const typename tnlParallelReductionDiffSum< long double, long int > :: RealType* deviceInput1,
                                      const typename tnlParallelReductionDiffSum< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffSum< long double, long int> :: ResultType& result );
-#endif                                    
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-equalities_impl.cu b/src/core/cuda/cuda-reduction-equalities_impl.cu
index 398012099e47da5991ff7e97ff228c8ac564fdaf..d3e9fc4c36ba12754e68c591b29bbde52ea140e5 100644
--- a/src/core/cuda/cuda-reduction-equalities_impl.cu
+++ b/src/core/cuda/cuda-reduction-equalities_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -97,5 +92,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionEqualities< long double
                                      const typename tnlParallelReductionEqualities< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionEqualities< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-inequalities_impl.cu b/src/core/cuda/cuda-reduction-inequalities_impl.cu
index 479d9b2a31efec4c7131765e13186cd303aadea3..9ab552dc784ff0f308c7d7666efbf7f549915df3 100644
--- a/src/core/cuda/cuda-reduction-inequalities_impl.cu
+++ b/src/core/cuda/cuda-reduction-inequalities_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -98,4 +93,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionInequalities< long doub
                                      typename tnlParallelReductionInequalities< long double, long int> :: ResultType& result );
 #endif
 #endif
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-l2-norm_impl.cu b/src/core/cuda/cuda-reduction-l2-norm_impl.cu
index 214a15b53b37ef0ec780468b15701cb120e1d3c4..1aec1023dd591979bc8e634ca54b10823e4b103f 100644
--- a/src/core/cuda/cuda-reduction-l2-norm_impl.cu
+++ b/src/core/cuda/cuda-reduction-l2-norm_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -76,5 +71,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionL2Norm< long double, lo
                                      const typename tnlParallelReductionL2Norm< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionL2Norm< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-lp-norm_impl.cu b/src/core/cuda/cuda-reduction-lp-norm_impl.cu
index 4de950159022a52d973982c0d60b0ccd99951bdb..d4d325ac3ff83a45aec174b5cb8b126a7ef66385 100644
--- a/src/core/cuda/cuda-reduction-lp-norm_impl.cu
+++ b/src/core/cuda/cuda-reduction-lp-norm_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -76,5 +71,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionLpNorm< long double, lo
                                      const typename tnlParallelReductionLpNorm< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionLpNorm< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
diff --git a/src/core/cuda/cuda-reduction-max_impl.cu b/src/core/cuda/cuda-reduction-max_impl.cu
index cfca4156f9ba521d7c6625f475126ecae546b91d..ccafbf087c09cde40f08b875e73065439e8fe515 100644
--- a/src/core/cuda/cuda-reduction-max_impl.cu
+++ b/src/core/cuda/cuda-reduction-max_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -99,4 +94,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionMax< long double, long
                                      typename tnlParallelReductionMax< long double, long int> :: ResultType& result );
 #endif
 #endif
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
diff --git a/src/core/cuda/cuda-reduction-min_impl.cu b/src/core/cuda/cuda-reduction-min_impl.cu
index 535b38a32f8199fe6fc05abe5b59cff7cdace55c..449bf14dd90bad24bcf1a107ec58f0904276e51d 100644
--- a/src/core/cuda/cuda-reduction-min_impl.cu
+++ b/src/core/cuda/cuda-reduction-min_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -99,4 +94,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionMin< long double, long
                                      typename tnlParallelReductionMin< long double, long int> :: ResultType& result );
 #endif
 #endif
-#endif
\ No newline at end of file
+#endif
+
+} // namespace TNL
diff --git a/src/core/cuda/cuda-reduction-or_impl.cu b/src/core/cuda/cuda-reduction-or_impl.cu
index f312e5ff45b73080f11cb8f1d89908a613ecacff..b32dbf6ee411fd823f531a13c8e777568830b393 100644
--- a/src/core/cuda/cuda-reduction-or_impl.cu
+++ b/src/core/cuda/cuda-reduction-or_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -97,5 +92,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionLogicalOr< long double,
                                      const typename tnlParallelReductionLogicalOr< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionLogicalOr< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction-scalar-product_impl.cu b/src/core/cuda/cuda-reduction-scalar-product_impl.cu
index 6de27958bdd8bdb15827808c9d2f7fc5aeb72ff5..18183f4271ce2f0d3461186cc23b0496371268ce 100644
--- a/src/core/cuda/cuda-reduction-scalar-product_impl.cu
+++ b/src/core/cuda/cuda-reduction-scalar-product_impl.cu
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -97,5 +92,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionScalarProduct< long dou
                                      const typename tnlParallelReductionScalarProduct< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionScalarProduct< long double, long int> :: ResultType& result );
 #endif
-#endif                                     
-#endif
\ No newline at end of file
+#endif
+#endif
+
+} // namespace TNL
diff --git a/src/core/cuda/cuda-reduction-sum_impl.cu b/src/core/cuda/cuda-reduction-sum_impl.cu
index 62ed0a2beb59e6e71be42552df0a16f28c8ad24d..9f90a1dd8961b738709cc5e7ed915397f7b715f3 100644
--- a/src/core/cuda/cuda-reduction-sum_impl.cu
+++ b/src/core/cuda/cuda-reduction-sum_impl.cu
@@ -6,22 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
  
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
- * Sum 
+ * Sum
  */
 
 template bool reductionOnCudaDevice< tnlParallelReductionSum< char, int > >
@@ -97,6 +92,8 @@ template bool reductionOnCudaDevice< tnlParallelReductionSum< long double, long
                                      const typename tnlParallelReductionSum< long double, long int > :: RealType* deviceInput1,
                                      const typename tnlParallelReductionSum< long double, long int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionSum< long double, long int> :: ResultType& result );
-#endif                                     
-#endif                                     
 #endif
+#endif
+#endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/cuda/cuda-reduction.h b/src/core/cuda/cuda-reduction.h
index a6ade8235577647b5fe810eb03fa473e87ec9b02..f1c54560e46040313c49372dd0ae6a016e4fc508 100644
--- a/src/core/cuda/cuda-reduction.h
+++ b/src/core/cuda/cuda-reduction.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef CUDA_REDUCTION_H_
-#define CUDA_REDUCTION_H_
+#pragma once 
+
+namespace TNL {
 
 template< typename Operation >
 bool reductionOnCudaDevice( const Operation& operation,
@@ -25,6 +19,7 @@ bool reductionOnCudaDevice( const Operation& operation,
                             const typename Operation :: RealType* deviceInput2,
                             typename Operation :: ResultType& result );
 
+} // namespace TNL
+
 #include <core/cuda/cuda-reduction_impl.h>
 
-#endif /* CUDA_REDUCTION_H_ */
diff --git a/src/core/cuda/cuda-reduction_impl.cpp b/src/core/cuda/cuda-reduction_impl.cpp
index 2ee566873630881b712ae7bb117c03353a1b7456..a6c1f288e1e5bb9fa49c7971e87d1a8334fc3a12 100644
--- a/src/core/cuda/cuda-reduction_impl.cpp
+++ b/src/core/cuda/cuda-reduction_impl.cpp
@@ -6,18 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/cuda/reduction-operations.h>
 #include <core/cuda/cuda-reduction.h>
 
+namespace TNL {
+
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -1077,7 +1072,7 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffMin< long double, i
                                      const typename tnlParallelReductionDiffMin< long double, int > :: RealType* deviceInput1,
                                      const typename tnlParallelReductionDiffMin< long double, int > :: RealType* deviceInput2,
                                      typename tnlParallelReductionDiffMin< long double, int> :: ResultType& result );
-#endif 
+#endif
 
 #ifdef INSTANTIATE_LONG_INT
 template bool reductionOnCudaDevice< tnlParallelReductionDiffMin< char, long int > >
@@ -1499,6 +1494,6 @@ template bool reductionOnCudaDevice< tnlParallelReductionDiffLpNorm< long double
 #endif
 #endif
 
-#endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
+} // namespace TNL
 
 
diff --git a/src/core/cuda/cuda-reduction_impl.h b/src/core/cuda/cuda-reduction_impl.h
index e8795ec7bceb1373fc4e9af41fb61b6124b86778..138a5059ae433b342f2bd24983ca2d503ccd9b84 100644
--- a/src/core/cuda/cuda-reduction_impl.h
+++ b/src/core/cuda/cuda-reduction_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef CUDA_REDUCTION_IMPL_H_
-#define CUDA_REDUCTION_IMPL_H_
+#pragma once 
+
+namespace TNL {
 
 //#define CUDA_REDUCTION_PROFILING
 
@@ -69,24 +63,24 @@ typename Operation::IndexType reduceOnCudaDevice( Operation& operation,
    typedef typename Operation::IndexType IndexType;
    typedef typename Operation::RealType RealType;
    typedef typename Operation::ResultType ResultType;
-   
-   const IndexType desGridSize( minGPUReductionDataSize );   
-   dim3 blockSize( 256 ), gridSize( 0 );   
+ 
+   const IndexType desGridSize( minGPUReductionDataSize );
+   dim3 blockSize( 256 ), gridSize( 0 );
    gridSize.x = Min( tnlCuda::getNumberOfBlocks( size, blockSize.x ), desGridSize );
-  
+ 
    // create reference to the reduction buffer singleton and set default size
    tnlCudaReductionBuffer & cudaReductionBuffer = tnlCudaReductionBuffer::getInstance( 8 * minGPUReductionDataSize );
-   
+ 
    //tnlCudaReductionBuffer cudaReductionBuffer( 8 * minGPUReductionDataSize );
    if( ! cudaReductionBuffer.setSize( gridSize.x * sizeof( ResultType ) ) )
       return false;
-   output = cudaReductionBuffer.template getData< ResultType >();      
+   output = cudaReductionBuffer.template getData< ResultType >();
    IndexType shmem = blockSize.x * sizeof( ResultType );
-   
+ 
    /***
     * Depending on the blockSize we generate appropriate template instance.
     */
-   switch( blockSize.x )         
+   switch( blockSize.x )
    {
       case 512:
          tnlCUDAReductionKernel< Operation, 512 >
@@ -147,18 +141,18 @@ bool reductionOnCudaDevice( Operation& operation,
    typedef typename Operation::RealType RealType;
    typedef typename Operation::ResultType ResultType;
    typedef typename Operation::LaterReductionOperation LaterReductionOperation;
-   
+ 
    /***
     * First check if the input array(s) is/are large enough for the reduction on GPU.
     * Otherwise copy it/them to host and reduce on CPU.
-    */   
+    */
    RealType hostArray1[ minGPUReductionDataSize ];
    RealType hostArray2[ minGPUReductionDataSize ];
    if( size <= minGPUReductionDataSize )
    {
       if( ! tnlArrayOperations< tnlHost, tnlCuda >::copyMemory< RealType, RealType, IndexType >( hostArray1, deviceInput1, size ) )
          return false;
-      if( deviceInput2 && ! 
+      if( deviceInput2 && !
           tnlArrayOperations< tnlHost, tnlCuda >::copyMemory< RealType, RealType, IndexType >( hostArray2, deviceInput2, size ) )
          return false;
       result = operation.initialValue();
@@ -171,11 +165,11 @@ bool reductionOnCudaDevice( Operation& operation,
       tnlTimerRT timer;
       timer.reset();
       timer.start();
-   #endif   
+   #endif
 
    /****
     * Reduce the data on the CUDA device.
-    */      
+    */
    ResultType* deviceAux1( 0 );
    IndexType reducedSize = reduceOnCudaDevice( operation,
                                                size,
@@ -187,7 +181,7 @@ bool reductionOnCudaDevice( Operation& operation,
       cout << "   Reduction on GPU to size " << reducedSize << " took " << timer.getTime() << " sec. " << endl;
       timer.reset();
       timer.start();
-   #endif   
+   #endif
 
    /***
     * Transfer the reduced data from device to host.
@@ -195,30 +189,30 @@ bool reductionOnCudaDevice( Operation& operation,
    ResultType resultArray[ minGPUReductionDataSize ];
    if( ! tnlArrayOperations< tnlHost, tnlCuda >::copyMemory< ResultType, ResultType, IndexType >( resultArray, deviceAux1, reducedSize ) )
       return false;
-   
-   #ifdef CUDA_REDUCTION_PROFILING   
+ 
+   #ifdef CUDA_REDUCTION_PROFILING
       timer.stop();
       cout << "   Transferring data to CPU took " << timer.getTime() << " sec. " << endl;
-   #endif   
+   #endif
 
    #ifdef CUDA_REDUCTION_PROFILING
       timer.reset();
       timer.start();
-   #endif      
-   
+   #endif
+ 
    /***
     * Reduce the data on the host system.
-    */    
+    */
    LaterReductionOperation laterReductionOperation;
    result = laterReductionOperation. initialValue();
    for( IndexType i = 0; i < reducedSize; i ++ )
       result = laterReductionOperation.reduceOnHost( i, result, resultArray, ( ResultType*) 0 );
-   
+ 
    #ifdef CUDA_REDUCTION_PROFILING
       timer.stop();
       cout << "   Reduction of small data set on CPU took " << timer.getTime() << " sec. " << endl;
-   #endif 
-   
+   #endif
+ 
    return checkCudaDevice;
 #else
    tnlCudaSupportMissingMessage;;
@@ -1715,4 +1709,4 @@ extern template bool reductionOnCudaDevice< tnlParallelReductionDiffLpNorm< long
 
 #endif /* TEMPLATE_EXPLICIT_INSTANTIATION */
 
-#endif /* CUDA_REDUCTION_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/cuda/reduction-operations.h b/src/core/cuda/reduction-operations.h
index 0cc066e946329302fc4eed5e6e31e7fc81745be4..e0682c9d51c4c191d6e3b3d17990a68486f7c8c7 100644
--- a/src/core/cuda/reduction-operations.h
+++ b/src/core/cuda/reduction-operations.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef REDUCTION_OPERATIONS_H_
-#define REDUCTION_OPERATIONS_H_
+#pragma once 
 
 #include <core/tnlConstants.h>
 #include <core/tnlCuda.h>
@@ -24,7 +16,12 @@
 #ifdef HAVE_CUDA
 #include <cuda.h>
 #include <core/mfuncs.h>
+#endif
+
+
+namespace TNL {
 
+#ifdef HAVE_CUDA
 /***
  * This function returns minimum of two numbers stored on the device.
  * TODO: Make it tnlMin, tnlMax etc.
@@ -207,17 +204,17 @@ class tnlParallelReductionSum
    {
       return current + data1[ idx ];
    };
-   
+ 
    __cuda_callable__ ResultType initialValue() { return 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result += data1[ index ];
    }
-   
+ 
 #ifdef HAVE_CUDA
 
    __device__ void commonReductionOnDevice( ResultType& result,
@@ -225,7 +222,7 @@ class tnlParallelReductionSum
    {
       result += data;
    };
-   
+ 
    __device__ void commonReductionOnDevice( volatile ResultType& result,
                                             volatile const ResultType& data )
    {
@@ -254,28 +251,28 @@ class tnlParallelReductionMin
    };
 
    __cuda_callable__ ResultType initialValue() { return tnlMaxValue< ResultType>(); };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result = tnlCudaMin( result, data1[ index ] );
    }
-   
-#ifdef HAVE_CUDA   
+ 
+#ifdef HAVE_CUDA
    __device__ void commonReductionOnDevice( ResultType& result,
                                             const ResultType& data )
    {
       result = tnlCudaMin( result, data );
    };
-   
+ 
    __device__ void commonReductionOnDevice( volatile ResultType& result,
                                             volatile const ResultType& data )
    {
       result = tnlCudaMin( result, data );
    };
-   
+ 
 
 #endif
 };
@@ -299,16 +296,16 @@ class tnlParallelReductionMax
    };
 
    __cuda_callable__ ResultType initialValue() { return tnlMinValue< ResultType>(); };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result = tnlCudaMax( result, data1[ index ] );
-   }   
-   
-#ifdef HAVE_CUDA   
+   }
+ 
+#ifdef HAVE_CUDA
    __device__ void commonReductionOnDevice( ResultType& result,
                                             const ResultType& data )
    {
@@ -319,7 +316,7 @@ class tnlParallelReductionMax
                                             volatile const ResultType& data )
    {
       result = tnlCudaMax( result, data );
-   };   
+   };
 #endif
 };
 
@@ -342,29 +339,29 @@ class tnlParallelReductionLogicalAnd
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) true; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result = result && data1[ index ];
    }
-   
-   
-#ifdef HAVE_CUDA   
+ 
+ 
+#ifdef HAVE_CUDA
    __device__ void commonReductionOnDevice( ResultType& result,
                                             const ResultType& data )
    {
       result = result && data;
    };
-   
+ 
    __device__ void commonReductionOnDevice( volatile ResultType& result,
                                             volatile const ResultType& data )
    {
       result = result && data;
    };
-   
+ 
 
 #endif
 };
@@ -387,10 +384,10 @@ class tnlParallelReductionLogicalOr
    {
       return current || data1[ idx ];
    };
-   
+ 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) false; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -405,7 +402,7 @@ class tnlParallelReductionLogicalOr
    {
       result = result || data;
    };
-   
+ 
    __device__ void commonReductionOnDevice( volatile ResultType& result,
                                             volatile const ResultType& data )
    {
@@ -434,7 +431,7 @@ class tnlParallelReductionAbsSum : public tnlParallelReductionSum< Real, Index >
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
 
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -462,14 +459,14 @@ class tnlParallelReductionAbsMin : public tnlParallelReductionMin< Real, Index >
    };
 
    __cuda_callable__ ResultType initialValue() { return tnlMaxValue< ResultType>(); };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result = tnlCudaMin( result, tnlCudaAbs( data1[ index ] ) );
-   }   
+   }
 };
 
 template< typename Real, typename Index >
@@ -492,13 +489,13 @@ class tnlParallelReductionAbsMax : public tnlParallelReductionMax< Real, Index >
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
 
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result = tnlCudaMax( result, tnlCudaAbs( data1[ index ] ) );
-   }   
+   }
 };
 
 template< typename Real, typename Index >
@@ -521,8 +518,8 @@ class tnlParallelReductionL2Norm : public tnlParallelReductionSum< Real, Index >
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -557,15 +554,15 @@ class tnlParallelReductionLpNorm : public tnlParallelReductionSum< Real, Index >
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result += tnlCudaPow( tnlCudaAbs( data1[ index ] ), p );
    }
-   
+ 
    protected:
 
    RealType p;
@@ -589,9 +586,9 @@ class tnlParallelReductionEqualities : public tnlParallelReductionLogicalAnd< bo
       return current && ( data1[ idx ] == data2[ idx ] );
    };
 
-   __cuda_callable__ ResultType initialValue() { return ( ResultType ) true; }; 
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+   __cuda_callable__ ResultType initialValue() { return ( ResultType ) true; };
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -619,8 +616,8 @@ class tnlParallelReductionInequalities : public tnlParallelReductionLogicalAnd<
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) false; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -648,14 +645,14 @@ class tnlParallelReductionScalarProduct : public tnlParallelReductionSum< Real,
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ inline void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ inline void cudaFirstReduction( ResultType& result,
                                                  const IndexType& index,
                                                  const RealType* data1,
                                                  const RealType* data2 )
    {
       result += data1[ index ] * data2[ index ];
-   }   
+   }
 };
 
 template< typename Real, typename Index >
@@ -675,16 +672,16 @@ class tnlParallelReductionDiffSum : public tnlParallelReductionSum< Real, Index
    {
       return current + ( data1[ idx ] - data2[ idx ] );
    };
-   
-   __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };   
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                           const IndexType& index,
                                           const RealType* data1,
                                           const RealType* data2 )
    {
       result += data1[ index ] - data2[ index ];
-   }   
+   }
 };
 
 template< typename Real, typename Index >
@@ -706,8 +703,8 @@ class tnlParallelReductionDiffMin : public tnlParallelReductionMin< Real, Index
    };
 
    __cuda_callable__ ResultType initialValue() { return tnlMaxValue< ResultType>(); };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                           const IndexType& index,
                                           const RealType* data1,
                                           const RealType* data2 )
@@ -735,8 +732,8 @@ class tnlParallelReductionDiffMax : public tnlParallelReductionMax< Real, Index
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -764,8 +761,8 @@ class tnlParallelReductionDiffAbsSum : public tnlParallelReductionMax< Real, Ind
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                           const IndexType& index,
                                           const RealType* data1,
                                           const RealType* data2 )
@@ -793,8 +790,8 @@ class tnlParallelReductionDiffAbsMin : public tnlParallelReductionMin< Real, Ind
    };
 
    __cuda_callable__ ResultType initialValue() { return tnlMaxValue< ResultType>(); };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                           const IndexType& index,
                                           const RealType* data1,
                                           const RealType* data2 )
@@ -822,8 +819,8 @@ class tnlParallelReductionDiffAbsMax : public tnlParallelReductionMax< Real, Ind
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                           const IndexType& index,
                                           const RealType* data1,
                                           const RealType* data2 )
@@ -852,8 +849,8 @@ class tnlParallelReductionDiffL2Norm : public tnlParallelReductionSum< Real, Ind
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
@@ -861,9 +858,9 @@ class tnlParallelReductionDiffL2Norm : public tnlParallelReductionSum< Real, Ind
       this->aux = data2[ index ] - data1[ index ];
       result += aux * aux;
    }
-   
+ 
    protected:
-      
+ 
       RealType aux;
 };
 
@@ -891,19 +888,20 @@ class tnlParallelReductionDiffLpNorm : public tnlParallelReductionSum< Real, Ind
    };
 
    __cuda_callable__ ResultType initialValue() { return ( ResultType ) 0; };
-   
-   __cuda_callable__ void cudaFirstReduction( ResultType& result, 
+ 
+   __cuda_callable__ void cudaFirstReduction( ResultType& result,
                                               const IndexType& index,
                                               const RealType* data1,
                                               const RealType* data2 )
    {
       result += tnlCudaPow( tnlCudaAbs( data1[ index ] - data2[ index ] ), p );
    }
-   
+ 
    protected:
 
    RealType p;
 };
 
 
-#endif /* REDUCTION_OPERATIONS_H_ */
+} // namespace TNL
+
diff --git a/src/core/cuda/tnlCublasWrapper.h b/src/core/cuda/tnlCublasWrapper.h
index 54d3e861a251605886f37c40ae1ecb0b1571504d..7f14c3dea24cdf7b378522eb39826794768ae78e 100644
--- a/src/core/cuda/tnlCublasWrapper.h
+++ b/src/core/cuda/tnlCublasWrapper.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUBLASWARPER_H
-#define	TNLCUBLASWARPER_H
+#pragma once
 
 #if defined HAVE_CUBLAS && defined HAVE_CUDA
 #include <cublas_v2.h>
 #endif
 
-template< typename Real1, 
+namespace TNL {
+
+template< typename Real1,
           typename Real2,
           typename Index >
 class tnlCublasWrapper
@@ -31,7 +25,7 @@ class tnlCublasWrapper
         static bool dot( const Real1* v1, const Real2* v2, const Index size, Real1& result)
         {
             return false;
-        }        
+        }
 };
 
 #if defined HAVE_CUBLAS && defined HAVE_CUDA
@@ -48,7 +42,7 @@ class tnlCublasWrapper< float, float, Index >
             cublasSdot( handle, size, v1, 1, v2, 1, &result );
             cublasDestroy( handle );
             return false;
-        }        
+        }
 };
 
 template< typename Index >
@@ -62,9 +56,9 @@ class tnlCublasWrapper< double, double, Index >
             cublasDdot( handle, size, v1, 1, v2, 1, &result );
             cublasDestroy( handle );
             return false;
-        }        
+        }
 };
-#endif            
+#endif
 
-#endif	/* TNLCUBLASWARPER_H */
+} // namespace TNL
 
diff --git a/src/core/cuda/tnlCudaReduction.h b/src/core/cuda/tnlCudaReduction.h
index d5084cff8bc8a7bfcab573d23f4c867a631309c8..90db9d68b7d2e8ab809e009322d815a32f787ff0 100644
--- a/src/core/cuda/tnlCudaReduction.h
+++ b/src/core/cuda/tnlCudaReduction.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDAREDUCTION_H
-#define	TNLCUDAREDUCTION_H
+#pragma once
 
+namespace TNL {
+   
 #ifdef HAVE_CUDA
 
 template< typename Operation, int blockSize >
@@ -29,24 +23,24 @@ class tnlCUDAReduction
       typedef typename Operation::RealType RealType;
       typedef typename Operation::ResultType ResultType;
 
-      
+ 
       __device__ static void reduce( Operation& operation,
                                      const IndexType size,
                                      const RealType* input1,
                                      const RealType* input2,
                                      ResultType* output );
 };
-      
+ 
 /*template< typename Real, typename Index, int blockSize >
 class tnlCUDAReduction< tnlParallelReductionScalarProduct< Real, Index >, blockSize >
 {
    public:
-      
-      typedef tnlParallelReductionScalarProduct< Real, Index > Operation;      
+ 
+      typedef tnlParallelReductionScalarProduct< Real, Index > Operation;
       typedef typename Operation::IndexType IndexType;
       typedef typename Operation::RealType RealType;
       typedef typename Operation::ResultType ResultType;
-      
+ 
       __device__ static void reduce( Operation operation,
                                      const IndexType size,
                                      const RealType* input1,
@@ -58,5 +52,5 @@ class tnlCUDAReduction< tnlParallelReductionScalarProduct< Real, Index >, blockS
 
 #endif
 
-#endif	/* TNLCUDAREDUCTION_H */
+} // namespace TNL
 
diff --git a/src/core/cuda/tnlCudaReductionBuffer.h b/src/core/cuda/tnlCudaReductionBuffer.h
index b47ab5baa5539580e34724d4807f61f8f72df697..8ad11c60b4ef67e2f2395c37cad3f2528342d9fd 100644
--- a/src/core/cuda/tnlCudaReductionBuffer.h
+++ b/src/core/cuda/tnlCudaReductionBuffer.h
@@ -6,22 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDAREDUCTIONBUFFER_H
-#define	TNLCUDAREDUCTIONBUFFER_H
+#pragma once
 
 #include <stdlib.h>
-
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 class tnlCudaReductionBuffer
 {
    public:
@@ -92,5 +85,5 @@ class tnlCudaReductionBuffer
 };
 
 
-#endif	/* TNLCUDAREDUCTIONBUFFER_H */
+} // namespace TNL
 
diff --git a/src/core/cuda/tnlCudaReduction_impl.h b/src/core/cuda/tnlCudaReduction_impl.h
index 5fa295f65eb7642278ad25da914146339455060e..e26ffe94ad003bbd453bd99fcc7c88c7199da91e 100644
--- a/src/core/cuda/tnlCudaReduction_impl.h
+++ b/src/core/cuda/tnlCudaReduction_impl.h
@@ -6,19 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDAREDUCTION_IMPL_H
-#define	TNLCUDAREDUCTION_IMPL_H
+#pragma once
 
-template< typename Operation, int blockSize >      
+namespace TNL {
+
+template< typename Operation, int blockSize >
 __device__
 void
 tnlCUDAReduction< Operation, blockSize >::
@@ -154,7 +148,7 @@ reduce( Operation& operation,
 
 #ifdef UNDEF
 
-template< typename Real, typename Index, int blockSize >      
+template< typename Real, typename Index, int blockSize >
 __device__
 void
 tnlCUDAReduction< tnlParallelReductionScalarProduct< Real, Index >, blockSize >::
@@ -166,7 +160,7 @@ reduce( Operation& operation,
 {
   extern __shared__ __align__ ( 8 ) char __sdata[];
 
-   ResultType* sdata = reinterpret_cast< ResultType* >( __sdata );        
+   ResultType* sdata = reinterpret_cast< ResultType* >( __sdata );
 
    /***
     * Get thread id (tid) and global thread id (gid).
@@ -292,5 +286,5 @@ reduce( Operation& operation,
 
 #endif
 
-#endif	/* TNLCUDAREDUCTION_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/images/tnlDicomHeader.h b/src/core/images/tnlDicomHeader.h
index 06614abec124c0c801967eb7ceb2a6260f8e7499..1e080606e0292f56d72b9e84b4472a87206087a6 100644
--- a/src/core/images/tnlDicomHeader.h
+++ b/src/core/images/tnlDicomHeader.h
@@ -2,24 +2,16 @@
                           tnlDicomHeader.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDICOMHEADER_H
-#define TNLDICOMHEADER_H
+#pragma once 
 
 #include <tnlConfig.h>
 
@@ -29,6 +21,8 @@
 #include <dcmtk/dcmdata/dcdeftag.h>
 #endif
 
+namespace TNL {
+
 class tnlDicomSeriesInfo;
 class tnlDicomPatientInfo;
 class tnlDicomImageInfo;
@@ -41,38 +35,39 @@ class tnlDicomImageInfo;
 class tnlDicomHeader
 {
    public:
-      
+ 
       inline tnlDicomHeader();
-      
+ 
       inline virtual ~tnlDicomHeader();
 
-#ifdef HAVE_DCMTK_H      
+#ifdef HAVE_DCMTK_H
       inline DcmFileFormat &getFileFormat();
 #endif
-      
+ 
       inline tnlDicomImageInfo &getImageInfo();
-      
+ 
       inline tnlDicomPatientInfo &getPatientInfo();
-      
+ 
       inline tnlDicomSeriesInfo &getSeriesInfo();
 
       inline bool loadFromFile( const tnlString& fileName );
 
    protected:
-      
+ 
       tnlDicomImageInfo *imageInfoObj;
-      
+ 
       tnlDicomPatientInfo *patientInfoObj;
-      
+ 
       tnlDicomSeriesInfo *seriesInfoObj;
 
-#ifdef HAVE_DCMTK_H      
+#ifdef HAVE_DCMTK_H
       DcmFileFormat *fileFormat;
 #endif
-      
+ 
       bool isLoaded;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlDicomHeader_impl.h>
 
-#endif // TNLDICOMHEADER_H
diff --git a/src/core/images/tnlDicomHeader_impl.h b/src/core/images/tnlDicomHeader_impl.h
index cbecc1eb1951cbd837aaab73425ce1e0b117b854..eb7261e549afce048115f6dd028d69783cfb1349 100644
--- a/src/core/images/tnlDicomHeader_impl.h
+++ b/src/core/images/tnlDicomHeader_impl.h
@@ -2,32 +2,29 @@
                           tnlDicomHeader_impl.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/images/tnlDicomHeader.h>
 #include <core/images/tnlDicomSeriesInfo.h>
 #include <core/images/tnlDicomPatientInfo.h>
 #include <core/images/tnlDicomImageInfo.h>
 
+namespace TNL {
+
 inline tnlDicomHeader::tnlDicomHeader()
 {
 #ifdef HAVE_DCMTK_H
     fileFormat = new DcmFileFormat();
-#endif    
+#endif
     isLoaded = false;
     imageInfoObj = new tnlDicomImageInfo(*this);
     patientInfoObj = new tnlDicomPatientInfo(*this);
@@ -39,9 +36,9 @@ inline tnlDicomHeader::~tnlDicomHeader()
     delete imageInfoObj;
     delete patientInfoObj;
     delete seriesInfoObj;
-#ifdef HAVE_DCMTK_H    
+#ifdef HAVE_DCMTK_H
     delete fileFormat;
-#endif    
+#endif
 }
 
 inline bool tnlDicomHeader::loadFromFile( const tnlString& fileName )
@@ -53,7 +50,7 @@ inline bool tnlDicomHeader::loadFromFile( const tnlString& fileName )
         isLoaded = true;
         return true;
     }
-#endif    
+#endif
     isLoaded = false;
     return false;
 }
@@ -80,3 +77,5 @@ inline tnlDicomSeriesInfo &tnlDicomHeader::getSeriesInfo()
     return *seriesInfoObj;
 }
 
+} // namespace TNL
+
diff --git a/src/core/images/tnlDicomImageInfo.h b/src/core/images/tnlDicomImageInfo.h
index feb0e91acf4a5aac6610fbafb4441c1d271bfd66..3303664c23e4d594dabce3aa1227de2e5162295b 100644
--- a/src/core/images/tnlDicomImageInfo.h
+++ b/src/core/images/tnlDicomImageInfo.h
@@ -2,24 +2,16 @@
                           tnlDicomImageInfo.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDICOMIMAGEINFO_H
-#define TNLDICOMIMAGEINFO_H
+#pragma once
 
 #include <tnlConfig.h>
 
@@ -29,6 +21,8 @@
 #include <dcmtk/dcmdata/dcdeftag.h>
 #endif
 
+namespace TNL {
+
 class tnlDicomHeader;
 
 /***ImageInfoObj class stores selected informations about images.
@@ -58,46 +52,47 @@ struct PixelSpacing
 class tnlDicomImageInfo
 {
    public:
-      
+ 
       inline tnlDicomImageInfo( tnlDicomHeader &tnlDicomHeader);
-       
+ 
       inline virtual ~tnlDicomImageInfo();
 
       inline ImagePositionToPatient getImagePositionToPatient();
-      
+ 
       inline ImageOrientationToPatient getImageOrientationToPatient();
-       
+ 
       inline double getSliceThickness();
-       
+ 
       inline double getSliceLocation();
-       
+ 
       inline PixelSpacing getPixelSpacing();
-       
+ 
       inline int getNumberOfSlices();
 
    private:
-      
+ 
       tnlDicomHeader &dicomHeader;
-       
+ 
       bool retrieveInfo();
-       
+ 
       bool isObjectRetrieved;
 
       double sliceLocation;
-       
+ 
       double sliceThickness;
-       
+ 
       ImagePositionToPatient imagePositionToPatient;
-       
+ 
       ImageOrientationToPatient imageOrientationToPatient;
-              
+ 
       PixelSpacing pixelSpacing;
-       
+ 
       int numberOfSlices;
-       
+ 
       int width, height, depth;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlDicomImageInfo_impl.h>
 
-#endif // TNLDICOMIMAGEINFO_H
diff --git a/src/core/images/tnlDicomImageInfo_impl.h b/src/core/images/tnlDicomImageInfo_impl.h
index 90f6d590b43ab835ae24c20eb347d2e92ab15cc1..a4504169107d748ad5706c5ff91fec9087f1a80e 100644
--- a/src/core/images/tnlDicomImageInfo_impl.h
+++ b/src/core/images/tnlDicomImageInfo_impl.h
@@ -2,25 +2,22 @@
                           tnlDicomImageInfo_impl.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/images/tnlDicomImageInfo.h>
 #include <core/images/tnlDicomHeader.h>
 
+namespace TNL {
+
 inline tnlDicomImageInfo::tnlDicomImageInfo( tnlDicomHeader& dicomHeader )
 : dicomHeader( dicomHeader )
 {
@@ -61,7 +58,7 @@ inline bool tnlDicomImageInfo::retrieveInfo()
 #else
    cerr << "DICOM format is not supported in this build of TNL." << endl;
    return false;
-#endif   
+#endif
 }
 
 inline ImagePositionToPatient tnlDicomImageInfo::getImagePositionToPatient()
@@ -105,3 +102,5 @@ inline int tnlDicomImageInfo::getNumberOfSlices()
         retrieveInfo();
     return numberOfSlices;
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/images/tnlDicomPatientInfo.h b/src/core/images/tnlDicomPatientInfo.h
index 1220d208f90892c10e9ef28342c6c805eea338b1..2be83a3c3fa9900e18aecf8f57e5fd7b11410737 100644
--- a/src/core/images/tnlDicomPatientInfo.h
+++ b/src/core/images/tnlDicomPatientInfo.h
@@ -2,27 +2,16 @@
                           tnlDicomPatientInfo.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDICOMPATIENTINFO_H
-#define TNLDICOMPATIENTINFO_H
-
-class tnlDicomHeader;
+#pragma once
 
 #include <core/tnlString.h>
 #include <tnlConfig.h>
@@ -35,6 +24,10 @@ class tnlDicomHeader;
 #include <dcmtk/ofstd/ofstring.h>
 #endif
 
+namespace TNL {
+
+class tnlDicomHeader;
+
 /***
  * PatientInfoObj class stores selected informations about patient.
  * (accesses information via tnlDicomHeader class)
@@ -42,21 +35,21 @@ class tnlDicomHeader;
 class tnlDicomPatientInfo
 {
    public:
-      
+ 
       inline tnlDicomPatientInfo(tnlDicomHeader &atnlDicomHeader);
-       
+ 
       inline virtual ~tnlDicomPatientInfo();
 
       inline const tnlString& getName();
-       
+ 
       inline const tnlString& getSex();
-       
+ 
       inline const tnlString& getID();
-       
+ 
       inline const tnlString& getWeight();
-       
+ 
       inline const tnlString& getPosition();
-       
+ 
       inline const tnlString& getOrientation();
 
    private:
@@ -78,6 +71,7 @@ class tnlDicomPatientInfo
        tnlString patientOrientation;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlDicomPatientInfo_impl.h>
 
-#endif // TNLDICOMPATIENTINFO_H
diff --git a/src/core/images/tnlDicomPatientInfo_impl.h b/src/core/images/tnlDicomPatientInfo_impl.h
index e61032b0e424b3b19c8ec6170e59d13aade9170f..649bae151598c2a0f41ff9e872139a619f978c5d 100644
--- a/src/core/images/tnlDicomPatientInfo_impl.h
+++ b/src/core/images/tnlDicomPatientInfo_impl.h
@@ -2,22 +2,16 @@
                           tnlDicomPatientInfo_impl.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
 #include "tnlDicomPatientInfo.h"
 #include "tnlDicomHeader.h"
@@ -28,6 +22,8 @@
 #include <dcmtk/ofstd/ofstring.h>
 #endif
 
+namespace TNL
+
 inline tnlDicomPatientInfo::tnlDicomPatientInfo( tnlDicomHeader &dicomHeader )
 : dicomHeader( dicomHeader )
 {
@@ -51,16 +47,16 @@ inline bool tnlDicomPatientInfo::retrieveInfo()
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientWeight, str );
    this->weight.setString( str.data() );
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientPosition, str );
-   this->patientPosition.setString( str.data() ); 
+   this->patientPosition.setString( str.data() );
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientOrientation, str );
-   this->patientOrientation.setString( str.data() ); 
+   this->patientOrientation.setString( str.data() );
 
    isObjectRetrieved = true;
    return true;
 #else
    cerr << "DICOM format is not supported in this build of TNL." << endl;
    return false;
-#endif   
+#endif
 }
 
 inline const tnlString& tnlDicomPatientInfo::getName()
@@ -104,3 +100,5 @@ inline const tnlString& tnlDicomPatientInfo::getOrientation()
         retrieveInfo();
     return patientOrientation;
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/images/tnlDicomSeries.h b/src/core/images/tnlDicomSeries.h
index 0f007396a950f1d4fbeab5dfed6a192f1d981744..ff927cf2b0953a2ef67677e1cdcd34abda19ddcb 100644
--- a/src/core/images/tnlDicomSeries.h
+++ b/src/core/images/tnlDicomSeries.h
@@ -3,24 +3,16 @@
                              -------------------
     begin                : Jul 31, 2015
     copyright            : (C) 2015 by Tomas Oberhuber et al.
-     
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
-  
+ 
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDICOMSERIES_H
-#define TNLDICOMSERIES_H
+#pragma once
 
 #include <core/arrays/tnlArray.h>
 #include <core/tnlList.h>
@@ -32,7 +24,6 @@
 #include <mesh/tnlGrid.h>
 #include <tnlConfig.h>
 
-
 #ifdef HAVE_DCMTK_H
 #define USING_STD_NAMESPACE
 #include <dcmtk/config/osconfig.h>
@@ -42,6 +33,8 @@
 #include <dirent.h>
 #include <string>
 
+namespace TNL {
+
 template<> inline tnlString getType< tnlDicomHeader * > () { return tnlString( "tnlDicomHeader *" ); }
 
 struct WindowCenterWidth
@@ -65,13 +58,13 @@ struct ImagesInfo
 class tnlDicomSeries : public tnlImage< int >
 {
    public:
-      
+ 
       inline tnlDicomSeries( const tnlString& filePath );
-       
+ 
       inline virtual ~tnlDicomSeries();
 
       inline int getImagesCount();
-            
+ 
       template< typename Real,
                 typename Device,
                 typename Index,
@@ -80,50 +73,51 @@ class tnlDicomSeries : public tnlImage< int >
                      const tnlGrid< 2, Real, Device, Index >& grid,
                      const tnlRegionOfInterest< int > roi,
                      Vector& vector );
-       
-#ifdef HAVE_DCMTK_H       
+ 
+#ifdef HAVE_DCMTK_H
       inline const Uint16 *getData( int imageNumber = 0 );
-#endif       
-       
+#endif
+ 
       inline int getColorCount();
-       
+ 
       inline int getBitsPerSampleCount();
-       
+ 
       inline int getMinColorValue();
-       
+ 
       inline WindowCenterWidth getWindowDefaults();
-       
+ 
       inline int getMaxColorValue();
-       
+ 
       inline void freeData();
-       
+ 
       inline tnlDicomHeader &getHeader(int image);
-       
+ 
       inline bool isDicomSeriesLoaded();
 
    private:
-      
+ 
       bool loadDicomSeries( const tnlString& filePath );
-       
+ 
       bool retrieveFileList( const tnlString& filePath );
-       
+ 
       bool loadImage( const tnlString& filePath, int number );
 
       tnlList< tnlString > fileList;
-       
+ 
       tnlArray<tnlDicomHeader *,tnlHost,int> dicomSeriesHeaders;
 
       bool isLoaded;
-      
-#ifdef HAVE_DCMTK_H       
+ 
+#ifdef HAVE_DCMTK_H
       DicomImage *dicomImage;
-       
+ 
       Uint16 *pixelData;
-#endif       
-       
+#endif
+ 
       ImagesInfo imagesInfo;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlDicomSeries_impl.h>
 
-#endif // TNLDICOMSERIES_H
diff --git a/src/core/images/tnlDicomSeriesInfo.h b/src/core/images/tnlDicomSeriesInfo.h
index 4b38abb56a4134fc26c252f08520259e9e51740c..b8236b5bff859af77bc941fc9e9d4e609ee53136 100644
--- a/src/core/images/tnlDicomSeriesInfo.h
+++ b/src/core/images/tnlDicomSeriesInfo.h
@@ -2,24 +2,16 @@
                           tnlDicomSeries.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDICOMSERIESINFO_H
-#define TNLDICOMSERIESINFO_H
+#pragma once
 
 #include <core/tnlString.h>
 #include <tnlConfig.h>
@@ -31,6 +23,9 @@
 #define HAVE_STD_STRING
 #include <dcmtk/ofstd/ofstring.h>
 #endif
+
+namespace TNL {
+
 class tnlDicomHeader;
 
 /***
@@ -40,41 +35,41 @@ class tnlDicomHeader;
 class tnlDicomSeriesInfo
 {
    public:
-      
+ 
        inline tnlDicomSeriesInfo( tnlDicomHeader &dicomHeader );
-       
+ 
        inline virtual ~tnlDicomSeriesInfo();
 
        inline const tnlString& getModality();
-       
+ 
        inline const tnlString& getStudyInstanceUID();
-       
+ 
        inline const tnlString& getSeriesInstanceUID();
-       
+ 
        inline const tnlString& getSeriesDescription();
-       
+ 
        inline const tnlString& getSeriesNumber();
-       
+ 
        inline const tnlString& getSeriesDate();
-       
+ 
        inline const tnlString& getSeriesTime();
-       
+ 
        inline const tnlString& getPerformingPhysiciansName();
-       
+ 
        inline const tnlString& getPerformingPhysicianIdentificationSequence();
-       
+ 
        inline const tnlString& getOperatorsName();
-       
+ 
        inline const tnlString& getOperatorIdentificationSequence();
-       
+ 
        inline const tnlString& getAcquisitionTime();
-   
+ 
    private:
-   
+ 
        tnlDicomHeader &dicomHeader;
-              
+ 
        bool retrieveInfo();
-       
+ 
        bool isObjectRetrieved;
 
        tnlString modality;
@@ -110,6 +105,7 @@ class tnlDicomSeriesInfo
        tnlString acquisitionTime;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlDicomSeriesInfo_impl.h>
 
-#endif // SERIESINFOOBJ_H
diff --git a/src/core/images/tnlDicomSeriesInfo_impl.h b/src/core/images/tnlDicomSeriesInfo_impl.h
index 87ffc6399b027109844793f1291d31beaa9a70f2..ae25638986ff7e7b3b09ec596d04051c36a70916 100644
--- a/src/core/images/tnlDicomSeriesInfo_impl.h
+++ b/src/core/images/tnlDicomSeriesInfo_impl.h
@@ -2,26 +2,23 @@
                           tnlDicomSeriesInfo_impl.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/images/tnlDicomSeriesInfo.h>
 #include <core/images/tnlDicomHeader.h>
 #include <stdio.h>
 
+namespace TNL {
+
 inline tnlDicomSeriesInfo::tnlDicomSeriesInfo( tnlDicomHeader &dicomHeader)
 : dicomHeader( dicomHeader )
 {
@@ -35,52 +32,52 @@ inline tnlDicomSeriesInfo::~tnlDicomSeriesInfo()
 inline bool tnlDicomSeriesInfo::retrieveInfo()
 {
 #ifdef HAVE_DCMTK_H
-   OFString str;    
+   OFString str;
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_Modality, str );
    this->modality.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_StudyInstanceUID, str );
    this->studyInstanceUID.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_SeriesInstanceUID, str );
    this->seriesInstanceUID.setString( str.data() );
-    
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_SeriesNumber, str );
    this->seriesNumber.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_SeriesDescription, str );
    this->seriesDescription.setString( str.data() );
-      
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_SeriesDate, str );
    this->seriesDate.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_SeriesTime, str );
    this->seriesTime.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PerformingPhysicianName, str );
    this->performingPhysiciansName.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PerformingPhysicianIdentificationSequence, str );
    this->performingPhysicianIdentificationSequence.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_OperatorsName, str );
    this->operatorsName.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_OperatorIdentificationSequence, str );
    this->operatorIdentificationSequence.setString( str.data());
-    
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_FrameAcquisitionDuration, str );
    this->frameTime.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_FrameAcquisitionDateTime, str );
    this->faDateTime.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_FrameReferenceTime, str );
    this->faRefTime.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_ActualFrameDuration, str );
    this->AFD.setString( str.data() );
-   
+ 
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_AcquisitionTime, str );
    this->acquisitionTime.setString( str.data() );
 
@@ -95,7 +92,7 @@ inline bool tnlDicomSeriesInfo::retrieveInfo()
 #else
     cerr << "DICOM format is not supported in this build of TNL." << endl;
     return false;
-#endif    
+#endif
 }
 
 inline const tnlString& tnlDicomSeriesInfo::getModality()
@@ -181,3 +178,5 @@ inline const tnlString& tnlDicomSeriesInfo::getAcquisitionTime()
         retrieveInfo();
     return this->acquisitionTime;
 }
+
+} // namespace TNL
diff --git a/src/core/images/tnlDicomSeries_impl.h b/src/core/images/tnlDicomSeries_impl.h
index da449ab2e13ee61285e2f73fdf311549f0a7ab57..d8db3001082d1785a133d5535cb72a254fc28699 100644
--- a/src/core/images/tnlDicomSeries_impl.h
+++ b/src/core/images/tnlDicomSeries_impl.h
@@ -2,26 +2,22 @@
                           tnlDicomSeries_impl.h  -  description
                              -------------------
     begin                : Jul 19, 2015
-    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
-     
+    copyright            : (C) 2015 by Tomas Oberhuber et al.
+ 
      Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
      Jiri Kafka          kafka9@seznam.cz
      Pavel Neskudla
  ***************************************************************************/
 
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/images/tnlDicomSeries.h>
 #include <core/images/tnlDicomSeriesInfo.h>
 #include <dirent.h>
 
+namespace TNL {
 
 int findLastIndexOf(tnlString &str, const char* c)
 {
@@ -48,7 +44,7 @@ inline tnlDicomSeries::tnlDicomSeries( const tnlString& filePath)
 #ifdef HAVE_DCMTK_H
     dicomImage = 0;
     pixelData = 0;
-#endif    
+#endif
     imagesInfo.imagesCount = 0;
     imagesInfo.maxColorValue = 0;
     imagesInfo.minColorValue = 128000;
@@ -69,13 +65,13 @@ inline tnlDicomSeries::~tnlDicomSeries()
         header = 0;
     }
 
-#ifdef HAVE_DCMTK_H    
+#ifdef HAVE_DCMTK_H
     if(dicomImage)
         delete dicomImage;
 
     if(pixelData)
         delete pixelData;
-#endif    
+#endif
 }
 
 template< typename Real,
@@ -93,7 +89,7 @@ getImage( const int imageIdx,
    const Uint16* imageData = this->getData( imageIdx );
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    Index i, j;
    int position( 0 );
    for( i = 0; i < this->height; i ++ )
@@ -118,7 +114,7 @@ getImage( const int imageIdx,
    return true;
 #else
    cerr << "DICOM format is not supported in this build of TNL." << endl;
-   return false;     
+   return false;
 #endif
 }
 
@@ -315,7 +311,7 @@ inline bool tnlDicomSeries::loadImage( const tnlString& filePath, int number)
 #else
     cerr << "DICOM format is not supported in this build of TNL." << endl;
     return false;
-#endif    
+#endif
 }
 
 
@@ -385,7 +381,7 @@ inline void tnlDicomSeries::freeData()
     if (pixelData)
         delete pixelData;
     pixelData = NULL;
-#endif    
+#endif
 }
 
 inline tnlDicomHeader &tnlDicomSeries::getHeader(int image)
@@ -400,3 +396,4 @@ inline bool tnlDicomSeries::isDicomSeriesLoaded()
     return isLoaded;
 }
 
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/images/tnlImage.h b/src/core/images/tnlImage.h
index b6bea26a0bae62d432b1eba61778f37ab65f5ecc..9408fa7605755fc7be458af51f3a9767586ed4bb 100644
--- a/src/core/images/tnlImage.h
+++ b/src/core/images/tnlImage.h
@@ -6,43 +6,36 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLIMAGE_H
-#define	TNLIMAGE_H
+#pragma once
+
+namespace TNL {
 
 template< typename Index = int >
 class tnlImage
 {
    public:
-      
+ 
       typedef Index IndexType;
-      
+ 
       tnlImage() : width( 0 ), height( 0 ) {};
-      
+ 
       IndexType getWidth() const
       {
          return this->width;
       }
-      
+ 
       IndexType getHeight() const
       {
          return this->height;
       }
-      
+ 
    protected:
-      
+ 
       IndexType width, height;
-      
+ 
 };
 
-
-#endif	/* TNLIMAGE_H */
+} // namespace TNL
 
diff --git a/src/core/images/tnlJPEGImage.h b/src/core/images/tnlJPEGImage.h
index de66653f30e7edec61075f5df3f71c4b68fefd80..c788086a91bd58c061a5965cd310f298ec2210c6 100644
--- a/src/core/images/tnlJPEGImage.h
+++ b/src/core/images/tnlJPEGImage.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLJPEGIMAGE_H
-#define	TNLJPEGIMAGE_H
+#pragam once
 
 #include <tnlConfig.h>
 
@@ -28,7 +20,7 @@
 #include <core/images/tnlImage.h>
 #include <core/images/tnlRegionOfInterest.h>
 
-#ifdef HAVE_JPEG_H      
+#ifdef HAVE_JPEG_H
 struct my_error_mgr
 {
    jpeg_error_mgr pub;
@@ -36,62 +28,63 @@ struct my_error_mgr
 };
 #endif
 
+namespace TNL {
+
 template< typename Index = int >
 class tnlJPEGImage : public tnlImage< Index >
 {
    public:
-      
+ 
       typedef Index IndexType;
-      
+ 
       tnlJPEGImage();
-       
+ 
       bool openForRead( const tnlString& fileName );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool read( const tnlRegionOfInterest< Index > roi,
                  const tnlGrid< 2, Real, Device, Index >& grid,
                  Vector& vector );
-      
+ 
       template< typename Real,
                 typename Device >
       bool openForWrite( const tnlString& fileName,
                          tnlGrid< 2, Real, Device, Index >& grid );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool write( const tnlGrid< 2, Real, Device, Index >& grid,
                   Vector& vector );
-      
+ 
       void close();
-      
+ 
       ~tnlJPEGImage();
-      
+ 
    protected:
-      
+ 
       bool readHeader();
-         
+ 
       template< typename Real,
                 typename Device >
       bool writeHeader( const tnlGrid< 2, Real, Device, Index >& grid );
-    
+ 
       FILE* file;
 
       bool fileOpen;
 
-#ifdef HAVE_JPEG_H      
+#ifdef HAVE_JPEG_H
       my_error_mgr jerr;
       jpeg_decompress_struct decinfo;
       jpeg_compress_struct cinfo;
       int components;
       J_COLOR_SPACE color_space;
-#endif         
+#endif
 };
 
-#include <core/images/tnlJPEGImage_impl.h>
-
+} // namespace TNL
 
-#endif	/* TNLJPEGIMAGE_H */
+#include <core/images/tnlJPEGImage_impl.h>
 
diff --git a/src/core/images/tnlJPEGImage_impl.h b/src/core/images/tnlJPEGImage_impl.h
index d05c1f3ee671c8bccb357579bfaad6e5c943a09d..cc5c8f4afc176eb3ee7d0932e316422c1e17a6de 100644
--- a/src/core/images/tnlJPEGImage_impl.h
+++ b/src/core/images/tnlJPEGImage_impl.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLJPEGIMAGE_IMPL_H
-#define	TNLJPEGIMAGE_IMPL_H
+#pragma once
 
 #include <core/images/tnlJPEGImage.h>
 #include <setjmp.h>
 
+namespace TNL {
+
 #ifdef HAVE_JPEG_H
 inline void my_error_exit( j_common_ptr cinfo )
 {
@@ -38,7 +32,7 @@ inline void my_error_exit( j_common_ptr cinfo )
 
 template< typename Index >
 tnlJPEGImage< Index >::
-tnlJPEGImage() : 
+tnlJPEGImage() :
    fileOpen( false )
 {
 }
@@ -50,8 +44,8 @@ readHeader()
 {
 #ifdef HAVE_JPEG_H
    this->decinfo.err = jpeg_std_error(&jerr.pub);
-   this->jerr.pub.error_exit = my_error_exit; 
-   
+   this->jerr.pub.error_exit = my_error_exit;
+ 
    /***
     * Prepare the long jump back from libjpeg.
     */
@@ -64,20 +58,20 @@ readHeader()
       jpeg_destroy_decompress( &this->decinfo );
       return false;
    }
-   
+ 
    jpeg_create_decompress( &this->decinfo );
    jpeg_stdio_src( &this->decinfo, this->file );
    if( jpeg_read_header( &this->decinfo, true ) != JPEG_HEADER_OK )
       return false;
    this->height = this->decinfo.image_height;
    this->width = this->decinfo.image_width;
-   this->components = this->decinfo.num_components; 
+   this->components = this->decinfo.num_components;
    //this->color_space = this->cinfo.jpeg_color_space;
    //cout << this->height << " x " << this->width << " : " << this->components << " " << this->color_space << endl;
 #else
    cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << endl;
    return false;
-#endif   
+#endif
 }
 
 template< typename Index >
@@ -111,7 +105,7 @@ read( const tnlRegionOfInterest< Index > roi,
 #ifdef HAVE_JPEG_H
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    /***
     * Prepare the long jump back from libjpeg.
     */
@@ -124,14 +118,14 @@ read( const tnlRegionOfInterest< Index > roi,
       jpeg_destroy_decompress( &this->decinfo );
       return false;
    }
-      
+ 
    jpeg_start_decompress( &this->decinfo );
    int row_stride = this->decinfo.output_width * this->decinfo.output_components;
    JSAMPARRAY row = ( *( this->decinfo.mem->alloc_sarray ) )( ( j_common_ptr ) &this->decinfo,
                                                               JPOOL_IMAGE,
                                                               row_stride,
                                                               1 );	
-   
+ 
    Index i( 0 ), j;
    while( this->decinfo.output_scanline < this->decinfo.output_height)
    {
@@ -140,7 +134,7 @@ read( const tnlRegionOfInterest< Index > roi,
       {
          if( !roi.isIn( i, j ) )
             continue;
-     
+ 
          cell.getCoordinates().x() =  j - roi.getLeft();
          cell.getCoordinates().y() = roi.getBottom() - 1 - i;
          //Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
@@ -177,7 +171,7 @@ read( const tnlRegionOfInterest< Index > roi,
 #else
    //cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << endl;
    return false;
-#endif      
+#endif
 }
 
 template< typename Index >
@@ -200,7 +194,7 @@ writeHeader( const tnlGrid< 2, Real, Device, Index >& grid )
 #else
    //cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << endl;
    return false;
-#endif    
+#endif
 }
 
 template< typename Index >
@@ -236,7 +230,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
 
-#ifdef HAVE_JPEG_H   
+#ifdef HAVE_JPEG_H
    Index i( 0 ), j;
    JSAMPROW row[1];
    row[ 0 ] = new JSAMPLE[ grid.getDimensions().x() ];
@@ -251,18 +245,18 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
          //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
          //                                     grid.getDimensions().y() - 1 - i ) );
 
-         row[ 0 ][ j ] = 255 * vector.getElement( cell.getIndex() );         
+         row[ 0 ][ j ] = 255 * vector.getElement( cell.getIndex() );
       }
       jpeg_write_scanlines( &this->cinfo, row, 1 );
       i++;
-   }   
+   }
    jpeg_finish_compress( &this->cinfo );
    jpeg_destroy_compress( &this->cinfo );
    delete[] row[ 0 ];
    return true;
 #else
    return false;
-#endif   
+#endif
 }
 
 
@@ -283,7 +277,6 @@ tnlJPEGImage< Index >::
    close();
 }
 
+} // namespace TNL
 
 
-#endif	/* TNLJPEGIMAGE_IMPL_H */
-
diff --git a/src/core/images/tnlPGMImage.h b/src/core/images/tnlPGMImage.h
index bebab581e6ca3e76003d983f26bcc2de6867923c..4796ade6eec03de169fafec1bd7d1619f13442bf 100644
--- a/src/core/images/tnlPGMImage.h
+++ b/src/core/images/tnlPGMImage.h
@@ -6,77 +6,72 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPGMIMAGE_H
-#define	TNLPGMIMAGE_H
+#pragma once 
 
 #include <core/tnlString.h>
 #include <core/images/tnlImage.h>
 #include <core/images/tnlRegionOfInterest.h>
 #include <fstream>
 
+namespace TNL {
+
 template< typename Index = int >
 class tnlPGMImage : public tnlImage< Index >
 {
    public:
-      
+ 
       typedef Index IndexType;
-      
+ 
       tnlPGMImage();
-       
+ 
       bool openForRead( const tnlString& fileName );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool read( const tnlRegionOfInterest< Index > roi,
                  const tnlGrid< 2, Real, Device, Index >& grid,
                  Vector& vector );
-      
+ 
       template< typename Real,
                 typename Device >
       bool openForWrite( const tnlString& fileName,
                          tnlGrid< 2, Real, Device, Index >& grid,
                          bool binary = true );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool write( const tnlGrid< 2, Real, Device, Index >& grid,
                   Vector& vector );
 
-      
+ 
       void close();
-      
+ 
       ~tnlPGMImage();
-      
+ 
       protected:
-         
+ 
          bool readHeader();
-         
+ 
          template< typename Real,
                    typename Device >
          bool writeHeader( const tnlGrid< 2, Real, Device, Index >& grid,
                            bool binary );
-         
+ 
          bool binary;
-         
+ 
          IndexType maxColors;
-         
+ 
          fstream file;
-         
+ 
          bool fileOpen;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlPGMImage_impl.h>
 
-#endif	/* TNLPGMIMAGE_H */
 
diff --git a/src/core/images/tnlPGMImage_impl.h b/src/core/images/tnlPGMImage_impl.h
index 128068ac06e050f5af3b260af5f5fb8d46278db1..6967e6ac925657e321dd87fdde2947bb1a9428be 100644
--- a/src/core/images/tnlPGMImage_impl.h
+++ b/src/core/images/tnlPGMImage_impl.h
@@ -6,24 +6,18 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPGMIMAGE_IMPL_H
-#define	TNLPGMIMAGE_IMPL_H
+#pragma once 
 
 #include <cstring>
 #include <core/images/tnlPGMImage.h>
 
+namespace TNL {
+
 template< typename Index >
 tnlPGMImage< Index >::
-tnlPGMImage() : 
+tnlPGMImage() :
    binary( false ), maxColors( 0 ), fileOpen( false )
 {
 }
@@ -44,7 +38,7 @@ readHeader()
    if( strcmp( magicNumber, "P5" ) != 0 &&
        strcmp( magicNumber, "P2" ) != 0 )
       return false;
-   
+ 
    if( strcmp( magicNumber, "P5" ) == 0 )
       this->binary = true;
 
@@ -58,9 +52,9 @@ readHeader()
 			this->file.get( character );
    }
    this->file.unget();
-   
+ 
    this->file >> this->width >> this->height >> this->maxColors;
-   return true;   
+   return true;
 }
 
 template< typename Index >
@@ -71,7 +65,7 @@ openForRead( const tnlString& fileName )
    this->close();
    if ( this->binary )
    	this->file.open( fileName.getString(), fstream::in | fstream::binary);
-   else 
+   else
 	this->file.open( fileName.getString(), fstream::in );
    if( ! this->file )
    {
@@ -96,14 +90,14 @@ read( const tnlRegionOfInterest< Index > roi,
 {
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    Index i, j;
    for( i = 0; i < this->height; i ++ )
       for( j = 0; j < this->width; j ++ )
       {
          int col;
          unsigned char col_aux;
-              if( this->binary ) 
+              if( this->binary )
          {
            this->file >> col_aux;
            col = (int)col_aux;
@@ -136,7 +130,7 @@ writeHeader( const tnlGrid< 2, Real, Device, Index >& grid,
       this->file << "P2\n";
    this->file << "# This file was generated by TNL (tnl-image-converter)\n";
    this->file << grid.getDimensions().x() << ' '<< grid.getDimensions().y() << '\n' << "255\n";
-   return true;   
+   return true;
 }
 
 template< typename Index >
@@ -151,7 +145,7 @@ openForWrite( const tnlString& fileName,
    this->close();
    if( binary )
         this->file.open( fileName.getString(), fstream::out | fstream::binary);
-   else 
+   else
         this->file.open( fileName.getString(), fstream::out);
    if( this->file.fail() )
    {
@@ -176,7 +170,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
 {
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    Index i, j;
    for( i = 0; i < grid.getDimensions().y(); i ++ )
    {
@@ -185,7 +179,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
          cell.refresh();
-                        
+ 
          //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
          //                                     grid.getDimensions().y() - 1 - i ) );
 
@@ -198,7 +192,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
 	 }
 	 else this->file << color;
       }
-      
+ 
       if ( ! this->binary )
         this->file << '\n';
    }
@@ -222,5 +216,5 @@ tnlPGMImage< Index >::
    close();
 }
 
-#endif	/* TNLPGMIMAGE_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/images/tnlPNGImage.h b/src/core/images/tnlPNGImage.h
index 6967f08548a341c76679de107afe9ee028bcaa55..bf08ac8fbf4277cca0aa27fc55b95d223c8bbb50 100644
--- a/src/core/images/tnlPNGImage.h
+++ b/src/core/images/tnlPNGImage.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPNGIMAGE_H
-#define	TNLPNGIMAGE_H
+#pragma once
 
 #include <tnlConfig.h>
 
@@ -28,61 +20,63 @@
 #include <core/images/tnlImage.h>
 #include <core/images/tnlRegionOfInterest.h>
 
+namespace TNL {
+
 template< typename Index = int >
 class tnlPNGImage : public tnlImage< Index >
 {
    public:
-      
+ 
       typedef Index IndexType;
-      
+ 
       tnlPNGImage();
-       
+ 
       bool openForRead( const tnlString& fileName );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool read( const tnlRegionOfInterest< Index > roi,
                  const tnlGrid< 2, Real, Device, Index >& grid,
                  Vector& vector );
-      
+ 
       template< typename Real,
                 typename Device >
       bool openForWrite( const tnlString& fileName,
                          tnlGrid< 2, Real, Device, Index >& grid );
-      
+ 
       template< typename Real,
                 typename Device,
                 typename Vector >
       bool write( const tnlGrid< 2, Real, Device, Index >& grid,
                   Vector& vector );
-      
+ 
       void close();
-      
+ 
       ~tnlPNGImage();
-      
+ 
    protected:
-      
+ 
       bool readHeader();
-         
+ 
       template< typename Real,
                 typename Device >
       bool writeHeader( const tnlGrid< 2, Real, Device, Index >& grid );
-    
+ 
       FILE* file;
 
       bool fileOpen;
 
-#ifdef HAVE_PNG_H      
+#ifdef HAVE_PNG_H
       png_structp png_ptr;
 
       png_infop info_ptr, end_info;
-      
+ 
       png_byte color_type, bit_depth;
-#endif         
+#endif
 };
 
-#include <core/images/tnlPNGImage_impl.h>
+} // namespace TNL
 
-#endif	/* TNLPNGIMAGE_H */
+#include <core/images/tnlPNGImage_impl.h>
 
diff --git a/src/core/images/tnlPNGImage_impl.h b/src/core/images/tnlPNGImage_impl.h
index 6a06fe76c5cacdc0fe6523bd567d206b319bea17..a57bd62740b3d4c5dc356911d536db5e4cd6354d 100644
--- a/src/core/images/tnlPNGImage_impl.h
+++ b/src/core/images/tnlPNGImage_impl.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPNGIMAGE_IMPL_H
-#define	TNLPNGIMAGE_IMPL_H
+#pragma once 
 
 #include <core/images/tnlPNGImage.h>
 
+namespace TNL {
+
 template< typename Index >
 tnlPNGImage< Index >::
-tnlPNGImage() : 
+tnlPNGImage() :
    fileOpen( false )
 {
 }
@@ -46,7 +40,7 @@ readHeader()
    bool isPNG = !png_sig_cmp( header, 0, headerSize );
    if( ! isPNG )
       return false;
-   
+ 
    /****
     * Allocate necessary memory
     */
@@ -87,7 +81,7 @@ readHeader()
    }
    png_init_io( this->png_ptr, this->file );
    png_set_sig_bytes( this->png_ptr, headerSize );
-   
+ 
    /****
     * Read the header
     */
@@ -97,11 +91,11 @@ readHeader()
    this->bit_depth = png_get_bit_depth( this->png_ptr, this->info_ptr );
    this->color_type = png_get_color_type( this->png_ptr, this->info_ptr );
    cout << this->height << " x " << this->width << endl;
-   return true;   
+   return true;
 #else
    //cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << endl;
    return false;
-#endif   
+#endif
 }
 
 template< typename Index >
@@ -135,7 +129,7 @@ read( const tnlRegionOfInterest< Index > roi,
 #ifdef HAVE_PNG_H
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    /***
     * Prepare the long jump back from libpng.
     */
@@ -146,9 +140,9 @@ read( const tnlRegionOfInterest< Index > roi,
                                &this->end_info );
       return false;
    }
-   
+ 
    png_bytepp row_pointers = png_get_rows( this->png_ptr, this->info_ptr );
-   
+ 
    Index i, j;
    for( i = 0; i < this->height; i ++ )
    {
@@ -156,7 +150,7 @@ read( const tnlRegionOfInterest< Index > roi,
       {
          if( !roi.isIn( i, j ) )
             continue;
-         
+ 
          cell.getCoordinates().x() = j - roi.getLeft();
          cell.getCoordinates().y() = roi.getBottom() - 1 - i;
          cell.refresh();
@@ -216,7 +210,7 @@ read( const tnlRegionOfInterest< Index > roi,
 #else
    //cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << endl;
    return false;
-#endif      
+#endif
 }
 
 template< typename Index >
@@ -241,7 +235,7 @@ writeHeader( const tnlGrid< 2, Real, Device, Index >& grid )
                                 NULL);
       return false;
    }
-   
+ 
    /***
     * Prepare the long jump back from libpng.
     */
@@ -257,24 +251,24 @@ writeHeader( const tnlGrid< 2, Real, Device, Index >& grid )
     * Set the zlib compression level
     */
    //png_set_compression_level( this->png_ptr, Z_BEST_COMPRESSION );
-   
+ 
    const int bitDepth( 8 );
    png_set_IHDR( this->png_ptr,
                  this->info_ptr,
                  grid.getDimensions().x(),
                  grid.getDimensions().y(),
-                 8, //bitDepth, 
+                 8, //bitDepth,
                  PNG_COLOR_TYPE_GRAY,
                  PNG_INTERLACE_NONE,
                  PNG_COMPRESSION_TYPE_DEFAULT,
                  PNG_FILTER_TYPE_DEFAULT );
    png_init_io( this->png_ptr, this->file );
    png_write_info( png_ptr, info_ptr );
-   
+ 
 #else
    cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << endl;
    return false;
-#endif    
+#endif
 }
 
 template< typename Index >
@@ -307,10 +301,10 @@ tnlPNGImage< Index >::
 write( const tnlGrid< 2, Real, Device, Index >& grid,
        Vector& vector )
 {
-#ifdef HAVE_PNG_H   
+#ifdef HAVE_PNG_H
    typedef tnlGrid< 2, Real, Device, Index > GridType;
    typename GridType::Cell cell( grid );
-   
+ 
    /***
     * Prepare the long jump back from libpng.
     */
@@ -321,7 +315,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
                                &this->end_info );
       return false;
    }
-              
+ 
    Index i, j;
    png_bytep row = new png_byte[ 3 * grid.getDimensions().x() ];
    for( i = 0; i < grid.getDimensions().y(); i ++ )
@@ -334,7 +328,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
          //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
          //                                     grid.getDimensions().y() - 1 - i ) );
 
-         row[ j ] = 255 * vector.getElement( cell.getIndex() );         
+         row[ j ] = 255 * vector.getElement( cell.getIndex() );
       }
       png_write_row( this->png_ptr, row );
    }
@@ -342,7 +336,7 @@ write( const tnlGrid< 2, Real, Device, Index >& grid,
    return true;
 #else
    return false;
-#endif   
+#endif
 }
 
 
@@ -363,6 +357,5 @@ tnlPNGImage< Index >::
    close();
 }
 
-
-#endif	/* TNLPNGIMAGE_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/images/tnlRegionOfInterest.h b/src/core/images/tnlRegionOfInterest.h
index a8171ba5fe53df3eb4e2764b6b56a6d875b904e5..d64696586b00a8390c585d804d1fe71689c1da6e 100644
--- a/src/core/images/tnlRegionOfInterest.h
+++ b/src/core/images/tnlRegionOfInterest.h
@@ -6,59 +6,53 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLREGIONOFINTEREST_H
-#define	TNLREGIONOFINTEREST_H
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <mesh/tnlGrid.h>
 #include <core/images/tnlImage.h>
 
+namespace TNL {
 
 template< typename Index = int >
 class tnlRegionOfInterest
 {
    public:
-      
+ 
       tnlRegionOfInterest();
-      
+ 
       bool setup( const tnlParameterContainer& parameters,
                   const tnlImage< Index >* image );
-      
+ 
       bool check( const tnlImage< Index >* image ) const;
-      
+ 
       Index getTop() const;
-      
+ 
       Index getBottom() const;
-      
+ 
       Index getLeft() const;
-      
+ 
       Index getRight() const;
-      
+ 
       Index getWidth() const;
-      
+ 
       Index getHeight() const;
-      
+ 
       template< typename Grid >
          bool setGrid( Grid& grid,
                        bool verbose = false );
-      
+ 
       bool isIn( const Index row, const Index column ) const;
-      
+ 
    protected:
-      
+ 
       Index top, bottom, left, right;
 };
 
+} // namespace TNL
+
 #include <core/images/tnlRegionOfInterest_impl.h>
 
-#endif	/* TNLREGIONOFINTEREST_H */
 
diff --git a/src/core/images/tnlRegionOfInterest_impl.h b/src/core/images/tnlRegionOfInterest_impl.h
index a3befeaafdf1112ad82fe3ff8974a4e5561f14f6..fea4de4ed9e124ee38bfa8c6b326b4da9dd5a0cc 100644
--- a/src/core/images/tnlRegionOfInterest_impl.h
+++ b/src/core/images/tnlRegionOfInterest_impl.h
@@ -6,28 +6,21 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLREGIONOFINTEREST_IMPL_H
-#define	TNLREGIONOFINTEREST_IMPL_H
+#pragma once
 
 #include "tnlImage.h"
 
+namespace TNL {
 
 template< typename Index >
 tnlRegionOfInterest< Index >::
 tnlRegionOfInterest()
 : top( -1 ), bottom( -1 ), left( -1 ), right( -1 )
-{   
+{
 }
-      
+ 
 template< typename Index >
 bool
 tnlRegionOfInterest< Index >::
@@ -38,7 +31,7 @@ setup( const tnlParameterContainer& parameters,
    const int roiBottom = parameters.getParameter< int >( "roi-bottom" );
    const int roiRight  = parameters.getParameter< int >( "roi-right" );
    const int roiLeft   = parameters.getParameter< int >( "roi-left" );
-    
+ 
    if( roiBottom < roiTop )
    {
       cerr << "Error: roi-bottom (" << roiBottom << ") is smaller than roi-top (" << roiTop << ")." << endl;
@@ -61,7 +54,7 @@ setup( const tnlParameterContainer& parameters,
       }
       this->left = roiLeft;
    }
-    
+ 
    if( roiRight == -1 )
       this->right = image->getWidth();
    else
@@ -73,7 +66,7 @@ setup( const tnlParameterContainer& parameters,
       }
       this->right = roiRight;
    }
-    
+ 
    if( roiTop == -1 )
       this->top = 0;
    else
@@ -85,7 +78,7 @@ setup( const tnlParameterContainer& parameters,
       }
       this->top = roiTop;
    }
-    
+ 
    if( roiBottom == -1 )
       this->bottom = image->getHeight();
    else
@@ -177,7 +170,7 @@ setGrid( Grid& grid,
     grid.setDomain( origin, proportions );
     if( verbose )
     {
-        cout << "Setting grid to dimensions " << grid.getDimensions() << 
+        cout << "Setting grid to dimensions " << grid.getDimensions() <<
                 " and proportions " << grid.getProportions() << endl;
     }
     return true;
@@ -195,5 +188,5 @@ isIn( const Index row, const Index column ) const
    return false;
 }
 
-#endif	/* TNLREGIONOFINTEREST_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/mfilename.cpp b/src/core/mfilename.cpp
index 69efe5234569a97bbf88185e60fb27eba7bccc5f..a4bd5323ef005e23f535caaf0af7cedd49d3fcfb 100644
--- a/src/core/mfilename.cpp
+++ b/src/core/mfilename.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <cstring>
 #include <cstdlib>
@@ -21,6 +14,8 @@
 #include <core/tnlString.h>
 #include <core/mfuncs.h>
 
+namespace TNL {
+
 void FileNameBaseNumberEnding( const char* base_name,
                                int number,
                                int index_size,
@@ -34,7 +29,7 @@ void FileNameBaseNumberEnding( const char* base_name,
 
    const int k = Min( 1024, index_size );
    int i;
-   for( i = len; i < k ; i ++ ) 
+   for( i = len; i < k ; i ++ )
       zeros[ i - len ] = '0';
    zeros[ k - len ] = 0;
    file_name += zeros;
@@ -59,3 +54,5 @@ void RemoveFileExtension( tnlString& fileName )
    while( fileName. getString()[ size - i ] != '.' && size > i  ) i ++ ;
    fileName. setString( fileName. getString(), 0, i );
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/mfilename.h b/src/core/mfilename.h
index 8432172d451cb0cbda845b192806a50d47eb7721..d40fd4c7937e2ec07e7010c9febf5f7d2286ba78 100644
--- a/src/core/mfilename.h
+++ b/src/core/mfilename.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once 
 
-#ifndef mfilenameH
-#define mfilenameH
+namespace TNL {
 
 class tnlString;
 
@@ -30,4 +24,4 @@ tnlString getFileExtension( const tnlString fileName );
 
 void RemoveFileExtension( tnlString& file_name );
 
-#endif
+} // namespace TNL
diff --git a/src/core/mfuncs.h b/src/core/mfuncs.h
index db1ad50fbd6c882900048100ebbab5877bb5b7d3..4e90f0398c353efcf2da458d3e0af584fab01411 100644
--- a/src/core/mfuncs.h
+++ b/src/core/mfuncs.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef mfuncsH
-#define mfuncsH
+#pragma once 
 
 #include <math.h>
 #include <stdlib.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Type1, typename Type2 >
 __cuda_callable__
 Type1 Min( const Type1& a, const Type2& b )
@@ -113,5 +107,5 @@ inline bool isPow2( long int x )
    return ( ( x & ( x - 1 ) ) == 0 );
 }
 
+} // namespace TNL
 
-#endif
diff --git a/src/core/mpi-supp.cpp b/src/core/mpi-supp.cpp
index bd1ed8734a11d2b7462a9f4bcbf85c5c60d218c9..edeb27032b1a5053a949a38d0e303879097d8055 100644
--- a/src/core/mpi-supp.cpp
+++ b/src/core/mpi-supp.cpp
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/mpi-supp.h>
 
-//--------------------------------------------------------------------------
+namespace TNL {
+
 void MPIInit( int* argc, char** argv[] )
 {
 #ifdef HAVE_MPI
@@ -67,7 +61,9 @@ int MPIGetSize( MPI_Comm comm )
 void MPIBarrier( MPI_Comm comm )
 {
 #ifdef HAVE_MPI
-   MPI_Barrier( comm ); 
+   MPI_Barrier( comm );
 #endif
 }
 
+} // namespace TNL
+
diff --git a/src/core/mpi-supp.h b/src/core/mpi-supp.h
index ad203c653f16593ad6adb341dc1a60205937aa3f..fb45bef183db442c0e579f6d51a49c95281f3f56 100644
--- a/src/core/mpi-supp.h
+++ b/src/core/mpi-supp.h
@@ -6,23 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef mpi_suppH
-#define mpi_suppH
+#pragma once
 
 #include <iostream>
 #include <cstdlib>
 
-using namespace std;
-
 #ifdef HAVE_MPI
    #include <mpi.h>
 #else
@@ -34,6 +24,8 @@ using namespace std;
    #define MPI_SUM 0
 #endif
 
+namespace TNL {
+   
 class tnlString;
 
 #ifdef HAVE_MPI
@@ -108,8 +100,8 @@ template< class T > void MPIBcast( T& data,
 
 inline void MPIBcast( tnlString& data, int cout, int root, MPI_Comm comm = MPI_COMM_WORLD )
 {
-   cerr << "Call method MPIBcast of mString instead of function MPIBcast( mString&, ... ) " << endl;
-   abort();    
+   std::cerr << "Call method MPIBcast of mString instead of function MPIBcast( mString&, ... ) " << std::endl;
+   abort();
 }
 #else
 template< class T > void MPIBcast( T&,
@@ -128,9 +120,9 @@ template< typename T > void MPIReduce( T& data,
                                        int root,
                                        MPI_Comm comm )
 {
-   MPI_Reduce( &data, 
-               &reduced_data, 
-               count, 
+   MPI_Reduce( &data,
+               &reduced_data,
+               count,
                MPIDataType( data ),
                op,
                root,
@@ -155,9 +147,9 @@ template< typename T > void MPIAllreduce( T& data,
                                           MPI_Op op,
                                           MPI_Comm comm )
 {
-   MPI_Allreduce( &data, 
-                  &reduced_data, 
-                  count, 
+   MPI_Allreduce( &data,
+                  &reduced_data,
+                  count,
                   MPIDataType( data ),
                   op,
                   comm );
@@ -173,4 +165,4 @@ template< typename T > void MPIAllreduce( T& data,
 };
 #endif
 
-#endif
+} // namespace TNL
diff --git a/src/core/multimaps/tnlEllpackIndexMultimap.h b/src/core/multimaps/tnlEllpackIndexMultimap.h
index c7be27b4585936ad9229b56699edfa93e7cb2e56..ec3d1a72bf5ab96f4fd114f5194a501c59c81d3a 100644
--- a/src/core/multimaps/tnlEllpackIndexMultimap.h
+++ b/src/core/multimaps/tnlEllpackIndexMultimap.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKINDEXMULTIMAP_H
-#define	TNLELLPACKINDEXMULTIMAP_H
+#pragma once 
 
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Index = int,
           typename Device = tnlHost >
 class tnlEllpackIndexMultimapValues;
@@ -33,40 +27,40 @@ template< typename Index = int,
 class tnlEllpackIndexMultimap
 {
    public:
-      
+ 
       typedef Device                                                       DeviceType;
       typedef Index                                                        IndexType;
       typedef tnlEllpackIndexMultimapValues< IndexType, DeviceType >       ValuesAccessorType;
       typedef tnlEllpackIndexMultimapConstValues< IndexType, DeviceType >  ConstValuesAccessorType;
       typedef tnlVector< IndexType, DeviceType, IndexType >                ValuesAllocationVectorType;
-            
+ 
       tnlEllpackIndexMultimap();
-      
+ 
       static tnlString getType();
 
       tnlString getTypeVirtual() const;
-      
+ 
       void setRanges( const IndexType keysRange,
                       const IndexType valuesRange );
-      
+ 
       const IndexType getKeysRange() const;
-      
+ 
       const IndexType getValuesRange() const;
-      
+ 
       void allocate( const ValuesAllocationVectorType& portsCount );
-      
+ 
       ValuesAccessorType getValues( const IndexType& inputIndex );
-      
+ 
       ConstValuesAccessorType getValues( const IndexType& inputIndex ) const;
-      
+ 
    protected:
-      
+ 
       tnlVector< IndexType, DeviceType, IndexType > values;
-      
+ 
       IndexType keysRange, valuesRange, valuesMaxCount;
 };
 
-#include <core/multimaps/tnlEllpackIndexMultimap_impl.h>
+} // namespace TNL
 
-#endif	/* TNLELLPACKINDEXMULTIMAP_H */
+#include <core/multimaps/tnlEllpackIndexMultimap_impl.h>
 
diff --git a/src/core/multimaps/tnlEllpackIndexMultimapValues.h b/src/core/multimaps/tnlEllpackIndexMultimapValues.h
index cba0ee8aa0ff22f6783c83cb6b3c9ada0085c870..a965ae51bbb24953a49398aea962e28256f618bd 100644
--- a/src/core/multimaps/tnlEllpackIndexMultimapValues.h
+++ b/src/core/multimaps/tnlEllpackIndexMultimapValues.h
@@ -6,56 +6,50 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKINDEXMULTIMAPVALUES_H
-#define	TNLELLPACKINDEXMULTIMAPVALUES_H
+#pragma once
 
 #include <ostream>
 #include <core/multimaps/tnlEllpackIndexMultimap.h>
 
+namespace TNL {
+
 template< typename Index,
           typename Device >
 class tnlEllpackIndexMultimapValues
 {
    public:
-      
+ 
       typedef Device                                     DeviceType;
       typedef Index                                      IndexType;
       typedef tnlEllpackIndexMultimap< IndexType, DeviceType > NetworkType;
-      
+ 
       tnlEllpackIndexMultimapValues();
-      
+ 
       IndexType getPortsCount() const;
-      
+ 
       void setOutput( const IndexType portIndex,
                       const IndexType output );
-      
+ 
       IndexType getOutput( const IndexType portIndex ) const;
-      
+ 
       IndexType& operator[]( const IndexType portIndex );
-      
+ 
       const IndexType& operator[]( const IndexType portIndex ) const;
-      
-      void print( std::ostream& str ) const;      
-      
+ 
+      void print( std::ostream& str ) const;
+ 
    protected:
-      
-      tnlEllpackIndexMultimapValues( IndexType* ports, 
+ 
+      tnlEllpackIndexMultimapValues( IndexType* ports,
                               const IndexType input,
                               const IndexType portsMaxCount );
-      
+ 
       IndexType* ports;
-      
+ 
       IndexType step, portsMaxCount;
-      
+ 
       friend tnlEllpackIndexMultimap< IndexType, DeviceType >;
 };
 
@@ -63,8 +57,7 @@ template< typename Index,
           typename Device >
 std::ostream& operator << ( std::ostream& str, const tnlEllpackIndexMultimapValues< Index, Device>& ports );
 
-#include <core/multimaps/tnlEllpackIndexMultimapValues_impl.h>
-
+} // namespace TNL
 
-#endif	/* TNLELLPACKINDEXMULTIMAPVALUES_H */
+#include <core/multimaps/tnlEllpackIndexMultimapValues_impl.h>
 
diff --git a/src/core/multimaps/tnlEllpackIndexMultimapValues_impl.h b/src/core/multimaps/tnlEllpackIndexMultimapValues_impl.h
index 0441495b7a4f83568c77176285e87d35a379fa61..037264f2d52588755d84f69090b112e8525844c5 100644
--- a/src/core/multimaps/tnlEllpackIndexMultimapValues_impl.h
+++ b/src/core/multimaps/tnlEllpackIndexMultimapValues_impl.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKINDEXMULTIMAPVALUES_IMPL_H
-#define TNLELLPACKINDEXMULTIMAPVALUES_IMPL_H
+#pragma once
 
 #include "tnlEllpackIndexMultimapValues.h"
 
-
+namespace TNL {
+ 
 template< typename Index,
           typename Device >
 tnlEllpackIndexMultimapValues< Index, Device >::
@@ -31,7 +24,7 @@ tnlEllpackIndexMultimapValues()
 template< typename Index,
           typename Device >
 tnlEllpackIndexMultimapValues< Index, Device >::
-tnlEllpackIndexMultimapValues( IndexType* networkPorts, 
+tnlEllpackIndexMultimapValues( IndexType* networkPorts,
                         const IndexType input,
                         const IndexType portsMaxCount )
 {
@@ -50,7 +43,7 @@ getPortsCount() const
 
 template< typename Index,
           typename Device >
-void 
+void
 tnlEllpackIndexMultimapValues< Index, Device >::
 setOutput( const IndexType portIndex,
            const IndexType output )
@@ -110,5 +103,5 @@ std::ostream& operator << ( std::ostream& str, const tnlEllpackIndexMultimapValu
    return str;
 }
 
-#endif	/* TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/multimaps/tnlEllpackIndexMultimap_impl.h b/src/core/multimaps/tnlEllpackIndexMultimap_impl.h
index 0434bd445db60115b42b9a939eae64671b6c0ff7..c2187f37eec47d889bd1f323ef0b197f093f1251 100644
--- a/src/core/multimaps/tnlEllpackIndexMultimap_impl.h
+++ b/src/core/multimaps/tnlEllpackIndexMultimap_impl.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKINDEXMULTIMAP_IMPL_H
-#define	TNLELLPACKINDEXMULTIMAP_IMPL_H
+#pragma once 
 
 #include <core/multimaps/tnlEllpackIndexMultimap.h>
 #include <core/multimaps/tnlEllpackIndexMultimapValues.h>
 
+namespace TNL {
 
 template< typename Index,
           typename Device >
@@ -37,7 +30,7 @@ tnlString tnlEllpackIndexMultimap< Index, Device > :: getType()
    return tnlString( "tnlEllpackIndexMultimap< ") +
           Device :: getDeviceType() +
           tnlString( ", " ) +
-          tnlString( ::getType< Index >() ) +                    
+          tnlString( ::getType< Index >() ) +
           tnlString( " >" );
 }
 
@@ -50,7 +43,7 @@ tnlString tnlEllpackIndexMultimap< Index, Device >::getTypeVirtual() const
 
 template< typename Index,
           typename Device >
-void 
+void
 tnlEllpackIndexMultimap< Index, Device >::
 setRanges( const IndexType inputs,
                const IndexType outputs )
@@ -87,8 +80,8 @@ allocate( const ValuesAllocationVectorType& portsCount )
               cerr << "portsCount.getSize() =  " << portsCount.getSize()
                    << "this->inputs = " << this->keysRange );
    this->valuesMaxCount = portsCount.max();
-   
-   tnlAssert( this->valuesMaxCount >= 0 && this->valuesMaxCount <= this->valuesRange, 
+ 
+   tnlAssert( this->valuesMaxCount >= 0 && this->valuesMaxCount <= this->valuesRange,
               cerr << "this->portsMaxCount = " << this->valuesMaxCount
                    << " this->outputs = " << this->valuesRange );
    this->values.setSize( this->keysRange * this->valuesMaxCount );
@@ -96,7 +89,7 @@ allocate( const ValuesAllocationVectorType& portsCount )
 
 template< typename Index,
           typename Device >
-typename tnlEllpackIndexMultimap< Index, Device >::ValuesAccessorType 
+typename tnlEllpackIndexMultimap< Index, Device >::ValuesAccessorType
 tnlEllpackIndexMultimap< Index, Device >::
 getValues( const IndexType& inputIndex )
 {
@@ -112,5 +105,5 @@ getValues( const IndexType& inputIndex ) const
    return ConstPortsType( this->values.getData(), inputIndex, this->valuesMaxCount );
 }
 
-#endif	/* TNLELLPACKGRAPH_IMPL_H */
+} // namespace TNL
 
diff --git a/src/core/param-types.h b/src/core/param-types.h
index 5a43683821cf126b941b3a4578b16ad0df6341f5..37d7c71ae7fef9ddc91f7a35b172dc91dba1aad2 100644
--- a/src/core/param-types.h
+++ b/src/core/param-types.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef param_typesH
-#define param_typesH
+#pragma once 
 
 #include <core/tnlReal.h>
 #include <core/tnlString.h>
 
+namespace TNL {
+
 template< typename T >
 tnlString getType() { return T :: getType(); };
 
@@ -28,6 +22,7 @@ template<> inline tnlString getType< bool >() { return tnlString( "bool" ); };
 template<> inline tnlString getType< short int >() { return tnlString( "short int" ); };
 template<> inline tnlString getType< int >() { return tnlString( "int" ); };
 template<> inline tnlString getType< long int >() { return tnlString( "long int" ); };
+template<> inline tnlString getType< unsigned int >() { return tnlString( "unsigned int" ); };
 template<> inline tnlString getType< char >() { return tnlString( "char" ); };
 template<> inline tnlString getType< float >() { return tnlString( "float" ); };
 template<> inline tnlString getType< double >() { return tnlString( "double" ); };
@@ -35,4 +30,4 @@ template<> inline tnlString getType< long double >() { return tnlString( "long d
 template<> inline tnlString getType< tnlFloat >() { return tnlString( "tnlFloat" ); };
 template<> inline tnlString getType< tnlDouble> () { return tnlString( "tnlDouble" ); };
 
-#endif
+} // namespace TNL
diff --git a/src/core/terminal-colors.h b/src/core/terminal-colors.h
index 2c67d00c51a06e57f0300f8a0b9d7a73cb61eda9..4892d4da0d16350c6976e242d9637c465497bf6d 100644
--- a/src/core/terminal-colors.h
+++ b/src/core/terminal-colors.h
@@ -6,25 +6,19 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TERMINAL_COLORS_H
-#define	TERMINAL_COLORS_H
+#pragma once
 
-const std::string red( "\033[0;31m" );
-const std::string green( "\033[1;32m" );
-const std::string yellow( "\033[1;33m" );
-const std::string cyan( "\033[0;36m" );
-const std::string magenta( "\033[0;35m" );
-const std::string reset( "\033[0m" );
+namespace TNL {
 
+const tnlString red( "\033[0;31m" );
+const tnlString green( "\033[1;32m" );
+const tnlString yellow( "\033[1;33m" );
+const tnlString cyan( "\033[0;36m" );
+const tnlString magenta( "\033[0;35m" );
+const tnlString bold();
+const tnlString reset( "\033[0m" );
 
-#endif	/* TERMINAL_COLORS_H */
+} // namespace TNL
 
diff --git a/src/core/tnlAssert.h b/src/core/tnlAssert.h
index ccb4ee2bf49705029e54860c6ad67510b78fe377..7e9e07d8f3a4a941a4f3dfe27b7ff1e48fde6dfa 100644
--- a/src/core/tnlAssert.h
+++ b/src/core/tnlAssert.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLASSERT_H_
-#define TNLASSERT_H_
+#pragma once
 
 /****
  * Debugging assert
@@ -28,6 +20,8 @@
 #include <stdlib.h>
 #include <assert.h>
 
+namespace TNL {
+
 #ifdef HAVE_CUDA
 #define tnlAssert( ___tnl__assert_condition, ___tnl__assert_command )                                    \
    if( ! ( ___tnl__assert_condition ) )                                                                  \
@@ -54,7 +48,8 @@
 #endif /* HAVE_CUDA */
 #else /* #ifndef NDEBUG */
 #define tnlAssert( ___tnl__assert_condition, ___tnl__assert_command )
-#endif /* #ifndef NDEBUG */
 
+} // namespace TNL
+
+#endif /* #ifndef NDEBUG */
 
-#endif /* TNLASSERT_H_ */
diff --git a/src/core/tnlCommunicator.h b/src/core/tnlCommunicator.h
deleted file mode 100644
index 770bc79197b9082285c15046f46a98d6dfcece1f..0000000000000000000000000000000000000000
--- a/src/core/tnlCommunicator.h
+++ /dev/null
@@ -1,1192 +0,0 @@
-/***************************************************************************
-                          tnlCommunicator.h  -  description
-                             -------------------
-    begin                : Feb 5, 2011
-    copyright            : (C) 2011 by Tomas 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 TNLCOMMUNICATOR_H_
-#define TNLCOMMUNICATOR_H_
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/shm.h>
-#include <sys/stat.h>
-#include <sys/ipc.h>
-#include <errno.h>
-#include <unistd.h>
-#include <debug/tnlDebug.h>
-#include <core/vectors/tnlVector.h>
-#include <core/vectors/tnlStaticVector.h>
-#include <core/tnlCriticalSection.h>
-#include <core/tnlSharedMemory.h>
-
-const key_t tnlIPCKey = 76025938;
-
-enum tnlReductionOperation
-{
-   tnlSumReduction,
-   tnlProductReduction,
-   tnlMinReduction,
-   tnlMaxReduction
-};
-
-//! This object establishes basic communication operations in TNL.
-/*!***
- * It is aimed for the communication between GPUs and inside the MPI cluster.
- * To make the communication in TNL simple we adopt the MPI philosophy to
- * make use it for the communication between GPUs. In case of GPUs, this communicator
- * creates new process for each GPU device (except of the first one). Then we need
- * to communicate between processes. It is very similar to MPI. Therefore it makes good
- * sense to wrap the MPI communication to this communicator too. This may simplify
- * combining communication between GPUs and cluster nodes in the GPU clusters.
- * What devices will communicate by this communicator depends on the template
- * parameter @param Device.
- */
-template< int Dimensions, typename Device >
-class tnlCommunicator
-{
-   public:
-
-   tnlCommunicator();
-
-   //! This method initialize the group size.
-   /*!***
-    * The parameter @param maxCommunicationGroupSize says the maximum number
-    * of processes running in this communicator. If it is zero, the group size
-    * will be set to the greatest possible number. For example in case of the GPU
-    * communication, the group size will equal to the number of the GPUs installed
-    * in the system. In the case of MPI communication, the group size will equal
-    * to the number of the processes started by mpirun.
-    */
-   bool setCommunicationGroupSize( int maxCommunicationGroupSize = 0 );
-
-   int getCommunicationGroupSize() const;
-
-   bool setDimensions( const tnlStaticVector< Dimensions, int >& dimensions );
-
-   const tnlStaticVector< Dimensions, int >& getDimensions() const;
-
-   const tnlStaticVector< Dimensions, int >& getNodeCoordinates() const;
-
-   int getDeviceId() const;
-
-   //! This method starts the communicator.
-   /*!***
-    * In case of the GPU communication it creates new processes so that there
-    * is one process for each GPU in the system. Then the device IDs are set.
-    * In the case of the MPI, only the device IDs are set.
-    */
-   bool start();
-
-   bool stop();
-
-   template< typename DataType >
-   bool send( const DataType* data,
-              int destinationId ) const;
-
-   template< typename DataType >
-   bool receive( DataType* data,
-                 int sourceId ) const;
-
-   template< typename DataType, typename Index >
-   bool send( const tnlVector< DataType, Device, Index >& data,
-              int destinationId ) const;
-
-   template< typename DataType, typename Index >
-   bool receive( tnlVector< DataType, Device, Index >& data,
-                 int sourceId ) const;
-
-   template< typename DataType >
-   bool broadcast( DataType* data, int sourceId );
-
-   template< typename DataType, typename Index >
-   bool broadcast( tnlVector< DataType, Device, Index >& data, int sourceId );
-
-   template< typename DataType >
-   bool reduction( DataType* data, tnlReductionOperation operation, int targetId );
-
-   template< typename DataType, typename Index >
-   bool scatter( const tnlVector< DataType, Device, Index >& inputData,
-                 tnlVector< DataType, Device, Index >& scatteredData,
-                 int sourceId );
-
-   template< typename DataType, typename Index >
-   bool gather( const tnlVector< DataType, Device, Index >& inputData,
-                tnlVector< DataType, Device, Index >& gatheredData,
-                int targetId );
-
-   bool barrier();
-
-
-   ~tnlCommunicator();
-
-   protected:
-
-   int communicationGroupSize;
-
-   tnlStaticVector< Dimensions, int > dimensions;
-
-   tnlStaticVector< Dimensions, int > nodeCoordinates;
-
-   int deviceID;
-
-   pid_t processID;
-};
-
-template< int Dimensions, typename Device >
-tnlCommunicator< Dimensions, Device > :: tnlCommunicator()
-: communicationGroupSize( 0 ),
-  deviceID( -1 ),
-  processID( -1 )
-{
-}
-
-template< int Dimensions, typename Device >
-int tnlCommunicator< Dimensions, Device > :: getCommunicationGroupSize() const
-{
-   return this->communicationGroupSize;
-}
-
-template< int Dimensions, typename Device >
-bool tnlCommunicator< Dimensions, Device > :: setDimensions( const tnlStaticVector< Dimensions, int >& dimensions )
-{
-   this->dimensions = dimensions;
-   // TODO: add automatic dimensions setting from the group size
-}
-
-template< int Dimensions, typename Device >
-const tnlStaticVector< Dimensions, int >& tnlCommunicator< Dimensions, Device > :: getDimensions() const
-{
-   return this->dimensions;
-}
-
-template< int Dimensions, typename Device >
-const tnlStaticVector< Dimensions, int >& tnlCommunicator< Dimensions, Device > :: getNodeCoordinates() const
-{
-   return this->nodeCoordinates;
-}
-
-template< int Dimensions, typename Device >
-int tnlCommunicator< Dimensions, Device > :: getDeviceId() const
-{
-    return this->deviceID;
-}
-
-template< int Dimensions, typename Device >
-bool tnlCommunicator< Dimensions, Device > :: setCommunicationGroupSize( int communicationGroupSize )
-{
-    this->communicationGroupSize = communicationGroupSize;
-    // TODO: add automatic groupsize setting
-}
-
-template< int Dimensions, typename Device >
-bool tnlCommunicator< Dimensions, Device > :: start()
-{
-   dbgFunctionName( "tnlCommunicator", "start" );
-   if( this->getCommunicationGroupSize() < 1 )
-      this->setCommunicationGroupSize();
-   if( this->getCommunicationGroupSize() < 1 )
-   {
-      cerr << "Sorry, but I have wrong size ( " << this->getCommunicationGroupSize() << " of the communication group. I cannot create a communicator." << endl;
-      return false;
-   }
-   if( this->getDimensions() == tnlStaticVector< Dimensions, int >( 0 ) )
-      this->setDimensions( tnlStaticVector< Dimensions, int >( 0 ) );
-   if( this->getDimensions() == tnlStaticVector< Dimensions, int >( -1 ) )
-   {
-      cerr << "Sorry, but I have wrong dimensions ( " << this->getDimensions() << " of the communication group. I cannot create a communicator." << endl;
-      return false;
-   }
-   if( Device :: getDeviceType() == "tnlCuda" ||
-       Device :: getDeviceType() == "tnlHost" )
-   {
-      deviceID = 0;
-      int currentDeviceID = 1;
-      for( int i = 0; i < this->getCommunicationGroupSize() - 1; i ++ )
-      {
-         pid_t child_pid = fork();
-         if( child_pid != 0 )
-         {
-            /****
-             * This is a parent process.
-             */
-            currentDeviceID ++;
-            dbgCout( "The MASTER process is setting ID to " << currentDeviceID );
-         }
-         else
-         {
-            deviceID = currentDeviceID;
-            dbgCout( "The CHILD process is setting ID to " << deviceID );
-            return true;
-         } // if( child_pid != 0 ) - else
-      } // for( int i = 0; i < this->getCommunicationGroupSize() - 1; i ++ )
-   }
-}
-
-template< int Dimensions, typename Device >
-bool tnlCommunicator< Dimensions, Device > :: stop()
-{
-   dbgFunctionName( "tnlCommunicator", "stop")
-   if( deviceID == 0 )
-   {
-      for( int i = 1; i < getCommunicationGroupSize(); i ++ )
-      {
-         int childStatus;
-         wait( &childStatus );
-      }
-   }
-   else
-   {
-      dbgCout( "Exiting process for the device " << deviceID );
-      exit( EXIT_SUCCESS );
-   }
-
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType >
-bool tnlCommunicator< Dimensions, Device > :: send( const DataType* data,
-                                        int destinationID ) const
-{
-   dbgFunctionName( "tnlCommunicator", "send" );
-   /****
-    * We first allocate the shared memory.
-    */
-   dbgExpr( getDeviceId() );
-   key_t currentIPCKey = tnlIPCKey + deviceID + 1;
-   dbgCout( "The sending process is allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, 1, true );
-   if( ! sharedMemory )
-      return false;
-
-   /****
-    * We must reset the shared memory counters.
-    * This must be done in a critical section.
-    * We initiate the critical section with value 0, which means that it is closed
-    * until this process opens it.
-    */
-   dbgCout( "The sending process is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey, true, 0 );
-   if( ! criticalSection )
-   {
-      cerr << "The sending process with the ID " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-   dbgCout( "The sending process is the shared memory counters to zero ..." )
-   sharedMemory. setReadingCounter( 0 );
-   sharedMemory. setWritingCounter( 0 );
-
-   dbgCout( "The sending process is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-   /****
-    * Now we copy the data to the shared memory.
-    * The DataType cannot be a type with the dynamic memory allocation.
-    */
-   if( Device :: getDevice() == tnlHostDevice )
-   {
-      memcpy( ( void* ) sharedMemory. getData(),
-              data,
-              sizeof( DataType ) );
-   }
-   if( Device :: getDevice() == tnlCudaDevice )
-   {
-
-   }
-   dbgCout( "The sending process has copied data " << * ( ( DataType* ) sharedMemory. getData() ) );
-
-   dbgCout( "The sending process is increasing the writing counter of the shared memory ..." )
-   sharedMemory. increaseWritingCounter();
-
-   dbgCout( "The sending process is waiting for the receiving process to read the data ..." )
-   while( sharedMemory. getReadingCounter() != 1 )
-      usleep( 1 );
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType >
-bool tnlCommunicator< Dimensions, Device > :: receive( DataType* data,
-                                           int sourceID ) const
-{
-   dbgFunctionName( "tnlCommunicator", "receive" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + sourceID + 1;
-   dbgCout( "The receiving process is allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, 1, false );
-   if( ! sharedMemory )
-      return false;
-
-   /****
-    * We will now wait for the sender to reset the shared memory counters.
-    * This is done in a critical section.
-    */
-   dbgCout( "The receiving process is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey, false );
-   if( ! criticalSection )
-   {
-      cerr << "The receiving process cannot create a critical section." << endl;
-      return false;
-   }
-
-   dbgCout( "The receiving process is entering the critical section..." );
-   if( ! criticalSection. enter() )
-   {
-      cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-      return false;
-   }
-
-   dbgCout( "The receiving process is leaving the critical section..." );
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-      return false;
-   }
-
-   /****
-    * Now wait for the data to be copied to the shared memory.
-    */
-   dbgCout( "The receiving process is wating for the data to be copied..." );
-   while( sharedMemory. getWritingCounter() != 1 )
-      usleep( 1 );
-   /****
-    * Now we copy the data from the shared memory.
-    * The DataType cannot by a type with the dynamic memory allocation.
-    */
-   dbgCout( "The receiving process is copying the data from the shared memory " << *( sharedMemory. getData() ) );
-   memcpy( ( void* ) data,
-           ( void* ) sharedMemory. getData(),
-           sizeof( DataType ) );
-   /****
-    * We may now simply write 2 to the flag byte...
-    */
-   sharedMemory. increaseReadingCounter();
-   return true;
-}
-
-
-template< int Dimensions, typename Device >
-template< typename DataType, typename Index >
-bool tnlCommunicator< Dimensions, Device > :: send( const tnlVector< DataType, Device, Index >& data,
-                                        int destinationID ) const
-{
-   dbgFunctionName( "tnlCommunicator", "send" );
-   /****
-    * We first allocate the shared memory.
-    */
-   dbgExpr( getDeviceId() );
-   key_t currentIPCKey = tnlIPCKey + getDeviceId() + 1;
-   dbgCout( "The sending process is allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, data. getSize(), true );
-   if( ! sharedMemory )
-      return false;
-
-   /****
-    * We will now reset the shred memory accesses counters.
-    * This must be done in a critical section.
-    * We initiate it as closed so no other process can enter it before
-    * this and before this one opens it.
-    */
-   dbgCout( "The sending process is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey, true, 0 );
-   if( ! criticalSection )
-   {
-      cerr << "The sending process with the ID " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-   dbgCout( "The sending process is setting the flag byte to tnlSharedMemoryReady ..." )
-   sharedMemory. setReadingCounter( 0 );
-   sharedMemory. setWritingCounter( 0 );
-
-   dbgCout( "The sending process is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-   /****
-    * Now we copy the data to the shared memory.
-    * The DataType cannot be a type with the dynamic memory allocation.
-    */
-   tnlSharedArray< DataType, tnlHost, Index > sendingBuffer( "sendingBuffer" );
-   sendingBuffer. bind( sharedMemory. getData(), data. getSize() );
-   sendingBuffer = data;
-   dbgCout( "The sending process is setting the flag byte to tnlSharedMemoryDataSent ..." )
-   sharedMemory. increaseWritingCounter();
-
-   dbgCout( "The sending process is waiting for the receiving process to read the data ..." )
-   while( sharedMemory. getReadingCounter() != 1 )
-      usleep( 1 );
-
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType, typename Index >
-bool tnlCommunicator< Dimensions, Device > :: receive( tnlVector< DataType, Device, Index >& data,
-                                           int sourceID ) const
-{
-   dbgFunctionName( "tnlCommunicator", "receive" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + sourceID + 1;
-   dbgCout( "The receiving process is allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, data. getSize(), false );
-   if( ! sharedMemory )
-      return false;
-
-   /****
-    * We will now wait for the sender to reset the shared memory counters.
-    * This is done in a critical section.
-    */
-   dbgCout( "The receiving process is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey, false );
-   if( ! criticalSection )
-   {
-      cerr << "The receiving process cannot create a critical section." << endl;
-      return false;
-   }
-
-   dbgCout( "The receiving process is entering the critical section..." );
-   if( ! criticalSection. enter() )
-   {
-      cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-      return false;
-   }
-
-   dbgCout( "The receiving process is leaving the critical section..." );
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-      return false;
-   }
-
-   dbgCout( "The receiving process is waiting for the data to be copied..." );
-   while( sharedMemory. getWritingCounter() != 1 )
-      usleep( 1 );
-
-   dbgCout( "The receiving process is copying the data from the shared memory..." );
-   tnlSharedArray< DataType, tnlHost, Index > receivingBuffer( "receivingBuffer" );
-   receivingBuffer. bind( sharedMemory. getData(), data. getSize() );
-   data = receivingBuffer;
-
-   dbgCout( "The receiving process is increasing the reading counter of the shared memory..." );
-   sharedMemory. increaseReadingCounter();
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType >
-bool tnlCommunicator< Dimensions, Device > :: broadcast( DataType* data, int sourceId )
-{
-   dbgFunctionName( "tnlCommunicator", "broadcast" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + sourceId + 1;
-   dbgCout( "The processes are allocating the shared memory with a key " << currentIPCKey );
-   bool sharedMemoryMaster( false );
-   if( getDeviceId() == sourceId )
-      sharedMemoryMaster = true;
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, 1, sharedMemoryMaster );
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process " << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == sourceId,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process with the ID " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-
-   if( getDeviceId() != sourceId )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The broadcasting process " << getDeviceId() << " is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-      sharedMemory. setWritingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * The broadcasting process will now write data to the shared memory.
-    * After that it increases the writing counter of the shared memory.
-    * The other processes waits until the writing counter equals onr.
-    */
-   if( getDeviceId() == sourceId )
-   {
-      /****
-       * Now we copy the data to the shared memory.
-       * The DataType cannot be a type with the dynamic memory allocation.
-       */
-      if( Device :: getDevice() == tnlHostDevice )
-      {
-         memcpy( ( void* ) ( sharedMemory. getData() ),
-                 ( void* ) data,
-                 sizeof( DataType ) );
-      }
-      if( Device :: getDevice() == tnlCudaDevice )
-      {
-
-      }
-      dbgCout( "The broadcasting process " << getDeviceId() << " has copied data " << * ( ( DataType* ) sharedMemory. getData() ) );
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is increasing the writing counter of the shared memory ..." )
-      sharedMemory. increaseWritingCounter();
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process  " << getDeviceId() << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The broadcasting process  " << getDeviceId() << " is waiting for the receiving process to read the data ..." )
-      while( sharedMemory. getReadingCounter() != communicationGroupSize - 1 )
-         usleep( 1 );
-      return true;
-   }
-   else
-   {
-      /****
-       * The process waits for the broadcasting process to reset the shared memory counters.
-       */
-      dbgCout( "The receiving process  " << getDeviceId() << " is waiting for the data to be copied..." );
-      while( sharedMemory. getWritingCounter() != 1 )
-         usleep( 1 );
-
-      dbgCout( "The receiving process  " << getDeviceId() << " is copying the data from the shared memory " << *( DataType* ) sharedMemory. getData() );
-      memcpy( ( void* ) data,
-              ( void* ) ( sharedMemory. getData() ),
-              sizeof( DataType ) );
-
-      /****
-       * Increase the reading counter (inside the critical section)
-       */
-      dbgCout( "The receiving process  " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process  " << getDeviceId() << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The receiving process " << getDeviceId() << " is increasing the reading counter to " << sharedMemory. getReadingCounter() + 1 << "..." );
-      sharedMemory. increaseReadingCounter();
-
-      dbgCout( "The receiving process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process  " << getDeviceId() << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-      return true;
-   }
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType, typename Index >
-bool tnlCommunicator< Dimensions, Device > :: broadcast( tnlVector< DataType, Device, Index >& data,
-                                             int sourceId )
-{
-   dbgFunctionName( "tnlCommunicator", "broadcast" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + sourceId + 1;
-   dbgCout( "The process " << getDeviceId() << " is allocating the shared memory with a key " << currentIPCKey );
-   bool sharedMemoryMaster( false );
-   if( getDeviceId() == sourceId )
-      sharedMemoryMaster = true;
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey, 1, sharedMemoryMaster );
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process" << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == sourceId,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process with the ID " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-   if( getDeviceId() != sourceId )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The broadcasting process is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-      sharedMemory. setWritingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * The broadcasting process will now write data to the shared memory.
-    * After that it increases the writing counter of the shared memory.
-    * The other processes waits until the writing counter equals onr.
-    */
-   if( getDeviceId() == sourceId )
-   {
-      /****
-       * Now we copy the data to the shared memory.
-       * The DataType cannot be a type with the dynamic memory allocation.
-       */
-      tnlSharedArray< DataType, tnlHost, Index > sendingBuffer( "sendingBuffer" );
-      sendingBuffer. bind( sharedMemory. getData(), data. getSize() );
-      sendingBuffer = data;
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " has copied data." );
-      dbgCout( "The broadcasting process " << getDeviceId() << " is increasing the writing counter of the shared memory ..." )
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-      sharedMemory. increaseWritingCounter();
-      dbgCout( "The broadcasting process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is waiting for the receiving process to read the data ..." )
-      while( sharedMemory. getReadingCounter() != communicationGroupSize - 1 )
-         usleep( 1 );
-   }
-   else
-   {
-      dbgCout( "The receiving process " << getDeviceId() << " is waiting for the data to be copied..." );
-      while( sharedMemory. getWritingCounter() != 1 )
-         usleep( 1 );
-
-      dbgCout( "The receiving process " << getDeviceId() << " copying the data from the shared memory. " );
-      tnlSharedArray< DataType, tnlHost, Index > receivingBuffer( "receivingBuffer" );
-      receivingBuffer. bind( sharedMemory. getData(), data. getSize() );
-      data = receivingBuffer;
-
-      /****
-       * Increase the reading counter (inside the critical section)
-       */
-      dbgCout( "The receiving process " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The receiving process " << getDeviceId() << " is increasing the reading counter..." );
-      sharedMemory. increaseReadingCounter();
-
-      dbgCout( "The receiving process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-   }
-   dbgCout( "The process " << getDeviceId() << " is finishing the broadcasting operation.")
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType >
-bool tnlCommunicator< Dimensions, Device > :: reduction( DataType* data, tnlReductionOperation operation, int targetId )
-{
-   dbgFunctionName( "tnlCommunicator", "reduction" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + targetId + 1;
-   dbgCout( "The processes are allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey,
-                                             getCommunicationGroupSize(),
-                                             getDeviceId() == targetId );
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process " << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == targetId,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-
-   if( getDeviceId() != targetId )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The target process " << getDeviceId() << " is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-      sharedMemory. setWritingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * All processes will now write their data to its position in the shared memory array.
-    * After that each process increases the writing counter of the shared memory.
-    * The target process waits until all processes has written their data which
-    * means until the writing counter equals communication group size.
-    */
-
-
-   if( Device :: getDevice() == tnlHostDevice )
-   {
-      dbgCout( "The process " << getDeviceId() << " is writing data " << * data );
-      memcpy( ( void* ) &( sharedMemory. getData()[ getDeviceId() ] ),
-              ( void* ) data,
-              sizeof( DataType ) );
-   }
-   if( Device :: getDevice() == tnlCudaDevice )
-   {
-
-   }
-   dbgCout( "The process " << getDeviceId() << " has copied data " << sharedMemory. getData()[ getDeviceId() ] );
-
-   dbgCout( "The process " << getDeviceId() << " is entering the critical section..." );
-   if( ! criticalSection. enter() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot enter the critical section to receive data." << endl;
-      return false;
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is increasing the writing counter of the shared memory ..." )
-   sharedMemory. increaseWritingCounter();
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section..." );
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process  " << getDeviceId() << " cannot leave the critical section to receive data." << endl;
-      return false;
-   }
-
-   if( getDeviceId() == targetId )
-   {
-      dbgCout( "The target process " << getDeviceId() << " is waiting until the other processes write their data ..." )
-      while( sharedMemory. getWritingCounter() != communicationGroupSize )
-         usleep( 1 );
-      dbgCout( "The target process " << getDeviceId() << " is performing the reduction ..." );
-      DataType* array = sharedMemory. getData();
-      DataType aux = array[ 0 ];
-      for( int i = 1; i < getCommunicationGroupSize(); i ++ )
-      {
-         switch( operation )
-         {
-            case tnlSumReduction:
-               aux += array[ i ];
-               break;
-            case tnlProductReduction:
-               aux *= array[ i ];
-               break;
-            case tnlMinReduction:
-               aux = Min( aux, array[ i ] );
-               break;
-            case tnlMaxReduction:
-               aux = Max( aux, array[ i ] );
-               break;
-         }
-      }
-      if( Device :: getDevice() == tnlHostDevice )
-      {
-         *data = aux;
-         dbgExpr( *data );
-      }
-      if( Device :: getDevice() == tnlCudaDevice )
-      {
-
-      }
-   }
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType, typename Index >
-bool tnlCommunicator< Dimensions, Device > :: scatter( const tnlVector< DataType, Device, Index >& inputData,
-                                           tnlVector< DataType, Device, Index >& scatteredData,
-                                           int sourceId )
-{
-   dbgFunctionName( "tnlCommunicator", "scatter" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + sourceId + 1;
-   dbgCout( "The process " << getDeviceId() << " is allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey,
-                                             inputData. getSize(),
-                                             getDeviceId() == sourceId );
-   if( ! sharedMemory )
-      return false;
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process" << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == sourceId,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process with the ID " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-   if( getDeviceId() != sourceId )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The master process is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-      sharedMemory. setWritingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * The master process will now write data to the shared memory.
-    * After that it increases the writing counter of the shared memory.
-    * The other processes waits until the writing counter equals one.
-    */
-   if( getDeviceId() == sourceId )
-   {
-      /****
-       * Now we copy the data to the shared memory.
-       * The DataType cannot be a type with the dynamic memory allocation.
-       */
-      tnlSharedArray< DataType, tnlHost, Index > sendingBuffer( "sendingBuffer" );
-      sendingBuffer. bind( sharedMemory. getData(), inputData. getSize() );
-      sendingBuffer = inputData;
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " has copied data." );
-      dbgCout( "The broadcasting process " << getDeviceId() << " is increasing the writing counter of the shared memory ..." )
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-      sharedMemory. increaseWritingCounter();
-      dbgCout( "The broadcasting process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The process " << getDeviceId() << " is copying the data from the shared memory. " );
-      tnlSharedArray< DataType, tnlHost, Index > receivingBuffer( "receivingBuffer" );
-      receivingBuffer. bind( sharedMemory. getData(), scatteredData. getSize() );
-      scatteredData = receivingBuffer;
-
-      dbgCout( "The broadcasting process " << getDeviceId() << " is waiting for the receiving process to read the data ..." )
-      while( sharedMemory. getReadingCounter() != communicationGroupSize - 1 )
-         usleep( 1 );
-   }
-   else
-   {
-      dbgCout( "The process " << getDeviceId() << " is waiting for the data to be copied..." );
-      while( sharedMemory. getWritingCounter() != 1 )
-         usleep( 1 );
-
-      dbgCout( "The process " << getDeviceId() << " is copying the data from the shared memory. " );
-      tnlSharedArray< DataType, tnlHost, Index > receivingBuffer( "receivingBuffer" );
-      receivingBuffer. bind( sharedMemory. getData(), scatteredData. getSize() );
-      scatteredData = receivingBuffer;
-
-      /****
-       * Increase the reading counter (inside the critical section)
-       */
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." );
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << deviceID << " cannot enter the critical section to receive data." << endl;
-         return false;
-      }
-
-      dbgCout( "The process " << getDeviceId() << " is increasing the reading counter..." );
-      sharedMemory. increaseReadingCounter();
-
-      dbgCout( "The process " << getDeviceId() << " is leaving the critical section..." );
-      if( ! criticalSection. leave() )
-      {
-         cerr << "The process " << deviceID << " cannot leave the critical section to receive data." << endl;
-         return false;
-      }
-   }
-   dbgCout( "The process " << getDeviceId() << " is finishing the scattering operation.")
-   return true;
-}
-
-template< int Dimensions, typename Device >
-template< typename DataType, typename Index >
-bool tnlCommunicator< Dimensions, Device > :: gather( const tnlVector< DataType, Device, Index >& inputData,
-                                           tnlVector< DataType, Device, Index >& gatheredData,
-                                           int targetId )
-{
-   dbgFunctionName( "tnlCommunicator", "gather" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + targetId + 1;
-   dbgCout( "The processes are allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< DataType > sharedMemory( currentIPCKey,
-                                             getCommunicationGroupSize() * inputData. getSize(),
-                                             getDeviceId() == targetId );
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process " << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == targetId,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-
-   if( getDeviceId() != targetId )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The target process " << getDeviceId() << " is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-      sharedMemory. setWritingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * All processes will now write their data to its position in the shared memory array.
-    * After that each process increases the writing counter of the shared memory.
-    * The target process waits until all processes has written their data which
-    * means until the writing counter equals communication group size.
-    */
-
-   if( Device :: getDevice() == tnlHostDevice )
-   {
-      dbgCout( "The process " << getDeviceId() << " is writing data ... " );
-      memcpy( ( void* ) &( sharedMemory. getData()[ getDeviceId() * inputData. getSize() ] ),
-              ( void* ) inputData. getData(),
-              sizeof( DataType ) );
-   }
-   if( Device :: getDevice() == tnlCudaDevice )
-   {
-
-   }
-   dbgCout( "The process " << getDeviceId() << " has copied data " << sharedMemory. getData()[ getDeviceId() ] );
-
-   dbgCout( "The process " << getDeviceId() << " is entering the critical section..." );
-   if( ! criticalSection. enter() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot enter the critical section to receive data." << endl;
-      return false;
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is increasing the writing counter of the shared memory ..." )
-   sharedMemory. increaseWritingCounter();
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section..." );
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process  " << getDeviceId() << " cannot leave the critical section to receive data." << endl;
-      return false;
-   }
-
-   if( getDeviceId() == targetId )
-   {
-      dbgCout( "The target process " << getDeviceId() << " is waiting until the other processes write their data ..." )
-      while( sharedMemory. getWritingCounter() != communicationGroupSize )
-         usleep( 1 );
-      dbgCout( "The target process " << getDeviceId() << " is gathering the data ..." );
-      tnlSharedArray< DataType, tnlHost, Index > sharedMemoryVector( "sharedMemoryVector" );
-      sharedMemoryVector. bind( sharedMemory. getData(), getCommunicationGroupSize() * inputData. getSize() );
-      gatheredData = sharedMemoryVector;
-   }
-   return true;
-}
-
-template< int Dimensions, typename Device >
-bool tnlCommunicator< Dimensions, Device > :: barrier()
-{
-   dbgFunctionName( "tnlCommunicator", "gather" );
-   /****
-    * We first allocate the shared memory.
-    */
-   key_t currentIPCKey = tnlIPCKey + 1;
-   dbgCout( "The processes are allocating the shared memory with a key " << currentIPCKey );
-   tnlSharedMemory< char > sharedMemory( currentIPCKey,
-                                         1,
-                                         getDeviceId() == 0 );
-
-   /****
-    * Reset the shared memory counters
-    */
-   dbgCout( "The process " << getDeviceId() << " is creating a critical section..." );
-   tnlCriticalSection criticalSection( currentIPCKey,
-                                       getDeviceId() == 0,
-                                       0 );
-   if( ! criticalSection )
-   {
-      cerr << "The process " << getDeviceId() << " cannot create a critical section." << endl;
-      return false;
-   }
-
-
-   if( getDeviceId() != 0 )
-   {
-      dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-      if( ! criticalSection. enter() )
-      {
-         cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-         return false;
-      }
-   }
-   else
-   {
-      dbgCout( "The target process " << getDeviceId() << " is resetting the shared memory counters ..." );
-      sharedMemory. setReadingCounter( 0 );
-   }
-
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   /****
-    * Now each process will increase the read counter and then waits until
-    * this counter reaches the number of all processes.
-    */
-
-   dbgCout( "The process " << getDeviceId() << " is entering the critical section..." )
-   if( ! criticalSection. enter() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot enter the critical section to send the data." << endl;
-      return false;
-   }
-   sharedMemory. increaseReadingCounter();
-   dbgCout( "The process " << getDeviceId() << " is leaving the critical section ..." )
-   if( ! criticalSection. leave() )
-   {
-      cerr << "The process " << getDeviceId() << " cannot leave the critical section to send the data." << endl;
-      return false;
-   }
-
-   while( sharedMemory. getReadingCounter() != getCommunicationGroupSize() )
-      usleep( 1 );
-}
-
-template< int Dimensions, typename Device >
-tnlCommunicator< Dimensions, Device > :: ~tnlCommunicator()
-{
-   stop();
-}
-
-#endif /* TNLCOMMUNICATOR_H_ */
diff --git a/src/core/tnlConstants.h b/src/core/tnlConstants.h
index dc7d1f5ea12d067283e01f5143755fe4c3e36a5d..462bc7b99a91bfda1bb675e8374036884a648c1b 100644
--- a/src/core/tnlConstants.h
+++ b/src/core/tnlConstants.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONSTANTS_H
-#define	TNLCONSTANTS_H
+#pragma once
 
 #include <limits.h>
 #include <float.h>
@@ -24,6 +16,8 @@
 #include <core/tnlAssert.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename T > __cuda_callable__ T tnlMinValue(){ tnlAssert( false,)};
 template<> inline __cuda_callable__ char               tnlMinValue< char >() { return CHAR_MIN; }
 template<> inline __cuda_callable__ unsigned char      tnlMinValue< unsigned char >() { return 0; }
@@ -50,8 +44,5 @@ template<> inline __cuda_callable__ float              tnlMaxValue< float >() {
 template<> inline __cuda_callable__ double             tnlMaxValue< double >() { return DBL_MAX; }
 template<> inline __cuda_callable__ long double        tnlMaxValue< long double >() { return LDBL_MAX; }
 
-
-
-
-#endif	/* TNLCONSTANTS_H */
+} // namespace TNL
 
diff --git a/src/core/tnlCoordinates.h b/src/core/tnlCoordinates.h
deleted file mode 100644
index 55d88fbc573d54c3872d8739ede57302c51a995e..0000000000000000000000000000000000000000
--- a/src/core/tnlCoordinates.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/***************************************************************************
-                          tnlCoordinates.h  -  description
-                             -------------------
-    begin                : Feb 27, 2011
-    copyright            : (C) 2011 by Tomas 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 TNLCOORDINATES_H_
-#define TNLCOORDINATES_H_
-
-#include <core/vectors/tnlStaticVector.h>
-
-/*!***
- * tnlCoordinates are used mainly by the tnlCommunicator.
- * It is usually meant as coordinate of a node in a finite grid.
- */
-template< int Dimensions, typename Index >
-class tnlCoordinates : public tnlStaticVector< Dimensions, Index >
-{
-};
-
-template< typname Index >
-class tnlCoordinates< 1, Index > : public tnlStaticVector< 1, Index >
-{
-   Index getGridSize() const;
-
-   void nextNode( const tnlCoordinates< 1, Index >& dimensions );
-};
-
-template< typname Index >
-class tnlCoordinates< 2, Index > : public tnlStaticVector< 1, Index >
-{
-   Index getGridSize() const;
-
-   void nextNode( const tnlCoordinates< 2, Index >& dimensions );
-};
-
-template< typname Index >
-class tnlCoordinates< 3, Index > : public tnlStaticVector< 1, Index >
-{
-   Index getGridSize() const;
-
-   void nextNode( const tnlCoordinates< 3, Index >& dimensions );
-};
-
-template< typname Index >
-Index tnlCoordinates< 1, Index > :: getGridSize() const
-{
-   return ( *this )[ 0 ];
-}
-
-template< typname Index >
-void tnlCoordinates< 1, Index > :: nextNode( const tnlCoordinates< 1, Index >& dimensions )
-{
-   ( *this )[ 0 ] ++;
-   ( *this )[ 0 ] = ( *this )[ 0 ] % dimensions[ 0 ];
-}
-
-
-template< typname Index >
-Index tnlCoordinates< 2, Index > :: getGridSize() const
-{
-   return ( *this )[ 0 ] * ( *this )[ 1 ];
-}
-
-template< typname Index >
-void tnlCoordinates< 2, Index > :: nextNode( const tnlCoordinates< 2, Index >& dimensions )
-{
-
-}
-
-
-template< typname Index >
-Index tnlCoordinates< 3, Index > :: getGridSize() const
-{
-   return ( *this )[ 0 ] * ( *this )[ 1 ] * ( *this )[ 2 ];
-}
-
-template< typname Index >
-void tnlCoordinates< 3, Index > :: nextNode( const tnlCoordinates< 3, Index >& dimensions )
-{
-
-}
-
-
-#endif /* TNLCOORDINATES_H_ */
diff --git a/src/core/tnlCriticalSection.cpp b/src/core/tnlCriticalSection.cpp
deleted file mode 100644
index a85a52630d981aa1ea05d5a1535bd5fac72dbabc..0000000000000000000000000000000000000000
--- a/src/core/tnlCriticalSection.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/***************************************************************************
-                          tnlCriticalSection.cpp  -  description
-                             -------------------
-    begin                : Feb 20, 2011
-    copyright            : (C) 2011 by Tomas 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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include <errno.h>
-#include <iostream>
-#include <debug/tnlDebug.h>
-#include <core/tnlCriticalSection.h>
-
-using namespace std;
-
-tnlCriticalSection :: tnlCriticalSection( key_t sectionKey,
-                                          bool sectionMaster,
-                                          int initialSemaphoreValue )
-: semaphoreId( 0 ),
-  sectionMaster( sectionMaster ),
-  sectionKey( sectionKey ),
-  sectionOk( true )
-{
-   dbgFunctionName( "tnlCriticalSection", "tnlCriticalSection");
-
-   /****
-    * Get the semaphore first.
-    */
-   dbgCout( "The critical section is getting a semaphore..." );
-   semaphoreId = semget( sectionKey, 1, 0666 | IPC_CREAT );
-   if( semaphoreId < 0 )
-   {
-      cerr << "I am not able to create new semaphore for IPC ( errno = " << errno << ")." << endl;
-      sectionOk = false;
-      return;
-   }
-
-   if( sectionMaster )
-   {
-      /****
-       * Initialize the semaphore.
-       */
-      dbgCout( "The critical section is initializing the semaphore..." );
-      union semun {
-         int              val;
-         struct semid_ds *buf;
-         unsigned short  *array;
-         struct seminfo  *__buf;
-      } semaphoreUnion;
-
-      semaphoreUnion. val = initialSemaphoreValue;
-      if( semctl( semaphoreId, 0, SETVAL, semaphoreUnion ) == -1 )
-      {
-         cerr << "I am not able to set new semaphore for IPC ( errno = " << errno << ")." << endl;
-         sectionOk = false;
-      }
-   }
-
-}
-
-tnlCriticalSection :: operator bool () const
-{
-   return sectionOk;
-}
-
-bool tnlCriticalSection :: enter()
-{
-   dbgFunctionName( "tnlCriticalSection", "enter");
-   dbgCout( "The process is entering the critical section with semid " << semaphoreId << "..." );
-   sembuf semBuf;
-   semBuf. sem_num = 0;
-   semBuf. sem_op = -1;
-   semBuf. sem_flg = SEM_UNDO;
-   if( semop( semaphoreId, &semBuf, 1 ) ==  -1 )
-   {
-      cerr << "The process cannot enter the critical section ( errno = " << errno << ")." << endl;
-      return false;
-   }
-   return true;
-}
-
-bool tnlCriticalSection :: leave()
-{
-   dbgFunctionName( "tnlCriticalSection", "leave");
-   dbgCout( "The process is leaving the critical section with semid " << semaphoreId << " ..." );
-   sembuf semBuf;
-   semBuf. sem_num = 0;
-   semBuf. sem_op = 1;
-   semBuf. sem_flg = SEM_UNDO;
-   if( semop( semaphoreId, &semBuf, 1 ) ==  -1 )
-   {
-      cerr << "The process cannot leave the critical section ( errno = " << errno << ")." << endl;
-      return false;
-   }
-   return true;
-}
-
-tnlCriticalSection :: ~tnlCriticalSection()
-{
-   dbgFunctionName( "tnlCriticalSection", "~tnlCriticalSection");
-   if( sectionMaster )
-   {
-      /****
-       * Release the semaphore.
-       */
-      dbgCout( "The critical section is releasing the semaphore ..." );
-      union semun {
-         int              val;
-         struct semid_ds *buf;
-         unsigned short  *array;
-         struct seminfo  *__buf;
-      } semaphoreUnion;
-      if( semctl( semaphoreId, 0, IPC_RMID, semaphoreUnion ) == -1 )
-      {
-         cerr << "I am not able to release the semaphore ( errno = " << errno << ")." << endl;
-      }
-   }
-}
diff --git a/src/core/tnlCriticalSection.h b/src/core/tnlCriticalSection.h
deleted file mode 100644
index 639fd12ab0db691b2f445265f88b7db9a405fb1f..0000000000000000000000000000000000000000
--- a/src/core/tnlCriticalSection.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/***************************************************************************
-                          tnlCriticalSection.h  -  description
-                             -------------------
-    begin                : Feb 20, 2011
-    copyright            : (C) 2011 by Tomas 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 TNLCRITICALSECTION_H_
-#define TNLCRITICALSECTION_H_
-
-#include <sys/sem.h>
-
-/*!***
- * This class wraps semaphor used for entering and leaving critical section in IPC.
- */
-class tnlCriticalSection
-{
-   public:
-
-   /*!**
-    * This is a constructor taking a unique key for the semaphore.
-    * @param sectionKey is a unique key for the enwrapped semaphore
-    * @param sectionMaster one of the processes using this critical section must
-    *        be a master and release the semaphore at the end.
-    * @param initialSemaphoreValue is the initial value of the sempahore
-    */
-   tnlCriticalSection( key_t sectionKey,
-                       bool sectionMaster,
-                       int initalSemaphoreValue = 1 );
-
-   operator bool () const;
-
-   /*!**
-    * Call this method to enter the section.
-    */
-   bool enter();
-
-   /*!**
-    * Call this method to leave the section.
-    */
-   bool leave();
-
-   /*!**
-    * Destructor for the critical section.
-    */
-   ~tnlCriticalSection();
-
-   protected:
-
-   key_t sectionKey;
-
-   bool sectionMaster;
-
-   int semaphoreId;
-
-   bool sectionOk;
-};
-#endif /* TNLCRITICALSECTION_H_ */
diff --git a/src/core/tnlCuda.cpp b/src/core/tnlCuda.cpp
index 20f6272a30f42c66f2fccbd27ed1be1c4cd631d6..b7335d327c96852fa3a7b7b2366171b1e0746d67 100644
--- a/src/core/tnlCuda.cpp
+++ b/src/core/tnlCuda.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlCuda.h>
 #include <core/mfuncs.h>
@@ -21,6 +14,8 @@
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
 
+namespace TNL {
+ 
 tnlString tnlCuda :: getDeviceType()
 {
    return tnlString( "tnlCuda" );
@@ -56,7 +51,7 @@ void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix
    config.addEntry<  int >( prefix + "cuda-device", "Choose CUDA device to run the computationon (not supported on this system).", 0 );
 #endif
 }
-      
+ 
 bool tnlCuda::setup( const tnlParameterContainer& parameters,
                       const tnlString& prefix )
 {
@@ -67,7 +62,9 @@ bool tnlCuda::setup( const tnlParameterContainer& parameters,
       std::cerr << "I cannot activate CUDA device number " << cudaDevice << "." << std::endl;
       return false;
    }
-#endif   
+#endif
    return true;
 }
 
+} // namespace TNL
+
diff --git a/src/core/tnlCuda.cu b/src/core/tnlCuda.cu
index 113cba35227a0c461f1a32dc1148cd1e9646ac0f..607de6c8a637ef98bbb76d0cadfe62aea13ca877 100644
--- a/src/core/tnlCuda.cu
+++ b/src/core/tnlCuda.cu
@@ -6,29 +6,23 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlCuda.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
 
+namespace TNL {
 
 /*void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix )
 {
 #ifdef HAVE_CUDA
    config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device.", 0 );
 #else
-   config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device (CUDA is not supported on this system).", 0 );   
-#endif   
+   config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device (CUDA is not supported on this system).", 0 );
+#endif
 }
-      
+ 
 bool tnlCuda::setup( const tnlParameterContainer& parameters,
                     const tnlString& prefix )
 {
@@ -57,7 +51,7 @@ bool tnlCuda::checkDevice( const char* file_name, int line )
        break;
 
       // 2
-      case cudaErrorMemoryAllocation:   
+      case cudaErrorMemoryAllocation:
          cerr
           << "The API call failed because it was unable to allocate enough memory to " << endl
           << "perform the requested operation. " << endl;
@@ -69,7 +63,7 @@ bool tnlCuda::checkDevice( const char* file_name, int line )
           << "The API call failed because the CUDA driver and runtime could not be " << endl
           << "initialized. " << endl;
        break;
-   
+ 
       // 4
       case cudaErrorLaunchFailure:
          cerr
@@ -118,7 +112,7 @@ bool tnlCuda::checkDevice( const char* file_name, int line )
           << "proper device architecture. " << endl;
        break;
  
-      // 9 
+      // 9
       case cudaErrorInvalidConfiguration:
          cerr
           << "This indicates that a kernel launch is requesting resources that can " << endl
@@ -128,7 +122,7 @@ bool tnlCuda::checkDevice( const char* file_name, int line )
           << "device limitations. " << endl;
        break;
 
-      // 10 
+      // 10
       case cudaErrorInvalidDevice:
          cerr
           << "This indicates that the device ordinal supplied by the user does not " << endl
@@ -418,3 +412,5 @@ bool tnlCuda::checkDevice( const char* file_name, int line )
    //throw EXIT_FAILURE;
    return false;
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlCuda.h b/src/core/tnlCuda.h
index 3d5e6eb6ebfd391e634a2bb9ad2979d425b5353a..87a4fb80f425abf0a6101f91ba1a594e0d25f865 100644
--- a/src/core/tnlCuda.h
+++ b/src/core/tnlCuda.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDA_H_
-#define TNLCUDA_H_
+#pragma once
 
 #include <iostream>
 #include <unistd.h>
@@ -24,6 +16,8 @@
 #include <core/tnlString.h>
 #include <core/tnlAssert.h>
 
+namespace TNL {
+
 class tnlConfigDescription;
 class tnlParameterContainer;
 
@@ -93,9 +87,9 @@ class tnlCuda
 #else
    static bool checkDevice( const char* file_name, int line ) { return false;};
 #endif
-   
+ 
    static void configSetup( tnlConfigDescription& config, const tnlString& prefix = "" );
-      
+ 
    static bool setup( const tnlParameterContainer& parameters,
                       const tnlString& prefix = "" );
 
@@ -130,6 +124,6 @@ class tnlCuda
 
 #endif
 
+} // namespace TNL   
+   
 #include <core/tnlCuda_impl.h>
-
-#endif /* TNLCUDA_H_ */
diff --git a/src/core/tnlCudaDeviceInfo.cpp b/src/core/tnlCudaDeviceInfo.cpp
index cd5a4623900ebc174ee5da705674fe23eccb4ccc..fd3437822bf0d7277295d7a7ddd51eb2b950b3cf 100644
--- a/src/core/tnlCudaDeviceInfo.cpp
+++ b/src/core/tnlCudaDeviceInfo.cpp
@@ -6,26 +6,28 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef HAVE_CUDA
 
 #include <core/tnlCudaDeviceInfo.h>
 
+namespace TNL {
+
 int
 tnlCudaDeviceInfo::
 getNumberOfDevices()
 {
    return -1;
 }
-      
+
+int
+tnlCudaDeviceInfo::
+getActiveDevice()
+{
+   return -1;
+}
+
 tnlString
 tnlCudaDeviceInfo::
 getDeviceName( int deviceNum )
@@ -39,7 +41,7 @@ getArchitectureMajor( int deviceNum )
 {
     return 0;
 }
-      
+
 int
 tnlCudaDeviceInfo::
 getArchitectureMinor( int deviceNum )
@@ -53,7 +55,7 @@ getClockRate( int deviceNum )
 {
    return 0;
 }
-      
+
 size_t
 tnlCudaDeviceInfo::
 getGlobalMemory( int deviceNum )
@@ -96,5 +98,6 @@ getCudaCores( int deviceNum )
    return 0;
 }
 
+} // namespace TNL
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/core/tnlCudaDeviceInfo.cu b/src/core/tnlCudaDeviceInfo.cu
index 5754f38b43a7ac42360f3f2443c0e89e34d965d6..d916b90b20bf14694c08e73ad2bbb4587419d60d 100644
--- a/src/core/tnlCudaDeviceInfo.cu
+++ b/src/core/tnlCudaDeviceInfo.cu
@@ -6,20 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifdef HAVE_CUDA
 
 #include <core/tnlCudaDeviceInfo.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 int
 tnlCudaDeviceInfo::
 getNumberOfDevices()
@@ -28,7 +23,16 @@ getNumberOfDevices()
     cudaGetDeviceCount( &devices );
     return devices;
 }
-      
+
+int
+tnlCudaDeviceInfo::
+getActiveDevice()
+{
+    int device;
+    cudaGetDevice( &device );
+    return device;
+}
+
 tnlString
 tnlCudaDeviceInfo::
 getDeviceName( int deviceNum )
@@ -46,7 +50,7 @@ getArchitectureMajor( int deviceNum )
     cudaGetDeviceProperties( &properties, deviceNum );
     return properties.major;
 }
-      
+
 int
 tnlCudaDeviceInfo::
 getArchitectureMinor( int deviceNum )
@@ -55,7 +59,7 @@ getArchitectureMinor( int deviceNum )
     cudaGetDeviceProperties( &properties, deviceNum );
     return properties.minor;
 }
-      
+
 int
 tnlCudaDeviceInfo::
 getClockRate( int deviceNum )
@@ -64,7 +68,7 @@ getClockRate( int deviceNum )
     cudaGetDeviceProperties( &properties, deviceNum );
     return properties.clockRate;
 }
-      
+
 size_t
 tnlCudaDeviceInfo::
 getGlobalMemory( int deviceNum )
@@ -115,7 +119,7 @@ getCudaCoresPerMultiprocessors( int deviceNum )
         switch( minor )
         {
             case 0:  // GF100 class
-                return 32; 
+                return 32;
             case 1:  // GF10x class
                 return 48;
         }
@@ -136,5 +140,6 @@ getCudaCores( int deviceNum )
            tnlCudaDeviceInfo::getCudaCoresPerMultiprocessors( deviceNum );
 }
 
+} // namespace TNL
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/core/tnlCudaDeviceInfo.h b/src/core/tnlCudaDeviceInfo.h
index 34a560e3303ee17d3077b2613ecf968aec9a9d94..145a40f8527f15c46640224035fdf1a4d7b7d1b6 100644
--- a/src/core/tnlCudaDeviceInfo.h
+++ b/src/core/tnlCudaDeviceInfo.h
@@ -6,51 +6,44 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDADEVICEINFO_H
-#define	TNLCUDADEVICEINFO_H
+#pragma once
 
 #include <stdlib.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 class tnlCudaDeviceInfo
 {
    public:
-      
+
       static int getNumberOfDevices();
-      
+
+      static int getActiveDevice();
+
       static tnlString getDeviceName( int deviceNum );
-      
+
       static int getArchitectureMajor( int deviceNum );
-      
+
       static int getArchitectureMinor( int deviceNum );
-      
+
       static int getClockRate( int deviceNum );
-      
+
       static size_t getGlobalMemory( int deviceNum );
 
       static int getMemoryClockRate( int deviceNum );
 
       static bool getECCEnabled( int deviceNum );
 
-      static int getCudaMultiprocessors( int deviceNum );      
-      
-      static int getCudaCoresPerMultiprocessors( int deviceNum );      
-      
-      static int getCudaCores( int deviceNum );      
-      
-};
+      static int getCudaMultiprocessors( int deviceNum );
 
+      static int getCudaCoresPerMultiprocessors( int deviceNum );
 
+      static int getCudaCores( int deviceNum );
 
+};
 
-#endif	/* TNLCUDADEVICEINFO_H */
+} // namespace TNL
 
diff --git a/src/core/tnlCuda_impl.h b/src/core/tnlCuda_impl.h
index 42ec1165994f66a55f0c0512795e4cf719b62d3d..964e7708deda7abdfb755b185b08fc4287c70af3 100644
--- a/src/core/tnlCuda_impl.h
+++ b/src/core/tnlCuda_impl.h
@@ -6,47 +6,35 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCUDA_IMPL_H_
-#define TNLCUDA_IMPL_H_
+#pragma once
 
-#ifdef HAVE_CUDA
-__host__ __device__
-#endif
+#include <core/tnlCuda.h>
+
+namespace TNL {
+
+__cuda_callable__ 
 inline tnlDeviceEnum tnlCuda::getDevice()
 {
    return tnlCudaDevice;
 };
 
-#ifdef HAVE_CUDA
-__host__ __device__
-#endif
+__cuda_callable__ 
 inline int tnlCuda::getMaxGridSize()
 {
    // TODO: make it preprocessor macro constant defined in tnlConfig
-   return 65536;
+   return 65535;
 };
 
-#ifdef HAVE_CUDA
-__host__ __device__
-#endif
+__cuda_callable__
 inline int tnlCuda::getMaxBlockSize()
 {
    // TODO: make it preprocessor macro constant defined in tnlConfig
    return 1024;
 };
 
-#ifdef HAVE_CUDA
-__host__ __device__
-#endif
+__cuda_callable__ 
 inline int tnlCuda::getWarpSize()
 {
    // TODO: make it preprocessor macro constant defined in tnlConfig
@@ -62,9 +50,7 @@ __device__ Index tnlCuda::getGlobalThreadIdx( const Index gridIdx )
 #endif
 
 
-#ifdef HAVE_CUDA
-__host__ __device__
-#endif
+__cuda_callable__ 
 inline int tnlCuda::getNumberOfSharedMemoryBanks()
 {
    // TODO: make it preprocessor macro constant defined in tnlConfig
@@ -112,7 +98,7 @@ ObjectType tnlCuda::passFromDevice( const ObjectType* object )
 #else
    tnlAssert( false, cerr << "CUDA support is missing." );
    return 0;
-#endif      
+#endif
 }
 
 template< typename ObjectType >
@@ -127,7 +113,7 @@ void tnlCuda::passFromDevice( const ObjectType* deviceObject,
    checkCudaDevice;
 #else
    tnlAssert( false, cerr << "CUDA support is missing." );
-#endif      
+#endif
 }
 
 template< typename ObjectType >
@@ -144,12 +130,12 @@ void tnlCuda::print( const ObjectType* deviceObject, ostream& str )
 template< typename ObjectType >
 void tnlCuda::freeFromDevice( ObjectType* deviceObject )
 {
-#ifdef HAVE_CUDA   
+#ifdef HAVE_CUDA
    cudaFree( deviceObject );
    checkCudaDevice;
 #else
    tnlAssert( false, cerr << "CUDA support is missing." );
-#endif      
+#endif
 }
 
 #ifdef HAVE_CUDA
@@ -180,6 +166,4 @@ __device__ inline getSharedMemory< long int >::operator long int*()
 
 #endif /* HAVE_CUDA */
 
-
-
-#endif /* TNLCUDA_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/tnlCurve.h b/src/core/tnlCurve.h
index 60150d0cc4649b65051cb4f6ced123d694a10c10..7ceaaa66343b91c7cc475be5da22107b4a2f6860 100644
--- a/src/core/tnlCurve.h
+++ b/src/core/tnlCurve.h
@@ -6,74 +6,68 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef tnlCurveH
-#define tnlCurveH
+#pragma once
 
 #include <iomanip>
 #include <fstream>
 #include <cstring>
 #include <core/tnlList.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/mfuncs.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <core/param-types.h>
 
+namespace TNL {
+
 //! Basic structure for curves
 template< class T > class tnlCurveElement
 {
    public:
    tnlCurveElement() {};
 
-   tnlCurveElement( const T& pos, 
+   tnlCurveElement( const T& pos,
                   bool _speparator = false )
       : position( pos ),
         separator( _speparator ) {};
-   
+ 
    bool save( tnlFile& file ) const
    {
-#ifdef HAVE_NOT_CXX11      
+#ifdef HAVE_NOT_CXX11
       if( ! file. write< const T, tnlHost >( &position ) )
          return false;
       if( ! file. write< const bool, tnlHost >( &separator ) )
          return false;
       return true;
-#else      
+#else
       if( ! file. write( &position ) )
          return false;
       if( ! file. write( &separator ) )
          return false;
       return true;
-#endif      
+#endif
    };
-   
+ 
    bool load( tnlFile& file )
    {
-#ifdef HAVE_NOT_CXX11      
+#ifdef HAVE_NOT_CXX11
       if( ! file. read< T, tnlHost >( &position ) )
          return false;
       if( ! file. read< bool, tnlHost >( &separator ) )
          return false;
       return true;
-#else      
+#else
       if( ! file. read( &position ) )
          return false;
       if( ! file. read( &separator ) )
          return false;
       return true;
-#endif      
+#endif
    };
-   
+ 
    T position;
-   
+ 
    bool separator;
 };
 
@@ -108,7 +102,7 @@ template< class T > class tnlCurve : public tnlObject, public tnlList< tnlCurveE
    {
       tnlList< tnlCurveElement< T > >::reset();
    };
-   
+ 
    //! Method for saving the object to a file as a binary data
    bool save( tnlFile& file ) const
    {
@@ -135,7 +129,7 @@ template< class T > class tnlCurve : public tnlObject, public tnlList< tnlCurveE
    bool load( const tnlString& fileName )
    {
       return tnlObject :: load( fileName );
-   };   
+   };
 
 };
 
@@ -163,7 +157,7 @@ template< class T > bool Write( const tnlCurve< T >& curve,
          if( curve[ i ]. separator )
             str << endl;
          else
-            str << setprecision( 12 ) 
+            str << setprecision( 12 )
                 << curve[ i ]. position[ 0 ] << " "
                 << curve[ i ]. position[ 1 ] << endl;
          for( j = 0; j < step; j ++ )
@@ -237,6 +231,5 @@ template< class T > bool Read( tnlCurve< T >& crv,
 // Explicit instatiation
 template class tnlCurve< tnlStaticVector< 2, double > >;
 
+} // namespace TNL
 
-
-#endif
diff --git a/src/core/tnlDataElement.h b/src/core/tnlDataElement.h
index ae53cc8ae7b0f38ebdc15c7dae5bb33e7cd4c2de..dcf7b95dd42aaa155ee14bb090dd16163c3b9bfe 100644
--- a/src/core/tnlDataElement.h
+++ b/src/core/tnlDataElement.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef __mDATAELEMENT_H__
-#define __mDATAELEMENT_H__
+namespace TNL {
 
 //! Data element for tnlList and mStack
 template< class T > class tnlDataElement
@@ -37,10 +31,10 @@ template< class T > class tnlDataElement
         previous( 0 ){};
 
    //! Constructor with given data and possibly pointer to next element
-   tnlDataElement( const T& dt, 
+   tnlDataElement( const T& dt,
                    tnlDataElement< T >* prv = 0,
                    tnlDataElement< T >* nxt = 0 )
-      : data( dt ), 
+      : data( dt ),
         next( nxt ),
         previous( prv ){};
 
@@ -67,4 +61,4 @@ template< class T > class tnlDataElement
 
 };
 
-#endif
+} // namespace TNL
diff --git a/src/core/tnlDevice.h b/src/core/tnlDevice.h
index 31f10b682a031b3a22e2c56b29d620bce6b3ce0e..0594987fab5bbc3f59f91f862453db241fff0ae8 100644
--- a/src/core/tnlDevice.h
+++ b/src/core/tnlDevice.h
@@ -6,18 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+// TODO: remove this file
 
-#ifndef TNLDEVICE_H_
-#define TNLDEVICE_H_
+namespace TNL {
 
 enum tnlDeviceEnum { tnlHostDevice, tnlCudaDevice };
 
-#endif /* TNLDEVICE_H_ */
+} // namespace TNL
diff --git a/src/core/tnlDynamicTypeTag.h b/src/core/tnlDynamicTypeTag.h
index 9c2b6c551ad7e74c045f7fbba4b03c8243dc84b1..3a5fa935cb89ecde39a977980375dca863800a60 100644
--- a/src/core/tnlDynamicTypeTag.h
+++ b/src/core/tnlDynamicTypeTag.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLDYNAMICTYPETAG_H_
-#define TNLDYNAMICTYPETAG_H_
+namespace TNL {
 
 template< typename Element >
 struct tnlDynamicTypeTag
@@ -25,4 +19,4 @@ struct tnlDynamicTypeTag
 };
 
 
-#endif /* TNLDYNAMICTYPETAG_H_ */
+} // namespace TNL
diff --git a/src/core/tnlFeature.h b/src/core/tnlFeature.h
index 1368bb87bdb579a36450d4642d3de2992aba59d4..23e7ffac91da299b71deb01400fa800b4a93bc9f 100644
--- a/src/core/tnlFeature.h
+++ b/src/core/tnlFeature.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFEATURE_H_
-#define TNLFEATURE_H_
+#pragma once
+
+namespace TNL {
 
 template< bool featureEnabled >
 class tnlFeature
@@ -26,5 +20,4 @@ class tnlFeature
    enum{ enabled = featureEnabled };
 };
 
-
-#endif /* TNLFEATURE_H_ */
+} // namespace TNL
diff --git a/src/core/tnlFile.cpp b/src/core/tnlFile.cpp
index 7c02c0db864b68d29b9a53fe101c18745e45928d..b1eeec8adc8fa89d84f0c0b8177c217e45fdf90e 100644
--- a/src/core/tnlFile.cpp
+++ b/src/core/tnlFile.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlFile.h>
 
+namespace TNL {
+
 int tnlFile :: verbose = 0;
 
 tnlFile :: tnlFile()
@@ -80,3 +75,4 @@ bool fileExists( const tnlString& fileName )
   return result;
 };
 
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlFile.h b/src/core/tnlFile.h
index c0819ea3015da49cf242eae007d1a0d9d54f639b..c165ec63e75fbd4df56a1a7fe6a83aaf10071f55 100644
--- a/src/core/tnlFile.h
+++ b/src/core/tnlFile.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFILE_H_
-#define TNLFILE_H_
+#pragma once
 
 #include <iostream>
 #include <fstream>
@@ -32,7 +24,7 @@
 #include <core/tnlHost.h>
 #include <core/tnlCuda.h>
 
-using namespace std;
+namespace TNL {
 
 enum tnlIOMode { tnlUndefinedMode = 0,
                  tnlReadMode = 1,
@@ -101,7 +93,7 @@ class tnlFile
 
 	template< typename Type, typename Device >
 	bool write( const Type* buffer );
-#else        
+#else
    template< typename Type, typename Device = tnlHost, typename Index = int >
    bool read( Type* buffer,
               const Index& elements );
@@ -126,6 +118,7 @@ class tnlFile
 
 bool fileExists( const tnlString& fileName );
 
+} // namespace TNL
+
 #include <core/tnlFile_impl.h>
 
-#endif /* TNLFILE_H_ */
diff --git a/src/core/tnlFile_impl.h b/src/core/tnlFile_impl.h
index e3e6eb32f1ce86688355b11219af6dc4aa28da46..f0ea4f94eb08ef2f9936a9de42c1d9cda63b4de9 100644
--- a/src/core/tnlFile_impl.h
+++ b/src/core/tnlFile_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFILE_IMPL_H
-#define	TNLFILE_IMPL_H
+#pragma once 
+
+namespace TNL {
 
 template< typename Type, typename Device >
 bool tnlFile :: read( Type* buffer )
@@ -215,7 +209,6 @@ bool tnlFile ::  write( const Type* buffer,
    return true;
 };
 
+} // namespace TNL
 
 
-#endif	/* TNLFILE_IMPL_H */
-
diff --git a/src/core/tnlFlopsCounter.cpp b/src/core/tnlFlopsCounter.cpp
index e8c9534745f93d9313b820ae29de85f5347cb268..0a7d1b6c06f2d0a9b18aa618d66a5b4835161673 100644
--- a/src/core/tnlFlopsCounter.cpp
+++ b/src/core/tnlFlopsCounter.cpp
@@ -6,16 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlFlopsCounter.h>
 
+namespace TNL {
+
 tnlFlopsCounter tnl_flops_counter;
 
+} // namespace TNL
diff --git a/src/core/tnlFlopsCounter.h b/src/core/tnlFlopsCounter.h
index 117c18bce4d00ee2a13c8fbd42b62b791eb88422..ea8c6e042c66297a50e5dc41a29e1d4cd3d104bb 100644
--- a/src/core/tnlFlopsCounter.h
+++ b/src/core/tnlFlopsCounter.h
@@ -6,20 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFLOPSCOUNTER_H_
-#define TNLFLOPSCOUNTER_H_
+#pragma once
 
+namespace TNL {
 
 class tnlFlopsCounter
 {
@@ -89,4 +80,4 @@ class tnlFlopsCounter
 
 extern tnlFlopsCounter tnl_flops_counter;
 
-#endif /* TNLFLOPSCOUNTER_H_ */
+} // namespace TNL
diff --git a/src/core/tnlHost.cpp b/src/core/tnlHost.cpp
index 7d53f0435cdc88f707af57ad46b0ee45b6b3d8af..32e01c963ba974ae4358796d2cfd4d4bdb3db089 100644
--- a/src/core/tnlHost.cpp
+++ b/src/core/tnlHost.cpp
@@ -6,19 +6,22 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLHOSTL_H_
-#define TNLHOSTL_H_
+#pragma once 
 
 #include <core/tnlHost.h>
+#ifdef HAVE_OPENMP
+#include <omp.h>
+#endif
+#include <config/tnlConfigDescription.h>
+#include <config/tnlParameterContainer.h>
+
+namespace TNL {
+
+
+bool tnlHost::ompEnabled( true );
+int tnlHost::maxThreadsCount( -1 );
 
 tnlString tnlHost::getDeviceType()
 {
@@ -32,4 +35,63 @@ size_t tnlHost::getFreeMemory()
    return pages * page_size;
 };
 
-#endif /* TNLHOST_H_ */
+void tnlHost::enableOMP()
+{
+   ompEnabled = true;
+}
+
+void tnlHost::disableOMP()
+{
+   ompEnabled = false;
+}
+
+void tnlHost::setMaxThreadsCount( int maxThreadsCount_ )
+{
+   maxThreadsCount = maxThreadsCount_;
+#ifdef HAVE_OPENMP
+   omp_set_num_threads( maxThreadsCount );
+#endif
+}
+
+int tnlHost::getMaxThreadsCount()
+{
+#ifdef HAVE_OPENMP
+   if( maxThreadsCount == -1 )
+      return omp_get_max_threads();
+   return maxThreadsCount;
+#else
+   return 0;
+#endif
+}
+ 
+int tnlHost::getThreadIdx()
+{
+#ifdef HAVE_OPENMP
+   return omp_get_thread_num();
+#else
+   return 0;
+#endif
+}
+
+void tnlHost::configSetup( tnlConfigDescription& config, const tnlString& prefix )
+{
+#ifdef HAVE_OPENMP
+   config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP.", true );
+   config.addEntry<  int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() );
+#else
+   config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP (not supported on this system).", false );
+   config.addEntry<  int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 );
+#endif
+ 
+}
+ 
+bool tnlHost::setup( const tnlParameterContainer& parameters,
+                    const tnlString& prefix )
+{
+   ompEnabled = parameters.getParameter< bool >( prefix + "omp-enabled" );
+   maxThreadsCount = parameters.getParameter< int >( prefix + "omp-max-threads" );
+   return true;
+}
+
+} // namespace TNL
+
diff --git a/src/core/tnlHost.h b/src/core/tnlHost.h
index 6f921492dfb24f0b5c2f8c5106eacf2ff56252c2..9914958be87fcf19f6e87d68ed24e2ecd00f47fc 100644
--- a/src/core/tnlHost.h
+++ b/src/core/tnlHost.h
@@ -6,36 +6,58 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLHOST_H_
-#define TNLHOST_H_
+#pragam once 
 
 #include <unistd.h>
 #include <core/tnlDevice.h>
 #include <core/tnlString.h>
 
+namespace TNL {
+
+class tnlConfigDescription;
+class tnlParameterContainer;
+
 class tnlHost
 {
    public:
 
-   enum { DeviceType = tnlHostDevice };
-
-   static tnlString getDeviceType();
+      enum { DeviceType = tnlHostDevice };
+
+      static tnlString getDeviceType();
+
+   #ifdef HAVE_CUDA
+      __host__ __device__
+   #endif
+      static inline tnlDeviceEnum getDevice() { return tnlHostDevice; };
+
+      static size_t getFreeMemory();
+ 
+      static void disableOMP();
+ 
+      static void enableOMP();
+ 
+      static inline bool isOMPEnabled() { return ompEnabled; };
+ 
+      static void setMaxThreadsCount( int maxThreadsCount );
+ 
+      static int getMaxThreadsCount();
+ 
+      static int getThreadIdx();
+ 
+      static void configSetup( tnlConfigDescription& config, const tnlString& prefix = "" );
+ 
+      static bool setup( const tnlParameterContainer& parameters,
+                         const tnlString& prefix = "" );
+
+   protected:
+ 
+      static bool ompEnabled;
+ 
+      static int maxThreadsCount;
 
-#ifdef HAVE_CUDA
-   __host__ __device__
-#endif
-   static inline tnlDeviceEnum getDevice() { return tnlHostDevice; };
 
-   static size_t getFreeMemory();
 };
 
-#endif /* TNLHOST_H_ */
+} // namespace TNL
diff --git a/src/core/tnlIndexedSet.h b/src/core/tnlIndexedSet.h
index 1af9f4c201535106e8968dd80232ad772d27efa5..1439e3b34dd46388fd4625971257f9e6dec87213 100644
--- a/src/core/tnlIndexedSet.h
+++ b/src/core/tnlIndexedSet.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLINDEXEDSET_H_
-#define TNLINDEXEDSET_H_
+#pragma once
 
 #include <map>
 #include <stdexcept>
 
+namespace TNL {
 
 template< typename Element,
           typename Index,
@@ -47,7 +40,7 @@ class tnlIndexedSet
    const Element& getElement( KeyType key ) const;
 
    Element& getElement( KeyType key );
-   
+ 
    void print( ostream& str ) const;
 
    protected:
@@ -57,9 +50,9 @@ class tnlIndexedSet
       // This constructor is here only because of bug in g++, we might fix it later.
       // http://stackoverflow.com/questions/22357887/comparing-two-mapiterators-why-does-it-need-the-copy-constructor-of-stdpair
       DataWithIndex(){};
-      
+ 
       DataWithIndex( const DataWithIndex& d ) : data( d.data ), index( d.index) {}
-      
+ 
       explicit DataWithIndex( const Element data) : data( data ) {}
 
       DataWithIndex( const Element data,
@@ -82,6 +75,6 @@ template< typename Element,
           typename Key >
 ostream& operator <<( ostream& str, tnlIndexedSet< Element, Index, Key >& set );
 
-#include <core/tnlIndexedSet_impl.h>
+} // namespace TNL
 
-#endif /* TNLINDEXEDSET_H_ */
+#include <core/tnlIndexedSet_impl.h>
diff --git a/src/core/tnlIndexedSet_impl.h b/src/core/tnlIndexedSet_impl.h
index e6da50da2d91e2c2006476e98046fbcdc84c05cd..d00083c31c2e4eea4a273a12075a3d8d42a6089e 100644
--- a/src/core/tnlIndexedSet_impl.h
+++ b/src/core/tnlIndexedSet_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLINDEXEDSET_IMPL_H_
-#define TNLINDEXEDSET_IMPL_H_
+namespace TNL {
 
 template< typename Element,
           typename Index,
@@ -112,4 +106,4 @@ ostream& operator<<( ostream& str, tnlIndexedSet< Element, Index, Key >& set )
    return str;
 }
 
-#endif /* TNLINDEXEDSET_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/tnlList.h b/src/core/tnlList.h
index 7d3c4579396e66968967f62df65604e33fd87c80..c49cd78c96a20801b50c35d4485ffd1ced3e9b49 100644
--- a/src/core/tnlList.h
+++ b/src/core/tnlList.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef mListH
-#define mListH
+#pragma once
 
 #include <core/tnlAssert.h>
 #include <stdlib.h>
@@ -26,11 +18,13 @@
 
 #include <core/param-types.h>
 
+namespace TNL {
+
 class tnlFile;
 
 //! Template for double linked lists
 /*! To acces elements in the list one can use method getSize() and
-    operator[](). To add elements there are methods Append(), 
+    operator[](). To add elements there are methods Append(),
     Prepend() and Insert() to insert an element at given
     position. To erase particular element there is merthod
     Erase() taking the element position. To erase all elements
@@ -89,7 +83,7 @@ template< class T > class tnlList
       bool AppendList( const tnlList< T >& lst );
 
       //! Prepend copy of another list
-      bool PrependList( const tnlList< T >& lst );   
+      bool PrependList( const tnlList< T >& lst );
 
       template< typename Array >
       void toArray( Array& array );
@@ -117,7 +111,7 @@ template< class T > class tnlList
 
       //! Load the list using method Load of the type T
       bool DeepLoad( tnlFile& file );
-   
+ 
    protected:
 
       //! Pointer to the first element
@@ -135,13 +129,14 @@ template< class T > class tnlList
       mutable tnlDataElement< T >* iterator;
 
       //! Iterator index
-      mutable int index;   
-      
+      mutable int index;
+ 
 
 };
 
 template< typename T > ostream& operator << ( ostream& str, const tnlList< T >& list );
 
+} // namespace TNL
+
 #include<core/tnlList_impl.h>
 
-#endif
diff --git a/src/core/tnlList_impl.h b/src/core/tnlList_impl.h
index 886d5959425e1f96ec911066cf8c53c2fe7411f7..e76a294b9849e015bd04bd3959e27389ba54f64f 100644
--- a/src/core/tnlList_impl.h
+++ b/src/core/tnlList_impl.h
@@ -6,64 +6,58 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLIST_IMPL_H
-#define	TNLLIST_IMPL_H
+#pragma once
 
 #include <core/tnlFile.h>
 
-template< typename T > 
-tnlList< T >::tnlList() 
+namespace TNL {
+
+template< typename T >
+tnlList< T >::tnlList()
    : first( 0 ),  last( 0 ), size( 0 ), iterator( 0 ), index( 0 )
 {
 }
 
-template< typename T > 
+template< typename T >
 tnlList< T >::tnlList( const tnlList& list )
    : first( 0 ), last( 0 ), size( 0 ), iterator( 0 ), index( 0 )
 {
    AppendList( list );
 }
 
-template< typename T > 
+template< typename T >
 tnlList< T >::~tnlList()
-{ 
-   reset(); 
+{
+   reset();
 }
 
-template< typename T >    
+template< typename T >
 tnlString tnlList< T >::getType()
 {
    return tnlString( "tnlList< " ) + ::getType< T >() +  tnlString( " >" );
 }
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::isEmpty() const
-{ 
-   return ! size; 
+{
+   return ! size;
 }
-   
-template< typename T > 
+ 
+template< typename T >
 int tnlList< T >::getSize() const
-{ 
-   return size; 
+{
+   return size;
 }
 
-template< typename T > 
+template< typename T >
 T& tnlList< T >::operator[]( const int& ind )
 {
    tnlAssert( ind < size, );
    int iter_dist = abs( index - ind );
    if( ! iterator ||
-       iter_dist > ind || 
+       iter_dist > ind ||
        iter_dist > size - ind )
    {
       if( ind < size - ind )
@@ -83,7 +77,7 @@ T& tnlList< T >::operator[]( const int& ind )
    {
       //cout << " current index = " << index
       //     << " index = " << ind << endl;
-      if( ind < index ) 
+      if( ind < index )
       {
          iterator = iterator -> Previous();
          index --;
@@ -97,21 +91,21 @@ T& tnlList< T >::operator[]( const int& ind )
    }
    return iterator -> Data();
 };
-   
-template< typename T > 
+ 
+template< typename T >
 const T& tnlList< T >::operator[]( const int& ind ) const
 {
    return const_cast< tnlList< T >* >( this ) -> operator[]( ind );
 }
 
-template< typename T >    
+template< typename T >
 const tnlList< T >& tnlList< T >::operator = ( const tnlList& lst )
 {
    AppendList( lst );
    return( *this );
 }
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::Append( const T& data )
 {
    if( ! first )
@@ -120,7 +114,7 @@ bool tnlList< T >::Append( const T& data )
       first = last = new tnlDataElement< T >( data );
       if( ! first ) return false;
    }
-   else 
+   else
    {
       tnlDataElement< T >* new_element =  new tnlDataElement< T >( data, last, 0 );
       if( ! new_element ) return false;
@@ -131,7 +125,7 @@ bool tnlList< T >::Append( const T& data )
    return true;
 };
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::Prepend( const T& data )
 {
    if( ! first )
@@ -144,21 +138,21 @@ bool tnlList< T >::Prepend( const T& data )
    {
       tnlDataElement< T >* new_element =  new tnlDataElement< T >( data, 0, first );
       if( ! new_element ) return false;
-      first = first -> Previous() = new_element; 
+      first = first -> Previous() = new_element;
    }
    size ++;
    index ++;
    return true;
 };
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::Insert( const T& data, const int& ind )
 {
    tnlAssert( ind <= size || ! size, );
    if( ind == 0 ) return Prepend( data );
    if( ind == size ) return Append( data );
    operator[]( ind );
-   tnlDataElement< T >* new_el = 
+   tnlDataElement< T >* new_el =
       new tnlDataElement< T >( data,
                              iterator -> Previous(),
                              iterator );
@@ -170,7 +164,7 @@ bool tnlList< T >::Insert( const T& data, const int& ind )
    return true;
 };
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::AppendList( const tnlList< T >& lst )
 {
    int i;
@@ -180,8 +174,8 @@ bool tnlList< T >::AppendList( const tnlList< T >& lst )
    }
    return true;
 };
-   
-template< typename T > 
+ 
+template< typename T >
 bool tnlList< T >::PrependList( const tnlList< T >& lst )
 
 {
@@ -191,7 +185,7 @@ bool tnlList< T >::PrependList( const tnlList< T >& lst )
    return true;
 };
 
-template< typename T >    
+template< typename T >
    template< typename Array >
 void tnlList< T >::toArray( Array& array )
 {
@@ -202,7 +196,7 @@ void tnlList< T >::toArray( Array& array )
       array[ i ] = ( *this )[ i ];
 }
 
-template< typename T > 
+template< typename T >
 void tnlList< T >::Erase( const int& ind )
 {
    operator[]( ind );
@@ -223,7 +217,7 @@ void tnlList< T >::Erase( const int& ind )
    size --;
 };
 
-template< typename T > 
+template< typename T >
 void tnlList< T >::DeepErase( const int& ind )
 {
    operator[]( ind );
@@ -231,7 +225,7 @@ void tnlList< T >::DeepErase( const int& ind )
    Erase( ind );
 };
 
-template< typename T > 
+template< typename T >
 void tnlList< T >::reset()
 {
    iterator = first;
@@ -247,7 +241,7 @@ void tnlList< T >::reset()
    size = 0;
 };
 
-template< typename T > 
+template< typename T >
 void tnlList< T >::DeepEraseAll()
 {
    iterator = first;
@@ -262,8 +256,8 @@ void tnlList< T >::DeepEraseAll()
    first = last = 0;
    size = 0;
 };
-   
-template< typename T > 
+ 
+template< typename T >
 bool tnlList< T >::Save( tnlFile& file ) const
 {
 #ifdef HAVE_NOT_CXX11
@@ -279,10 +273,10 @@ bool tnlList< T >::Save( tnlFile& file ) const
          return false;
    return true;
 
-#endif            
+#endif
 }
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::DeepSave( tnlFile& file ) const
 {
 #ifdef HAVE_NOT_CXX11
@@ -295,10 +289,10 @@ bool tnlList< T >::DeepSave( tnlFile& file ) const
    for( int i = 0; i < size; i ++ )
       if( ! operator[]( i ). save( file ) ) return false;
    return true;
-#endif            
+#endif
 }
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::Load( tnlFile& file )
 {
 #ifdef HAVE_NOT_CXX11
@@ -335,10 +329,10 @@ bool tnlList< T >::Load( tnlFile& file )
       Append( t );
    }
    return true;
-#endif            
+#endif
 };
 
-template< typename T > 
+template< typename T >
 bool tnlList< T >::DeepLoad( tnlFile& file )
 {
 #ifdef HAVE_NOT_CXX11
@@ -373,9 +367,9 @@ bool tnlList< T >::DeepLoad( tnlFile& file )
       Append( t );
    }
    return true;
-#endif            
+#endif
 };
-   
+ 
 template< typename T >
 ostream& operator << ( ostream& str, const tnlList< T >& list )
 {
@@ -385,7 +379,6 @@ ostream& operator << ( ostream& str, const tnlList< T >& list )
    return str;
 };
 
+} // namespace TNL
 
 
-#endif	/* TNLLIST_IMPL_H */
-
diff --git a/src/core/tnlLogger.cpp b/src/core/tnlLogger.cpp
index 492af9eb93ebb6a497e39422dc065e12583d7fd3..4016036a7dd84dd5d550406f0312b23576606695 100644
--- a/src/core/tnlLogger.cpp
+++ b/src/core/tnlLogger.cpp
@@ -6,24 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include <sys/utsname.h>
-#include <time.h>
-#include <unistd.h>
-#include <fstream>
 #include <iomanip>
 #include <core/tnlLogger.h>
 #include <tnlConfig.h>
+#include <core/tnlSystemInfo.h>
 #include <core/tnlCudaDeviceInfo.h>
 
+namespace TNL {
+
 tnlLogger :: tnlLogger( int _width,
                         ostream& _stream )
 : width( _width ),
@@ -33,7 +25,7 @@ tnlLogger :: tnlLogger( int _width,
 
 void tnlLogger :: writeHeader( const tnlString& title )
 {
-   int fill = stream. fill(); 
+   int fill = stream. fill();
    int titleLength = title. getLength();
    stream << "+" << setfill( '-' ) << setw( width ) << "+" << endl;
    stream << "|" << setfill( ' ' ) << setw( width ) << "|" << endl;
@@ -46,141 +38,70 @@ void tnlLogger :: writeHeader( const tnlString& title )
 
 void tnlLogger :: writeSeparator()
 {
-   int fill = stream. fill(); 
+   int fill = stream. fill();
    stream << "+" << setfill( '-' ) << setw( width ) << "+" << endl;
    stream. fill( fill );
 }
 
 bool tnlLogger :: writeSystemInformation( const tnlParameterContainer& parameters )
 {
-   char host_name[ 256 ];
-   struct utsname uts;
-   gethostname( host_name, 255 );
-   uname( &uts );
-   writeParameter< char* >( "Host name:", host_name );
-   writeParameter< char* >( "Architecture:", uts. machine );
-   fstream file;
-   file.open( "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", ios::in );
-   int maxCpuFreq( 0 );
-   if( file )
-   {
-      char line[ 1024 ];
-      file.getline( line, 1024 );
-      maxCpuFreq = atoi( line );
-   }
-   else
-       cerr << "Unable to read information from /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq." << endl;
-   file.close();
-   file. open( "/proc/cpuinfo", ios :: in );
-   if( file )
-   {
-      char line[ 1024 ];
-      char* cpu_id;
-      char* cpu_model_name;
-      char* cpu_mhz;
-      char* cpu_cache;
-      tnlString modelName, Mhz, cache;
-      int cores( 0 ), siblings( 0 );
-      while( ! file. eof() )
-      {
-         int i;
-         file. getline( line, 1024 );
-         /*if( strncmp( line, "processor", strlen( "processor" ) ) == 0 )
-         {
-            i = strlen( "processor" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            cpu_id = &line[ i + 1 ];
-            writeParameter< char * >( "CPU Id.:", cpu_id );
-            continue;
-         }*/
-         if( strncmp( line, "model name", strlen( "model name" ) ) == 0 )
-         {
-            i = strlen( "model name" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            //cpu_model_name = &line[ i + 1 ];
-            modelName.setString( &line[ i + 1 ] );
-            //writeParameter< char * >( "Model name:", cpu_model_name );
-            continue;
-         }
-         if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 )
-         {
-            i = strlen( "cpu MHz" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            cores = atoi( &line[ i + 1 ] );
-            continue;
-         }
-         if( strncmp( line, "siblings", strlen( "siblings" ) ) == 0 )
-         {
-            i = strlen( "siblings" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            siblings = atoi( &line[ i + 1 ] );
-         }
-         /*if( strncmp( line, "cpu MHz", strlen( "cpu MHz" ) ) == 0 )
-         {
-            i = strlen( "cpu MHz" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            //cpu_mhz = &line[ i + 1 ];
-            Mhz.setString( &line[ i + 1 ] );
-            //writeParameter< char * >( "CPU MHz:", cpu_mhz );
-            continue;
-         }*/
-         if( strncmp( line, "cache size", strlen( "cache size" ) ) == 0 )
-         {
-            i = strlen( "cache size" );
-            while( line[ i ] != ':' && line[ i ] ) i ++;
-            //cpu_cache = &line[ i + 1 ];
-            cache.setString( &line[ i + 1 ] );
-            //writeParameter< char * >( "CPU cache:", cpu_cache );
-            continue;
-         }
-      }
-      int threadsPerCore = siblings / cores;
-      writeParameter< tnlString >( "CPU info", tnlString("") );
-      writeParameter< tnlString >( "Model name:", modelName, 1 );
-      writeParameter< int >( "Cores:", cores, 1 );
-      writeParameter< int >( "Threads per core:", threadsPerCore, 1 );
-      writeParameter< tnlString >( "Max clock rate (in MHz):", maxCpuFreq / 1000, 1 );
-      writeParameter< tnlString >( "Cache:", cache, 1 );
-    }
-   else
-      cerr << "Unable to read information from /proc/cpuinfo." << endl;
-   file.close();
+   tnlSystemInfo systemInfo;
+
+
+   writeParameter< tnlString >( "Host name:", systemInfo.getHostname() );
+   writeParameter< tnlString >( "Architecture:", systemInfo.getArchitecture() );
+   // FIXME: generalize for multi-socket systems, here we consider only the first found CPU
+   const int cpu_id = 0;
+   const int threads = systemInfo.getNumberOfThreads( cpu_id );
+   const int cores = systemInfo.getNumberOfCores( cpu_id );
+   int threadsPerCore = threads / cores;
+   writeParameter< tnlString >( "CPU info", tnlString("") );
+   writeParameter< tnlString >( "Model name:", systemInfo.getCPUModelName( cpu_id ), 1 );
+   writeParameter< int >( "Cores:", cores, 1 );
+   writeParameter< int >( "Threads per core:", threadsPerCore, 1 );
+   writeParameter< tnlString >( "Max clock rate (in MHz):", systemInfo.getCPUMaxFrequency( cpu_id ) / 1000, 1 );
+   tnlCacheSizes cacheSizes = systemInfo.getCPUCacheSizes( cpu_id );
+   tnlString cacheInfo = tnlString( cacheSizes.L1data ) + ", "
+                       + tnlString( cacheSizes.L1instruction ) + ", "
+                       + tnlString( cacheSizes.L2 ) + ", "
+                       + tnlString( cacheSizes.L3 );
+   writeParameter< tnlString >( "Cache (L1d, L1i, L2, L3):", cacheInfo, 1 );
    if( parameters.getParameter< tnlString >( "device" ) == "cuda" )
-   {      
-      int devices = tnlCudaDeviceInfo::getNumberOfDevices();
-      writeParameter< tnlString >( "CUDA GPU info", tnlString("") );   
-      writeParameter< int >( "Number of devices", devices,1 );
-      for( int i = 0; i < devices; i++ )
-      {
-        writeParameter< int >( "Device no.", i, 1 );       
+   {
+      writeParameter< tnlString >( "CUDA GPU info", tnlString("") );
+      // TODO: Printing all devices does not make sense, but in the future TNL
+      //       might use more than one device for computations. Printing only
+      //       the active device for now...
+//      int devices = tnlCudaDeviceInfo::getNumberOfDevices();
+//      writeParameter< int >( "Number of devices", devices, 1 );
+//      for( int i = 0; i < devices; i++ )
+//      {
+//        writeParameter< int >( "Device no.", i, 1 );
+        int i = tnlCudaDeviceInfo::getActiveDevice();
         writeParameter< tnlString >( "Name", tnlCudaDeviceInfo::getDeviceName( i ), 2 );
         tnlString deviceArch = tnlString( tnlCudaDeviceInfo::getArchitectureMajor( i ) ) + "." +
                                 tnlString( tnlCudaDeviceInfo::getArchitectureMinor( i ) );
         writeParameter< tnlString >( "Architecture", deviceArch, 2 );
-        writeParameter< int >( "CUDA cores", tnlCudaDeviceInfo::getCudaCores( i ), 2 );         
+        writeParameter< int >( "CUDA cores", tnlCudaDeviceInfo::getCudaCores( i ), 2 );
         double clockRate = ( double ) tnlCudaDeviceInfo::getClockRate( i ) / 1.0e3;
         writeParameter< double >( "Clock rate (in MHz)", clockRate, 2 );
         double globalMemory = ( double ) tnlCudaDeviceInfo::getGlobalMemory( i ) / 1.0e9;
-        writeParameter< double >( "Global memory (in GB)", globalMemory, 2 );         
+        writeParameter< double >( "Global memory (in GB)", globalMemory, 2 );
         double memoryClockRate = ( double ) tnlCudaDeviceInfo::getMemoryClockRate( i ) / 1.0e3;
         writeParameter< double >( "Memory clock rate (in Mhz)", memoryClockRate, 2 );
-        writeParameter< bool >( "ECC enabled", tnlCudaDeviceInfo::getECCEnabled( i ), 2 );         
-      }
+        writeParameter< bool >( "ECC enabled", tnlCudaDeviceInfo::getECCEnabled( i ), 2 );
+//      }
    }
-   writeParameter< char* >( "System:", uts. sysname );
-   writeParameter< char* >( "Release:", uts. release );
+   writeParameter< tnlString >( "System:", systemInfo.getSystemName() );
+   writeParameter< tnlString >( "Release:", systemInfo.getSystemRelease() );
    writeParameter< char* >( "TNL Compiler:", ( char* ) TNL_CPP_COMPILER_NAME );
    return true;
 }
 
 void tnlLogger :: writeCurrentTime( const char* label )
 {
-   time_t timeval;
-   time( &timeval );
-   tm *tm_ptr = localtime( &timeval );
-   char buf[ 256 ];
-   strftime( buf, 256, "%a %b %d %H:%M:%S\0", tm_ptr );
-   writeParameter< char* >( label, buf );
+   tnlSystemInfo systemInfo;
+   writeParameter< tnlString >( label, systemInfo.getCurrentTime() );
 }
 
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
@@ -209,3 +130,5 @@ template void tnlLogger::writeParameter< int >( const tnlString&,
                                                 int );
 
 #endif
+
+} // namespace TNL
diff --git a/src/core/tnlLogger.h b/src/core/tnlLogger.h
index c657ee4fe3e549bcfb6762533e8df83718110311..8a22a1f299850680e62459034263669a7660c1dc 100644
--- a/src/core/tnlLogger.h
+++ b/src/core/tnlLogger.h
@@ -6,23 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef mLoggerH
-#define mLoggerH
+#pragma once
 
-#include <cstring>
 #include <ostream>
-#include <iomanip>
 #include <config/tnlParameterContainer.h>
 
+namespace TNL {
+
 class tnlLogger
 {
    public:
@@ -35,7 +27,7 @@ class tnlLogger
    void writeSeparator();
 
    bool writeSystemInformation( const tnlParameterContainer& parameters );
-   
+ 
 
    void writeCurrentTime( const char* label );
 
@@ -86,4 +78,4 @@ extern template void tnlLogger::writeParameter< int >( const tnlString&,
                                                        int );
 #endif
 
-#endif
+} // namespace TNL
diff --git a/src/core/tnlLogger_impl.h b/src/core/tnlLogger_impl.h
index cd058d37b3e2ab55d33dfd055997b2d5bd103a0f..5e842c4047b3527a68eeff75311c5da45537b87b 100644
--- a/src/core/tnlLogger_impl.h
+++ b/src/core/tnlLogger_impl.h
@@ -6,19 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLOGGER_IMPL_H_
-#define TNLLOGGER_IMPL_H_
+#pragma once
 
 #include <sstream>
+#include <iomanip>
+
+namespace TNL {
 
 template< typename T >
 void tnlLogger::writeParameter( const tnlString& label,
@@ -53,4 +48,4 @@ void tnlLogger :: writeParameter( const tnlString& label,
            << str.str() << " |" << endl;
 };
 
-#endif /* TNLLOGGER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/tnlOmp.cpp b/src/core/tnlOmp.cpp
deleted file mode 100644
index e44a1de189811ddfc996140f7a09fdedbf8ef306..0000000000000000000000000000000000000000
--- a/src/core/tnlOmp.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************
-                          tnlOmp.cpp  -  description
-                             -------------------
-    begin                : Mar 4, 2016
-    copyright            : (C) 2016 by Tomas 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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include <core/tnlOmp.h>
-#ifdef HAVE_OPENMP
-#include <omp.h>
-#endif
-
-bool tnlOmp::enabled( true );
-int tnlOmp::maxThreadsCount( -1 );
-
-void tnlOmp::enable()
-{
-   enabled = true;
-}
-
-void tnlOmp::disable()
-{
-   enabled = false;
-}
-
-void tnlOmp::setMaxThreadsCount( int maxThreadsCount_ )
-{
-   maxThreadsCount = maxThreadsCount_;
-#ifdef HAVE_OPENMP   
-   omp_set_num_threads( maxThreadsCount );
-#endif   
-}
-
-int tnlOmp::getMaxThreadsCount()
-{
-#ifdef HAVE_OPENMP
-   if( maxThreadsCount == -1 )
-      return omp_get_max_threads();
-   return maxThreadsCount;
-#else
-   return 0;
-#endif
-}
-      
-int tnlOmp::getThreadIdx()
-{
-#ifdef HAVE_OPENMP
-   return omp_get_thread_num();
-#else
-   return 0;
-#endif  
-}
-
-void tnlOmp::configSetup( tnlConfigDescription& config, const tnlString& prefix )
-{
-#ifdef HAVE_OPENMP
-   config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP.", true );
-   config.addEntry<  int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() );
-#else
-   config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP (not supported on this system).", false );
-   config.addEntry<  int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 );
-#endif
-   
-}
-      
-bool tnlOmp::setup( const tnlParameterContainer& parameters,
-                    const tnlString& prefix )
-{
-   enabled = parameters.getParameter< bool >( prefix + "omp-enabled" );
-   maxThreadsCount = parameters.getParameter< int >( prefix + "omp-max-threads" );
-   return true;
-}
-
diff --git a/src/core/tnlOmp.h b/src/core/tnlOmp.h
deleted file mode 100644
index 2308964a13d3f7eef8b3c6ae797f5e9d3b4aaddc..0000000000000000000000000000000000000000
--- a/src/core/tnlOmp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************
-                          tnlOmp.h  -  description
-                             -------------------
-    begin                : Mar 4, 2016
-    copyright            : (C) 2016 by Tomas 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 TNLOMP_H
-#define	TNLOMP_H
-
-#include <config/tnlConfigDescription.h>
-#include <config/tnlParameterContainer.h>
-
-class tnlOmp
-{
-   public:      
-      
-      static void disable();
-      
-      static void enable();
-      
-      static inline bool isEnabled() { return enabled; };
-      
-      static void setMaxThreadsCount( int maxThreadsCount );
-      
-      static int getMaxThreadsCount();
-      
-      static int getThreadIdx();
-      
-      static void configSetup( tnlConfigDescription& config, const tnlString& prefix = "" );
-      
-      static bool setup( const tnlParameterContainer& parameters,
-                         const tnlString& prefix = "" );
-            
-   protected:
-      
-      static bool enabled;
-      
-      static int maxThreadsCount;
-};
-
-
-#endif	/* TNLOMP_H */
-
diff --git a/src/core/tnlReal.h b/src/core/tnlReal.h
index 415f3b6da8b9622d767ea124309488f9f3d5463b..66b98438707ef3334fdba4b6af53f0736fe0d7cd 100644
--- a/src/core/tnlReal.h
+++ b/src/core/tnlReal.h
@@ -6,25 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLREAL_H_
-#define TNLREAL_H_
+#pragma once
 
 #include <iostream>
 #include <math.h>
 #include <core/tnlFlopsCounter.h>
 
-using namespace std;
+namespace TNL {
 
 template< class T > class tnlReal
 {
@@ -425,7 +415,7 @@ template< class T > const tnlReal< T > log10( const tnlReal< T >& x )
 };
 
 template< class T >
-ostream& operator << ( ostream& str, const tnlReal< T >& v )
+std::ostream& operator << ( std::ostream& str, const tnlReal< T >& v )
 {
    str << v. Data();
    return str;
@@ -434,4 +424,4 @@ ostream& operator << ( ostream& str, const tnlReal< T >& v )
 typedef tnlReal< float > tnlFloat;
 typedef tnlReal< double > tnlDouble;
 
-#endif /* TNLREAL_H_ */
+} // namespace TNL
diff --git a/src/core/tnlSharedMemory.h b/src/core/tnlSharedMemory.h
index 1a29be7c72fc400d99377f3a2c1fac90e1f230ab..c1a2520f8897812682ebcb19ac266cd02a6c46e2 100644
--- a/src/core/tnlSharedMemory.h
+++ b/src/core/tnlSharedMemory.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSHAREDMEMORY_H_
 #define TNLSHAREDMEMORY_H_
@@ -21,6 +14,8 @@
 #include <errno.h>
 #include <sys/shm.h>
 
+// TODO: remove this file
+
 /*!***
  * This template wraps shared memory for IPC. For the communication
  * in MPI style we usually allocate the shared memory which is accessed by
diff --git a/src/core/tnlStack.h b/src/core/tnlStack.h
index aa5218517145344138ce2a56a12ea0e137cb15ef..1d0768029d753732cd93fb6faf00a2c9ce51c472 100644
--- a/src/core/tnlStack.h
+++ b/src/core/tnlStack.h
@@ -6,20 +6,14 @@
  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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTACK_H_
-#define TNLSTACK_H_
+#pragma once
 
 #include <core/tnlList.h>
 
+namespace TNL {
+
 /*
  *
  */
@@ -55,4 +49,4 @@ template< class T > class tnlStack : protected tnlList< T >
    }
 };
 
-#endif /* TNLSTACK_H_ */
+} // namespace TNL
diff --git a/src/core/tnlStaticFor.h b/src/core/tnlStaticFor.h
index a707d152d22c47449ce166b2b91d8fd10a595475..b6555df084bb9eb7cc2d2c6279530c9ae0da2c93 100644
--- a/src/core/tnlStaticFor.h
+++ b/src/core/tnlStaticFor.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLSTATICFOR_H_
-#define TNLSTATICFOR_H_
+namespace TNL {
 
 template< typename IndexType, IndexType val >
 class tnlStaticForIndexTag
@@ -203,4 +197,4 @@ class tnlStaticFor
 };
 
 
-#endif /* TNLSTATICFOR_H_ */
+} // namespace TNL
diff --git a/src/core/tnlStaticMultiIndex.h b/src/core/tnlStaticMultiIndex.h
index 6d856a1da7e60b788ee3cb75c685ba0447b07880..ccd7944ed2d47fbfe5db79443fae7171ce16c05f 100644
--- a/src/core/tnlStaticMultiIndex.h
+++ b/src/core/tnlStaticMultiIndex.h
@@ -6,25 +6,19 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLSTATICMULTIINDEX_H
-#define	TNLSTATICMULTIINDEX_H
+namespace TNL {
 
 template< int i1_ >
 class tnlStaticMultiIndex1D
 {
    public:
-      
+ 
       static const int i1 = i1_;
-      
+ 
       static const int size = 1;
 };
 
@@ -33,11 +27,11 @@ template< int i1_,
 class tnlStaticMultiIndex2D
 {
    public:
-      
+ 
       static const int i1 = i1_;
-      
+ 
       static const int i2 = i2_;
-      
+ 
       static const int size = 2;
 };
 
@@ -47,18 +41,15 @@ template< int i1_,
 class tnlStaticMultiIndex3D
 {
    public:
-      
+ 
       static const int i1 = i1_;
-      
+ 
       static const int i2 = i2_;
-      
+ 
       static const int i3 = i3_;
-      
+ 
       static const int size = 3;
 };
 
-
-
-
-#endif	/* TNLSTATICMULTIINDEX_H */
+} // namespace TNL
 
diff --git a/src/core/tnlStatistics.cpp b/src/core/tnlStatistics.cpp
index c21ea5115a82819742ee82a9152301acdcee3024..d6dc010a82c9ae0cb4a6230ccf2e6b9aea2ae91c 100644
--- a/src/core/tnlStatistics.cpp
+++ b/src/core/tnlStatistics.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlStatistics.h>
 
+namespace TNL {
+
 tnlStatistics defaultTnlStatistics;
 
 tnlStatistics :: tnlStatistics()
@@ -39,3 +34,5 @@ void tnlStatistics :: addTransferedBytes( const long int transfered )
 {
    transferedBytes += transfered;
 }
+
+} // namespace TNL
diff --git a/src/core/tnlStatistics.h b/src/core/tnlStatistics.h
index a17d156fbd0b8558b654bd7b85d815b777ba7870..1aa2f13871929c1d806ea9ef3ec4f61fa13f8106 100644
--- a/src/core/tnlStatistics.h
+++ b/src/core/tnlStatistics.h
@@ -6,18 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATISTICS_H_
-#define TNLSTATISTICS_H_
+#pragma once
 
+namespace TNL {
 
 class tnlStatistics
 {
@@ -39,4 +32,4 @@ class tnlStatistics
 
 extern tnlStatistics defaultTnlStatistics;
 
-#endif /* TNLSTATISTICS_H_ */
+} // namespace TNL
diff --git a/src/core/tnlString.cpp b/src/core/tnlString.cpp
index 265984f6f5bf2909e9e3564c468caef839727b1c..8a413f14cc39fb333a24817309d0121efddcae8e 100644
--- a/src/core/tnlString.cpp
+++ b/src/core/tnlString.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <cstring>
 #include <string.h>
@@ -28,6 +21,8 @@
    #include <mpi.h>
 #endif
 
+namespace TNL {
+
 const unsigned int STRING_PAGE = 256;
 
 tnlString :: tnlString()
@@ -49,6 +44,12 @@ tnlString :: tnlString( const tnlString& str )
    setString( str. getString() );
 }
 
+tnlString :: tnlString( unsigned number )
+: string( 0 ), length( 0 )
+{
+   this->setString( convertToString( number ).getString() );
+}
+
 tnlString :: tnlString( int number )
 : string( 0 ), length( 0 )
 {
@@ -310,7 +311,7 @@ bool tnlString :: load( istream& file )
       delete[] string;
       string = NULL;
    }
-   if( ! string ) 
+   if( ! string )
    {
       //dbgCout( "Reallocating string..." );
       length = STRING_PAGE * ( _length / STRING_PAGE + 1 );
@@ -333,15 +334,15 @@ bool tnlString :: save( tnlFile& file ) const
    int len = strlen( string );
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< int, tnlHost >( &len ) )
-#else      
+#else
    if( ! file. write( &len ) )
-#endif      
+#endif
       return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< char, tnlHost, int >( string, len ) )
-#else      
+#else
    if( ! file. write( string, len ) )
-#endif      
+#endif
       return false;
    return true;
 }
@@ -351,9 +352,9 @@ bool tnlString :: load( tnlFile& file )
    int _length;
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< int, tnlHost >( &_length ) )
-#else      
+#else
    if( ! file. read( &_length ) )
-#endif      
+#endif
    {
       cerr << "I was not able to read tnlString length." << endl;
       return false;
@@ -380,7 +381,7 @@ bool tnlString :: load( tnlFile& file )
    if( ! file. read< char, tnlHost, int >( string, _length ) )
 #else
    if( ! file. read( string, _length ) )
-#endif      
+#endif
    {
       cerr << "I was not able to read a tnlString with a length " << length << "." << endl;
       return false;
@@ -409,8 +410,8 @@ void tnlString :: MPIBcast( int root, MPI_Comm comm )
          string = new char[ length ];
       }
    }
-   
-   MPI_Bcast( string, len + 1, MPI_CHAR, root, comm );  
+ 
+   MPI_Bcast( string, len + 1, MPI_CHAR, root, comm );
    dbgExpr( iproc );
    dbgExpr( string );
 #endif
@@ -456,3 +457,5 @@ ostream& operator << ( ostream& stream, const tnlString& str )
    stream << str. getString();
    return stream;
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlString.h b/src/core/tnlString.h
index 42bfa9cabc197f0083d91aa9ef22493d4ea335f6..c17022eb1bf292701287974a1676502c6d36a3b8 100644
--- a/src/core/tnlString.h
+++ b/src/core/tnlString.h
@@ -6,24 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef __MSTRING_H__
-#define __MSTRING_H__
+#pragma once
 
 #include <stdio.h>
 #include <iostream>
 #include <sstream>
 #include "mpi-supp.h"
 
-using namespace :: std;
+namespace TNL {
 
 template< class T > class tnlList;
 class tnlFile;
@@ -56,8 +48,10 @@ class tnlString
    tnlString( const tnlString& str );
 
    //! Convert number to a string
+   tnlString( unsigned number );
+
    tnlString( int number );
-   
+ 
    tnlString( long int number );
 
    tnlString( float number );
@@ -110,10 +104,10 @@ class tnlString
    //! Operator +
    tnlString operator + ( const char* str ) const;
 
-   //! Comparison operator 
+   //! Comparison operator
    bool operator == ( const tnlString& str ) const;
 
-   //! Comparison operator 
+   //! Comparison operator
    bool operator != ( const tnlString& str ) const;
 
    //! Comparison operator
@@ -121,7 +115,7 @@ class tnlString
 
    //! Comparison operator
    bool operator != ( const char* ) const;
-  
+ 
    //! Retyping operator
    operator bool () const;
 
@@ -175,4 +169,4 @@ template<> inline tnlString convertToString( const bool& b )
    return "false";
 }
 
-#endif
+} // namespace TNL
diff --git a/src/core/tnlSystemInfo.cpp b/src/core/tnlSystemInfo.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e9fd3569a51c249f2679b057c7e99dcef1e7f801
--- /dev/null
+++ b/src/core/tnlSystemInfo.cpp
@@ -0,0 +1,178 @@
+#include <set>
+#include <iomanip>
+#include <cstring>
+#include <ctime>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "tnlSystemInfo.h"
+
+namespace TNL {
+
+tnlSystemInfo::tnlSystemInfo()
+{
+   uname( &uts );
+   parseCPUInfo();
+}
+
+void
+tnlSystemInfo::parseCPUInfo( void )
+{
+   std::ifstream file( "/proc/cpuinfo" );
+   if( ! file ) {
+      std::cerr << "Unable to read information from /proc/cpuinfo." << std::endl;
+      return;
+   }
+
+   char line[ 1024 ];
+   std::set< int > processors;
+   while( ! file. eof() )
+   {
+      int i;
+      file.getline( line, 1024 );
+      if( strncmp( line, "physical id", strlen( "physical id" ) ) == 0 )
+      {
+         i = strlen( "physical id" );
+         while( line[ i ] != ':' && line[ i ] ) i ++;
+         processors.insert( atoi( &line[ i + 1 ] ) );
+         continue;
+      }
+      // FIXME: the rest does not work on heterogeneous multi-socket systems
+      if( strncmp( line, "model name", strlen( "model name" ) ) == 0 )
+      {
+         i = strlen( "model name" );
+         while( line[ i ] != ':' && line[ i ] ) i ++;
+         CPUModelName.setString( &line[ i + 1 ] );
+         continue;
+      }
+      if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 )
+      {
+         i = strlen( "cpu MHz" );
+         while( line[ i ] != ':' && line[ i ] ) i ++;
+         CPUCores = atoi( &line[ i + 1 ] );
+         continue;
+      }
+      if( strncmp( line, "siblings", strlen( "siblings" ) ) == 0 )
+      {
+         i = strlen( "siblings" );
+         while( line[ i ] != ':' && line[ i ] ) i ++;
+         CPUThreads = atoi( &line[ i + 1 ] );
+      }
+   }
+   numberOfProcessors = processors.size();
+}
+
+tnlString
+tnlSystemInfo::getHostname( void ) const
+{
+   char host_name[ 256 ];
+   gethostname( host_name, 255 );
+   return tnlString( host_name );
+}
+
+tnlString
+tnlSystemInfo::getArchitecture( void ) const
+{
+   return tnlString( uts.machine );
+}
+
+tnlString
+tnlSystemInfo::getSystemName( void ) const
+{
+   return tnlString( uts.sysname );
+}
+
+tnlString
+tnlSystemInfo::getSystemRelease( void ) const
+{
+   return tnlString( uts.release );
+}
+
+tnlString
+tnlSystemInfo::getCurrentTime( const char* format ) const
+{
+   const std::time_t time_since_epoch = std::time( nullptr );
+   std::tm* localtime = std::localtime( &time_since_epoch );
+   // TODO: use std::put_time in the future (available since GCC 5)
+//   std::stringstream ss;
+//   ss << std::put_time( localtime, format );
+//   return tnlString( ss.str().c_str() );
+   char buffer[1024];
+   std::strftime( buffer, 1024, format, localtime );
+   return tnlString( buffer );
+}
+
+int
+tnlSystemInfo::getNumberOfProcessors( void ) const
+{
+   return numberOfProcessors;
+}
+
+tnlString
+tnlSystemInfo::getOnlineCPUs( void ) const
+{
+   std::string online = readFile< std::string >( "/sys/devices/system/cpu/online" );
+   return tnlString( online.c_str() );
+}
+
+int
+tnlSystemInfo::getNumberOfCores( int cpu_id ) const
+{
+   return CPUCores;
+}
+
+int
+tnlSystemInfo::getNumberOfThreads( int cpu_id ) const
+{
+   return CPUThreads;
+}
+
+tnlString
+tnlSystemInfo::getCPUModelName( int cpu_id ) const
+{
+   cout << "model name = " << CPUModelName << endl;
+   return CPUModelName;
+}
+
+int
+tnlSystemInfo::getCPUMaxFrequency( int cpu_id ) const
+{
+   tnlString fileName( "/sys/devices/system/cpu/cpu" );
+   fileName += tnlString( cpu_id ) + "/cpufreq/cpuinfo_max_freq";
+   return readFile< int >( fileName );
+}
+
+tnlCacheSizes
+tnlSystemInfo::getCPUCacheSizes( int cpu_id ) const
+{
+   tnlString directory( "/sys/devices/system/cpu/cpu" );
+   directory += tnlString( cpu_id ) + "/cache";
+
+   tnlCacheSizes sizes;
+   for( int i = 0; i <= 3; i++ ) {
+      const tnlString cache = directory + "/index" + tnlString( i );
+
+      // check if the directory exists
+      struct stat st;
+      if( stat( cache.getString(), &st ) != 0 || ! S_ISDIR( st.st_mode ) )
+         break;
+
+      const int level = readFile< int >( cache + "/level" );
+      const std::string type = readFile< std::string >( cache + "/type" );
+      const int size = readFile< int >( cache + "/size" );
+
+      if( level == 1 && type == "Instruction" )
+         sizes.L1instruction = size;
+      else if( level == 1 && type == "Data" )
+         sizes.L1data = size;
+      else if( level == 2 )
+         sizes.L2 = size;
+      else if( level == 3 )
+         sizes.L3 = size;
+   }
+   return sizes;
+}
+
+} // namespace TNL
diff --git a/src/core/tnlSystemInfo.h b/src/core/tnlSystemInfo.h
new file mode 100644
index 0000000000000000000000000000000000000000..de2c0a833c41be3a964e80231be6e2ac196243bb
--- /dev/null
+++ b/src/core/tnlSystemInfo.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include <fstream>
+#include <sstream>
+
+#include <sys/utsname.h>
+
+#include <core/tnlString.h>
+
+namespace TNL {
+
+struct tnlCacheSizes {
+   int L1instruction = 0;
+   int L1data = 0;
+   int L2 = 0;
+   int L3 = 0;
+};
+
+class tnlSystemInfo
+{
+public:
+   tnlSystemInfo();
+
+   tnlString getHostname( void ) const;
+   tnlString getArchitecture( void ) const;
+   tnlString getSystemName( void ) const;
+   tnlString getSystemRelease( void ) const;
+   tnlString getCurrentTime( const char* format = "%a %b %d %Y, %H:%M:%S" ) const;
+
+   int getNumberOfProcessors( void ) const;
+   tnlString getOnlineCPUs( void ) const;
+   int getNumberOfCores( int cpu_id ) const;
+   int getNumberOfThreads( int cpu_id ) const;
+   tnlString getCPUModelName( int cpu_id ) const;
+   int getCPUMaxFrequency( int cpu_id ) const;
+   tnlCacheSizes getCPUCacheSizes( int cpu_id ) const;
+
+protected:
+   struct utsname uts;
+   int numberOfProcessors = 0;
+   tnlString CPUModelName;
+   int CPUThreads = 0;
+   int CPUCores = 0;
+
+   void parseCPUInfo( void );
+
+   template< typename ResultType >
+   ResultType
+   readFile( const tnlString & fileName ) const
+   {
+      std::ifstream file( fileName.getString() );
+      if( ! file ) {
+         std::cerr << "Unable to read information from " << fileName << "." << std::endl;
+         return 0;
+      }
+      ResultType result;
+      file >> result;
+      return result;
+   }
+};
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlTimer.cpp b/src/core/tnlTimer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b6648a756a108d62c00ac215eda462330aa96c5d
--- /dev/null
+++ b/src/core/tnlTimer.cpp
@@ -0,0 +1,148 @@
+/***************************************************************************
+                          tnlTimer.cpp  -  description
+                             -------------------
+    begin                : Mar 14, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include <core/tnlTimer.h>
+
+#include "tnlConfig.h"
+#ifdef HAVE_SYS_RESOURCE_H
+   #include <sys/resource.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+   #include <stddef.h>
+   #include <sys/time.h>
+   #define HAVE_TIME
+#endif
+
+namespace TNL {
+
+tnlTimer defaultTimer;
+
+tnlTimer::tnlTimer()
+{
+   reset();
+}
+
+void tnlTimer::reset()
+{
+   this->initialCPUTime = 0;
+   this->totalCPUTime = 0.0;
+   this->initialRealTime = 0;
+   this->totalRealTime = 0.0;
+   this->initialCPUCycles = 0;
+   this->totalCPUCycles = 0;
+   this->stopState = true;
+}
+
+void tnlTimer::stop()
+{
+
+   if( ! this->stopState )
+   {
+      /****
+       * Real time
+       */
+#ifdef HAVE_TIME
+      struct timeval tp;
+      int rtn = gettimeofday( &tp, NULL );
+      this->totalRealTime += ( double ) tp. tv_sec + 1.0e-6 * ( double ) tp. tv_usec - this->initialRealTime;
+#endif
+ 
+      /****
+       * CPU time
+       */
+#ifdef HAVE_SYS_RESOURCE_H
+      rusage initUsage;
+      getrusage(  RUSAGE_SELF, &initUsage );
+      this->totalCPUTime += initUsage. ru_utime. tv_sec + 1.0e-6 * ( double ) initUsage. ru_utime. tv_usec - this->initialCPUTime;
+#endif
+ 
+      /****
+       * CPU cycles
+       */
+      this->totalCPUCycles += this->rdtsc() - this->initialCPUCycles;
+      this->stopState = true;
+   }
+}
+
+void tnlTimer::start()
+{
+   /****
+    * Real time
+    */
+#ifdef HAVE_TIME
+   struct timeval tp;
+   int rtn = gettimeofday( &tp, NULL );
+   this->initialRealTime = ( double ) tp. tv_sec + 1.0e-6 * ( double ) tp. tv_usec;
+#endif
+
+   /****
+    * CPU Time
+    */
+#ifdef HAVE_SYS_RESOURCE_H
+   rusage initUsage;
+   getrusage( RUSAGE_SELF, &initUsage );
+   this->initialCPUTime = initUsage. ru_utime. tv_sec + 1.0e-6 * ( double ) initUsage. ru_utime. tv_usec;
+#endif
+ 
+   /****
+    * CPU cycles
+    */
+   this->initialCPUCycles = this->rdtsc();
+ 
+   this->stopState = false;
+}
+
+double tnlTimer::getRealTime()
+{
+#ifdef HAVE_TIME
+   if( ! this->stopState )
+   {
+      this->stop();
+      this->start();
+   }
+   return this->totalRealTime;
+#else
+   return -1;
+#endif
+}
+
+double tnlTimer::getCPUTime()
+{
+#ifdef HAVE_SYS_RESOURCE_H
+   if( ! this->stopState )
+   {
+      this->stop();
+      this->start();
+   }
+   return this->totalCPUTime;
+#else
+   return -1;
+#endif
+}
+
+unsigned long long int tnlTimer::getCPUCycles()
+{
+   if( ! this->stopState )
+   {
+      this->stop();
+      this->start();
+   }
+   return this->totalCPUCycles;
+}
+
+bool tnlTimer::writeLog( tnlLogger& logger, int logLevel )
+{
+   logger.writeParameter< double                 >( "Real time:",  this->getRealTime(),  logLevel );
+   logger.writeParameter< double                 >( "CPU time:",   this->getCPUTime(),   logLevel );
+   logger.writeParameter< unsigned long long int >( "CPU Cycles:", this->getCPUCycles(), logLevel );
+
+}
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlTimer.h b/src/core/tnlTimer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9b7eeb8c157eb2f600522f14c5202f3cd6ea003
--- /dev/null
+++ b/src/core/tnlTimer.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+                          tnlTimer.h  -  description
+                             -------------------
+    begin                : Mar 14, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
+#pragma once
+
+#include <core/tnlLogger.h>
+
+namespace TNL {
+
+class tnlTimer
+{
+   public:
+ 
+      tnlTimer();
+
+      void reset();
+
+      void stop();
+
+      void start();
+
+      double getRealTime();
+
+      double getCPUTime();
+
+      unsigned long long int getCPUCycles();
+ 
+      bool writeLog( tnlLogger& logger, int logLevel = 0 );
+ 
+   protected:
+
+   double initialRealTime, totalRealTime,
+          initialCPUTime, totalCPUTime;
+ 
+   unsigned long long int initialCPUCycles, totalCPUCycles;
+ 
+   bool stopState;
+ 
+   inline unsigned long long rdtsc()
+   {
+     unsigned hi, lo;
+     __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+     return ( ( unsigned long long ) lo ) | ( ( ( unsigned long long ) hi ) << 32 );
+   }
+};
+
+extern tnlTimer defaultTimer;
+
+} // namespace TNL
+
diff --git a/src/core/tnlTimerCPU.cpp b/src/core/tnlTimerCPU.cpp
index 71fec8390336da5b23e67dae3715fdfdea5493ac..d4fd640723067ae35026a84da40617b6cb92bb34 100644
--- a/src/core/tnlTimerCPU.cpp
+++ b/src/core/tnlTimerCPU.cpp
@@ -6,17 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlTimerCPU.h>
 
+// TODO: remove this file
+
+namespace TNL {
+
 tnlTimerCPU defaultCPUTimer;
 
 tnlTimerCPU :: tnlTimerCPU()
@@ -68,3 +65,6 @@ double tnlTimerCPU::getTime( int root, MPI_Comm comm )
    return -1;
 #endif
 }
+
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlTimerCPU.h b/src/core/tnlTimerCPU.h
index c982018b5b1bb0ee6e02085569d7c00c9bff732f..4d1256c393546e190e6be8f1e3f7cf43961d2ef3 100644
--- a/src/core/tnlTimerCPU.h
+++ b/src/core/tnlTimerCPU.h
@@ -6,26 +6,22 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlTimerCPUH
 #define tnlTimerCPUH
 
+// TODO: remove this file
+
 #include "tnlConfig.h"
 #ifdef HAVE_SYS_RESOURCE_H
    #include <sys/resource.h>
 #endif
 
-
 #include "mpi-supp.h"
 
+namespace TNL {
+
 class tnlTimerCPU
 {
    public:
@@ -33,13 +29,13 @@ class tnlTimerCPU
    tnlTimerCPU();
 
    void reset();
-   
+ 
    void stop();
 
    void start();
 
    double getTime( int root = 0, MPI_Comm = MPI_COMM_WORLD );
-      
+ 
    protected:
 
    double initial_time;
@@ -51,6 +47,6 @@ class tnlTimerCPU
 
 extern tnlTimerCPU defaultCPUTimer;
 
-
+} // namespace TNL
 
 #endif
diff --git a/src/core/tnlTimerRT.cpp b/src/core/tnlTimerRT.cpp
index 43dad3e7fe8c64e879e6da5c11860260964cf88b..62a2b53d16bc234a8c856fc392bb3ecd9c7e5b1e 100644
--- a/src/core/tnlTimerRT.cpp
+++ b/src/core/tnlTimerRT.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlTimerRT.h>
 #include <tnlConfig.h>
@@ -24,6 +17,9 @@
    #define HAVE_TIME
 #endif
 
+// TODO: remove this file
+
+namespace TNL {
 
 tnlTimerRT defaultRTTimer;
 
@@ -73,3 +69,5 @@ double tnlTimerRT::getTime()
 #endif
    return -1;
 }
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/tnlTimerRT.h b/src/core/tnlTimerRT.h
index 7aa6305c6f8f48e8cdf6f25616b3438f0efb09f3..c92db7c81edb27d4291f01831a0d2b9c6b695c2b 100644
--- a/src/core/tnlTimerRT.h
+++ b/src/core/tnlTimerRT.h
@@ -6,20 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlTimerRTH
 #define tnlTimerRTH
 
 #include "mpi-supp.h"
 
+// TODO: remove this file
+
+namespace TNL {
+
 class tnlTimerRT
 {
    public:
@@ -44,4 +41,7 @@ class tnlTimerRT
 };
 
 extern tnlTimerRT defaultRTTimer;
+
+} // namespace TNL
+
 #endif
diff --git a/src/core/vectors/tnlMultiVector.h b/src/core/vectors/tnlMultiVector.h
index 1493f89759f20c2d41b959f0a987b4b65c2ea1e1..98b1a4d635185cd010a304cf8d00c0ef34ce4d41 100644
--- a/src/core/vectors/tnlMultiVector.h
+++ b/src/core/vectors/tnlMultiVector.h
@@ -6,23 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIVECTOR_H_
-#define TNLMULTIVECTOR_H_
+#pragma once 
 
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <core/tnlAssert.h>
 
-
+namespace TNL {
+   
 template< int Dimensions, typename Real = double, typename Device = tnlHost, typename Index = int >
 class tnlMultiVector : public tnlVector< Real, Device, Index >
 {
@@ -62,7 +55,7 @@ class tnlMultiVector< 1, Real, Device, Index > : public tnlVector< Real, Device,
    //! Set dimensions of the Vector using another Vector as a template
    template< typename MultiVector >
    bool setLike( const tnlMultiVector& v );
-   
+ 
    Index getElementIndex( const Index i ) const;
 
    void setElement( const Index i, Real value );
@@ -366,10 +359,9 @@ ostream& operator << ( ostream& str, const tnlMultiVector< 3, Real, device, Inde
 template< typename Real, typename device, typename Index >
 ostream& operator << ( ostream& str, const tnlMultiVector< 4, Real, device, Index >& Vector );
 
+} // namespace TNL
 
 #include <core/vectors/tnlMultiVector1D_impl.h>
 #include <core/vectors/tnlMultiVector2D_impl.h>
 #include <core/vectors/tnlMultiVector3D_impl.h>
-#include <core/vectors/tnlMultiVector4D_impl.h>
-
-#endif /* TNLMULTIVECTOR_H_ */
+#include <core/vectors/tnlMultiVector4D_impl.h>
\ No newline at end of file
diff --git a/src/core/vectors/tnlMultiVector1D_impl.h b/src/core/vectors/tnlMultiVector1D_impl.h
index b2348daf8a75f69e762ae26e71d229d6e54846d4..43c37dbb171b8c8110bae9bd591a53a9015d2597 100644
--- a/src/core/vectors/tnlMultiVector1D_impl.h
+++ b/src/core/vectors/tnlMultiVector1D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIVECTOT1D_IMPL_H_
-#define TNLMULTIVECTOR1D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Real, typename Device, typename Index >
 tnlMultiVector< 1, Real, Device, Index > :: tnlMultiVector()
@@ -262,4 +254,4 @@ extern template class tnlMultiVector< 1, double, tnlCuda, long int >;
 
 #endif
 
-#endif /* TNLMULTIVECTOR1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlMultiVector2D_impl.h b/src/core/vectors/tnlMultiVector2D_impl.h
index 2373ad127b621015a5009d9d154b41bf473ae21e..90b8fcfa00e48a319c50f46520f850762cff6605 100644
--- a/src/core/vectors/tnlMultiVector2D_impl.h
+++ b/src/core/vectors/tnlMultiVector2D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIVECTOR2D_IMPL_H_
-#define TNLMULTIVECTOR2D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Real, typename Device, typename Index >
 tnlMultiVector< 2, Real, Device, Index > :: tnlMultiVector()
@@ -273,5 +265,4 @@ extern template class tnlMultiVector< 2, double, tnlCuda, long int >;
 
 #endif
 
-
-#endif /* TNLMULTIVECTOR2D_IMPL_H_ */
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/vectors/tnlMultiVector3D_impl.h b/src/core/vectors/tnlMultiVector3D_impl.h
index 371fc1df094fd644138ee48db756d4094e90b789..d68702d0a24682f1069a9a2510622ad37d65ea9d 100644
--- a/src/core/vectors/tnlMultiVector3D_impl.h
+++ b/src/core/vectors/tnlMultiVector3D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIVECTOR3D_IMPL_H_
-#define TNLMULTIVECTOR3D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Real, typename Device, typename Index >
 tnlMultiVector< 3, Real, Device, Index > :: tnlMultiVector()
@@ -297,5 +289,4 @@ extern template class tnlMultiVector< 3, double, tnlCuda, long int >;
 
 #endif
 
-
-#endif /* TNLMULTIVECTOR3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlMultiVector4D_impl.h b/src/core/vectors/tnlMultiVector4D_impl.h
index 2d99447c7cd9ea34dd25e66fb651ad8ae4b76932..acf6310362f2726997954676f30217a5a17cc014 100644
--- a/src/core/vectors/tnlMultiVector4D_impl.h
+++ b/src/core/vectors/tnlMultiVector4D_impl.h
@@ -6,19 +6,11 @@
     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 TNLMULTIVECTOR4D_IMPL_H_
-#define TNLMULTIVECTOR4D_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
 
+#pragma once
 
+namespace TNL {
 
 template< typename Real, typename Device, typename Index >
 tnlMultiVector< 4, Real, Device, Index > :: tnlMultiVector()
@@ -318,5 +310,4 @@ extern template class tnlMultiVector< 4, double, tnlCuda, long int >;
 
 #endif
 
-
-#endif /* TNLMULTIVECTOR4D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlMultiVector_impl.cpp b/src/core/vectors/tnlMultiVector_impl.cpp
index 5920c03ff640ad3500e4e88877a62344c24cb7aa..c440da69760e42d4f39a6bcee893a25dd77196e4 100644
--- a/src/core/vectors/tnlMultiVector_impl.cpp
+++ b/src/core/vectors/tnlMultiVector_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlMultiVector.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -110,5 +105,6 @@ template class tnlMultiVector< 4, double, tnlCuda, long int >;
 
 #endif
 
+} // namespace TNL
 
 
diff --git a/src/core/vectors/tnlSharedVector.h b/src/core/vectors/tnlSharedVector.h
index 1d973ed3894205682d143580911224fdeb12629a..338c1fb126fc7118e7adc9bca10b6ecb61421785 100644
--- a/src/core/vectors/tnlSharedVector.h
+++ b/src/core/vectors/tnlSharedVector.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSHAREDVECTOR_H_
-#define TNLSHAREDVECTOR_H_
+#pragma once 
 
 #include <core/arrays/tnlSharedArray.h>
 #include <core/vectors/tnlVector.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 class tnlHost;
 
 template< typename Real = double,
@@ -82,9 +76,9 @@ class tnlSharedVector : public tnlSharedArray< Real, Device, Index >
 
    template< typename Vector >
    tnlSharedVector< Real, Device, Index >& operator += ( const Vector& vector );
-   
+ 
    tnlSharedVector< Real, Device, Index >& operator *= ( const RealType& c );
-   
+ 
    tnlSharedVector< Real, Device, Index >& operator /= ( const RealType& c );
 
    //bool save( tnlFile& file ) const;
@@ -151,6 +145,7 @@ class tnlSharedVector : public tnlSharedArray< Real, Device, Index >
 
 };
 
+} // namespace TNL
+
 #include <core/vectors/tnlSharedVector_impl.h>
 
-#endif /* TNLSHAREDVECTOR_H_ */
diff --git a/src/core/vectors/tnlSharedVector_impl.cpp b/src/core/vectors/tnlSharedVector_impl.cpp
index 1993b3d301a7c8934514611be5ec032a7d35d1db..30e0820ec70e1832edbc389a4f980a5269eca77f 100644
--- a/src/core/vectors/tnlSharedVector_impl.cpp
+++ b/src/core/vectors/tnlSharedVector_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlSharedVector.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -59,5 +54,5 @@ template class tnlSharedVector< long double, tnlCuda, long int >;
 
 #endif
 
-
+} // namespace TNL
 
diff --git a/src/core/vectors/tnlSharedVector_impl.h b/src/core/vectors/tnlSharedVector_impl.h
index 6b3c8155a9d318786cd06a225aa59fcc4d08033e..84badb5b6ca35c566a7ae42beb257446045f22a9 100644
--- a/src/core/vectors/tnlSharedVector_impl.h
+++ b/src/core/vectors/tnlSharedVector_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSHAREDVECTOR_H_IMPLEMENTATION
-#define TNLSHAREDVECTOR_H_IMPLEMENTATION
+#pragma once
 
 #include <core/vectors/tnlVectorOperations.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -412,10 +406,10 @@ extern template class tnlSharedVector< double, tnlCuda, long int >;
 #ifdef INSTANTIATE_LONG_DOUBLE
 extern template class tnlSharedVector< long double, tnlCuda, long int >;
 #endif
- #endif 
+ #endif
  */
 #endif
 
 #endif
 
-#endif /* TNLSHAREDVECTOR_H_IMPLEMENTATION */
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector.h b/src/core/vectors/tnlStaticVector.h
index d0d121a1ed51d4381eb11cded641353d5886a17c..a358366719d7d35e938ee435f643e62f1356e66a 100644
--- a/src/core/vectors/tnlStaticVector.h
+++ b/src/core/vectors/tnlStaticVector.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICVECTOR_H_
-#define TNLSTATICVECTOR_H_
+#pragma once
 
 #include <core/arrays/tnlStaticArray.h>
 
+namespace TNL {
+
 template< int Size, typename Real = double >
 class tnlStaticVector : public tnlStaticArray< Size, Real >
 {
@@ -86,8 +80,8 @@ class tnlStaticVector : public tnlStaticArray< Size, Real >
 
    template< typename OtherReal >
    __cuda_callable__
-   operator tnlStaticVector< Size, OtherReal >() const;   
-   
+   operator tnlStaticVector< Size, OtherReal >() const;
+ 
    __cuda_callable__
    ThisType abs() const;
 };
@@ -155,8 +149,8 @@ class tnlStaticVector< 1, Real > : public tnlStaticArray< 1, Real >
 
    template< typename OtherReal >
    __cuda_callable__
-   operator tnlStaticVector< 1, OtherReal >() const;   
-   
+   operator tnlStaticVector< 1, OtherReal >() const;
+ 
    __cuda_callable__
    ThisType abs() const;
 };
@@ -227,11 +221,11 @@ class tnlStaticVector< 2, Real > : public tnlStaticArray< 2, Real >
 
    __cuda_callable__
    bool operator >= ( const tnlStaticVector& v ) const;
-   
+ 
    template< typename OtherReal >
    __cuda_callable__
-   operator tnlStaticVector< 2, OtherReal >() const;   
-   
+   operator tnlStaticVector< 2, OtherReal >() const;
+ 
    __cuda_callable__
    ThisType abs() const;
 };
@@ -305,8 +299,8 @@ class tnlStaticVector< 3, Real > : public tnlStaticArray< 3, Real >
 
    template< typename OtherReal >
    __cuda_callable__
-   operator tnlStaticVector< 3, OtherReal >() const;   
-   
+   operator tnlStaticVector< 3, OtherReal >() const;
+ 
    __cuda_callable__
    ThisType abs() const;
 };
@@ -382,4 +376,5 @@ Real tnlTriangleArea( const tnlStaticVector< 3, Real >& a,
    const tnlStaticVector< 3, Real > v = tnlVectorProduct( u1, u2 );
    return 0.5 * sqrt( tnlScalarProduct( v, v ) );
 };
-#endif /* TNLSTATICVECTOR_H_ */
+
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector1D_impl.h b/src/core/vectors/tnlStaticVector1D_impl.h
index d3fcb35ea9fb923839eadcf2117a47571311bbc1..67131ae5b6c31d871d64bc45d37289b4495526bf 100644
--- a/src/core/vectors/tnlStaticVector1D_impl.h
+++ b/src/core/vectors/tnlStaticVector1D_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICVECTOR1D_IMPL_H_
-#define TNLSTATICVECTOR1D_IMPL_H_
+#pragma once 
+
+namespace TNL {
 
 template< typename Real >
 __cuda_callable__
@@ -151,7 +145,7 @@ tnlStaticVector< 1, Real >
 tnlStaticVector< 1, Real >::abs() const
 {
    return tnlStaticVector< 1, Real >( tnlAbs( this->data[ 0 ] ) );
-} 
+}
 
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -168,4 +162,4 @@ extern template class tnlStaticVector< 1, long double >;
 
 #endif
 
-#endif /* TNLSTATICVECTOR1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector2D_impl.h b/src/core/vectors/tnlStaticVector2D_impl.h
index cbfdc8f6fb070b0b7195044054cc3b95a6e39758..dfac6654115a6b384e095ee74f337d822a3b79b7 100644
--- a/src/core/vectors/tnlStaticVector2D_impl.h
+++ b/src/core/vectors/tnlStaticVector2D_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICVECTOR2D_IMPL_H_
-#define TNLSTATICVECTOR2D_IMPL_H_
+#pragma once 
+
+namespace TNL {
 
 template< typename Real >
 __cuda_callable__
@@ -178,7 +172,7 @@ tnlStaticVector< 2, Real >::abs() const
 {
    return tnlStaticVector< 2, Real >( tnlAbs( this->data[ 0 ] ),
                                       tnlAbs( this->data[ 1 ] ) );
-} 
+}
 
 
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
@@ -196,4 +190,4 @@ extern template class tnlStaticVector< 2, long double >;
 
 #endif
 
-#endif /* TNLSTATICVECTOR2D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector3D_impl.h b/src/core/vectors/tnlStaticVector3D_impl.h
index 3b03b8e991e584c3ba6d4e38da7d9f28d01203e3..fca58c0e71fd2a5deb2cbc9624c6dc9ce10dccee 100644
--- a/src/core/vectors/tnlStaticVector3D_impl.h
+++ b/src/core/vectors/tnlStaticVector3D_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICVECTOR3D_IMPL_H_
-#define TNLSTATICVECTOR3D_IMPL_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Real >
 __cuda_callable__
@@ -190,7 +184,7 @@ tnlStaticVector< 3, Real >::abs() const
    return tnlStaticVector< 3, Real >( tnlAbs( this->data[ 0 ] ),
                                       tnlAbs( this->data[ 1 ] ),
                                       tnlAbs( this->data[ 2 ] ) );
-} 
+}
 
 
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
@@ -208,4 +202,4 @@ extern template class tnlStaticVector< 3, long double >;
 
 #endif
 
-#endif /* TNLSTATICVECTOR3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector_impl.cpp b/src/core/vectors/tnlStaticVector_impl.cpp
index d1b92ecf6cf98c701f8d522092e8ee51ca0b9703..cf486059144774a576c35df2051326b99dd7689d 100644
--- a/src/core/vectors/tnlStaticVector_impl.cpp
+++ b/src/core/vectors/tnlStaticVector_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlStaticVector.h>
 
+namespace TNL {
+
 #ifndef HAVE_CUDA
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -55,4 +50,4 @@ template class tnlStaticVector< 4, long double >;
 #endif
 #endif
 
-
+} // namespace TNL
diff --git a/src/core/vectors/tnlStaticVector_impl.cu b/src/core/vectors/tnlStaticVector_impl.cu
index 48b12a3a9e7926210d76fb1b39641ccc593bfe9c..8ec704bde47985586206b244ed4c1e373d76b32a 100644
--- a/src/core/vectors/tnlStaticVector_impl.cu
+++ b/src/core/vectors/tnlStaticVector_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlStaticVector.h>
 
+namespace TNL {
+
 #ifdef HAVE_CUDA
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -54,3 +49,5 @@ template class tnlStaticVector< 4, long double >;
 
 #endif
 #endif
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/vectors/tnlStaticVector_impl.h b/src/core/vectors/tnlStaticVector_impl.h
index f4b1f923d7bb78b5c768727fa8c54133862c9b57..c78ca32393515afa9b78587c7f2bd8488b43d30a 100644
--- a/src/core/vectors/tnlStaticVector_impl.h
+++ b/src/core/vectors/tnlStaticVector_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSTATICVECTOR_IMPL_H_
-#define TNLSTATICVECTOR_IMPL_H_
+#pragama once
+
+namespace TNL {
 
 template< int Size, typename Real >
 __cuda_callable__
@@ -183,7 +177,7 @@ tnlStaticVector< Size, Real >::abs() const
    for( int i = 0; i < Size; i++ )
       v.data[ i ] = tnlAbs( this->data[ i ] );
    return v;
-} 
+}
 
 
 template< int Size, typename Real >
@@ -207,4 +201,4 @@ extern template class tnlStaticVector< 4, long double >;
 
 #endif
 
-#endif /* TNLSTATICVECTOR_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlVector.h b/src/core/vectors/tnlVector.h
index 4f95d20a9ec040146834b10a6c69bf342f37d5b1..2a6350648914d2e26de26c80508ec0fb5088ce0b 100644
--- a/src/core/vectors/tnlVector.h
+++ b/src/core/vectors/tnlVector.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLVECTOR_H_
-#define TNLVECTOR_H_
+#pragma once
 
 #include <core/arrays/tnlArray.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 class tnlHost;
 
 template< typename Real = double,
@@ -73,7 +67,7 @@ class tnlVector : public tnlArray< Real, Device, Index >
    tnlVector< Real, Device, Index >& operator += ( const Vector& vector );
 
    tnlVector< Real, Device, Index >& operator *= ( const RealType& c );
-   
+ 
    tnlVector< Real, Device, Index >& operator /= ( const RealType& c );
 
    Real max() const;
@@ -136,6 +130,6 @@ class tnlVector : public tnlArray< Real, Device, Index >
    void computeExclusivePrefixSum( const IndexType begin, const IndexType end );
 };
 
-#include <core/vectors/tnlVector_impl.h>
+} // namespace TNL
 
-#endif /* TNLVECTOR_H_ */
+#include <core/vectors/tnlVector_impl.h>
diff --git a/src/core/vectors/tnlVectorOperations.h b/src/core/vectors/tnlVectorOperations.h
index afa7b2e96249ae383cd9f982b98e303c2d559c20..0f5755dc72e032aa1bb1a4e4cb147963927eb6ae 100644
--- a/src/core/vectors/tnlVectorOperations.h
+++ b/src/core/vectors/tnlVectorOperations.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLVECTOROPERATIONS_H_
-#define TNLVECTOROPERATIONS_H_
+#pragma once 
 
 #include <core/cuda/cuda-reduction.h>
 #include <core/cuda/reduction-operations.h>
 #include <core/tnlHost.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlVectorOperations{};
 
@@ -56,10 +50,10 @@ class tnlVectorOperations< tnlHost >
 
    template< typename Vector >
    static typename Vector::RealType getVectorL1Norm( const Vector& v );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorL2Norm( const Vector& v );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorLpNorm( const Vector& v,
                                                      const typename Vector::RealType& p );
@@ -90,7 +84,7 @@ class tnlVectorOperations< tnlHost >
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceL2Norm( const Vector1& v1,
                                                            const Vector2& v2 );
-   
+ 
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceLpNorm( const Vector1& v1,
                                                            const Vector2& v2,
@@ -99,8 +93,8 @@ class tnlVectorOperations< tnlHost >
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceSum( const Vector1& v1,
                                                                const Vector2& v2 );
-   
-   
+ 
+ 
    template< typename Vector >
    static void vectorScalarMultiplication( Vector& v,
                                            const typename Vector::RealType& alpha );
@@ -114,7 +108,7 @@ class tnlVectorOperations< tnlHost >
                           const Vector2& v,
                           const typename Vector2::RealType& multiplicator,
                           const typename Vector1::RealType& thisMultiplicator = 1.0 );
-   
+ 
    template< typename Vector1, typename Vector2, typename Vector3 >
    static void addVectors( Vector1& v,
                            const Vector2& v1,
@@ -162,17 +156,17 @@ class tnlVectorOperations< tnlCuda >
 
    template< typename Vector >
    static typename Vector::RealType getVectorAbsMin( const Vector& v );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorL1Norm( const Vector& v );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorL2Norm( const Vector& v );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorLpNorm( const Vector& v,
                                                      const typename Vector::RealType& p );
-   
+ 
    template< typename Vector >
    static typename Vector::RealType getVectorSum( const Vector& v );
 
@@ -191,7 +185,7 @@ class tnlVectorOperations< tnlCuda >
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceAbsMin( const Vector1& v1,
                                                                 const Vector2& v2 );
-  
+ 
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceL1Norm( const Vector1& v1,
                                                                 const Vector2& v2 );
@@ -199,7 +193,7 @@ class tnlVectorOperations< tnlCuda >
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceL2Norm( const Vector1& v1,
                                                                 const Vector2& v2 );
-  
+ 
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceLpNorm( const Vector1& v1,
                                                            const Vector2& v2,
@@ -208,7 +202,7 @@ class tnlVectorOperations< tnlCuda >
    template< typename Vector1, typename Vector2 >
    static typename Vector1::RealType getVectorDifferenceSum( const Vector1& v1,
                                                                const Vector2& v2 );
-   
+ 
    template< typename Vector >
    static void vectorScalarMultiplication( Vector& v,
                                            const typename Vector::RealType& alpha );
@@ -222,7 +216,7 @@ class tnlVectorOperations< tnlCuda >
                           const Vector2& x,
                           const typename Vector2::RealType& alpha,
                           const typename Vector1::RealType& thisMultiplicator = 1.0 );
-   
+ 
    template< typename Vector1, typename Vector2, typename Vector3 >
    static void addVectors( Vector1& v,
                            const Vector2& v1,
@@ -230,7 +224,7 @@ class tnlVectorOperations< tnlCuda >
                            const Vector3& v2,
                            const typename Vector3::RealType& multiplicator2,
                            const typename Vector1::RealType& thisMultiplicator = 1.0 );
-   
+ 
 
    template< typename Vector >
    static void computePrefixSum( Vector& v,
@@ -243,7 +237,8 @@ class tnlVectorOperations< tnlCuda >
                                           const typename Vector::IndexType end );
 };
 
+} // namespace TNL
+
 #include <core/vectors/tnlVectorOperationsHost_impl.h>
 #include <core/vectors/tnlVectorOperationsCuda_impl.h>
 
-#endif /* TNLVECTOROPERATIONS_H_ */
diff --git a/src/core/vectors/tnlVectorOperationsCuda_impl.cpp b/src/core/vectors/tnlVectorOperationsCuda_impl.cpp
index c9b21196d2741180bcfd597f79d0137cda4d2c33..8bb1456ee0e18e6e0ef0e2a424caedb406cd0a3d 100644
--- a/src/core/vectors/tnlVectorOperationsCuda_impl.cpp
+++ b/src/core/vectors/tnlVectorOperationsCuda_impl.cpp
@@ -6,16 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#include <core/vectors/tnlVectorOperations.h>
 
-#include <core/vectors/tnlVectorOperations.h> 
+namespace TNL {
 
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -322,7 +317,7 @@ template double      tnlVectorOperations< tnlCuda >::getVectorDifferenceAbsMin(
 template long double tnlVectorOperations< tnlCuda >::getVectorDifferenceAbsMin( const tnlVector< long double, tnlCuda, long int >& v1, const tnlVector< long double, tnlCuda, long int >& v2 );
 #endif
 #endif
-        
+ 
 #endif
  
-
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/vectors/tnlVectorOperationsCuda_impl.cu b/src/core/vectors/tnlVectorOperationsCuda_impl.cu
index 6190d289a3b76df5c605da8496af3f0fb8dd70d8..e67a12af0dab1c26adb62289e604922bcf3fd00c 100644
--- a/src/core/vectors/tnlVectorOperationsCuda_impl.cu
+++ b/src/core/vectors/tnlVectorOperationsCuda_impl.cu
@@ -6,16 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include <core/vectors/tnlVectorOperations.h> 
+#include <core/vectors/tnlVectorOperations.h>
+
+namespace TNL {
 
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
@@ -322,6 +317,7 @@ template double      tnlVectorOperations< tnlCuda >::getVectorDifferenceAbsMin(
 template long double tnlVectorOperations< tnlCuda >::getVectorDifferenceAbsMin( const tnlVector< long double, tnlCuda, long int >& v1, const tnlVector< long double, tnlCuda, long int >& v2 );
 #endif
 #endif
-        
+ 
 #endif
  
+} // namespace TNL
\ No newline at end of file
diff --git a/src/core/vectors/tnlVectorOperationsCuda_impl.h b/src/core/vectors/tnlVectorOperationsCuda_impl.h
index 6a96f20274f26c76cb2b7c055a5052d7add96366..0a6b9787bf6d90bceb014f034e81c8440f7abf80 100644
--- a/src/core/vectors/tnlVectorOperationsCuda_impl.h
+++ b/src/core/vectors/tnlVectorOperationsCuda_impl.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLVECTOROPERATIONSCUDA_IMPL_H_
-#define TNLVECTOROPERATIONSCUDA_IMPL_H_
+#pragma once
 
 #include <tnlConfig.h>
 #include <core/cuda/cuda-prefix-sum.h>
 #include <core/cuda/tnlCublasWrapper.h>
 
+namespace TNL {
+
 template< typename Vector >
 void tnlVectorOperations< tnlCuda >::addElement( Vector& v,
                                                  const typename Vector::IndexType i,
@@ -53,7 +47,7 @@ typename Vector :: RealType tnlVectorOperations< tnlCuda > :: getVectorMax( cons
                           v. getSize(),
                           v. getData(),
                           ( Real* ) 0,
-                          result );   
+                          result );
    return result;
 }
 
@@ -112,7 +106,7 @@ typename Vector :: RealType tnlVectorOperations< tnlCuda > :: getVectorAbsMin( c
 }
 
 template< typename Vector >
-typename Vector::RealType 
+typename Vector::RealType
 tnlVectorOperations< tnlCuda >::
 getVectorL1Norm( const Vector& v )
 {
@@ -132,7 +126,7 @@ getVectorL1Norm( const Vector& v )
 }
 
 template< typename Vector >
-typename Vector::RealType 
+typename Vector::RealType
 tnlVectorOperations< tnlCuda >::
 getVectorL2Norm( const Vector& v )
 {
@@ -164,7 +158,7 @@ getVectorLpNorm( const Vector& v,
    tnlAssert( v. getSize() > 0, );
    tnlAssert( p > 0.0,
               cerr << " p = " << p );
-   
+ 
    if( p == 1 )
       return getVectorL1Norm( v );
    if( p == 2 )
@@ -485,7 +479,7 @@ void tnlVectorOperations< tnlCuda > :: addVector( Vector1& y,
       const Index& size = x.getSize();
       dim3 cudaBlockSize( 256 );
       dim3 cudaBlocks;
-      cudaBlocks.x = Min( tnlCuda::getMaxGridSize(), tnlCuda::getNumberOfBlocks( size, cudaBlockSize.x ) );      
+      cudaBlocks.x = Min( tnlCuda::getMaxGridSize(), tnlCuda::getNumberOfBlocks( size, cudaBlockSize.x ) );
 
       vectorAddVectorCudaKernel<<< cudaBlocks, cudaBlockSize >>>( y.getData(),
                                                                   x.getData(),
@@ -558,7 +552,7 @@ addVectors( Vector1& v,
       const Index& size = v.getSize();
       dim3 cudaBlockSize( 256 );
       dim3 cudaBlocks;
-      cudaBlocks.x = Min( tnlCuda::getMaxGridSize(), tnlCuda::getNumberOfBlocks( size, cudaBlockSize.x ) );      
+      cudaBlocks.x = Min( tnlCuda::getMaxGridSize(), tnlCuda::getNumberOfBlocks( size, cudaBlockSize.x ) );
 
       vectorAddVectorsCudaKernel<<< cudaBlocks, cudaBlockSize >>>( v.getData(),
                                                                    v1.getData(),
@@ -876,4 +870,4 @@ extern template long double tnlVectorOperations< tnlCuda >::getVectorDifferenceA
 
 #endif
 
-#endif /* TNLVECTOROPERATIONSCUDA_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlVectorOperationsHost_impl.cpp b/src/core/vectors/tnlVectorOperationsHost_impl.cpp
index 6b95318297dc2588633710c47ca9c39c500b6865..337e563b265c150c4a6f8f72d9fb09ec33af44f3 100644
--- a/src/core/vectors/tnlVectorOperationsHost_impl.cpp
+++ b/src/core/vectors/tnlVectorOperationsHost_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlVectorOperations.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 /****
@@ -325,4 +320,4 @@ template long double tnlVectorOperations< tnlHost >::getVectorDifferenceAbsMin(
 
 #endif
 
-
+} // namespace TNL
diff --git a/src/core/vectors/tnlVectorOperationsHost_impl.h b/src/core/vectors/tnlVectorOperationsHost_impl.h
index c2c9b1eed1ec184fd77c1a94f85ba78aa1bbe9ad..c709c267b9e2638e81200b131e50f96230744cc7 100644
--- a/src/core/vectors/tnlVectorOperationsHost_impl.h
+++ b/src/core/vectors/tnlVectorOperationsHost_impl.h
@@ -6,19 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLVECTOROPERATIONSHOST_IMPL_H_
-#define TNLVECTOROPERATIONSHOST_IMPL_H_
+#pragma once 
 
-#include <core/tnlOmp.h>
+namespace TNL {
 
 static const int OpenMPVectorOperationsThreshold = 65536; // TODO: check this threshold
 
@@ -104,8 +96,8 @@ getVectorL1Norm( const Vector& v )
    Real result( 0.0 );
    const Index n = v. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += fabs( v[ i ] );
    return result;
@@ -122,8 +114,8 @@ getVectorL2Norm( const Vector& v )
    Real result( 0.0 );
    const Index n = v. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
    {
       const Real& aux = v[ i ];
@@ -151,8 +143,8 @@ getVectorLpNorm( const Vector& v,
    Real result( 0.0 );
    const Index n = v. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += pow( fabs( v[ i ] ), p );
    return pow( result, 1.0 / p );
@@ -168,8 +160,8 @@ typename Vector :: RealType tnlVectorOperations< tnlHost > :: getVectorSum( cons
    Real result( 0.0 );
    const Index n = v. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += v[ i ];
    return result;
@@ -256,8 +248,8 @@ getVectorDifferenceL1Norm( const Vector1& v1,
    Real result( 0.0 );
    const Index n = v1. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += fabs( v1[ i ] - v2[ i ] );
    return result;
@@ -278,8 +270,8 @@ getVectorDifferenceL2Norm( const Vector1& v1,
    Real result( 0.0 );
    const Index n = v1. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
    {
       Real aux = fabs( v1[ i ] - v2[ i ] );
@@ -312,8 +304,8 @@ getVectorDifferenceLpNorm( const Vector1& v1,
    Real result( 0.0 );
    const Index n = v1. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += pow( fabs( v1. getElement( i ) - v2. getElement( i ) ), p );
    return pow( result, 1.0 / p );
@@ -332,8 +324,8 @@ typename Vector1::RealType tnlVectorOperations< tnlHost > :: getVectorDifference
    Real result( 0.0 );
    const Index n = v1. getSize();
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() &&n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i ++ )
       result += v1. getElement( i ) - v2. getElement( i );
    return result;
@@ -352,7 +344,7 @@ void tnlVectorOperations< tnlHost > :: vectorScalarMultiplication( Vector& v,
    const Index n = v. getSize();
 #ifdef HAVE_OPENMP
 #pragma omp parallel for if( n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif        
+#endif
    for( Index i = 0; i < n; i ++ )
       v[ i ] *= alpha;
 }
@@ -371,8 +363,8 @@ typename Vector1 :: RealType tnlVectorOperations< tnlHost > :: getScalarProduct(
    Real result( 0.0 );
    const Index n = v1. getSize();
 #ifdef HAVE_OPENMP
-  #pragma omp parallel for reduction(+:result) if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif     
+  #pragma omp parallel for reduction(+:result) if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
    for( Index i = 0; i < n; i++ )
       result += v1[ i ] * v2[ i ];
    /*Real result1( 0.0 ), result2( 0.0 ), result3( 0.0 ), result4( 0.0 ),
@@ -411,14 +403,14 @@ void tnlVectorOperations< tnlHost > :: addVector( Vector1& y,
    const Index n = y. getSize();
    if( thisMultiplicator == 1.0 )
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
       for( Index i = 0; i < n; i ++ )
          y[ i ] += alpha * x[ i ];
    else
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
       for( Index i = 0; i < n; i ++ )
          y[ i ] = thisMultiplicator * y[ i ] + alpha * x[ i ];
 }
@@ -441,18 +433,18 @@ addVectors( Vector1& v,
    tnlAssert( v.getSize() > 0, );
    tnlAssert( v.getSize() == v1.getSize(), );
    tnlAssert( v.getSize() == v2.getSize(), );
-   
+ 
    const Index n = v.getSize();
    if( thisMultiplicator == 1.0 )
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
       for( Index i = 0; i < n; i ++ )
          v[ i ] += multiplicator1 * v1[ i ] + multiplicator2 * v2[ i ];
    else
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() && n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
+#endif
       for( Index i = 0; i < n; i ++ )
          v[ i ] = thisMultiplicator * v[ i ] + multiplicator1 * v1[ i ] + multiplicator2 * v2[ i ];
 }
@@ -742,4 +734,4 @@ extern template long double tnlVectorOperations< tnlHost >::getVectorDifferenceA
 #endif
 
 
-#endif /* TNLVECTOROPERATIONSHOST_IMPL_H_ */
+} // namespace TNL
diff --git a/src/core/vectors/tnlVector_impl.cpp b/src/core/vectors/tnlVector_impl.cpp
index 5ab60546b237877201dc0ab71755ca5f56461caf..b774fcde62c8d33183e350a56c782280d8061cd7 100644
--- a/src/core/vectors/tnlVector_impl.cpp
+++ b/src/core/vectors/tnlVector_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef INSTANTIATE_FLOAT
@@ -41,4 +36,5 @@ template class tnlVector< long double, tnlHost, long int >;
 
 #endif
 
+} // namespace TNL
 
diff --git a/src/core/vectors/tnlVector_impl.cu b/src/core/vectors/tnlVector_impl.cu
index ca671f4361b2e966eb2fa925db5a0247bb4ba408..1e172c6e7ddf7a4b8e5f2737b41b382068e45437 100644
--- a/src/core/vectors/tnlVector_impl.cu
+++ b/src/core/vectors/tnlVector_impl.cu
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION
 
 #ifdef HAVE_CUDA
@@ -40,3 +35,5 @@ template class tnlVector< long double, tnlCuda, long int >;
 #endif
 
 #endif
+
+} // namespace TNL
diff --git a/src/core/vectors/tnlVector_impl.h b/src/core/vectors/tnlVector_impl.h
index 9615e4ca8ed3e51eeb12a4ef694fe689b251bcdd..764e1c32a00f0ba023ad27303445611c36483de9 100644
--- a/src/core/vectors/tnlVector_impl.h
+++ b/src/core/vectors/tnlVector_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLVECTOR_H_IMPLEMENTATION
-#define TNLVECTOR_H_IMPLEMENTATION
+#pragma once 
 
 #include <core/vectors/tnlVectorOperations.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -401,4 +395,4 @@ extern template class tnlVector< long double, tnlCuda, long int >;
 
 #endif
 
-#endif /* TNLVECTOR_H_IMPLEMENTATION */
+} // namespace TNL
diff --git a/src/debug/tnl-debug-test.cpp b/src/debug/tnl-debug-test.cpp
index 0997b95e05e9ae5037c1a07e79c8a126f7e5af0b..a167cd995a703ce44b3cc94e24ccf896447d2bce 100644
--- a/src/debug/tnl-debug-test.cpp
+++ b/src/debug/tnl-debug-test.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <iostream>
 #define HAVE_TNLDEBUG_H
diff --git a/src/debug/tnlDbgDataElement.h b/src/debug/tnlDbgDataElement.h
index e312173afa134e33e1da5ca801d7a032e4e0efde..7a8529c5de89cc1fc95dd3b046a22362469badcb 100644
--- a/src/debug/tnlDbgDataElement.h
+++ b/src/debug/tnlDbgDataElement.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef __TNLDBGDATAELEMENT_H__
 #define __TNLDBGDATAELEMENT_H__
@@ -39,10 +32,10 @@ template< class T > class tnlDbgDataElement
         previous( 0 ){};
 
    //! Constructor with given data and possibly pointer to next element
-   tnlDbgDataElement( const T& dt, 
+   tnlDbgDataElement( const T& dt,
                       tnlDbgDataElement< T >* prv = 0,
                       tnlDbgDataElement< T >* nxt = 0 )
-      : data( dt ), 
+      : data( dt ),
         next( nxt ),
         previous( prv ){};
 
diff --git a/src/debug/tnlDebug.cpp b/src/debug/tnlDebug.cpp
index 73542a379e689ae29f13d8ee773087ae4bf2d3d2..3a327c9870e00a68fb458d599e7781325ffa8342 100644
--- a/src/debug/tnlDebug.cpp
+++ b/src/debug/tnlDebug.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <string>
 #include <fstream>
@@ -31,7 +24,7 @@ bool tnlInitDebug( const char* file_name, const char* program_name )
 {
    cout << "tnlDebug initiation..." << endl;
    __tnl_debug_structure. setDebug( true );
-   tnlDebugParser debug_parser; 
+   tnlDebugParser debug_parser;
    fstream in_file;
    in_file. open( file_name, ios :: in );
    if( ! in_file )
@@ -39,10 +32,10 @@ bool tnlInitDebug( const char* file_name, const char* program_name )
       cerr << "Unable to open file " << file_name << endl;
       return false;
    }
-   debug_parser. setScanner( &in_file ); 
+   debug_parser. setScanner( &in_file );
    int errs = debug_parser. runParsing( &__tnl_debug_structure );
    if( errs != 0 )
-   {    
+   {
       cerr << errs << " errors occurred while parsing " << file_name << endl;
       return false;
    }
@@ -59,7 +52,7 @@ bool _tnldbg_debug_func( const char* group_name,
                          const char* function_name )
 {
    bool debug = __tnl_debug_structure. Debug( group_name, function_name );
-   //cout << "Debug ( " << group_name << ", " << function_name 
+   //cout << "Debug ( " << group_name << ", " << function_name
    //     << " ) -> " << debug << endl;
    return debug;
 }
diff --git a/src/debug/tnlDebug.h b/src/debug/tnlDebug.h
index ce7baa42e2f9dba33c454320cdb17f00b20ffaf4..b8c5a3a18de61355f6141cfc0540492ab4c1907c 100644
--- a/src/debug/tnlDebug.h
+++ b/src/debug/tnlDebug.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef __tnlDebug_h__
 #define __tnlDebug_h__
@@ -121,7 +114,7 @@ extern int __tnldbg_mpi_i_proc;
       __LINE__);                                             \
       printf( #expr );                                       \
       printf( "\n" );                                        \
-   }         
+   }
 
 #define dbgExpr( expr )                                      \
    if( _tnldbg_debug_func( _tnldbg_debug_class_name,         \
@@ -149,7 +142,7 @@ extern int __tnldbg_mpi_i_proc;
       << __LINE__ << " | CALL:  "                \
       << #expr << " -> " << std :: flush << std :: endl;       \
       expr;                                      \
-   }         
+   }
 
 #define dbgWait                                     \
    if( _tnldbg_interactive_func( _tnldbg_debug_class_name, \
@@ -180,7 +173,7 @@ extern int __tnldbg_mpi_i_proc;
          __LINE__);                                    \
          printf( #expr );                              \
          printf( "\n" );                               \
-      }         
+      }
 
 #define dbgCondExpr( condition, expr )         \
    if( _tnldbg_debug_func( _tnldbg_debug_class_name,   \
@@ -201,7 +194,7 @@ extern int __tnldbg_mpi_i_proc;
          << __LINE__ << " | CALL:  "             \
          << #expr << " -> " << std :: flush << std :: endl;    \
          expr;                                   \
-      }         
+      }
 
 #define dbgCondWait( condition )                     \
    if( _tnldbg_interactive_func( _tnldbg_debug_class_name,   \
diff --git a/src/debug/tnlDebugEntry.h b/src/debug/tnlDebugEntry.h
index ffc9763edfe6f0a001804c6d8eee7ba568ef0d2c..dee69829e352189f668659139acfa8f2ef16fda3 100644
--- a/src/debug/tnlDebugEntry.h
+++ b/src/debug/tnlDebugEntry.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlDebugEntryH
 #define tnlDebugEntryH
diff --git a/src/debug/tnlDebugGroup.cpp b/src/debug/tnlDebugGroup.cpp
index de95da52106865abf93dc29e2e26ddfc2655ce5a..18ca85ed00d4ee00d9361b7bd0eb26a72fcaf3f2 100644
--- a/src/debug/tnlDebugGroup.cpp
+++ b/src/debug/tnlDebugGroup.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlDebugGroup.h"
 
diff --git a/src/debug/tnlDebugGroup.h b/src/debug/tnlDebugGroup.h
index aee5472f1e4685e28556eb764604654f5d658f6d..aff823cd8e29fe95752fce5feebeac4eab763a18 100644
--- a/src/debug/tnlDebugGroup.h
+++ b/src/debug/tnlDebugGroup.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlDebugGroupH
 #define tnlDebugGroupH
diff --git a/src/debug/tnlDebugParser.cpp b/src/debug/tnlDebugParser.cpp
index 45d373c4364f6d942f445c61a6fa6b8ad11b4736..eda404492689507f174bd4ef04a0251908176e77 100644
--- a/src/debug/tnlDebugParser.cpp
+++ b/src/debug/tnlDebugParser.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlDebugParser.h>
 #include <tnlDebugScanner.h>
@@ -80,7 +73,7 @@ void tnlDebugParser :: AddCurrentGroup()
 #endif
    debug_structure -> AppendGroup( current_group );
    current_group = 0;
-   
+ 
 }
 //--------------------------------------------------------------------------
 void tnlDebugParser :: AddCurrentEntry()
@@ -96,7 +89,7 @@ void tnlDebugParser :: AddCurrentEntry()
 #ifdef DEBUG
       cout << " into class " << current_group -> group_name << endl;
 #endif
-      current_group -> debug_entries. push_back( current_entry ); 
+      current_group -> debug_entries. push_back( current_entry );
    }
    else
    {
@@ -124,7 +117,7 @@ void tnlDebugParser :: SetCurrentFunctionId( char* s )
 #endif
    assert( current_group );
    current_entry = new tnlDebugEntry;
-   current_entry -> function_name = string( s );   
+   current_entry -> function_name = string( s );
 }
 //--------------------------------------------------------------------------
 void tnlDebugParser :: SetBool( bool v )
diff --git a/src/debug/tnlDebugStructure.cpp b/src/debug/tnlDebugStructure.cpp
index 4e5dfdae3bd1e7a890dc150b5b9e925815babafa..fcfc4f406ab56cc02ffbc2910c370639b0ab9ca6 100644
--- a/src/debug/tnlDebugStructure.cpp
+++ b/src/debug/tnlDebugStructure.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <cstring>
 #include <iostream>
@@ -47,7 +40,7 @@ void tnlDebugStructure :: setDebug( bool debug )
 void tnlDebugStructure :: AppendGroup( tnlDebugGroup* group )
 {
   //cout << "Adding group ... " << endl;
-  debug_groups. push_back( group );   
+  debug_groups. push_back( group );
 }
 //--------------------------------------------------------------------------
 void tnlDebugStructure :: AppendAloneEntry( tnlDebugEntry* entry )
@@ -160,7 +153,7 @@ void tnlDebugStructure :: Print()
       {
          cout << "   " << ( * it2 ) -> function_name
               << "[ debug = " << booltostr( ( * it2 ) -> debug )
-              << " ]" << endl;  
+              << " ]" << endl;
          it2 ++;
       }
       cout << "}" << endl;
diff --git a/src/debug/tnlDebugStructure.h b/src/debug/tnlDebugStructure.h
index a38e55a99554397ce2df0f9afca64bc9e6c3c730..9d8bb5c8dadb8fcf491f478db07d7eb11c0a9640 100644
--- a/src/debug/tnlDebugStructure.h
+++ b/src/debug/tnlDebugStructure.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlDebugStructureH
 #define tnlDebugStructureH
@@ -72,9 +65,9 @@ class tnlDebugStructure
    //! Check entry whether it is set to allow interactive debuging
    bool Interactive( const char* group_name,
                      const char* function_name );
-   
+ 
    void Print();
-   
+ 
 };
 
 
diff --git a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h
index 00ddc009986b0483bae7ea7c8e29670576915fc1..2060d487d2e38a36cee214e4d22285f6f0d19013 100644
--- a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h
+++ b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLBLOBFUNCTION_H_
-#define TNLBLOBFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 class tnlBlobFunctionBase : public tnlDomain< Dimensions, SpaceDomain >
@@ -66,14 +60,14 @@ class tnlBlobFunction< 1, Real > : public tnlBlobFunctionBase< Real, 1 >
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
-                           const Real& time = 0.0 ) const;      
+                           const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
@@ -105,7 +99,7 @@ class tnlBlobFunction< 2, Real > : public tnlBlobFunctionBase< Real, 2 >
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -129,14 +123,14 @@ class tnlBlobFunction< 3, Real > : public tnlBlobFunctionBase< Real, 3 >
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
-                           const Real& time = 0.0 ) const;      
+                           const Real& time = 0.0 ) const;
 };
 
 template< int Dimensions,
@@ -147,7 +141,7 @@ ostream& operator << ( ostream& str, const tnlBlobFunction< Dimensions, Real >&
    return str;
 }
 
-#include <functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h>
+} // namepsace TNL
 
+#include <functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h>
 
-#endif /* TNLBLOBFUNCTION_H_ */
diff --git a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h
index 90652ae26dbe7aa02ecf78fa52692dc389416307..a6590e6c8ea6b158b4aa9400d101ca9573b65122 100644
--- a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h
+++ b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLBLOBFUNCTION_IMPL_H_
-#define TNLBLOBFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/initial_conditions/level_set_functions/tnlBlobFunction.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 bool
@@ -28,7 +22,7 @@ setup( const tnlParameterContainer& parameters,
        const tnlString& prefix )
 {
    this->height = parameters.getParameter< double >( prefix + "height" );
-   
+ 
    return true;
 }
 
@@ -49,7 +43,7 @@ tnlBlobFunction< 1, Real >::tnlBlobFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder >
 __cuda_callable__
@@ -163,5 +157,4 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
-#endif /* TNLBLOBFUNCTION_IMPL_H_ */
+} // namepsace TNL
diff --git a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h
index ffcc671f6293c088f5bfe8e385b23cf8197ed7ab..5eff8db606744a286fadbbb682dd794814c8bb06 100644
--- a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h
+++ b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPSEUDOSQUAREFUNCTION_H_
-#define TNLPSEUDOSQUAREFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 class tnlPseudoSquareFunctionBase : public tnlDomain< Dimensions, SpaceDomain >
@@ -66,14 +60,14 @@ class tnlPseudoSquareFunction< 1, Real > : public tnlPseudoSquareFunctionBase< R
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
-                           const Real& time = 0.0 ) const;      
+                           const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
@@ -101,10 +95,10 @@ class tnlPseudoSquareFunction< 2, Real > : public tnlPseudoSquareFunctionBase< R
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
-                           const Real& time = 0.0 ) const;      
+                           const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
@@ -128,15 +122,15 @@ class tnlPseudoSquareFunction< 3, Real > : public tnlPseudoSquareFunctionBase< R
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -147,7 +141,6 @@ ostream& operator << ( ostream& str, const tnlPseudoSquareFunction< Dimensions,
    return str;
 }
 
-#include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h>
+} // namepsace TNL
 
-
-#endif /* TNLPSEUDOSQUAREFUNCTION_H_ */
+#include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h>
diff --git a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h
index 2b15177f6bc63852ba2d059a6bd51291df7b071d..5207bc633dfb2fb1a15d88fcb185d4d2d44645a9 100644
--- a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h
+++ b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPSEUDOSQUAREFUNCTION_IMPL_H_
-#define TNLPSEUDOSQUAREFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 bool
@@ -28,7 +22,7 @@ setup( const tnlParameterContainer& parameters,
        const tnlString& prefix )
 {
    this->height = parameters.getParameter< double >( prefix + "height" );
-   
+ 
    return true;
 }
 
@@ -50,7 +44,7 @@ tnlPseudoSquareFunction< 1, Real >::tnlPseudoSquareFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder >
 __cuda_callable__
@@ -164,4 +158,4 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-#endif /* TNLPSEUDOSQUAREFUNCTION_IMPL_H_ */
+} // namepsace TNL
diff --git a/src/functions/initial_conditions/tnlCylinderFunction.h b/src/functions/initial_conditions/tnlCylinderFunction.h
index babd74e0ea976146a9c260520193db7a390ac0c5..2795ea29953a67c25d5dc343a264369988fcf4ad 100644
--- a/src/functions/initial_conditions/tnlCylinderFunction.h
+++ b/src/functions/initial_conditions/tnlCylinderFunction.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCYLINDERFUNCTION_H_
-#define TNLCYLINDERFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 class tnlCylinderFunctionBase : public tnlDomain< Dimensions, SpaceDomain >
@@ -72,7 +66,7 @@ class tnlCylinderFunction< 1, Real > : public tnlCylinderFunctionBase< Real, 1 >
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
@@ -80,7 +74,7 @@ class tnlCylinderFunction< 1, Real > : public tnlCylinderFunctionBase< Real, 1 >
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -110,11 +104,11 @@ class tnlCylinderFunction< 2, Real > : public tnlCylinderFunctionBase< Real, 2 >
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -140,15 +134,15 @@ class tnlCylinderFunction< 3, Real > : public tnlCylinderFunctionBase< Real, 3 >
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -159,7 +153,7 @@ ostream& operator << ( ostream& str, const tnlCylinderFunction< Dimensions, Real
    return str;
 }
 
-#include <functions/initial_conditions/tnlCylinderFunction_impl.h>
+} // namespace TNL
 
+#include <functions/initial_conditions/tnlCylinderFunction_impl.h>
 
-#endif /* TNLEXPBUMPFUNCTION_H_ */
diff --git a/src/functions/initial_conditions/tnlCylinderFunction_impl.h b/src/functions/initial_conditions/tnlCylinderFunction_impl.h
index bf4e2f7f8638c9c366f734734313288b6d23b9b3..54ce35c4f197e8b275bcae3d99f119eb3c172f9a 100644
--- a/src/functions/initial_conditions/tnlCylinderFunction_impl.h
+++ b/src/functions/initial_conditions/tnlCylinderFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCYLINDERFUNCTION_IMPL_H_
-#define TNLCYLINDERFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/initial_conditions/tnlCylinderFunction.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 bool
@@ -64,7 +58,7 @@ tnlCylinderFunction< 1, Real >::tnlCylinderFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder,
              typename Vertex >
@@ -183,5 +177,4 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
-#endif /* TNLCYLINDERFUNCTION_IMPL_H_ */
+} // namespace TNL
diff --git a/src/functions/initial_conditions/tnlFlowerpotFunction.h b/src/functions/initial_conditions/tnlFlowerpotFunction.h
index 9f0e8a0a41e543af8ac925316c77fa102039ac4d..20b6a3f4fe626ac077325bbf2420a23c2060d86b 100644
--- a/src/functions/initial_conditions/tnlFlowerpotFunction.h
+++ b/src/functions/initial_conditions/tnlFlowerpotFunction.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFLOWERPOTFUNCTION_H_
-#define TNLFLOWERPOTFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 class tnlFlowerpotFunctionBase : public tnlDomain< Dimensions, SpaceDomain >
@@ -72,15 +66,15 @@ class tnlFlowerpotFunction< 1, Real > : public tnlFlowerpotFunctionBase< Real, 1
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -110,11 +104,11 @@ class tnlFlowerpotFunction< 2, Real > : public tnlFlowerpotFunctionBase< Real, 2
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -140,15 +134,15 @@ class tnlFlowerpotFunction< 3, Real > : public tnlFlowerpotFunctionBase< Real, 3
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -159,7 +153,7 @@ ostream& operator << ( ostream& str, const tnlFlowerpotFunction< Dimensions, Rea
    return str;
 }
 
-#include <functions/initial_conditions/tnlFlowerpotFunction_impl.h>
+} // namespace TNL
 
+#include <functions/initial_conditions/tnlFlowerpotFunction_impl.h>
 
-#endif /* TNLFLOWERPOTFUNCTION_H_ */
diff --git a/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h b/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h
index 0b5b08d3b98e108d4b8c3289e007a1cca3495396..e515528b1f9cd3c96ec52bb9628bc87833341f64 100644
--- a/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h
+++ b/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFLOWERPOTFUNCTION_IMPL_H_
-#define TNLFLOWERPOTFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/initial_conditions/tnlFlowerpotFunction.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 bool
@@ -31,7 +25,7 @@ setup( const tnlParameterContainer& parameters,
    return true;
 }
 
-template< typename Real, 
+template< typename Real,
           int Dimensions >
 void tnlFlowerpotFunctionBase< Real, Dimensions >::setDiameter( const Real& sigma )
 {
@@ -62,7 +56,7 @@ tnlFlowerpotFunction< 1, Real >::tnlFlowerpotFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder,
              typename Vertex >
@@ -181,4 +175,5 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-#endif /* TNLFLOWERPOTFUNCTION_IMPL_H_ */
+} // namespace TNL
+
diff --git a/src/functions/initial_conditions/tnlTwinsFunction.h b/src/functions/initial_conditions/tnlTwinsFunction.h
index b3e0af47620c98dd59d136b77120d9b590074ac8..72e5c88c8710ec646a515312f4008dc7b021040d 100644
--- a/src/functions/initial_conditions/tnlTwinsFunction.h
+++ b/src/functions/initial_conditions/tnlTwinsFunction.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTWINSFUNCTION_H_
-#define TNLTWINSFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 #include <core/tnlCuda.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 class tnlTwinsFunctionBase : public tnlDomain< Dimensions, SpaceDomain >
@@ -64,15 +58,15 @@ class tnlTwinsFunction< 1, Real > : public tnlTwinsFunctionBase< Real, 1 >
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -102,11 +96,11 @@ class tnlTwinsFunction< 2, Real > : public tnlTwinsFunctionBase< Real, 2 >
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -132,15 +126,15 @@ class tnlTwinsFunction< 3, Real > : public tnlTwinsFunctionBase< Real, 3 >
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0,
                 typename Vertex = VertexType >
-#endif   
+#endif
       __cuda_callable__
       RealType getPartialDerivative( const Vertex& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -151,7 +145,7 @@ ostream& operator << ( ostream& str, const tnlTwinsFunction< Dimensions, Real >&
    return str;
 }
 
-#include <functions/initial_conditions/tnlTwinsFunction_impl.h>
+} // namespace TNL
 
+#include <functions/initial_conditions/tnlTwinsFunction_impl.h>
 
-#endif /* TNLTWINSFUNCTION_H_ */
diff --git a/src/functions/initial_conditions/tnlTwinsFunction_impl.h b/src/functions/initial_conditions/tnlTwinsFunction_impl.h
index da6bb603617b0cb2920f0b83fc3ae49c0a841839..b719e0ad25ff3c3ffeb2531addfc15ae19749620 100644
--- a/src/functions/initial_conditions/tnlTwinsFunction_impl.h
+++ b/src/functions/initial_conditions/tnlTwinsFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTWINSFUNCTION_IMPL_H_
-#define TNLTWINSFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/initial_conditions/tnlTwinsFunction.h>
 
+namespace TNL {
+
 template< typename Real,
           int Dimensions >
 bool
@@ -48,7 +42,7 @@ tnlTwinsFunction< 1, Real >::tnlTwinsFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder,
              typename Vertex >
@@ -166,4 +160,5 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-#endif /* TNLTWINSFUNCTION_IMPL_H_ */
+} // namespace TNL
+
diff --git a/src/functions/tnlConstantFunction.h b/src/functions/tnlConstantFunction.h
index 381bf3cae3119d199b1b6dec3b15144cf98adc71..2d643e4fc581993a1ffd186eb5aadbf575698ef2 100644
--- a/src/functions/tnlConstantFunction.h
+++ b/src/functions/tnlConstantFunction.h
@@ -6,31 +6,25 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCONSTANTFUNCTION_H_
-#define TNLCONSTANTFUNCTION_H_
+#pragma once 
 
 #include <iostream>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int dimensions,
           typename Real = double >
 class tnlConstantFunction : public tnlDomain< dimensions, NonspaceDomain >
 {
    public:
-      
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< dimensions, RealType > VertexType;      
-      
+      typedef tnlStaticVector< dimensions, RealType > VertexType;
+ 
       tnlConstantFunction();
 
       static void configSetup( tnlConfigDescription& config,
@@ -62,7 +56,7 @@ class tnlConstantFunction : public tnlDomain< dimensions, NonspaceDomain >
       {
          return constant;
       }
-      
+ 
        __cuda_callable__ inline
       RealType getValue( const Real& time = 0.0 ) const
       {
@@ -82,6 +76,7 @@ std::ostream& operator << ( std::ostream& str, const tnlConstantFunction< dimens
    return str;
 }
 
+} //namespace TNL
+
 #include <functions/tnlConstantFunction_impl.h>
 
-#endif /* TNLCONSTANTFUNCTION_H_ */
diff --git a/src/functions/tnlConstantFunction_impl.h b/src/functions/tnlConstantFunction_impl.h
index bb841744c05b97fdd41f0ee974141e6d931424bd..ee38f6ea3a08cc33d45c0dc2f221da367e5397dc 100644
--- a/src/functions/tnlConstantFunction_impl.h
+++ b/src/functions/tnlConstantFunction_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLCONSTANTFUNCTION_IMPL_H_
-#define TNLCONSTANTFUNCTION_IMPL_H_
+namespace TNL {
 
 template< int Dimensions,
           typename Real >
@@ -80,4 +74,4 @@ getPartialDerivative( const VertexType& v,
    return constant;
 }
 
-#endif
+} // namespace TNL
diff --git a/src/functions/tnlDomain.h b/src/functions/tnlDomain.h
index ddc32173cfe5573d36127876f8beca1c09d74b3e..7ffcdc916ee00d64aab6b69a8afc2053495bb8ff 100644
--- a/src/functions/tnlDomain.h
+++ b/src/functions/tnlDomain.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
 
+#pragma once
 
-#ifndef TNLFUNCTION_H
-#define	TNLFUNCTION_H
+namespace TNL {
 
 enum tnlDomainType { NonspaceDomain, SpaceDomain, MeshDomain, MeshInteriorDomain, MeshBoundaryDomain };
 
@@ -26,14 +20,14 @@ template< int Dimensions,
 class tnlDomain
 {
    public:
-      
+ 
       typedef void DeviceType;
-      
+ 
       static const int dimensions = Dimensions;
       static constexpr int getDimensions() { return Dimensions; }
-      
+ 
       static constexpr tnlDomainType getDomainType() { return DomainType; }
 };
 
-#endif	/* TNLFUNCTION_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlExactOperatorFunction.h b/src/functions/tnlExactOperatorFunction.h
index 20bd39184af9d206e100701728f8fcca71df272d..79638728e56301cf3a6e960d00424e8d158e36d1 100644
--- a/src/functions/tnlExactOperatorFunction.h
+++ b/src/functions/tnlExactOperatorFunction.h
@@ -6,41 +6,35 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTOPERATORFUNCTION_H
-#define	TNLEXACTOPERATORFUNCTION_H
+#pragma once
 
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename Operator,
           typename Function >
 class tnlExactOperatorFunction : public tnlDomain< Operator::getDimensions(), SpaceDomain >
-{   
+{
    static_assert( Operator::getDimensions() == Function::getDimensions(),
       "Operator and function have different number of domain dimensions." );
-   
-   public:      
-      
+ 
+   public:
+ 
       typedef Operator OperatorType;
       typedef Function FunctionType;
       typedef typename FunctionType::RealType RealType;
       typedef typename FunctionType::VertexType VertexType;
-      
+ 
       static constexpr int getDimensions(){ return Operator::getDimensions(); };
-      
+ 
       tnlExactOperatorFunction(
          const OperatorType& operator_,
          const FunctionType& function )
       : operator_( operator_ ), function( function ) {};
-      
+ 
       __cuda_callable__
       RealType operator()(
          const VertexType& vertex,
@@ -48,13 +42,13 @@ class tnlExactOperatorFunction : public tnlDomain< Operator::getDimensions(), Sp
       {
          return this->operator_( function, vertex, time );
       }
-      
+ 
    protected:
-      
+ 
       const OperatorType& operator_;
-      
-      const FunctionType& function;               
+ 
+      const FunctionType& function;
 };
 
-#endif	/* TNLEXACTOPERATORFUNCTION_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlExpBumpFunction.h b/src/functions/tnlExpBumpFunction.h
index f32aba0e0804a0724536c7ba04fbbda8ac78972c..e9acca327e7621249f0725b23486d85cf8cccc74 100644
--- a/src/functions/tnlExpBumpFunction.h
+++ b/src/functions/tnlExpBumpFunction.h
@@ -6,32 +6,26 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXPBUMPFUNCTION_H_
-#define TNLEXPBUMPFUNCTION_H_
+#pragma once 
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int dimensions,
           typename Real >
 class tnlExpBumpFunctionBase : public tnlDomain< dimensions, SpaceDomain >
 {
    public:
-     
+ 
       typedef Real RealType;
-      
+ 
       tnlExpBumpFunctionBase();
-      
+ 
       bool setup( const tnlParameterContainer& parameters,
                  const tnlString& prefix = "" );
 
@@ -58,9 +52,9 @@ template< typename Real >
 class tnlExpBumpFunction< 1, Real > : public tnlExpBumpFunctionBase< 1, Real >
 {
    public:
-     
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< 1, RealType > VertexType;      
+      typedef tnlStaticVector< 1, RealType > VertexType;
 
       static tnlString getType();
 
@@ -74,11 +68,11 @@ class tnlExpBumpFunction< 1, Real > : public tnlExpBumpFunctionBase< 1, Real >
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
-   __cuda_callable__ 
+#endif
+   __cuda_callable__
    RealType getPartialDerivative( const VertexType& v,
                                   const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
                         const RealType& time = 0.0 ) const;
@@ -90,7 +84,7 @@ class tnlExpBumpFunction< 2, Real > : public tnlExpBumpFunctionBase< 2, Real >
    public:
  
       typedef Real RealType;
-      typedef tnlStaticVector< 2, RealType > VertexType;      
+      typedef tnlStaticVector< 2, RealType > VertexType;
 
       static tnlString getType();
 
@@ -108,21 +102,21 @@ class tnlExpBumpFunction< 2, Real > : public tnlExpBumpFunctionBase< 2, Real >
    __cuda_callable__ inline
    RealType getPartialDerivative( const VertexType& v,
                                   const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
-                        const Real& time = 0.0 ) const;                            
+                        const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class tnlExpBumpFunction< 3, Real > : public tnlExpBumpFunctionBase< 3, Real >
 {
    public:
-      
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< 3, RealType > VertexType;      
+      typedef tnlStaticVector< 3, RealType > VertexType;
 
-    
+ 
       static tnlString getType();
 
       tnlExpBumpFunction();
@@ -135,15 +129,15 @@ class tnlExpBumpFunction< 3, Real > : public tnlExpBumpFunctionBase< 3, Real >
       template< int XDiffOrder = 0,
                 int YDiffOrder = 0,
                 int ZDiffOrder = 0 >
-#endif   
+#endif
    __cuda_callable__
    RealType getPartialDerivative( const VertexType& v,
                                   const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
                         const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -154,7 +148,8 @@ ostream& operator << ( ostream& str, const tnlExpBumpFunction< Dimensions, Real
    return str;
 }
 
+} // namespace TNL
+
 #include <functions/tnlExpBumpFunction_impl.h>
 
 
-#endif /* TNLEXPBUMPFUNCTION_H_ */
diff --git a/src/functions/tnlExpBumpFunction_impl.h b/src/functions/tnlExpBumpFunction_impl.h
index cb1d8c758ca1975e5f562c67c0bfd5080749181f..2c01fae27dcb96248678001c7ef7a557eda5ff9d 100644
--- a/src/functions/tnlExpBumpFunction_impl.h
+++ b/src/functions/tnlExpBumpFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXPBUMPFUNCTION_IMPL_H_
-#define TNLEXPBUMPFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/tnlExpBumpFunction.h>
 
+namespace TNL {
+
 template< int dimensions, typename Real >
 tnlExpBumpFunctionBase< dimensions, Real >::
 tnlExpBumpFunctionBase()
@@ -79,7 +73,7 @@ tnlExpBumpFunction< 1, Real >::tnlExpBumpFunction()
 }
 
 template< typename Real >
-   template< int XDiffOrder, 
+   template< int XDiffOrder,
              int YDiffOrder,
              int ZDiffOrder >
 __cuda_callable__
@@ -228,6 +222,4 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
-
-#endif /* TNLEXPBUMPFUNCTION_IMPL_H_ */
+} //namespace TNL
diff --git a/src/functions/tnlFunctionAdapter.h b/src/functions/tnlFunctionAdapter.h
index 71e14b30ef00a5404b5767941fb3148475a999b6..6348421df001f2590634df15835ce6ad4a0d48ae 100644
--- a/src/functions/tnlFunctionAdapter.h
+++ b/src/functions/tnlFunctionAdapter.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLFUNCTIONADAPTER_H
-#define	TNLFUNCTIONADAPTER_H
+namespace TNL {
 
 /***
  * MeshType is a type of mesh on which we evaluate the function.
@@ -30,19 +24,19 @@ template< typename Mesh,
 class tnlFunctionAdapter
 {
       public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
+      typedef typename MeshType::IndexType     IndexType;
       //typedef typename FunctionType::VertexType VertexType;
-      
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function( meshEntity, time );
       }
 };
@@ -56,19 +50,19 @@ template< typename Mesh,
 class tnlFunctionAdapter< Mesh, Function, SpaceDomain >
 {
    public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
+      typedef typename MeshType::IndexType     IndexType;
       typedef typename FunctionType::VertexType VertexType;
-      
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function( meshEntity.getCenter(), time );
       }
 };
@@ -83,19 +77,19 @@ template< typename Mesh,
 class tnlFunctionAdapter< Mesh, Function, NonspaceDomain >
 {
    public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
+      typedef typename MeshType::IndexType     IndexType;
       typedef typename FunctionType::VertexType VertexType;
-      
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function.getValue( time );
       }
 };
@@ -110,18 +104,18 @@ template< typename Mesh,
 class tnlFunctionAdapter< Mesh, Function, MeshFunction >
 {
    public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
-      
+      typedef typename MeshType::IndexType     IndexType;
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function( meshEntity, time );
       }
 };
@@ -134,19 +128,19 @@ template< typename Mesh,
 class tnlFunctionAdapter< Mesh, Function, SpaceDomain >
 {
    public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
+      typedef typename MeshType::IndexType     IndexType;
       typedef typename FunctionType::VertexType VertexType;
-      
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function.getValue( meshEntity.getCenter(), time );
       }
 };
@@ -159,23 +153,23 @@ template< typename Mesh,
 class tnlFunctionAdapter< Mesh, Function, SpaceDomain >
 {
    public:
-      
+ 
       typedef Function FunctionType;
       typedef Mesh MeshType;
       typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::IndexType     IndexType;      
+      typedef typename MeshType::IndexType     IndexType;
       typedef typename FunctionType::VertexType VertexType;
-      
+ 
       template< typename EntityType >
       __cuda_callable__ inline
       static RealType getValue( const FunctionType& function,
                                 const EntityType& meshEntity,
                                 const RealType& time )
-      {         
+      {
          return function.getValue( time );
       }
 };
 #endif
 
-#endif	/* TNLFUNCTIONADAPTER_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlFunctionEvaluator.h b/src/functions/tnlFunctionEvaluator.h
index d57175d535eec690749534d0dcef355750db332b..e3f32e095aba32461dd611bf175b6b11690af6ad 100644
--- a/src/functions/tnlFunctionEvaluator.h
+++ b/src/functions/tnlFunctionEvaluator.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_H_
-#define SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_H_
+#pragma once
 
 #include <functions/tnlFunctionAdapter.h>
 
+namespace TNL {
+
 template< typename MeshFunction,
           typename Function >
 class tnlFunctionEvaluatorTraverserUserData
@@ -49,7 +43,7 @@ class tnlFunctionEvaluatorTraverserUserData
         functionCoefficient( &functionCoefficient ),
         dofVectorCoefficient( &dofVectorCoefficient )
       {};
-            
+ 
 };
 
 
@@ -72,9 +66,9 @@ class tnlFunctionEvaluator
                        const RealType& time = 0.0 ) const;
 
       //void addition( ... );
-      
+ 
       //void subtruction( .... );
-      
+ 
       //void multiplication( .... );
 
       class TraverserEntitiesProcessor
@@ -93,7 +87,7 @@ class tnlFunctionEvaluator
                      ( *userData.functionCoefficient ) * FunctionAdapter::getValue( *userData.function,
                                                                                     entity,
                                                                                     *userData.time );
-               else                                                                                            
+               else
                  ( *userData.u )( entity ) =
                              ( *userData.dofVectorCoefficient ) * ( *userData.u )( entity ) +
                              ( *userData.functionCoefficient ) * FunctionAdapter::getValue( *userData.function,
@@ -105,8 +99,7 @@ class tnlFunctionEvaluator
 
 };
 
-#include <functions/tnlFunctionEvaluator_impl.h>
-
+} // namespace TNL
 
+#include <functions/tnlFunctionEvaluator_impl.h>
 
-#endif /* SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_H_ */
diff --git a/src/functions/tnlFunctionEvaluator_impl.h b/src/functions/tnlFunctionEvaluator_impl.h
index 756f6e584c656882788164bcf9c1d5d9a8cca64d..4ffb1b181c71687d945f0f4ec892075175e6daa9 100644
--- a/src/functions/tnlFunctionEvaluator_impl.h
+++ b/src/functions/tnlFunctionEvaluator_impl.h
@@ -6,16 +6,9 @@
     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 SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_IMPL_H_
-#define SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_IMPL_H_
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <type_traits>
 #include <functions/tnlFunctionEvaluator.h>
@@ -23,6 +16,8 @@
 #include <mesh/grids/tnlTraverser_Grid2D.h>
 #include <mesh/grids/tnlTraverser_Grid3D.h>
 
+namespace TNL {
+
 template< typename MeshFunction,
           typename Function >
 void
@@ -78,4 +73,4 @@ assignment( const Function& function,
    }
 }
 
-#endif /* SRC_FUNCTIONS_TNLFUNCTIONEVALUATOR_IMPL_H_ */
+} // namespace TNL
diff --git a/src/functions/tnlMeshFunction.h b/src/functions/tnlMeshFunction.h
index add52cc1c939d2b202206e15a949f1879285d050..dba74c2b97a7968e6eeb2a6e47516d4beeee6a18 100644
--- a/src/functions/tnlMeshFunction.h
+++ b/src/functions/tnlMeshFunction.h
@@ -6,147 +6,139 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <functions/tnlDomain.h>
 #include <functions/tnlMeshFunctionGnuplotWriter.h>
 #include <functions/tnlMeshFunctionVTKWriter.h>
 
-#ifndef TNLMESHFUNCTION_H
-#define TNLMESHFUNCTION_H
+#pragma once
 
 template< typename Mesh,
           int MeshEntityDimensions = Mesh::meshDimensions,
           typename Real = typename Mesh::RealType >
-class tnlMeshFunction : 
+class tnlMeshFunction :
    public tnlObject,
    public tnlDomain< Mesh::meshDimensions, MeshDomain >
 {
    //static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType,
    //               "Both mesh and vector of a mesh function must reside on the same device.");
    public:
-      
-      typedef Mesh MeshType;      
+ 
+      typedef Mesh MeshType;
       typedef typename MeshType::DeviceType DeviceType;
       typedef typename MeshType::IndexType IndexType;
       typedef Real RealType;
       typedef tnlVector< RealType, DeviceType, IndexType > VectorType;
       typedef tnlMeshFunction< Mesh, MeshEntityDimensions, Real > ThisType;
-      
+ 
       static constexpr int getEntitiesDimensions() { return MeshEntityDimensions; };
-      
+ 
       tnlMeshFunction();
-      
+ 
       tnlMeshFunction( const MeshType& mesh );
-      
+ 
       template< typename Vector >
       tnlMeshFunction( const MeshType& mesh,
                        Vector& data,
                        const IndexType& offset = 0 );
-      
+ 
       static tnlString getType();
-      
+ 
       tnlString getTypeVirtual() const;
-      
+ 
       static tnlString getSerializationType();
 
-      virtual tnlString getSerializationTypeVirtual() const;      
-      
+      virtual tnlString getSerializationTypeVirtual() const;
+ 
       static void configSetup( tnlConfigDescription& config,
                                const tnlString& prefix = "" );
 
       bool setup( const tnlParameterContainer& parameters,
-                  const tnlString& prefix = "" );      
-      
+                  const tnlString& prefix = "" );
+ 
+      void bind( ThisType& meshFunction );
+ 
       template< typename Vector >
       void bind( const MeshType& mesh,
                  const Vector& data,
                  const IndexType& offset = 0 );
-      
+ 
       void setMesh( const MeshType& mesh );
-      
+ 
       const MeshType& getMesh() const;
-      
-      const VectorType& getData() const;      
-      
+ 
+      const VectorType& getData() const;
+ 
       VectorType& getData();
-      
+ 
       bool refresh( const RealType& time = 0.0 ) const;
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 ) const;
-      
+ 
       template< typename EntityType >
       RealType getValue( const EntityType& meshEntity ) const;
-      
+ 
       template< typename EntityType >
       void setValue( const EntityType& meshEntity,
                      const RealType& value );
-      
+ 
       template< typename EntityType >
       __cuda_callable__
       RealType& operator()( const EntityType& meshEntity,
                             const RealType& time = 0.0 );
-      
+ 
       template< typename EntityType >
       __cuda_callable__
       const RealType& operator()( const EntityType& meshEntity,
                                   const RealType& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType& operator[]( const IndexType& meshEntityIndex );
-      
+ 
       __cuda_callable__
       const RealType& operator[]( const IndexType& meshEntityIndex ) const;
 
       template< typename Function >
       ThisType& operator = ( const Function& f );
-      
+ 
       template< typename Function >
       ThisType& operator -= ( const Function& f );
 
       template< typename Function >
       ThisType& operator += ( const Function& f );
-      
+ 
       RealType getLpNorm( const RealType& p ) const;
-      
+ 
       RealType getMaxNorm() const;
-      
+ 
       bool save( tnlFile& file ) const;
 
       bool load( tnlFile& file );
-      
+ 
       bool boundLoad( tnlFile& file );
-      
+ 
       bool write( const tnlString& fileName,
                   const tnlString& format = "vtk" ) const;
-      
+ 
       using tnlObject::save;
-      
+ 
       using tnlObject::load;
-            
+ 
       using tnlObject::boundLoad;
-            
+ 
    protected:
-      
+ 
       const MeshType* mesh;
-      
+ 
       VectorType data;
-      
+ 
       template< typename, typename > friend class tnlMeshFunctionEvaluator;
 };
 
+} // namespace TNL
+
 #include <functions/tnlMeshFunction_impl.h>
 #include <functions/tnlMeshFunctionGnuplotWriter_impl.h>
 #include <functions/tnlMeshFunctionVTKWriter_impl.h>
-
-
-#endif	/* TNLMESHFUNCTION_H */
-
diff --git a/src/functions/tnlMeshFunctionEvaluator.h b/src/functions/tnlMeshFunctionEvaluator.h
index 882d2e5d0e171ee5b51dd7bcebe4a02b2e6aa617..83b2732a8c64a347b2a60d8e26abcb6c18564f41 100644
--- a/src/functions/tnlMeshFunctionEvaluator.h
+++ b/src/functions/tnlMeshFunctionEvaluator.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHFUNCTIONEVALUATOR_H
-#define	TNLMESHFUNCTIONEVALUATOR_H
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <functions/tnlMeshFunction.h>
 #include <functions/tnlOperatorFunction.h>
 
+namespace TNL {
+
 template< typename OutMeshFunction,
           typename InFunction,
           typename Real >
@@ -48,32 +42,32 @@ class tnlMeshFunctionEvaluator : public tnlDomain< OutMeshFunction::getEntitiesD
       typedef typename OutMeshFunction::RealType RealType;
       typedef tnlMeshFunctionEvaluatorTraverserUserData< OutMeshFunction, InFunction, RealType > TraverserUserData;
 
-      
+ 
       const static int meshEntityDimensions = OutMeshFunction::getEntitiesDimensions();
-      
-      static_assert( MeshType::meshDimensions == InFunction::getDimensions(), 
+ 
+      static_assert( MeshType::meshDimensions == InFunction::getDimensions(),
          "Input function and the mesh of the mesh function have both different number of dimensions." );
-      
+ 
       static void evaluate( OutMeshFunction& meshFunction,
-                            const InFunction& function,                          
+                            const InFunction& function,
                             const RealType& time = 0.0,
                             const RealType& outFunctionMultiplicator = 0.0,
                             const RealType& inFunctionMultiplicator = 1.0 );
 
       static void evaluateAllEntities( OutMeshFunction& meshFunction,
-                                       const InFunction& function,                          
+                                       const InFunction& function,
                                        const RealType& time = 0.0,
                                        const RealType& outFunctionMultiplicator = 0.0,
                                        const RealType& inFunctionMultiplicator = 1.0 );
-      
+ 
       static void evaluateInteriorEntities( OutMeshFunction& meshFunction,
-                                            const InFunction& function,                          
+                                            const InFunction& function,
                                             const RealType& time = 0.0,
                                             const RealType& outFunctionMultiplicator = 0.0,
                                             const RealType& inFunctionMultiplicator = 1.0 );
 
       static void evaluateBoundaryEntities( OutMeshFunction& meshFunction,
-                                            const InFunction& function,                          
+                                            const InFunction& function,
                                             const RealType& time = 0.0,
                                             const RealType& outFunctionMultiplicator = 0.0,
                                             const RealType& inFunctionMultiplicator = 1.0 );
@@ -81,16 +75,16 @@ class tnlMeshFunctionEvaluator : public tnlDomain< OutMeshFunction::getEntitiesD
    protected:
 
       enum EntitiesType { all, boundary, interior };
-      
+ 
       static void evaluateEntities( OutMeshFunction& meshFunction,
-                                    const InFunction& function,                          
+                                    const InFunction& function,
                                     const RealType& time,
                                     const RealType& outFunctionMultiplicator,
                                     const RealType& inFunctionMultiplicator,
                                     EntitiesType entitiesType );
 
-      
-}; 
+ 
+};
 
 template< typename OutMeshFunction,
           typename InFunction,
@@ -106,11 +100,11 @@ class tnlMeshFunctionEvaluatorTraverserUserData
                                                  OutMeshFunction* meshFunction,
                                                  const Real* outFunctionMultiplicator,
                                                  const Real* inFunctionMultiplicator )
-      : meshFunction( meshFunction ), function( function ), time( time ), 
+      : meshFunction( meshFunction ), function( function ), time( time ),
         outFunctionMultiplicator( outFunctionMultiplicator ),
         inFunctionMultiplicator( inFunctionMultiplicator ){}
 
-      OutMeshFunction* meshFunction;            
+      OutMeshFunction* meshFunction;
       const InFunction* function;
       const Real *time, *outFunctionMultiplicator, *inFunctionMultiplicator;
 
@@ -118,7 +112,7 @@ class tnlMeshFunctionEvaluatorTraverserUserData
 
 
 template< typename MeshType,
-          typename UserData > 
+          typename UserData >
 class tnlMeshFunctionEvaluatorAssignmentEntitiesProcessor
 {
    public:
@@ -130,18 +124,18 @@ class tnlMeshFunctionEvaluatorAssignmentEntitiesProcessor
                                         const EntityType& entity )
       {
          typedef tnlFunctionAdapter< MeshType, typename UserData::InFunctionType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) = 
+         ( *userData.meshFunction )( entity ) =
             *userData.inFunctionMultiplicator *
             FunctionAdapter::getValue( *userData.function, entity, *userData.time );
-         /*cerr << "Idx = " << entity.getIndex() 
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, *userData.time ) 
+         /*cerr << "Idx = " << entity.getIndex()
+            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, *userData.time )
             << " stored value = " << ( *userData.meshFunction )( entity )
             << " multiplicators = " << endl;*/
       }
 };
 
 template< typename MeshType,
-          typename UserData > 
+          typename UserData >
 class tnlMeshFunctionEvaluatorAdditionEntitiesProcessor
 {
    public:
@@ -153,19 +147,18 @@ class tnlMeshFunctionEvaluatorAdditionEntitiesProcessor
                                         const EntityType& entity )
       {
          typedef tnlFunctionAdapter< MeshType, typename UserData::InFunctionType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) = 
+         ( *userData.meshFunction )( entity ) =
             *userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity ) +
             *userData.inFunctionMultiplicator *
             FunctionAdapter::getValue( *userData.function, entity, *userData.time );
-         /*cerr << "Idx = " << entity.getIndex() 
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, *userData.time ) 
+         /*cerr << "Idx = " << entity.getIndex()
+            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, *userData.time )
             << " stored value = " << ( *userData.meshFunction )( entity )
             << " multiplicators = " << endl;*/
       }
 };
 
+} // namespace TNL
 
 #include <functions/tnlMeshFunctionEvaluator_impl.h>
 
-#endif	/* TNLMESHFUNCTIONEVALUATOR_H */
-
diff --git a/src/functions/tnlMeshFunctionEvaluator_impl.h b/src/functions/tnlMeshFunctionEvaluator_impl.h
index 83d463e35c07e79fa13e267d2558b8ff896a3ef4..a4c8b52e6321f7e4a7176d7d7942a821bf702107 100644
--- a/src/functions/tnlMeshFunctionEvaluator_impl.h
+++ b/src/functions/tnlMeshFunctionEvaluator_impl.h
@@ -6,27 +6,21 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHFUNCTIONEVALUATOR_IMPL_H
-#define	TNLMESHFUNCTIONEVALUATOR_IMPL_H
+#pragma once
 
 #include <functions/tnlMeshFunctionEvaluator.h>
 #include <mesh/tnlTraverser.h>
 
+namespace TNL {
+
 template< typename OutMeshFunction,
           typename InFunction >
 void
 tnlMeshFunctionEvaluator< OutMeshFunction, InFunction >::
 evaluate( OutMeshFunction& meshFunction,
-          const InFunction& function,                          
+          const InFunction& function,
           const RealType& time,
           const RealType& outFunctionMultiplicator,
           const RealType& inFunctionMultiplicator )
@@ -34,7 +28,7 @@ evaluate( OutMeshFunction& meshFunction,
    switch( InFunction::getDomainType() )
    {
       case SpaceDomain:
-      case MeshDomain:   
+      case MeshDomain:
          evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, all );
          break;
       case MeshInteriorDomain:
@@ -43,7 +37,7 @@ evaluate( OutMeshFunction& meshFunction,
       case MeshBoundaryDomain:
          evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, boundary );
          break;
-   }         
+   }
 }
 
 
@@ -52,7 +46,7 @@ template< typename OutMeshFunction,
 void
 tnlMeshFunctionEvaluator< OutMeshFunction, InFunction >::
 evaluateAllEntities( OutMeshFunction& meshFunction,
-                     const InFunction& function,                          
+                     const InFunction& function,
                      const RealType& time,
                      const RealType& outFunctionMultiplicator,
                      const RealType& inFunctionMultiplicator )
@@ -65,7 +59,7 @@ template< typename OutMeshFunction,
 void
 tnlMeshFunctionEvaluator< OutMeshFunction, InFunction >::
 evaluateInteriorEntities( OutMeshFunction& meshFunction,
-                          const InFunction& function,                          
+                          const InFunction& function,
                           const RealType& time,
                           const RealType& outFunctionMultiplicator,
                           const RealType& inFunctionMultiplicator )
@@ -75,10 +69,10 @@ evaluateInteriorEntities( OutMeshFunction& meshFunction,
 
 template< typename OutMeshFunction,
           typename InFunction >
-void 
+void
 tnlMeshFunctionEvaluator< OutMeshFunction, InFunction >::
 evaluateBoundaryEntities( OutMeshFunction& meshFunction,
-                          const InFunction& function,                          
+                          const InFunction& function,
                           const RealType& time,
                           const RealType& outFunctionMultiplicator,
                           const RealType& inFunctionMultiplicator )
@@ -102,14 +96,14 @@ evaluateEntities( OutMeshFunction& meshFunction,
    typedef typename MeshType::template MeshEntity< OutMeshFunction::getEntitiesDimensions() > MeshEntityType;
    typedef tnlMeshFunctionEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData > AssignmentEntitiesProcessor;
    typedef tnlMeshFunctionEvaluatorAdditionEntitiesProcessor< MeshType, TraverserUserData > AdditionEntitiesProcessor;
-  
+ 
    if( std::is_same< MeshDeviceType, tnlHost >::value )
    {
       TraverserUserData userData( &function, &time, &meshFunction, &outFunctionMultiplicator, &inFunctionMultiplicator );
       tnlTraverser< MeshType, MeshEntityType > meshTraverser;
       switch( entitiesType )
       {
-         case all:            
+         case all:
             if( outFunctionMultiplicator )
                meshTraverser.template processAllEntities< TraverserUserData,
                                                           AdditionEntitiesProcessor >
@@ -131,7 +125,7 @@ evaluateEntities( OutMeshFunction& meshFunction,
                meshTraverser.template processInteriorEntities< TraverserUserData,
                                                                AssignmentEntitiesProcessor >
                                                              ( meshFunction.getMesh(),
-                                                               userData );            
+                                                               userData );
             break;
          case boundary:
             if( outFunctionMultiplicator )
@@ -148,19 +142,19 @@ evaluateEntities( OutMeshFunction& meshFunction,
       }
    }
    if( std::is_same< MeshDeviceType, tnlCuda >::value )
-   {      
+   {
       OutMeshFunction* kernelMeshFunction = tnlCuda::passToDevice( meshFunction );
       InFunction* kernelFunction = tnlCuda::passToDevice( function );
       RealType* kernelTime = tnlCuda::passToDevice( time );
       RealType* kernelOutFunctionMultiplicator = tnlCuda::passToDevice( outFunctionMultiplicator );
       RealType* kernelInFunctionMultiplicator = tnlCuda::passToDevice( inFunctionMultiplicator );
-      
+ 
       TraverserUserData userData( kernelFunction, kernelTime, kernelMeshFunction, kernelOutFunctionMultiplicator, kernelInFunctionMultiplicator );
       checkCudaDevice;
       tnlTraverser< MeshType, MeshEntityType > meshTraverser;
       switch( entitiesType )
       {
-         case all:            
+         case all:
             if( outFunctionMultiplicator )
                meshTraverser.template processAllEntities< TraverserUserData,
                                                           AdditionEntitiesProcessor >
@@ -182,7 +176,7 @@ evaluateEntities( OutMeshFunction& meshFunction,
                meshTraverser.template processInteriorEntities< TraverserUserData,
                                                                AssignmentEntitiesProcessor >
                                                              ( meshFunction.getMesh(),
-                                                               userData );            
+                                                               userData );
             break;
          case boundary:
             if( outFunctionMultiplicator )
@@ -195,18 +189,18 @@ evaluateEntities( OutMeshFunction& meshFunction,
                                                                AssignmentEntitiesProcessor >
                                                              ( meshFunction.getMesh(),
                                                                userData );
-            break;         
-      }      
+            break;
+      }
 
-      checkCudaDevice;      
+      checkCudaDevice;
       tnlCuda::freeFromDevice( kernelMeshFunction );
       tnlCuda::freeFromDevice( kernelFunction );
       tnlCuda::freeFromDevice( kernelTime );
       tnlCuda::freeFromDevice( kernelOutFunctionMultiplicator );
-      tnlCuda::freeFromDevice( kernelInFunctionMultiplicator );            
+      tnlCuda::freeFromDevice( kernelInFunctionMultiplicator );
       checkCudaDevice;
    }
 }
 
-#endif	/* TNLMESHFUNCTIONEVALUATOR_IMPL_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunctionGnuplotWriter.h b/src/functions/tnlMeshFunctionGnuplotWriter.h
index ec405927166626b1278652045a665bd11099ebfb..8ffba5b3f057daa25ae05b4128045d52d2d4f4e2 100644
--- a/src/functions/tnlMeshFunctionGnuplotWriter.h
+++ b/src/functions/tnlMeshFunctionGnuplotWriter.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHFUNCTIONGNUPLOTWRITER_H
-#define	TNLMESHFUNCTIONGNUPLOTWRITER_H
+#pragma once
 
 #include<mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename, int, typename > class tnlMeshFunction;
 
 template< typename MeshFunction >
@@ -122,6 +116,5 @@ class tnlMeshFunctionGnuplotWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Devic
                          ostream& str );
 };
 
-
-#endif	/* TNLMESHFUNCTIONGNUPLOTWRITER_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunctionGnuplotWriter_impl.h b/src/functions/tnlMeshFunctionGnuplotWriter_impl.h
index 1c9815cccc4388d2937238b48fadd0303ffd94c0..3f7870b72e0c559d8186ebd59cc85a9c93086b42 100644
--- a/src/functions/tnlMeshFunctionGnuplotWriter_impl.h
+++ b/src/functions/tnlMeshFunctionGnuplotWriter_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHFUNCTIONGNUPLOTWRITER_IMPL_H
-#define	TNLMESHFUNCTIONGNUPLOTWRITER_IMPL_H
+#pragma once
+
+namespace TNL {
 
 template< typename MeshFunction >
 bool
@@ -25,7 +19,7 @@ write( const MeshFunction& function,
        ostream& str )
 {
    std::cerr << "Gnuplot writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implemented." << std::endl;
-   return false;   
+   return false;
 }
 
 /****
@@ -39,7 +33,7 @@ bool
 tnlMeshFunctionGnuplotWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 1, Real > >::
 write( const MeshFunctionType& function,
        ostream& str )
-{ 
+{
    const MeshType& mesh = function.getMesh();
    typename MeshType::Cell entity( mesh );
    for( entity.getCoordinates().x() = 0;
@@ -48,7 +42,7 @@ write( const MeshFunctionType& function,
    {
       entity.refresh();
       typename MeshType::VertexType v = entity.getCenter();
-      str << v << " " 
+      str << v << " "
           << function.getData().getElement( entity.getIndex() ) << std::endl;
    }
    return true;
@@ -65,7 +59,7 @@ bool
 tnlMeshFunctionGnuplotWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 0, Real > >::
 write( const MeshFunctionType& function,
        ostream& str )
-{ 
+{
    const MeshType& mesh = function.getMesh();
    typename MeshType::Vertex entity( mesh );
    for( entity.getCoordinates().x() = 0;
@@ -74,8 +68,8 @@ write( const MeshFunctionType& function,
    {
       entity.refresh();
       typename MeshType::VertexType v = entity.getCenter();
-      str << v << " " 
-          << function.getData().getElement( entity.getIndex() ) << std::endl;      
+      str << v << " "
+          << function.getData().getElement( entity.getIndex() ) << std::endl;
    }
    return true;
 }
@@ -97,7 +91,7 @@ write( const MeshFunctionType& function,
    typename MeshType::Cell entity( mesh );
    for( entity.getCoordinates().y() = 0;
         entity.getCoordinates().y() < mesh.getDimensions().y();
-        entity.getCoordinates().y() ++ ) 
+        entity.getCoordinates().y() ++ )
    {
       for( entity.getCoordinates().x() = 0;
            entity.getCoordinates().x() < mesh.getDimensions().x();
@@ -106,7 +100,7 @@ write( const MeshFunctionType& function,
          entity.refresh();
          typename MeshType::VertexType v = entity.getCenter();
          str << v.x() << " " << v.y() << " "
-             << function.getData().getElement( entity.getIndex() ) << std::endl;      
+             << function.getData().getElement( entity.getIndex() ) << std::endl;
       }
       str << std::endl;
    }
@@ -129,11 +123,11 @@ write( const MeshFunctionType& function,
    typedef typename MeshType::Face EntityType;
    typedef typename EntityType::EntityOrientationType EntityOrientation;
    EntityType entity( mesh );
-   
+ 
    entity.setOrientation( EntityOrientation( 1.0, 0.0 ) );
    for( entity.getCoordinates().y() = 0;
         entity.getCoordinates().y() < mesh.getDimensions().y();
-        entity.getCoordinates().y() ++ )       
+        entity.getCoordinates().y() ++ )
    {
       for( entity.getCoordinates().x() = 0;
            entity.getCoordinates().x() <= mesh.getDimensions().x();
@@ -142,11 +136,11 @@ write( const MeshFunctionType& function,
          entity.refresh();
          typename MeshType::VertexType v = entity.getCenter();
          str << v.x() << " " << v.y() << " "
-             << function.getData().getElement( entity.getIndex() ) << std::endl;      
+             << function.getData().getElement( entity.getIndex() ) << std::endl;
       }
       str << std::endl;
    }
-   
+ 
    entity.setOrientation( EntityOrientation( 0.0, 1.0 ) );
          for( entity.getCoordinates().x() = 0;
            entity.getCoordinates().x() < mesh.getDimensions().x();
@@ -155,16 +149,16 @@ write( const MeshFunctionType& function,
    {
             for( entity.getCoordinates().y() = 0;
         entity.getCoordinates().y() <= mesh.getDimensions().y();
-        entity.getCoordinates().y() ++ ) 
+        entity.getCoordinates().y() ++ )
 
       {
          entity.refresh();
          typename MeshType::VertexType v = entity.getCenter();
          str << v.x() << " " << v.y() << " "
-             << function.getData().getElement( entity.getIndex() ) << std::endl;      
+             << function.getData().getElement( entity.getIndex() ) << std::endl;
       }
       str << std::endl;
-   }   
+   }
    return true;
 }
 
@@ -185,7 +179,7 @@ write( const MeshFunctionType& function,
    typename MeshType::Vertex entity( mesh );
    for( entity.getCoordinates().y() = 0;
         entity.getCoordinates().y() <= mesh.getDimensions().y();
-        entity.getCoordinates().y() ++ )   
+        entity.getCoordinates().y() ++ )
    {
       for( entity.getCoordinates().x() = 0;
            entity.getCoordinates().x() <= mesh.getDimensions().x();
@@ -194,12 +188,12 @@ write( const MeshFunctionType& function,
          entity.refresh();
          typename MeshType::VertexType v = entity.getCenter();
          str << v.x() << " " << v.y() << " "
-             << function.getData().getElement( entity.getIndex() ) << std::endl;      
+             << function.getData().getElement( entity.getIndex() ) << std::endl;
       }
       str << std::endl;
    }
    return true;
 }
 
-#endif	/* TNLMESHFUNCTIONGNUPLOTWRITER_IMPL_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunctionNormGetter.h b/src/functions/tnlMeshFunctionNormGetter.h
index c83a83833242ac96c06913053b35b825e65a23a1..7d123104c4b9fa3e4720f4c1e41aed6cf7736357 100644
--- a/src/functions/tnlMeshFunctionNormGetter.h
+++ b/src/functions/tnlMeshFunctionNormGetter.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMESHFUNCTIONNORMGETTER_H
-#define	TNLMESHFUNCTIONNORMGETTER_H
+namespace TNL {
 
 template< typename MeshFunction,
           typename Mesh = typename MeshFunction::MeshType >
@@ -37,7 +31,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
                                  tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > >
 {
    public:
-      
+ 
       typedef tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex >, EntityDimensions, Real > MeshFunctionType;
       typedef tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > GridType;
       typedef MeshReal MeshRealType;
@@ -46,7 +40,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
       typedef typename MeshFunctionType::RealType RealType;
       typedef typename MeshFunctionType::MeshType MeshType;
       typedef typename MeshType::Face EntityType;
-      
+ 
       static RealType getNorm( const MeshFunctionType& function,
                                const RealType& p )
       {
@@ -81,7 +75,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
                {
                   EntityType entity = function.getMesh().template getEntity< EntityType >( i );
                   result += function[ i ] * function[ i ] * entity.getMeasure();
-               }            
+               }
                return sqrt( result );
             }
 
@@ -92,10 +86,10 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
             {
                EntityType entity = function.getMesh().template getEntity< EntityType >( i );
                result += pow( fabs( function[ i ] ), p ) * entity.getMeasure();
-            }                     
+            }
             return pow( result, 1.0 / p );
          }
-         
+ 
          if( p == 1.0 )
             return function.getData().lpNorm( 1.0 );
          if( p == 2.0 )
@@ -116,7 +110,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
                                  tnlGrid< Dimensions, MeshReal, tnlCuda, MeshIndex > >
 {
    public:
-      
+ 
       typedef tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlCuda, MeshIndex >, EntityDimensions, Real > MeshFunctionType;
       typedef tnlGrid< Dimensions, MeshReal, tnlCuda, MeshIndex > GridType;
       typedef MeshReal MeshRealType;
@@ -125,7 +119,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
       typedef typename MeshFunctionType::RealType RealType;
       typedef typename MeshFunctionType::MeshType MeshType;
       typedef typename MeshType::Face EntityType;
-      
+ 
       static RealType getNorm( const MeshFunctionType& function,
                                const RealType& p )
       {
@@ -141,7 +135,7 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
          {
             tnlAssert( false, std::cerr << "Not implemented yet." << std::endl );
          }
-         
+ 
          if( p == 1.0 )
             return function.getData().lpNorm( 1.0 );
          if( p == 2.0 )
@@ -151,5 +145,5 @@ class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal,
 };
 
 
-#endif	/* TNLMESHFUNCTIONNORMGETTER_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunctionVTKWriter.h b/src/functions/tnlMeshFunctionVTKWriter.h
index b06e4ea27ff18f38db6d00fbea097f26194ddd6b..b776453ce419db529dea3dbcaa1692a127aa4635 100644
--- a/src/functions/tnlMeshFunctionVTKWriter.h
+++ b/src/functions/tnlMeshFunctionVTKWriter.h
@@ -6,31 +6,202 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMESHFUNCTIONVTKWRITER_H
-#define	TNLMESHFUNCTIONVTKWRITER_H
+namespace TNL {
 
 template< typename MeshFunction >
 class tnlMeshFunctionVTKWriter
 {
    public:
-      
+ 
       static bool write( const MeshFunction& function,
-                         ostream& str )
-      {
-         std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implmeneted." << std::endl;
-         return false;
-      }
+                         ostream& str );
+      static void writeHeader(const MeshFunction& function,
+                         ostream& str ){}
+};
+
+/***
+ * 1D grid, cells
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 1, Real > >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 1, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+ 
+/***
+ * 1D grid, vertices
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 0, Real > >
+{
+   public:
+      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 0, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 2D grid, cells
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 2, Real > >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 2, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 2D grid, faces
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real > >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 1, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 2D grid, vertices
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 0, Real > >
+{
+   public:
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 0, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 3D grid, cells
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 3, Real > >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 3, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
 };
 
+/***
+ * 3D grid, faces
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real > >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 2, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 3D grid, edges
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 1, Real > >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 1, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
+
+/***
+ * 3D grid, vertices
+ */
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+class tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 0, Real > >
+{
+   public:
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef tnlMeshFunction< MeshType, 0, RealType > MeshFunctionType;
+
+      static bool write( const MeshFunctionType& function,
+                         ostream& str );
+      static void writeHeader(const MeshFunctionType& function,
+                         ostream& str );
+};
 
-#endif	/* TNLMESHFUNCTIONVTKWRITER_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunctionVTKWriter_impl.h b/src/functions/tnlMeshFunctionVTKWriter_impl.h
index 4173fd0399e50145efd5c76e03715ac824c8284d..87e03cb98769c8dc1ed346c716b9b5295ae37cee 100644
--- a/src/functions/tnlMeshFunctionVTKWriter_impl.h
+++ b/src/functions/tnlMeshFunctionVTKWriter_impl.h
@@ -6,19 +6,1013 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+namespace TNL {
+
+template< typename MeshFunction >
+bool
+tnlMeshFunctionVTKWriter< MeshFunction >::
+write( const MeshFunction& function,
+                         ostream& str )
+{
+   std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implemented." << std::endl;
+   return false;
+}
+
+/****
+ * 1D grid, cells
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 1, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 1, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType origin = mesh.getOrigin().x();
+   const RealType spaceStep = mesh.getSpaceSteps().x();
+ 
+   str << "POINTS " << mesh.getDimensions().x() + 1 << " float" << endl;
+ 
+   for (int i = 0; i <= mesh.getDimensions().x(); i++)
+   {
+       str << origin + i * spaceStep << " 0 0" << endl;
+   }
+ 
+   str << endl << "CELLS " << mesh.getDimensions().x() << " " << mesh.getDimensions().x() * 3 << endl;
+   for (int i = 0; i < mesh.getDimensions().x(); i++)
+   {
+       str << "2 " << i << " " << i+1 << endl;
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.getDimensions().x() << endl;
+   for (int i = 0; i < mesh.getDimensions().x(); i++)
+   {
+       str << "3 " << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.getDimensions().x() << endl;
+   str << "SCALARS cellFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typename MeshType::Cell entity( mesh );
+   for( entity.getCoordinates().x() = 0;
+        entity.getCoordinates().x() < mesh.getDimensions().x();
+        entity.getCoordinates().x() ++ )
+   {
+      entity.refresh();
+      str << function.getData().getElement( entity.getIndex() ) << std::endl;
+   }
+ 
+   return true;
+}
+
+/****
+ * 1D grid, vertices
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 0, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 1, MeshReal, Device, MeshIndex >, 0, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType origin = mesh.getOrigin().x();
+   const RealType spaceStep = mesh.getSpaceSteps().x();
+ 
+   str << "POINTS " << mesh.getDimensions().x() + 1 << " float" << endl;
+ 
+   for (int i = 0; i < mesh.getDimensions().x() + 1; i++)
+   {
+       str << origin + i * spaceStep << " 0 0" << endl;
+   }
+ 
+   str << endl << "CELLS " << mesh.getDimensions().x() + 1 << " " << ( mesh.getDimensions().x() + 1 ) * 2 << endl;
+   for (int i = 0; i < mesh.getDimensions().x() + 1; i++)
+   {
+       str << "1 " << i << endl;
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.getDimensions().x() + 1 << endl;
+   for (int i = 0; i < mesh.getDimensions().x() + 1; i++)
+   {
+       str << "1 " << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.getDimensions().x() + 1 << endl;
+   str << "SCALARS VerticesFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typename MeshType::Vertex entity( mesh );
+   for( entity.getCoordinates().x() = 0;
+        entity.getCoordinates().x() <= mesh.getDimensions().x();
+        entity.getCoordinates().x() ++ )
+   {
+      entity.refresh();
+      str << function.getData().getElement( entity.getIndex() ) << std::endl;
+   }
+ 
+   return true;
+}
+
+/****
+ * 2D grid, cells
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 2, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 2, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+ 
+   str << "POINTS " << (mesh.getDimensions().x() + 1) * (mesh.getDimensions().y() + 1) << " float" << endl;
+ 
+   for (int j = 0; j < mesh.getDimensions().y() + 1; j++)
+   {
+        for (int i = 0; i < mesh.getDimensions().x() + 1; i++)
+        {
+             str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " 0" << endl;
+        }
+   }
+ 
+   str << endl << "CELLS " << mesh.getDimensions().x() * mesh.getDimensions().y() << " " <<
+          mesh.getDimensions().x() * mesh.getDimensions().y() * 5 << endl;
+   for (int j = 0; j < mesh.getDimensions().y(); j++)
+   {
+        for (int i = 0; i < mesh.getDimensions().x(); i++)
+        {
+            str << "4 " << j * ( mesh.getDimensions().x() + 1 ) + i << " " << j * ( mesh.getDimensions().x() + 1 )+ i + 1 <<
+                   " " << (j+1) * ( mesh.getDimensions().x() + 1 ) + i << " " << (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 << endl;
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.getDimensions().x() * mesh.getDimensions().y() << endl;
+   for (int i = 0; i < mesh.getDimensions().x()*mesh.getDimensions().y(); i++)
+   {
+       str << "8 " << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.getDimensions().x() * mesh.getDimensions().y() << endl;
+   str << "SCALARS cellFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typename MeshType::Cell entity( mesh );
+   for( entity.getCoordinates().y() = 0;
+        entity.getCoordinates().y() < mesh.getDimensions().y();
+        entity.getCoordinates().y() ++ )
+   {
+      for( entity.getCoordinates().x() = 0;
+           entity.getCoordinates().x() < mesh.getDimensions().x();
+           entity.getCoordinates().x() ++ )
+      {
+         entity.refresh();
+         str << function.getData().getElement( entity.getIndex() ) << endl;
+      }
+   }
+   return true;
+}
+
+/****
+ * 2D grid, faces
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   typedef typename MeshType::template MeshEntity< 0 > Vertex;
+   typedef typename MeshType::template MeshEntity< 1 > Face;
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+ 
+   str << "POINTS " << mesh.template getEntitiesCount< Vertex >() << " float" << endl;
+ 
+   for (int j = 0; j < ( mesh.getDimensions().y() + 1); j++)
+   {
+        for (int i = 0; i < ( mesh.getDimensions().x() + 1 ); i++)
+        {
+             str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " 0" << endl;
+        }
+   }
+ 
+   str << endl << "CELLS " << mesh.template getEntitiesCount< Face >() << " " <<
+          mesh.template getEntitiesCount< Face >() * 3 << endl;
+   for (int j = 0; j < mesh.getDimensions().y(); j++)
+   {
+        for (int i = 0; i < ( mesh.getDimensions().x() + 1 ); i++)
+        {
+            str << "2 " << j * ( mesh.getDimensions().x() + 1 ) + i << " " << (j+1) * ( mesh.getDimensions().x() + 1 ) + i << endl;
+        }
+   }
+ 
+   for (int j = 0; j < (mesh.getDimensions().y()+1); j++)
+   {
+        for (int i = 0; i < mesh.getDimensions().x(); i++)
+        {
+            str << "2 " << j * ( mesh.getDimensions().x() + 1 ) + i << " " <<j * ( mesh.getDimensions().x() + 1 ) + i + 1<< endl;
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.template getEntitiesCount< Face >() << endl;
+   for (int i = 0; i < mesh.template getEntitiesCount< Face >(); i++)
+   {
+       str << "3" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.template getEntitiesCount< Face >() << endl;
+   str << "SCALARS FaceslFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typedef typename MeshType::Face EntityType;
+   typedef typename EntityType::EntityOrientationType EntityOrientation;
+   EntityType entity( mesh );
+ 
+   entity.setOrientation( EntityOrientation( 1.0, 0.0 ) );
+   for( entity.getCoordinates().y() = 0;
+        entity.getCoordinates().y() < mesh.getDimensions().y();
+        entity.getCoordinates().y() ++ )
+   {
+      for( entity.getCoordinates().x() = 0;
+           entity.getCoordinates().x() <= mesh.getDimensions().x();
+           entity.getCoordinates().x() ++ )
+      {
+         entity.refresh();
+         str << function.getData().getElement( entity.getIndex() ) << std::endl;
+      }
+   }
+ 
+   entity.setOrientation( EntityOrientation( 0.0, 1.0 ) );
+   for( entity.getCoordinates().y() = 0;
+        entity.getCoordinates().y() <= mesh.getDimensions().y();
+        entity.getCoordinates().y() ++ )
+
+   {
+        for( entity.getCoordinates().x() = 0;
+             entity.getCoordinates().x() < mesh.getDimensions().x();
+             entity.getCoordinates().x() ++ )
+
+      {
+         entity.refresh();
+         str << function.getData().getElement( entity.getIndex() ) << std::endl;
+      }
+   }
+   return true;
+}
+
+/****
+ * 2D grid, vertices
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 0, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 2, MeshReal, Device, MeshIndex >, 0, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   typedef typename MeshType::template MeshEntity< 0 > Vertex;
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+
+ 
+   str << "POINTS " << mesh.template getEntitiesCount< Vertex >() << " float" << endl;
+ 
+   for (int j = 0; j < ( mesh.getDimensions().y() + 1); j++)
+   {
+        for (int i = 0; i < ( mesh.getDimensions().x() + 1 ); i++)
+        {
+             str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " 0" << endl;
+        }
+   }
+ 
+   str << endl << "CELLS " << mesh.template getEntitiesCount< Vertex >() << " " <<
+          mesh.template getEntitiesCount< Vertex >() * 2 << endl;
+   for (int j = 0; j < ( mesh.getDimensions().y() + 1 ); j++)
+   {
+        for (int i = 0; i < ( mesh.getDimensions().x() + 1 ); i++)
+        {
+            str << "1 " << j * mesh.getDimensions().x() + i  << endl;
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.template getEntitiesCount< Vertex >() << endl;
+   for (int i = 0; i < mesh.template getEntitiesCount< Vertex >(); i++)
+   {
+       str << "1" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.template getEntitiesCount< Vertex >() << endl;
+   str << "SCALARS VerticesFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typename MeshType::Vertex entity( mesh );
+   for( entity.getCoordinates().y() = 0;
+        entity.getCoordinates().y() <= mesh.getDimensions().y();
+        entity.getCoordinates().y() ++ )
+   {
+      for( entity.getCoordinates().x() = 0;
+           entity.getCoordinates().x() <= mesh.getDimensions().x();
+           entity.getCoordinates().x() ++ )
+      {
+         entity.refresh();
+         str << function.getData().getElement( entity.getIndex() ) << endl;
+      }
+   }
+ 
+   return true;
+}
+
+/****
+ * 3D grid, cells
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 3, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 3, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+   const RealType originZ = mesh.getOrigin().z();
+   const RealType spaceStepZ = mesh.getSpaceSteps().z();
+   const RealType entitiesCount = mesh.getDimensions().x() * mesh.getDimensions().y() * mesh.getDimensions().z();
+ 
+   str << "POINTS " << (mesh.getDimensions().x()+1) * (mesh.getDimensions().y()+1) * (mesh.getDimensions().z()+1) <<
+          " float" << endl;
+ 
+   for (int k = 0; k <= mesh.getDimensions().y(); k++)
+   {
+       for (int j = 0; j <= mesh.getDimensions().y(); j++)
+       {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                 str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " " <<
+                        originZ + k * spaceStepZ << endl;
+            }
+       }
+   }
+ 
+   str << endl << "CELLS " << entitiesCount << " " <<
+          entitiesCount * 9 << endl;
+   for (int k = 0; k < mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j < mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i < mesh.getDimensions().x(); i++)
+            {
+                str << "8 " <<  k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 << endl;
+            }
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << entitiesCount << endl;
+   for (int i = 0; i < entitiesCount; i++)
+   {
+       str << "11" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << entitiesCount << endl;
+   str << "SCALARS cellFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typename MeshType::Cell entity( mesh );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() < mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() < mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() < mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                entity.refresh();
+                str << function.getData().getElement( entity.getIndex() ) << endl;
+            }
+        }
+   }
+   return true;
+}
+
+/****
+ * 3D grid, faces
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   typedef typename MeshType::template MeshEntity< 2 > Face;
+   typedef typename MeshType::template MeshEntity< 3 > Cell;
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+   const RealType originZ = mesh.getOrigin().z();
+   const RealType spaceStepZ = mesh.getSpaceSteps().z();
+   const RealType entitiesCount = mesh.template getEntitiesCount< Face >();
+   const RealType pointsCount = mesh.template getEntitiesCount< Cell >();
+ 
+   str << "POINTS " << pointsCount <<
+          " float" << endl;
+ 
+   for (int k = 0; k <= mesh.getDimensions().y(); k++)
+   {
+       for (int j = 0; j <= mesh.getDimensions().y(); j++)
+       {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                 str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " " <<
+                        originZ + k * spaceStepZ << endl;
+            }
+       }
+   }
+ 
+   str << endl << "CELLS " << entitiesCount << " " <<
+          entitiesCount * 5 << endl;
+   for (int k = 0; k < mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j < mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                str << "4 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << endl;
+            }
+        }
+   }
+ 
+   for (int k = 0; k < mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j <= mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i < mesh.getDimensions().x(); i++)
+            {
+                str << "4 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << endl;
+            }
+        }
+   }
+ 
+   for (int k = 0; k <= mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j < mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i < mesh.getDimensions().x(); i++)
+            {
+                str << "4 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1<< endl;
+            }
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << entitiesCount << endl;
+   for (int i = 0; i < entitiesCount; i++)
+   {
+       str << "8" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << entitiesCount << endl;
+   str << "SCALARS facesFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typedef typename MeshType::Face EntityType;
+   typedef typename EntityType::EntityOrientationType EntityOrientation;
+   EntityType entity( mesh );
+ 
+   entity.setOrientation( EntityOrientation( 1.0, 0.0 , 0.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() < mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() < mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() <= mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   entity.setOrientation( EntityOrientation( 0.0, 1.0 , 0.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() < mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() <= mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() < mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   entity.setOrientation( EntityOrientation( 0.0, 0.0 , 1.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() <= mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() < mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() < mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   return true;
+}
+
+/****
+ * 3D grid, edges
+ */
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 1, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
+
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 1, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   typedef typename MeshType::template MeshEntity< 1 > Edge;
+   typedef typename MeshType::template MeshEntity< 3 > Cell;
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+   const RealType originZ = mesh.getOrigin().z();
+   const RealType spaceStepZ = mesh.getSpaceSteps().z();
+   const RealType entitiesCount = mesh.template getEntitiesCount< Edge >();
+   const RealType pointsCount = mesh.template getEntitiesCount< Cell >();
+ 
+   str << "POINTS " << pointsCount <<
+          " float" << endl;
+ 
+   for (int k = 0; k <= mesh.getDimensions().y(); k++)
+   {
+       for (int j = 0; j <= mesh.getDimensions().y(); j++)
+       {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                 str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " " <<
+                        originZ + k * spaceStepZ << endl;
+            }
+       }
+   }
+ 
+   str << endl << "CELLS " << entitiesCount << " " <<
+          entitiesCount * 3 << endl;
+   for (int k = 0; k <= mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j <= mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i < mesh.getDimensions().x(); i++)
+            {
+                str << "3 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 << endl;
+            }
+        }
+   }
+ 
+   for (int k = 0; k <= mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j < mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                str << "3 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i << endl;
+            }
+        }
+   }
+ 
+   for (int k = 0; k < mesh.getDimensions().z(); k++)
+   {
+        for (int j = 0; j <= mesh.getDimensions().y(); j++)
+        {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                str << "3 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << " "
+                    << (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i << endl;
+            }
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << entitiesCount << endl;
+   for (int i = 0; i < entitiesCount; i++)
+   {
+       str << "3" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << entitiesCount << endl;
+   str << "SCALARS edgesFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
+
+   typedef typename MeshType::Face EntityType;
+   typedef typename EntityType::EntityOrientationType EntityOrientation;
+   EntityType entity( mesh );
+ 
+   entity.setOrientation( EntityOrientation( 1.0, 0.0 , 0.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() <= mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() <= mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() < mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   entity.setOrientation( EntityOrientation( 0.0, 1.0 , 0.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() <= mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() < mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() <= mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   entity.setOrientation( EntityOrientation( 0.0, 0.0 , 1.0) );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() < mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() <= mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() <= mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   return true;
+}
+
+/****
+ * 3D grid, vertices
+ */
 
-#ifndef TNLMESHFUNCTIONVTKWRITER_IMPL_H
-#define	TNLMESHFUNCTIONVTKWRITER_IMPL_H
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+void
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 0, Real > >::
+writeHeader( const MeshFunctionType& function,
+       ostream& str )
+{
+    const MeshType& mesh = function.getMesh();
+    const typename MeshType::VertexType& origin = mesh.getOrigin();
+    const typename MeshType::VertexType& proportions = mesh.getProportions();
+    str << "# vtk DataFile Version 2.0" << endl;
+    str << "TNL DATA" << endl;
+    str << "ASCII" << endl;
+    str << "DATASET UNSTRUCTURED_GRID" << endl;
+}
 
+template< typename MeshReal,
+          typename Device,
+          typename MeshIndex,
+          typename Real >
+bool
+tnlMeshFunctionVTKWriter< tnlMeshFunction< tnlGrid< 3, MeshReal, Device, MeshIndex >, 0, Real > >::
+write( const MeshFunctionType& function,
+       ostream& str )
+{
+   typedef typename MeshType::template MeshEntity< 0 > Vertex;
+   writeHeader(function, str);
+ 
+   const MeshType& mesh = function.getMesh();
+   const RealType originX = mesh.getOrigin().x();
+   const RealType spaceStepX = mesh.getSpaceSteps().x();
+   const RealType originY = mesh.getOrigin().y();
+   const RealType spaceStepY = mesh.getSpaceSteps().y();
+   const RealType originZ = mesh.getOrigin().z();
+   const RealType spaceStepZ = mesh.getSpaceSteps().z();
+ 
+   str << "POINTS " << mesh.template getEntitiesCount< Vertex >() << " float" << endl;
+ 
+   for (int k = 0; k <= mesh.getDimensions().y(); k++)
+   {
+       for (int j = 0; j <= mesh.getDimensions().y(); j++)
+       {
+            for (int i = 0; i <= mesh.getDimensions().x(); i++)
+            {
+                 str << originX + i * spaceStepX << " " << originY + j * spaceStepY << " " <<
+                        originZ + k * spaceStepZ << endl;
+            }
+       }
+   }
+ 
+   str << endl << "CELLS " << mesh.template getEntitiesCount< Vertex >() << " " <<
+          mesh.template getEntitiesCount< Vertex >() * 2 << endl;
+   for (int k = 0; k < ( mesh.getDimensions().z() + 1 ); k++)
+   {
+        for (int j = 0; j < ( mesh.getDimensions().y() + 1 ); j++)
+        {
+            for (int i = 0; i < ( mesh.getDimensions().x() + 1 ); i++)
+            {
+                str << "1 " << k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i  << endl;
+            }
+        }
+   }
+ 
+   str << endl << "CELL_TYPES " << mesh.template getEntitiesCount< Vertex >() << endl;
+   for (int i = 0; i < mesh.template getEntitiesCount< Vertex >(); i++)
+   {
+       str << "1" << endl;
+   }
+ 
+   str << endl << "CELL_DATA " << mesh.template getEntitiesCount< Vertex >() << endl;
+   str << "SCALARS verticesFunctionValues float 1" << endl;
+   str << "LOOKUP_TABLE default" << endl;
 
+   typename MeshType::Vertex entity( mesh );
+   for( entity.getCoordinates().z() = 0;
+        entity.getCoordinates().z() <= mesh.getDimensions().z();
+        entity.getCoordinates().z() ++ )
+   {
+        for( entity.getCoordinates().y() = 0;
+             entity.getCoordinates().y() <= mesh.getDimensions().y();
+             entity.getCoordinates().y() ++ )
+        {
+            for( entity.getCoordinates().x() = 0;
+                 entity.getCoordinates().x() <= mesh.getDimensions().x();
+                 entity.getCoordinates().x() ++ )
+            {
+                 entity.refresh();
+                 str << function.getData().getElement( entity.getIndex() ) << std::endl;
+            }
+        }
+   }
+ 
+   return true;
+}
 
-#endif	/* TNLMESHFUNCTIONVTKWRITER_IMPL_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlMeshFunction_impl.h b/src/functions/tnlMeshFunction_impl.h
index 2b08d2f2927c25def185d48b1084a40299379331..8126d035a0f313a72617e177b17537eb26020512 100644
--- a/src/functions/tnlMeshFunction_impl.h
+++ b/src/functions/tnlMeshFunction_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlAssert.h>
 #include <functions/tnlMeshFunction.h>
@@ -23,8 +16,9 @@
 #include <functions/tnlMeshFunctionGnuplotWriter.h>
 #include <functions/tnlMeshFunctionVTKWriter.h>
 
-#ifndef TNLMESHFUNCTION_IMPL_H
-#define	TNLMESHFUNCTION_IMPL_H
+#pragma once
+
+namespace TNL {
 
 template< typename Mesh,
           int MeshEntityDimensions,
@@ -54,13 +48,13 @@ tnlMeshFunction( const MeshType& mesh,
                  Vector& data,
                  const IndexType& offset )
 {
-   this->bind( mesh, data, offset );   
+   this->bind( mesh, data, offset );
 }
 
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-tnlString 
+tnlString
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getType()
 {
@@ -74,7 +68,7 @@ getType()
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-tnlString 
+tnlString
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getTypeVirtual() const
 {
@@ -84,7 +78,7 @@ getTypeVirtual() const
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-tnlString 
+tnlString
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getSerializationType()
 {
@@ -98,7 +92,7 @@ getSerializationType()
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-tnlString 
+tnlString
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getSerializationTypeVirtual() const
 {
@@ -113,7 +107,7 @@ tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 configSetup( tnlConfigDescription& config,
              const tnlString& prefix )
 {
-   config.addEntry< tnlString >( prefix + "file", "Dataset for the mesh function." );   
+   config.addEntry< tnlString >( prefix + "file", "Dataset for the mesh function." );
 }
 
 template< typename Mesh,
@@ -133,6 +127,17 @@ setup( const tnlParameterContainer& parameters,
    return true;
 }
 
+template< typename Mesh,
+          int MeshEntityDimensions,
+          typename Real >
+void
+tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
+bind( tnlMeshFunction< Mesh, MeshEntityDimensions, Real >& meshFunction )
+{
+   this->mesh = &meshFunction.getMesh();
+   this->data.bind( meshFunction.getData() );
+}
+
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
@@ -160,7 +165,7 @@ setMesh( const MeshType& mesh )
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::MeshType& 
+const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::MeshType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getMesh() const
 {
@@ -170,7 +175,7 @@ getMesh() const
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& 
+const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getData() const
 {
@@ -180,7 +185,7 @@ getData() const
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& 
+typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getData()
 {
@@ -193,7 +198,7 @@ template< typename Mesh,
 bool
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 refresh( const RealType& time ) const
-{  
+{
    return true;
 }
 
@@ -210,7 +215,7 @@ deepRefresh( const RealType& time ) const
 template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
-   template< typename EntityType >          
+   template< typename EntityType >
 typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 getValue( const EntityType& meshEntity ) const
@@ -223,7 +228,7 @@ template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
    template< typename EntityType >
-void 
+void
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 setValue( const EntityType& meshEntity,
           const RealType& value )
@@ -237,7 +242,7 @@ template< typename Mesh,
           typename Real >
    template< typename EntityType >
 __cuda_callable__
-typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& 
+typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 operator()( const EntityType& meshEntity,
             const RealType& time )
@@ -251,7 +256,7 @@ template< typename Mesh,
           typename Real >
    template< typename EntityType >
 __cuda_callable__
-const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& 
+const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 operator()( const EntityType& meshEntity,
             const RealType& time ) const
@@ -264,10 +269,10 @@ template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
 __cuda_callable__
-typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& 
+typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 operator[]( const IndexType& meshEntityIndex )
-{   
+{
    return this->data[ meshEntityIndex ];
 }
 
@@ -275,7 +280,7 @@ template< typename Mesh,
           int MeshEntityDimensions,
           typename Real >
 __cuda_callable__
-const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& 
+const typename tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::RealType&
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 operator[]( const IndexType& meshEntityIndex ) const
 {
@@ -340,7 +345,7 @@ getMaxNorm() const
 
 template< typename Mesh,
           int MeshEntityDimensions,
-          typename Real >      
+          typename Real >
 bool
 tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
 save( tnlFile& file ) const
@@ -359,7 +364,7 @@ load( tnlFile& file )
 {
    if( ! tnlObject::load( file ) )
       return false;
-   return this->data.load( file );   
+   return this->data.load( file );
 }
 
 template< typename Mesh,
@@ -371,7 +376,7 @@ boundLoad( tnlFile& file )
 {
    if( ! tnlObject::load( file ) )
       return false;
-   return this->data.boundLoad( file );   
+   return this->data.boundLoad( file );
 }
 
 template< typename Mesh,
@@ -395,8 +400,6 @@ write( const tnlString& fileName,
       return tnlMeshFunctionGnuplotWriter< ThisType >::write( *this, file );
    return true;
 }
-      
-
-
-#endif	/* TNLMESHFUNCTION_IMPL_H */
+ 
+} // namespace TNL
 
diff --git a/src/functions/tnlOperatorFunction.h b/src/functions/tnlOperatorFunction.h
index d31ff2448d33c87ac9b9f8f5c447d5874b6ead9d..e1c88b36f65f68bcba57d01718a2b795e9ed2dbf 100644
--- a/src/functions/tnlOperatorFunction.h
+++ b/src/functions/tnlOperatorFunction.h
@@ -6,25 +6,19 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLOPERATORFUNCTION_H
-#define	TNLOPERATORFUNCTION_H
+#pragma once
 
 #include <type_traits>
 #include <core/tnlCuda.h>
 #include <functions/tnlMeshFunction.h>
 #include <solvers/pde/tnlBoundaryConditionsSetter.h>
 
+namespace TNL {
+
 /***
- * This class evaluates given operator on given preimageFunction. If the flag 
+ * This class evaluates given operator on given preimageFunction. If the flag
  * EvaluateOnFly is set on true, the values on particular mesh entities
  * are computed just  when operator() is called. If the EvaluateOnFly flag
  * is 'false', values on all mesh entities are evaluated by calling a method
@@ -33,7 +27,7 @@
  * values on the boundary mesh entities are undefined. In this case, the mesh
  * preimageFunction evaluator evaluates this preimageFunction only on the INTERIOR mesh entities.
  */
-
+   
 template< typename Operator,
           typename MeshFunction,
           typename BoundaryConditions = void,
@@ -48,7 +42,7 @@ template< typename Operator,
           typename BoundaryConditions >
 class tnlOperatorFunction< Operator, MeshFunction, BoundaryConditions, true >
  : public tnlDomain< Operator::getMeshDimensions(), MeshDomain >
-{   
+{
 };
 
 /****
@@ -58,16 +52,16 @@ template< typename Operator,
           typename MeshFunction >
 class tnlOperatorFunction< Operator, MeshFunction, void, true >
  : public tnlDomain< Operator::getDimensions(), Operator::getDomainType() >
-{   
+{
    public:
-      
+ 
       static_assert( MeshFunction::getDomainType() == MeshDomain ||
                      MeshFunction::getDomainType() == MeshInteriorDomain ||
                      MeshFunction::getDomainType() == MeshBoundaryDomain,
          "Only mesh preimageFunctions may be used in the operator preimageFunction. Use tnlExactOperatorFunction instead of tnlOperatorFunction." );
       static_assert( std::is_same< typename Operator::MeshType, typename MeshFunction::MeshType >::value,
           "Both, operator and mesh preimageFunction must be defined on the same mesh." );
-      
+ 
       typedef Operator OperatorType;
       typedef MeshFunction FunctionType;
       typedef typename OperatorType::MeshType MeshType;
@@ -76,32 +70,32 @@ class tnlOperatorFunction< Operator, MeshFunction, void, true >
       typedef typename OperatorType::IndexType IndexType;
       typedef typename OperatorType::ExactOperatorType ExactOperatorType;
       typedef tnlMeshFunction< MeshType, OperatorType::getPreimageEntitiesDimensions() > PreimageFunctionType;
-      
-      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };     
-      
+ 
+      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };
+ 
       tnlOperatorFunction( const OperatorType& operator_ )
       :  operator_( operator_ ), preimageFunction( 0 ){};
-      
+ 
       tnlOperatorFunction( const OperatorType& operator_,
                            const FunctionType& preimageFunction )
       :  operator_( operator_ ), preimageFunction( &preimageFunction ){};
-      
+ 
       const MeshType& getMesh() const
-      { 
+      {
          tnlAssert( this->preimageFunction, std::cerr << "The preimage function was not set." << std::endl );
-         return this->preimageFunction->getMesh(); 
+         return this->preimageFunction->getMesh();
       };
-      
+ 
       void setPreimageFunction( const FunctionType& preimageFunction ) { this->preimageFunction = &preimageFunction; }
-      
+ 
       Operator& getOperator() { return this->operator_; }
-      
+ 
       const Operator& getOperator() const { return this->operator_; }
-      
+ 
       bool refresh( const RealType& time = 0.0 ) { return true; };
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 ) { return true; };
-      
+ 
       template< typename MeshEntity >
       __cuda_callable__
       RealType operator()(
@@ -111,13 +105,13 @@ class tnlOperatorFunction< Operator, MeshFunction, void, true >
          tnlAssert( this->preimageFunction, std::cerr << "The preimage function was not set." << std::endl );
          return operator_( *preimageFunction, meshEntity, time );
       }
-      
+ 
    protected:
-      
+ 
       const Operator& operator_;
-      
+ 
       const FunctionType* preimageFunction;
-      
+ 
       template< typename, typename > friend class tnlMeshFunctionEvaluator;
 };
 
@@ -128,16 +122,16 @@ template< typename Operator,
           typename PreimageFunction >
 class tnlOperatorFunction< Operator, PreimageFunction, void, false >
  : public tnlDomain< Operator::getDimensions(), Operator::getDomainType() >
-{   
+{
    public:
-      
+ 
       static_assert( PreimageFunction::getDomainType() == MeshDomain ||
                      PreimageFunction::getDomainType() == MeshInteriorDomain ||
                      PreimageFunction::getDomainType() == MeshBoundaryDomain,
          "Only mesh preimageFunctions may be used in the operator preimageFunction. Use tnlExactOperatorFunction instead of tnlOperatorFunction." );
       static_assert( std::is_same< typename Operator::MeshType, typename PreimageFunction::MeshType >::value,
           "Both, operator and mesh preimageFunction must be defined on the same mesh." );
-      
+ 
       typedef Operator OperatorType;
       typedef typename OperatorType::MeshType MeshType;
       typedef typename OperatorType::RealType RealType;
@@ -147,40 +141,40 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
       typedef tnlMeshFunction< MeshType, Operator::getImageEntitiesDimensions() > ImageFunctionType;
       typedef tnlOperatorFunction< Operator, PreimageFunction, void, true > OperatorFunction;
       typedef typename OperatorType::ExactOperatorType ExactOperatorType;
-      
-      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };     
-      
+ 
+      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };
+ 
       tnlOperatorFunction( OperatorType& operator_,
                            const MeshType& mesh )
       :  operator_( operator_ ), imageFunction( mesh )
       {};
-      
+ 
       tnlOperatorFunction( OperatorType& operator_,
                            PreimageFunctionType& preimageFunction )
       :  operator_( operator_ ), imageFunction( preimageFunction.getMesh() ), preimageFunction( &preimageFunction )
       {};
-      
+ 
       const MeshType& getMesh() const { return this->imageFunction.getMesh(); };
-      
+ 
       ImageFunctionType& getImageFunction() { return this->imageFunction; };
-      
+ 
       const ImageFunctionType& getImageFunction() const { return this->imageFunction; };
-      
+ 
       void setPreimageFunction( PreimageFunction& preimageFunction )
-      { 
+      {
          this->preimageFunction = &preimageFunction;
          this->imageFunction.setMesh( preimageFunction.getMesh() );
       };
-      
+ 
       const PreimageFunctionType& getPreimageFunction() const { return *this->preimageFunction; };
-      
+ 
       Operator& getOperator() { return this->operator_; }
-      
+ 
       const Operator& getOperator() const { return this->operator_; }
 
       bool refresh( const RealType& time = 0.0 )
       {
-         OperatorFunction operatorFunction( this->operator_, *preimageFunction );         
+         OperatorFunction operatorFunction( this->operator_, *preimageFunction );
          this->operator_.setPreimageFunction( *this->preimageFunction );
          if( ! this->operator_.refresh( time ) ||
              ! operatorFunction.refresh( time )  )
@@ -188,14 +182,14 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
          this->imageFunction = operatorFunction;
          return true;
       };
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 )
       {
          if( ! this->preimageFunction->deepRefresh( time ) )
             return false;
          return this->refresh( time );
       };
-      
+ 
       template< typename MeshEntity >
       __cuda_callable__
       RealType operator()(
@@ -204,21 +198,21 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
       {
          return imageFunction[ meshEntity.getIndex() ];
       }
-      
+ 
       __cuda_callable__
       RealType operator[]( const IndexType& index ) const
       {
          return imageFunction[ index ];
       }
-      
+ 
    protected:
-      
+ 
       Operator& operator_;
-      
+ 
       PreimageFunctionType* preimageFunction;
-      
+ 
       ImageFunctionType imageFunction;
-      
+ 
       template< typename, typename > friend class tnlMeshFunctionEvaluator;
 };
 
@@ -230,9 +224,9 @@ template< typename Operator,
           typename BoundaryConditions >
 class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false >
   : public tnlDomain< Operator::getMeshDimensions(), MeshDomain >
-{   
+{
    public:
-      
+ 
       static_assert( PreimageFunction::getDomainType() == MeshDomain ||
                      PreimageFunction::getDomainType() == MeshInteriorDomain ||
                      PreimageFunction::getDomainType() == MeshBoundaryDomain,
@@ -240,8 +234,8 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
       static_assert( std::is_same< typename Operator::MeshType, typename PreimageFunction::MeshType >::value,
           "Both, operator and mesh preimageFunction must be defined on the same mesh." );
       static_assert( std::is_same< typename BoundaryConditions::MeshType, typename Operator::MeshType >::value,
-         "The operator and the boundary conditions are defined on different mesh types." );      
-      
+         "The operator and the boundary conditions are defined on different mesh types." );
+ 
       typedef Operator OperatorType;
       typedef typename OperatorType::MeshType MeshType;
       typedef typename OperatorType::RealType RealType;
@@ -252,9 +246,9 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
       typedef BoundaryConditions BoundaryConditionsType;
       typedef tnlOperatorFunction< Operator, PreimageFunction, void, true > OperatorFunction;
       typedef typename OperatorType::ExactOperatorType ExactOperatorType;
-      
-      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };     
-      
+ 
+      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };
+ 
       tnlOperatorFunction( OperatorType& operator_,
                            const BoundaryConditionsType& boundaryConditions,
                            const MeshType& mesh )
@@ -263,7 +257,7 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
          imageFunction( mesh ),
          preimageFunction( 0 )
       {};
-      
+ 
       tnlOperatorFunction( OperatorType& operator_,
                            const BoundaryConditionsType& boundaryConditions,
                            const PreimageFunctionType& preimageFunction )
@@ -272,32 +266,32 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
          imageFunction( preimageFunction.getMesh() ),
          preimageFunction( &preimageFunction )
       {};
-      
+ 
       const MeshType& getMesh() const { return imageFunction.getMesh(); };
-      
+ 
       void setPreimageFunction( const PreimageFunction& preimageFunction )
-      { 
+      {
          this->preimageFunction = &preimageFunction;
       }
-      
+ 
       const PreimageFunctionType& getPreimageFunction() const
-      { 
+      {
          tnlAssert( this->preimageFunction, );
          return *this->preimageFunction;
       };
-      
+ 
       PreimageFunctionType& getPreimageFunction()
-      { 
+      {
          tnlAssert( this->preimageFunction, );
-         return *this->preimageFunction; 
-      };      
-      
+         return *this->preimageFunction;
+      };
+ 
       const ImageFunctionType& getImageFunction() const { return this->imageFunction; };
-      
+ 
       ImageFunctionType& getImageFunction() { return this->imageFunction; };
-      
+ 
       Operator& getOperator() { return this->operator_; }
-      
+ 
       const Operator& getOperator() const { return this->operator_; }
 
       bool refresh( const RealType& time = 0.0 )
@@ -311,13 +305,13 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
          tnlBoundaryConditionsSetter< ImageFunctionType, BoundaryConditionsType >::apply( this->boundaryConditions, time, this->imageFunction );
          return true;
       };
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 )
       {
-         return preimageFunction->deepRefresh( time ) && 
+         return preimageFunction->deepRefresh( time ) &&
                 this->refresh( time );
       };
-      
+ 
       template< typename MeshEntity >
       __cuda_callable__
       const RealType& operator()(
@@ -326,25 +320,25 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false
       {
          return imageFunction[ meshEntity.getIndex() ];
       }
-      
+ 
       __cuda_callable__
       const RealType& operator[]( const IndexType& index ) const
       {
          return imageFunction[ index ];
       }
-      
+ 
    protected:
-      
+ 
       Operator& operator_;
-      
+ 
       const PreimageFunctionType* preimageFunction;
-      
+ 
       ImageFunctionType imageFunction;
-      
+ 
       const BoundaryConditionsType& boundaryConditions;
-      
+ 
       template< typename, typename > friend class tnlMeshFunctionEvaluator;
 };
 
-#endif	/* TNLOPERATORFUNCTION_H */
+} // namespace TNL
 
diff --git a/src/functions/tnlSinBumpsFunction.h b/src/functions/tnlSinBumpsFunction.h
index 68878e10cd8d83eeeb4e1e9a1723595f1a971d56..dc544e7d2918b6686773f9f4a223484c3961f2c2 100644
--- a/src/functions/tnlSinBumpsFunction.h
+++ b/src/functions/tnlSinBumpsFunction.h
@@ -6,27 +6,21 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSINBUMPSFUNCTION_H_
-#define TNLSINBUMPSFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename Vertex >
 class tnlSinBumpsFunctionBase : public tnlDomain< Vertex::size, SpaceDomain >
 {
    public:
-      
+ 
       typedef Vertex VertexType;
       typedef typename Vertex::RealType RealType;
       enum { Dimensions = VertexType::size };
@@ -59,9 +53,9 @@ template< typename Real >
 class tnlSinBumpsFunction< 1, Real  > : public tnlSinBumpsFunctionBase< tnlStaticVector< 1, Real > >
 {
    public:
-      
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< 1, RealType > VertexType;      
+      typedef tnlStaticVector< 1, RealType > VertexType;
 
 
       tnlSinBumpsFunction();
@@ -81,11 +75,11 @@ class tnlSinBumpsFunction< 1, Real  > : public tnlSinBumpsFunctionBase< tnlStati
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
                         const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -94,8 +88,8 @@ class tnlSinBumpsFunction< 2, Real > : public tnlSinBumpsFunctionBase< tnlStatic
    public:
 
       typedef Real RealType;
-      typedef tnlStaticVector< 2, RealType > VertexType;      
-      
+      typedef tnlStaticVector< 2, RealType > VertexType;
+ 
 
       tnlSinBumpsFunction();
 
@@ -114,11 +108,11 @@ class tnlSinBumpsFunction< 2, Real > : public tnlSinBumpsFunctionBase< tnlStatic
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
                         const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
@@ -146,11 +140,11 @@ class tnlSinBumpsFunction< 3, Real > : public tnlSinBumpsFunctionBase< tnlStatic
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                          const Real& time = 0.0 ) const;
-      
+ 
    __cuda_callable__
    RealType operator()( const VertexType& v,
                         const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -163,7 +157,8 @@ ostream& operator << ( ostream& str, const tnlSinBumpsFunction< Dimensions, Real
    return str;
 }
 
+} // namespace TNL
+
 #include <functions/tnlSinBumpsFunction_impl.h>
 
 
-#endif /* TNLSINBUMPSFUNCTION_H_ */
diff --git a/src/functions/tnlSinBumpsFunction_impl.h b/src/functions/tnlSinBumpsFunction_impl.h
index 34497733472727517d5a6a2aea8900727d3253d8..ad26617fd6720ad36b8fb6fec6c8e9a0a5dbaef0 100644
--- a/src/functions/tnlSinBumpsFunction_impl.h
+++ b/src/functions/tnlSinBumpsFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSINBUMPSFUNCTION_IMPL_H_
-#define TNLSINBUMPSFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/tnlSinBumpsFunction.h>
 
+namespace TNL {
+
 template< typename Vertex >
 void tnlSinBumpsFunctionBase< Vertex >::setWaveLength( const Vertex& waveLength )
 {
@@ -245,5 +239,5 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
+} // namespace TNL
 
-#endif /* TNLSINBUMPSFUNCTION_IMPL_H_ */
diff --git a/src/functions/tnlSinWaveFunction.h b/src/functions/tnlSinWaveFunction.h
index a1ea37ea3b557dee3c91e10eccf032160e6021bc..1668877f84d54efd029596d4aa6ef8ae67ec7201 100644
--- a/src/functions/tnlSinWaveFunction.h
+++ b/src/functions/tnlSinWaveFunction.h
@@ -6,28 +6,22 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSINWAVEFUNCTION_H_
-#define TNLSINWAVEFUNCTION_H_
+#pragma once
 
 #include <config/tnlParameterContainer.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int dimensions,
           typename Real = double >
 class tnlSinWaveFunctionBase : public tnlDomain< dimensions, SpaceDomain >
 {
    public:
-      
+ 
    tnlSinWaveFunctionBase();
 
    bool setup( const tnlParameterContainer& parameters,
@@ -59,7 +53,7 @@ template< typename Real >
 class tnlSinWaveFunction< 1, Real > : public tnlSinWaveFunctionBase< 1, Real >
 {
    public:
-      
+ 
       typedef Real RealType;
       typedef tnlStaticVector< 1, RealType > VertexType;
 
@@ -75,10 +69,10 @@ class tnlSinWaveFunction< 1, Real > : public tnlSinWaveFunctionBase< 1, Real >
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
-                           const Real& time = 0.0 ) const;      
+                           const Real& time = 0.0 ) const;
 
 };
 
@@ -86,10 +80,10 @@ template< typename Real >
 class tnlSinWaveFunction< 2, Real > : public tnlSinWaveFunctionBase< 2, Real >
 {
    public:
-            
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< 2, RealType > VertexType;      
-      
+      typedef tnlStaticVector< 2, RealType > VertexType;
+ 
 #ifdef HAVE_NOT_CXX11
       template< int XDiffOrder,
                 int YDiffOrder,
@@ -102,23 +96,23 @@ class tnlSinWaveFunction< 2, Real > : public tnlSinWaveFunctionBase< 2, Real >
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                                      const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< typename Real >
 class tnlSinWaveFunction< 3, Real > : public tnlSinWaveFunctionBase< 3, Real >
 {
-   public:      
-          
+   public:
+ 
       typedef Real RealType;
-      typedef tnlStaticVector< 3, RealType > VertexType;      
+      typedef tnlStaticVector< 3, RealType > VertexType;
 
 
-      
+ 
 #ifdef HAVE_NOT_CXX11
       template< int XDiffOrder,
                 int YDiffOrder,
@@ -131,11 +125,11 @@ class tnlSinWaveFunction< 3, Real > : public tnlSinWaveFunctionBase< 3, Real >
       __cuda_callable__
       RealType getPartialDerivative( const VertexType& v,
                          const Real& time = 0.0 ) const;
-      
+ 
       __cuda_callable__
       RealType operator()( const VertexType& v,
                            const Real& time = 0.0 ) const;
-      
+ 
 };
 
 template< int Dimensions,
@@ -148,6 +142,7 @@ ostream& operator << ( ostream& str, const tnlSinWaveFunction< Dimensions, Real
    return str;
 }
 
+} // namespace TNL
+
 #include <functions/tnlSinWaveFunction_impl.h>
 
-#endif /* TNLSINWAVEFUNCTION_H_ */
diff --git a/src/functions/tnlSinWaveFunction_impl.h b/src/functions/tnlSinWaveFunction_impl.h
index e03d31e95ffe90d9afd8b7029743151ad5d9e918..092e8e4741bc871749808c657aa0ab7db82d1d5d 100644
--- a/src/functions/tnlSinWaveFunction_impl.h
+++ b/src/functions/tnlSinWaveFunction_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSINWAVEFUNCTION_IMPL_H_
-#define TNLSINWAVEFUNCTION_IMPL_H_
+#pragma once
 
 #include <functions/tnlSinWaveFunction.h>
 
+namespace TNL {
+
 template< int dimensions, typename Real >
 tnlSinWaveFunctionBase< dimensions, Real >::tnlSinWaveFunctionBase()
 : waveLength( 1.0 ),
@@ -148,7 +142,7 @@ getPartialDerivative( const VertexType& v,
    if( XDiffOrder == 0 && YDiffOrder == 2 )
       return 2.0 * M_PI * y * y / ( this->waveLength * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength );
    if( XDiffOrder == 1 && YDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) 
+      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength )
              - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) / ( this->waveLength  * sqrt( (x * x + y * y )  * (x * x + y * y ) * (x * x + y * y ) ) );
    return 0.0;
 }
@@ -192,15 +186,15 @@ getPartialDerivative( const VertexType& v,
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1 )
       return 2.0 * M_PI * z / ( this->waveLength * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2 )
-      return 2.0 * M_PI * ( x * x + y * y ) / ( this->waveLength * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); 
+      return 2.0 * M_PI * ( x * x + y * y ) / ( this->waveLength * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0 )
-      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) 
+      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength )
              - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
    if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) 
+      return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength )
              - 2.0 * M_PI * this->amplitude * x * z * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
    if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) 
+      return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength )
              - 2.0 * M_PI * this->amplitude * z * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
    return 0.0;
 }
@@ -215,5 +209,4 @@ operator()( const VertexType& v,
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
-#endif /* TNLSINWAVEFUNCTION_IMPL_H_ */
+} // namespace TNL
diff --git a/src/functions/tnlTestFunction.h b/src/functions/tnlTestFunction.h
index 71ed8828c57761c8071b6115d09ba2d078f62245..7ac2d848c12d04f93c9a1a8ae18035b69f6c58b6 100644
--- a/src/functions/tnlTestFunction.h
+++ b/src/functions/tnlTestFunction.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTESTFUNCTION_H_
-#define TNLTESTFUNCTION_H_
+#pragma once
 
 #include <core/tnlHost.h>
 #include <core/vectors/tnlStaticVector.h>
@@ -24,6 +16,8 @@
 #include <config/tnlParameterContainer.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int FunctionDimensions,
           typename Real = double,
           typename Device = tnlHost >
@@ -103,8 +97,8 @@ class tnlTestFunction : public tnlDomain< FunctionDimensions, SpaceDomain >
                            const Real& time = 0 ) const
    {
       return this->getTimeDerivative< 0, 0, 0, Vertex >( vertex, time );
-   }   
-#endif                              
+   }
+#endif
 
    ostream& print( ostream& str ) const;
 
@@ -146,6 +140,7 @@ ostream& operator << ( ostream& str, const tnlTestFunction< FunctionDimensions,
    return f.print( str );
 }
 
+} // namespace TNL
+
 #include <functions/tnlTestFunction_impl.h>
 
-#endif /* TNLTESTFUNCTION_H_ */
diff --git a/src/functions/tnlTestFunction_impl.cpp b/src/functions/tnlTestFunction_impl.cpp
index dbac900553eda49dd3a8ef9b1f21bf38a46aa640..2f2367dbb4ca9c3a877c38cebe4e2fa29412e2fb 100644
--- a/src/functions/tnlTestFunction_impl.cpp
+++ b/src/functions/tnlTestFunction_impl.cpp
@@ -6,20 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 #include <functions/tnlTestFunction.h>
 
+namespace TNL {
+
 #ifdef INSTANTIATE_FLOAT
 template class tnlTestFunction< 1, float, tnlHost >;
 template class tnlTestFunction< 2, float, tnlHost >;
@@ -36,5 +31,7 @@ template class tnlTestFunction< 2, long double, tnlHost >;
 template class tnlTestFunction< 3, long double, tnlHost >;
 #endif
 
+} // namespace TNL
+
 #endif
 
diff --git a/src/functions/tnlTestFunction_impl.cu b/src/functions/tnlTestFunction_impl.cu
index de2cdc1e3c20f9ec222abc878695d42bceca1f3b..997fc422345bb59d3449fcfdc6645d69badb6e3c 100644
--- a/src/functions/tnlTestFunction_impl.cu
+++ b/src/functions/tnlTestFunction_impl.cu
@@ -6,20 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 #ifdef HAVE_CUDA
 
 #include <functions/tnlTestFunction.h>
 
+namespace TNL {
+
 #ifdef INSTANTIATE_FLOAT
 template class tnlTestFunction< 1, float, tnlCuda >;
 template class tnlTestFunction< 2, float, tnlCuda >;
@@ -36,5 +31,7 @@ template class tnlTestFunction< 2, long double, tnlCuda >;
 template class tnlTestFunction< 3, long double, tnlCuda >;
 #endif
 
+} // namespace TNL
+
 #endif
 #endif
diff --git a/src/functions/tnlTestFunction_impl.h b/src/functions/tnlTestFunction_impl.h
index 32271a80d9f85abbb016ccdea29db394e447f293..3b34c4c1c584c8334fafd78b1f23d3e0d4a66e22 100644
--- a/src/functions/tnlTestFunction_impl.h
+++ b/src/functions/tnlTestFunction_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTESTFUNCTION_IMPL_H_
-#define TNLTESTFUNCTION_IMPL_H_
+#pragma once
 
 #include <core/tnlCuda.h>
 #include <functions/tnlConstantFunction.h>
@@ -35,6 +27,8 @@
 #include <functions/initial_conditions/level_set_functions/tnlBlobFunction.h>
 #include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h>
 
+namespace TNL {
+
 template< int FunctionDimensions,
           typename Real,
           typename Device >
@@ -455,7 +449,7 @@ void
 tnlTestFunction< FunctionDimensions, Real, Device >::
 copyFunction( const void* function )
 {
-   if( Device::DeviceType == ( int ) tnlHostDevice ) 
+   if( Device::DeviceType == ( int ) tnlHostDevice )
    {
       FunctionType* f = new FunctionType;
       *f = * ( FunctionType* )function;
@@ -571,5 +565,5 @@ extern template class tnlTestFunction< 3, long double, tnlCuda >;
 
 #endif
 
+} // namespace TNL
 
-#endif /* TNLTESTFUNCTION_IMPL_H_ */
diff --git a/src/legacy/benchmarks/matrix-solvers-benchmark.cpp b/src/legacy/benchmarks/matrix-solvers-benchmark.cpp
index e45970c0ae13e218bc3e0fc1d9d3a2aac0d4035c..6d543d7c93bf817ce83d267d735b6fea732ee231 100644
--- a/src/legacy/benchmarks/matrix-solvers-benchmark.cpp
+++ b/src/legacy/benchmarks/matrix-solvers-benchmark.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "matrix-solvers-benchmark.h"
diff --git a/src/legacy/benchmarks/matrix-solvers-benchmark.cu b/src/legacy/benchmarks/matrix-solvers-benchmark.cu
index 1e924e00720b2c099f12353ac99f2fdd4fdc4339..5afd986ff0c0224bc51e40b3da4ff18da64ee0eb 100644
--- a/src/legacy/benchmarks/matrix-solvers-benchmark.cu
+++ b/src/legacy/benchmarks/matrix-solvers-benchmark.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "matrix-solvers-benchmark.h"
diff --git a/src/legacy/benchmarks/matrix-solvers-benchmark.h b/src/legacy/benchmarks/matrix-solvers-benchmark.h
index 69325136ee7a5805964bdb71ffafc6fdf47baa94..72ec732a1e2c822c61e0f1b09aa8b5001dd7d4bc 100644
--- a/src/legacy/benchmarks/matrix-solvers-benchmark.h
+++ b/src/legacy/benchmarks/matrix-solvers-benchmark.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef MATRIXSOLVERSBENCHMARK_H_
 #define MATRIXSOLVERSBENCHMARK_H_
 
 #include <fstream>
 #include <core/tnlFile.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlCuda.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
@@ -87,9 +80,9 @@ bool benchmarkSolver( const tnlParameterContainer&  parameters,
    solverMonitor. resetTimers();
 #ifdef HAVE_NOT_CXX11
    solver. template solve< Vector, tnlLinearResidueGetter< Matrix, Vector > >( b, x );
-#else   
+#else
    solver. solve( b, x );
-#endif   
+#endif
 
    bool solverConverged( solver. getResidue() < maxResidue );
    const tnlString& logFileName = parameters. getParameter< tnlString >( "log-file" );
diff --git a/src/legacy/benchmarks/sparse-matrix-benchmark.cpp b/src/legacy/benchmarks/sparse-matrix-benchmark.cpp
index c38341526d7faffed689a16a069cbee9a8c42aaf..0811d90de8825194b92c492ff0f19c61d75a03d6 100644
--- a/src/legacy/benchmarks/sparse-matrix-benchmark.cpp
+++ b/src/legacy/benchmarks/sparse-matrix-benchmark.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #include "sparse-matrix-benchmark.h"
diff --git a/src/legacy/benchmarks/sparse-matrix-benchmark.cu b/src/legacy/benchmarks/sparse-matrix-benchmark.cu
index 31d2575883e570ae50b9bf593452178cf7d8527c..524aca53bd8ff5d7db254032a90e9dde3dc1edee 100644
--- a/src/legacy/benchmarks/sparse-matrix-benchmark.cu
+++ b/src/legacy/benchmarks/sparse-matrix-benchmark.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #include "sparse-matrix-benchmark.h"
diff --git a/src/legacy/benchmarks/sparse-matrix-benchmark.h b/src/legacy/benchmarks/sparse-matrix-benchmark.h
index f9303e48f7f3d0464b0ac650077afed6fbe9e617..936ae79c4820f032fa117d85dc99d659f10a9495 100644
--- a/src/legacy/benchmarks/sparse-matrix-benchmark.h
+++ b/src/legacy/benchmarks/sparse-matrix-benchmark.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef SPARSEMATRIXBENCHMARK_H_
 #define SPARSEMATRIXBENCHMARK_H_
@@ -130,7 +123,7 @@ bool benchmarkMatrix( const tnlParameterContainer& parameters )
     */
    const long int nonzeroElements = csrMatrix. getNumberOfNonzeroMatrixElements();
    if( verbose )
-      cout << "Matrix rows: " << csrMatrix.getRows() 
+      cout << "Matrix rows: " << csrMatrix.getRows()
            << " Matrix columns: " << csrMatrix.getColumns()
            << " Non-zero elements: " << nonzeroElements << endl;
 
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmark.h b/src/legacy/benchmarks/tnlSpmvBenchmark.h
index 6fad0d1e2c1eb792d45a6c60b56f80575227197e..953e549c7473f9f81d30bf23c592afa2435d0a12 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmark.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmark.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARK_H_
 #define TNLSPMVBENCHMARK_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkAdaptiveRgCSRMatrix.h b/src/legacy/benchmarks/tnlSpmvBenchmarkAdaptiveRgCSRMatrix.h
index 794874d89857b3468837bcfd119512b117ce96bd..8d5a7849d471f5c0a7efab9db888ebe6e9123d26 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkAdaptiveRgCSRMatrix.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkAdaptiveRgCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKADAPTIVERGCSRMATRIX_H_
 #define TNLSPMVBENCHMARKADAPTIVERGCSRMATRIX_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkBase.h b/src/legacy/benchmarks/tnlSpmvBenchmarkBase.h
index 5f23288de8fa510012f47c392ccf95ed9da2ae31..f00bb5a0a9e57c7d1900ac85dc287de6851bd193 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkBase.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkBase.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKBASE_H_
 #define TNLSPMVBENCHMARKBASE_H_
@@ -32,7 +25,7 @@ class tnlSpmvBenchmarkBase
    public:
 
    tnlSpmvBenchmarkBase();
-   
+ 
    typedef typename Matrix::RealType RealType;
    typedef typename Matrix::DeviceType DeviceType;
    typedef typename Matrix::IndexType IndexType;
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkBase_impl.h b/src/legacy/benchmarks/tnlSpmvBenchmarkBase_impl.h
index cbe78d3829ec7930d40735a88dbb24e4f13fb8fa..8866a27307917e4f56fad552220febcd10b51527 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkBase_impl.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkBase_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKBASE_IMPL_H_
 #define TNLSPMVBENCHMARKBASE_IMPL_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkCSRMatrix.h b/src/legacy/benchmarks/tnlSpmvBenchmarkCSRMatrix.h
index c2328ce2b2f156169402a36886bf2c8075d62f89..2ec7e4a421c3912f9f096d1e14f940e552de377e 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkCSRMatrix.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKCSRMATRIX_H_
 #define TNLSPMVBENCHMARKCSRMATRIX_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkCusparseCSRMatrix.h b/src/legacy/benchmarks/tnlSpmvBenchmarkCusparseCSRMatrix.h
index d3907e582877687de233b2172119e5c794f2a7aa..a314da134fa9001ee6499d5a8ae3036515642c5e 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkCusparseCSRMatrix.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkCusparseCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKCUSPARSECSRMATRIX_H_
 #define TNLSPMVBENCHMARKCUSPARSECSRMATRIX_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkHybridMatrix.h b/src/legacy/benchmarks/tnlSpmvBenchmarkHybridMatrix.h
index fc6f36ffbe1321dcc71b30cf171707d8fc08491d..a6b0d6b954c1ead8e5e322a69f7f4c7841ba8743 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkHybridMatrix.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkHybridMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKHYBRIDMATRIX_H_
 #define TNLSPMVBENCHMARKHYBRIDMATRIX_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmarkRgCSRMatrix.h b/src/legacy/benchmarks/tnlSpmvBenchmarkRgCSRMatrix.h
index 8dd3d85b83e4e59d37cde56eb4ff46a9f051a614..0a29a50163cd27c4fc82628dfec72b44496f780d 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmarkRgCSRMatrix.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmarkRgCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARKRGCSRMATRIX_H_
 #define TNLSPMVBENCHMARKRGCSRMATRIX_H_
diff --git a/src/legacy/benchmarks/tnlSpmvBenchmark_impl.h b/src/legacy/benchmarks/tnlSpmvBenchmark_impl.h
index 0ceb0ca564d0213838f2ff7d81dd3db9866147f4..48077ccc092a10ffbdd1a20e9ebe8ff2f61c9708 100644
--- a/src/legacy/benchmarks/tnlSpmvBenchmark_impl.h
+++ b/src/legacy/benchmarks/tnlSpmvBenchmark_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPMVBENCHMARK_IMPL_H_
 #define TNLSPMVBENCHMARK_IMPL_H_
diff --git a/src/legacy/core/tnlCudaSupport.h b/src/legacy/core/tnlCudaSupport.h
index 114e64bb67cf7f3030a6c58f32d265fc727150f5..fc48b12bb56afd25e6546a05b3e46113be2fd2d0 100644
--- a/src/legacy/core/tnlCudaSupport.h
+++ b/src/legacy/core/tnlCudaSupport.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCUDASUPPORT_H_
 #define TNLCUDASUPPORT_H_
diff --git a/src/legacy/core/tnlTuple.h b/src/legacy/core/tnlTuple.h
index 1ade8c9ba98783dbf4ae727e63747c4a23bfc497..85ebc1ed748529900cb911750952122f7bc590b7 100644
--- a/src/legacy/core/tnlTuple.h
+++ b/src/legacy/core/tnlTuple.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlStaticVectorH
 #define tnlStaticVectorH
@@ -81,7 +74,7 @@ class tnlStaticVector
    __host__ __device__
 #endif
    Real& operator[]( int i );
-   
+ 
    //! Returns the first coordinate
 #ifdef HAVE_CUDA
    __host__ __device__
@@ -154,7 +147,7 @@ class tnlStaticVector
 #endif
    tnlStaticVector operator * ( const Real& c ) const;
 
-   //! 
+   //!
 #ifdef HAVE_CUDA
    __host__ __device__
 #endif
@@ -735,11 +728,11 @@ template< int Size, typename Real >
 bool tnlStaticVector< Size, Real > :: save( tnlFile& file ) const
 {
    int size = Size;
-#ifdef HAVE_NOT_CXX11   
+#ifdef HAVE_NOT_CXX11
    if( ! file. write< int, tnlHost >( &size ) ||
        ! file. write< Real, tnlHost, int >( data, size ) )
       cerr << "Unable to write tnlStaticVector." << endl;
-#else   
+#else
    if( ! file. write( &size ) ||
        ! file. write( data, size ) )
       cerr << "Unable to write tnlStaticVector." << endl;
@@ -751,26 +744,26 @@ template< int Size, typename Real >
 bool tnlStaticVector< Size, Real > :: load( tnlFile& file)
 {
    int size;
-#ifdef HAVE_NOT_CXX11   
+#ifdef HAVE_NOT_CXX11
    if( ! file. read< int, tnlHost >( &size ) )
-#else   
+#else
    if( ! file. read( &size ) )
-#endif      
+#endif
    {
       cerr << "Unable to read tnlStaticVector." << endl;
       return false;
-   }   
+   }
    if( size != Size )
    {
       cerr << "You try to read tnlStaticVector with wrong size " << size
            << ". It should be " << Size << endl;
       return false;
    }
-#ifdef HAVE_NOT_CXX11   
+#ifdef HAVE_NOT_CXX11
    if( ! file. read< Real, tnlHost, int >( data, size ) )
 #else
    if( ! file. read( data, size ) )
-#endif      
+#endif
    {
       cerr << "Unable to read tnlStaticVector." << endl;
       return false;
diff --git a/src/legacy/diff/curve-ident.h b/src/legacy/diff/curve-ident.h
index 5384f0b954feac4fa82d1f303a85f1d732bc079d..1c9db88bcfd9fe0f63761daed4228cd44e8cd1e0 100644
--- a/src/legacy/diff/curve-ident.h
+++ b/src/legacy/diff/curve-ident.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef curve_identH
 #define curve_identH
@@ -74,7 +67,7 @@ bool getLevelSetCurve( const tnlGridOld< 2, Real, Device, Index >& u,
             {
                curves[ k ] -> Prepend( tnlStaticVector< 2, Index >( i, j ) );
                added = true;
-               dbgCout( "Prepending to list no. " << k << "; list size ->  " << 
+               dbgCout( "Prepending to list no. " << k << "; list size ->  " <<
                      curves[ k ] -> getSize() );
                break;
             }
@@ -88,7 +81,7 @@ bool getLevelSetCurve( const tnlGridOld< 2, Real, Device, Index >& u,
             dbgCout( "Adding new list." );
          }
       }
-   
+ 
    // Now defragment all curves as much as it is possible.
    // It means - check if there are two curves whose begening and end
    // match, connect the together and erase the appended (or prepended) one.
@@ -115,7 +108,7 @@ bool getLevelSetCurve( const tnlGridOld< 2, Real, Device, Index >& u,
             if( ( n1 == 1 && n2 == 0 ) ||
                 ( n1 == 0 && n2 == 1 ) )
             {
-               dbgCout( "Prepending the list no. " << j << 
+               dbgCout( "Prepending the list no. " << j <<
                          " (" << c2. getSize() <<") to the list no. " << i <<
                          " (" << c1. getSize() <<").");
                c1. PrependList( c2 );
@@ -273,6 +266,6 @@ bool getLevelSetCurve( const tnlGridOld< 2, Real, Device, Index >& u,
    curves. DeepEraseAll();
    return true;
 };
-                                           
+ 
 
 #endif
diff --git a/src/legacy/diff/tnlMPIMesh.h b/src/legacy/diff/tnlMPIMesh.h
index 82f48c4a09336e72d12c492c8879ea1c14385a0b..f8c98a076a572267a105048d71f27f898a0171e6 100644
--- a/src/legacy/diff/tnlMPIMesh.h
+++ b/src/legacy/diff/tnlMPIMesh.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMPIMESH_H_
 #define TNLMPIMESH_H_
diff --git a/src/legacy/diff/tnlMPIMesh2D.h b/src/legacy/diff/tnlMPIMesh2D.h
index 367f8f43696c00f13560ebfd08dbd793c6ad3930..e3a4e235c0e066d17d51c8e25caba6798ce59d45 100644
--- a/src/legacy/diff/tnlMPIMesh2D.h
+++ b/src/legacy/diff/tnlMPIMesh2D.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMPIMesh2DH
 #define tnlMPIMesh2DH
@@ -46,7 +39,7 @@ class tnlMPIMesh< 2, Real, Device, Index >
               Index _overlap_width,
               int root = 0,
               MPI_Comm comm = MPI_COMM_WORLD );
-   
+ 
    //! Initiation by parametr container
    bool Init( const tnlGridOld< 2, Real, Device, Index >& u,
               const tnlParameterContainer& parameters,
@@ -157,7 +150,7 @@ class tnlMPIMesh< 2, Real, Device, Index >
 
    //! Scatter the function but only at the domains at the boundaries
    //void ScatterAtBoundaries( const tnlGridOld2D* u,
-   //                          tnlGridOld2D* sub_u ); 
+   //                          tnlGridOld2D* sub_u );
 
    //! Gather the function
    void Gather( tnlGridOld< 2, Real, Device, Index >& u,
@@ -166,7 +159,7 @@ class tnlMPIMesh< 2, Real, Device, Index >
 
    //! Synchronize domain edges
    void Synchronize( tnlGridOld< 2, Real, Device, Index >& u );
-   
+ 
    //! Get domain edges
    void DomainOverlaps( int& right, int& left,
                         int& bottom, int& top );
@@ -195,16 +188,16 @@ class tnlMPIMesh< 2, Real, Device, Index >
    int left_neighbour, right_neighbour, bottom_neighbour, top_neighbour,
        left_bottom_neighbour, right_bottom_neighbour,
        left_top_neighbour, right_top_neighbour;
-   
+ 
    //! Global domain dimensions
    Index domain_x_size, domain_y_size;
 
    //! Global domain size
    Real Ax, Bx, Ay, By;
-    
+ 
    //! The subdomain dimensions
    Index subdomain_x_size, subdomain_y_size;
-    
+ 
    //! The domain overlaps
    Index overlap_width, left_overlap, right_overlap, bottom_overlap, top_overlap;
 
@@ -222,7 +215,7 @@ class tnlMPIMesh< 2, Real, Device, Index >
         *top_left_recieve_buff,
         *top_right_recieve_buff;
 };
-               
+ 
 template< typename Real, typename Device, typename Index >
 void DrawSubdomains( const tnlMPIMesh< 2, Real, Device, Index >& mpi_mesh,
                      const tnlGridOld< 2, Real, Device, Index >* u,
@@ -256,7 +249,7 @@ tnlMPIMesh< 2, Real, Device, Index > :: tnlMPIMesh()
       top_left_recieve_buff( 0 ),
       top_right_recieve_buff( 0 )
       {};
-   
+ 
 template< typename Real, typename Device, typename Index  >
 bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, Device, Index >& u,
                                                    int& _mesh_x_size,
@@ -293,9 +286,9 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, De
          return false;
       }
       MPI_Cart_coords( mesh_comm, MPIGetRank( mesh_comm ), 2, dims );
-      node_x_pos = dims[ 0 ];  
-      node_y_pos = dims[ 1 ];  
-      
+      node_x_pos = dims[ 0 ];
+      node_y_pos = dims[ 1 ];
+ 
       MPI_Cart_shift( mesh_comm, 0, 1, &left_neighbour, &right_neighbour );
       MPI_Cart_shift( mesh_comm, 1, 1, &bottom_neighbour, &top_neighbour );
       :: MPIBcast< int >( _overlap_width, 1, root );
@@ -341,21 +334,21 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, De
       domain_y_size = u. GetYSize();
       :: MPIBcast< int >( domain_x_size, 1, 0 );
       :: MPIBcast< int >( domain_y_size, 1, 0 );
-      
+ 
       subdomain_x_size = domain_x_size / mesh_x_size;
       subdomain_y_size = domain_y_size / mesh_y_size;
-      
+ 
       if( node_x_pos == mesh_x_size - 1 )
          subdomain_x_size = domain_x_size - subdomain_x_size * ( mesh_x_size - 1 );
-      
+ 
       if( node_y_pos == mesh_y_size - 1 )
          subdomain_y_size = domain_y_size - subdomain_y_size * ( mesh_y_size - 1 );
-      
+ 
       Ax = u. GetAx();
       Ay = u. GetAy();
       Bx = u. GetBx();
       By = u. GetBy();
-      
+ 
       :: MPIBcast< double >( Ax, 1, 0 );
       :: MPIBcast< double >( Ay, 1, 0 );
       :: MPIBcast< double >( Bx, 1, 0 );
@@ -387,7 +380,7 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, De
          bottom_left_send_buff = new T[ bottom_overlap * left_overlap ];
          bottom_left_recieve_buff = new T[ bottom_overlap * left_overlap ];
       }
-   
+ 
       if( bottom_overlap && right_overlap )
       {
          bottom_right_send_buff = new T[ bottom_overlap * right_overlap ];
@@ -403,15 +396,15 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, De
          top_right_send_buff = new T[ top_overlap * right_overlap ];
          top_right_recieve_buff = new T[ top_overlap * right_overlap ];
       }
-      cout << "Node " << MPIGetRank() 
-           << " has position (" << GetXPos() 
-           << ", " << GetYPos() 
-           << ") and dimensions " << GetSubdomainXSize() 
+      cout << "Node " << MPIGetRank()
+           << " has position (" << GetXPos()
+           << ", " << GetYPos()
+           << ") and dimensions " << GetSubdomainXSize()
            << " x " << GetSubdomainYSize() << endl;
 #else
       domain_x_size = u. getDimensions(). x();
       domain_y_size = u. getDimensions(). y();
-      
+ 
       Ax = u. getDomainLowerCorner(). x();
       Ay = u. getDomainLowerCorner(). y();
       Bx = u. getDomainUpperCorner(). x();
@@ -420,7 +413,7 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, De
 #endif
       return true;
    };
-   
+ 
 template< typename Real, typename Device, typename Index  >
 bool tnlMPIMesh< 2, Real, Device, Index > :: Init( const tnlGridOld< 2, Real, Device, Index >& u,
                                                    const tnlParameterContainer& parameters,
@@ -439,12 +432,12 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: SetGlobalDomain( tnlGridOld< 2, Rea
 {
    if( ! global_u. setDimensions( tnlStaticVector< 2, int >( domain_x_size, domain_y_size ) ) )
       return false;
-   
+ 
    global_u. setDomain( tnlStaticVector< 2, Real >( Ax, Ay ),
                         tnlStaticVector< 2, Real >( Bx, By ) );
    return true;
 }
-   
+ 
 template< typename Real, typename Device, typename Index  >
 bool tnlMPIMesh< 2, Real, Device, Index > :: CreateMesh( const tnlGridOld< 2, Real, Device, Index >& u,
                                                          tnlGridOld< 2, Real, Device, Index >& sub_u,
@@ -470,8 +463,8 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: CreateMesh( const tnlGridOld< 2, Re
    if( ! sub_u. SetNewDimensions( subdomain_x_size + left_overlap + right_overlap,
                                   subdomain_y_size + bottom_overlap + top_overlap ) )
    {
-      cerr << "Unable to allocate subdomain grids for '" << name 
-           << "' on the node ( " << node_x_pos << ", " << node_y_pos 
+      cerr << "Unable to allocate subdomain grids for '" << name
+           << "' on the node ( " << node_x_pos << ", " << node_y_pos
            << " rank " << MPIGetRank( original_comm ) << "." << endl;
       err = 1;
    }
@@ -480,7 +473,7 @@ bool tnlMPIMesh< 2, Real, Device, Index > :: CreateMesh( const tnlGridOld< 2, Re
                         ay + ( node_y_pos * subdomain_y_size - bottom_overlap ) * hx,
                         ay + ( ( node_y_pos + 1 ) * subdomain_y_size + top_overlap - 1 ) * hx,
                         hx, hy );
-   //cout << "Node " << MPIGetRank() << " mesh size " 
+   //cout << "Node " << MPIGetRank() << " mesh size "
    //     << sub_u -> GetXSize() << "x" << sub_u -> GetYSize() << endl;
    MPI_Allreduce( &err, &all_err, 1, MPI_INT,MPI_SUM, mesh_comm );
    if( all_err != 0 ) return false;
@@ -515,8 +508,8 @@ void tnlMPIMesh< 2, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 2,
       if( dest_x_pos < mesh_x_size - 1 ) dest_right_overlap = overlap_width;
       if( dest_y_pos > 0 ) dest_bottom_overlap = overlap_width;
       if( dest_y_pos < mesh_y_size - 1 ) dest_top_overlap = overlap_width;
-     
-      dbgCout( "dest edges LRLU " << 
+ 
+      dbgCout( "dest edges LRLU " <<
                dest_left_overlap << dest_right_overlap <<
                dest_bottom_overlap << dest_top_overlap );
 
@@ -531,7 +524,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 2,
                   ( dest_x_pos + 1 ) * subdomain_x_size + dest_right_overlap << " > x < " <<
                   dest_y_pos * subdomain_y_size - dest_bottom_overlap << ", " <<
                   ( dest_y_pos + 1 ) * subdomain_y_size + dest_top_overlap << " >" );
-      
+ 
       int i, j;
       const int i1 = dest_x_pos * subdomain_x_size - dest_left_overlap;
       const int i2 = ( dest_x_pos + 1 ) * subdomain_x_size + dest_right_overlap;
@@ -540,7 +533,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 2,
       for( i = i1; i < i2; i ++ )
          for( j = j1; j < j2; j ++ )
             ( *mpi_buff )( i - i1, j - j1 ) = u( i, j );
-      int buf_size = 
+      int buf_size =
          ( subdomain_x_size + dest_left_overlap + dest_right_overlap ) *
          ( subdomain_y_size + dest_bottom_overlap + dest_top_overlap );
       if( dest_node != root )
@@ -589,7 +582,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Scatter( const tnlGridOld< 2, Real,
    sub_u = u;
 #endif
 }
-    
+ 
 template< typename Real, typename Device, typename Index  >
 void tnlMPIMesh< 2, Real, Device, Index > :: Gather( tnlGridOld< 2, Real, Device, Index >& u,
                                                      const tnlGridOld< 2, Real, Device, Index >& sub_u,
@@ -597,7 +590,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Gather( tnlGridOld< 2, Real, Device
 {
    dbgFunctionName( "tnlMPIMesh", "Gather" );
 #ifdef HAVE_MPI
-   
+ 
    dbgMPIBarrier;
    dbgExpr( MPIGetRank( original_comm ) );
    if( MPIGetRank( original_comm ) == root )
@@ -608,7 +601,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Gather( tnlGridOld< 2, Real, Device
       for( src = 0; src < mesh_size; src ++ )
       {
          int coords[ 2 ];
-         MPI_Cart_coords( mesh_comm, src, 2, coords ); 
+         MPI_Cart_coords( mesh_comm, src, 2, coords );
          int src_x_pos = coords[ 0 ];
          int src_y_pos = coords[ 1 ];
 
@@ -624,22 +617,22 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Gather( tnlGridOld< 2, Real, Device
          if( src_y_pos < mesh_y_size - 1 ) src_top_overlap = overlap_width;
          if( src != root )
          {
-            
+ 
             dbgCout( "Allocating supporting buffer < " <<
                       src_x_pos * subdomain_x_size - src_left_overlap <<
                       ", " << ( src_x_pos + 1 ) * subdomain_x_size + src_right_overlap <<
                       " >x< " << src_y_pos * subdomain_y_size - src_bottom_overlap <<
                       ", " << ( src_y_pos + 1 ) * subdomain_y_size + src_top_overlap <<
                       " >" );
-                  
+ 
             tnlGridOld< 2, Real, Device, Index > mpi_buff( subdomain_x_size + src_left_overlap + src_right_overlap,
                                    subdomain_y_size + src_bottom_overlap + src_top_overlap,
                                    0.0, 1.0, 0.0, 1.0 );
-            int buf_size = 
+            int buf_size =
                ( subdomain_x_size + src_left_overlap + src_right_overlap ) *
                ( subdomain_y_size + src_bottom_overlap + src_top_overlap );
             dbgExpr( buf_size );
-            
+ 
             dbgCout( "RECEIVING data from node " << src  );
             MPI_Recv( mpi_buff. getData(),
                       buf_size * sizeof( T ),
@@ -707,17 +700,17 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
   int max_y = min_y + subdomain_y_size;
   int wdth = overlap_width;
   MPI_Status status;
-   
+ 
   MPI_Request lft_snd_rqst, rght_snd_rqst, lwr_snd_rqst, uppr_snd_rqst,
               lwr_lft_snd_rqst, lwr_rght_snd_rqst,
               uppr_lft_snd_rqst, uppr_rght_snd_rqst,
               lft_rcv_rqst, rght_rcv_rqst, lwr_rcv_rqst, uppr_rcv_rqst,
               lwr_lft_rcv_rqst, lwr_rght_rcv_rqst,
               uppr_lft_rcv_rqst, uppr_rght_rcv_rqst;
-  
-  
+ 
+ 
   dbgMPIBarrier;
-  
+ 
   //starting communication with the left neighbour
   if( left_neighbour != MPI_PROC_NULL )
   {
@@ -733,7 +726,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm ,
                 &lft_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING data from the LEFT neighbour" );
      MPI_Irecv( left_recieve_buff,
                 wdth * subdomain_y_size * sizeof( T ),
@@ -744,7 +737,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 &lft_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   // starting communication with the right neighbour
   if( right_neighbour != MPI_PROC_NULL )
   {
@@ -760,7 +753,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &rght_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING data from the RIGHT neighbour" );
      MPI_Irecv( right_recieve_buff,
                 wdth * subdomain_y_size * sizeof( T ),
@@ -771,7 +764,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 &rght_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   // starting communication with the bottom neighbour
   if( bottom_neighbour != MPI_PROC_NULL )
   {
@@ -787,7 +780,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &lwr_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING data from the BOTTOM neighbour" );
      MPI_Irecv( bottom_recieve_buff,
                 wdth * subdomain_y_size * sizeof( T ),
@@ -814,7 +807,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &uppr_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING data from the TOP neighbour" );
      MPI_Irecv( top_recieve_buff,
                 wdth * subdomain_y_size * sizeof( T ),
@@ -825,9 +818,9 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 &uppr_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   int wdth_2 = wdth * wdth;
-  
+ 
   // starting communication with lower left neighbour
   if( left_bottom_neighbour != MPI_PROC_NULL )
   {
@@ -843,7 +836,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &lwr_lft_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the BOTTOM LEFT neighbour." );
      MPI_Irecv( bottom_left_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -854,7 +847,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 &lwr_lft_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   // starting communication with lower right neighbour
   if( right_bottom_neighbour != MPI_PROC_NULL )
   {
@@ -870,7 +863,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &lwr_rght_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the BOTTOM RIGHT neighbour." );
      MPI_Irecv( bottom_right_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -897,7 +890,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &uppr_lft_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the TOP LEFT neighbour." );
      MPI_Irecv( top_left_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -924,7 +917,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
                 0,
                 mesh_comm,
                 &uppr_rght_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the TOP RIGHT neighbour." );
      MPI_Irecv( top_right_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -948,7 +941,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
      MPI_Wait( &lft_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   // finishing communication with the right neighbour
   if( right_neighbour != MPI_PROC_NULL )
   {
@@ -961,7 +954,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
      MPI_Wait( &rght_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   // finishing communication with the lower neighbour
   if( bottom_neighbour != MPI_PROC_NULL )
   {
@@ -974,7 +967,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
      MPI_Wait( &lwr_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   // finishing communication with the upper neighbour
   if( top_neighbour != MPI_PROC_NULL )
   {
@@ -987,8 +980,8 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
      MPI_Wait( &uppr_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
-  
+ 
+ 
   // finishing communication with the lower left neighbour
   if( left_bottom_neighbour != MPI_PROC_NULL  )
   {
@@ -1027,7 +1020,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
      MPI_Wait( &uppr_rght_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   // finishing communication with the upper left neighbour
   if( left_top_neighbour != MPI_PROC_NULL )
   {
@@ -1039,7 +1032,7 @@ void tnlMPIMesh< 2, Real, Device, Index > :: Synchronize( tnlGridOld< 2, Real, D
            top_left_recieve_buff[ j * wdth + i ];
      MPI_Wait( &uppr_lft_snd_rqst, &status );
   }
-  
+ 
   dbgCout( "Synchronisation done..." );
   dbgMPIBarrier;
 #endif
diff --git a/src/legacy/diff/tnlMPIMesh3D.h b/src/legacy/diff/tnlMPIMesh3D.h
index 30e3a2c31d44af200491348275daec2f8644dd53..a6bb86bc51a6306b5387a823b2e07ad08c5e1d78 100644
--- a/src/legacy/diff/tnlMPIMesh3D.h
+++ b/src/legacy/diff/tnlMPIMesh3D.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMPIMesh3DH
 #define tnlMPIMesh3DH
@@ -172,7 +165,7 @@ class tnlMPIMesh< 3, Real, Device, Index >
    {
       if( ! global_u. setDimensions( tnlStaticVector< 3, Index >( domain_x_size, domain_y_size, domain_z_size  ) ) )
          return false;
-      
+ 
       global_u. setDomain( tnlStaticVector< 3, Real >( Ax, Bx, Ay ),
                            tnlStaticVector< 3, Real >( By, Az, Bz ) );
       return true;
@@ -190,7 +183,7 @@ class tnlMPIMesh< 3, Real, Device, Index >
 
    //! Scatter the function but only at the domains at the boundaries
    //void ScatterAtBoundaries( const tnlGridOld2D* u,
-   //                          tnlGridOld2D* sub_u ); 
+   //                          tnlGridOld2D* sub_u );
 
    //! Gather the function
    void Gather( tnlGridOld< 3, Real, Device, Index >& u,
@@ -199,7 +192,7 @@ class tnlMPIMesh< 3, Real, Device, Index >
 
    //! Synchronize domain edges
    void Synchronize( tnlGridOld< 3, Real, Device, Index >& u );
-   
+ 
    //! Get domain edges
    void DomainOverlaps( int& right, int& left,
                         int& bottom, int& top );
@@ -230,16 +223,16 @@ class tnlMPIMesh< 3, Real, Device, Index >
        closer_neighbour, further_neighbour,
        left_bottom_neighbour, right_bottom_neighbour,
        left_top_neighbour, right_top_neighbour;
-  
+ 
    //! The subdomain dimensions
    Index subdomain_x_size, subdomain_y_size, subdomain_z_size;
-   
+ 
    //! Global domain dimensions
    Index domain_x_size, domain_y_size, domain_z_size;
 
    //! Global domain size
    Real Ax, Bx, Ay, By, Az, Bz;
-    
+ 
    //! The domain overlaps
    Index overlap_width,
        left_overlap, right_overlap,
@@ -262,7 +255,7 @@ class tnlMPIMesh< 3, Real, Device, Index >
         *top_left_recieve_buff,
         *top_right_recieve_buff;
 };
-               
+ 
 template< typename Real, typename Device, typename Index >
 void DrawSubdomains( const tnlMPIMesh< 3, Real, Device, Index >& mpi_mesh,
                                          const tnlGridOld< 3, Real, Device, Index >& u,
@@ -276,7 +269,7 @@ tnlMPIMesh< 3, Real, Device, Index > :: tnlMPIMesh()
     : mesh_comm( 0 ), original_comm( 0 ),
       mesh_x_size( 0 ), mesh_y_size( 0 ), mesh_z_size( 0 ),
       node_x_pos( 0 ) , node_y_pos( 0 ), node_z_pos( 0 ),
-      left_neighbour( 0 ), right_neighbour( 0 ), 
+      left_neighbour( 0 ), right_neighbour( 0 ),
       bottom_neighbour( 0 ), top_neighbour( 0 ),
       closer_neighbour( 0 ), further_neighbour( 0 ),
       left_bottom_neighbour( 0 ), right_bottom_neighbour( 0 ),
@@ -300,7 +293,7 @@ tnlMPIMesh< 3, Real, Device, Index > :: tnlMPIMesh()
       top_left_recieve_buff( 0 ),
       top_right_recieve_buff( 0 )
       {};
-   
+ 
 template< typename Real, typename Device, typename Index >
 bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, Device, Index >& u,
                                                    int& _mesh_x_size,
@@ -349,20 +342,20 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
                     "x" << mesh_y_size << "x" << mesh_z_size << endl;
          return false;
       }
-      
+ 
       dbgMPIBarrier;
       dbgCout( "Getting node position in the MPI mesh ..." );
       MPI_Cart_coords( mesh_comm, MPIGetRank( mesh_comm ), 3, dims );
-      node_x_pos = dims[ 0 ];  
-      node_y_pos = dims[ 1 ];  
-      node_z_pos = dims[ 2 ];  
+      node_x_pos = dims[ 0 ];
+      node_y_pos = dims[ 1 ];
+      node_z_pos = dims[ 2 ];
       dbgMPIBarrier;
       dbgCout( "Node position is ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << ")" );
-      
+ 
 
       dbgMPIBarrier;
       dbgCout( "Checking MPI mesh neighbours ... " );
-      
+ 
       MPI_Cart_shift( mesh_comm, 0, 1, &left_neighbour, &right_neighbour );
       MPI_Cart_shift( mesh_comm, 1, 1, &bottom_neighbour, &top_neighbour );
       MPI_Cart_shift( mesh_comm, 2, 1, &closer_neighbour, &further_neighbour );
@@ -381,8 +374,8 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
       else further_overlap = 0;
 
       dbgMPIBarrier;
-      dbgCout( "Left " << left_overlap << 
-               " Right " << right_overlap <<  
+      dbgCout( "Left " << left_overlap <<
+               " Right " << right_overlap <<
                " Bottom " << bottom_overlap <<
                " Top " << top_overlap <<
                " Closer " << closer_overlap <<
@@ -419,7 +412,7 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
       }
       else left_bottom_neighbour = MPI_PROC_NULL;*/
       // TODO: add for 3d
-      
+ 
       dbgMPIBarrier;
       dbgCout( "Getting subdomain dimension ... " );
       domain_x_size = u. GetXSize();
@@ -428,39 +421,39 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
       :: MPIBcast< int >( domain_x_size, 1, 0 );
       :: MPIBcast< int >( domain_y_size, 1, 0 );
       :: MPIBcast< int >( domain_z_size, 1, 0 );
-      
+ 
       subdomain_x_size = domain_x_size / mesh_x_size;
       subdomain_y_size = domain_y_size / mesh_y_size;
       subdomain_z_size = domain_z_size / mesh_z_size;
-      
+ 
       if( node_x_pos == mesh_x_size - 1 )
          subdomain_x_size = domain_x_size - subdomain_x_size * ( mesh_x_size - 1 );
-      
+ 
       if( node_y_pos == mesh_y_size - 1 )
          subdomain_y_size = domain_y_size - subdomain_y_size * ( mesh_y_size - 1 );
-      
+ 
       if( node_z_pos == mesh_z_size - 1 )
          subdomain_z_size = domain_z_size - subdomain_z_size * ( mesh_z_size - 1 );
 
       dbgMPIBarrier;
-      dbgCout( "Subdomain dimensions are " << subdomain_x_size << "x" 
+      dbgCout( "Subdomain dimensions are " << subdomain_x_size << "x"
                << subdomain_y_size << "x" << subdomain_z_size );
-      
+ 
       Ax = u. GetAx();
       Ay = u. GetAy();
       Bx = u. GetBx();
       By = u. GetBy();
       Az = u. GetAz();
       Bz = u. GetBz();
-      
+ 
       :: MPIBcast< double >( Ax, 1, 0 );
       :: MPIBcast< double >( Ay, 1, 0 );
       :: MPIBcast< double >( Az, 1, 0 );
       :: MPIBcast< double >( Bx, 1, 0 );
       :: MPIBcast< double >( By, 1, 0 );
       :: MPIBcast< double >( Bz, 1, 0 );
-      
-      
+ 
+ 
       FreeBuffers();
       if( left_overlap )
       {
@@ -485,12 +478,12 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
       if( closer_overlap )
       {
          closer_send_buff = new T[ subdomain_x_size * subdomain_y_size * closer_overlap ];
-         closer_recieve_buff = new T[ subdomain_x_size * subdomain_y_size * closer_overlap ]; 
+         closer_recieve_buff = new T[ subdomain_x_size * subdomain_y_size * closer_overlap ];
       }
       if( further_overlap )
       {
          further_send_buff = new T[ subdomain_x_size * subdomain_y_size * further_overlap ];
-         further_recieve_buff = new T[ subdomain_x_size * subdomain_y_size * further_overlap ]; 
+         further_recieve_buff = new T[ subdomain_x_size * subdomain_y_size * further_overlap ];
       }
 
       // TODO: fix it for 3D
@@ -499,7 +492,7 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
          bottom_left_send_buff = new T[ bottom_overlap * left_overlap ];
          bottom_left_recieve_buff = new T[ bottom_overlap * left_overlap ];
       }
-   
+ 
       if( bottom_overlap && right_overlap )
       {
          bottom_right_send_buff = new T[ bottom_overlap * right_overlap ];
@@ -515,11 +508,11 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
          top_right_send_buff = new T[ top_overlap * right_overlap ];
          top_right_recieve_buff = new T[ top_overlap * right_overlap ];
       }
-      cout << "Node " << MPIGetRank() 
-           << " has position (" << GetXPos() 
-           << ", " << GetYPos() 
+      cout << "Node " << MPIGetRank()
+           << " has position (" << GetXPos()
+           << ", " << GetYPos()
            << ", " << GetZPos()
-           << ") and dimensions " << GetSubdomainXSize() 
+           << ") and dimensions " << GetSubdomainXSize()
            << " x " << GetSubdomainYSize()
            << " x " << GetSubdomainZSize() << endl;
 #else
@@ -552,11 +545,11 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: Init( const tnlGridOld< 3, Real, De
                 mpi_mesh_y_size,
                 mpi_mesh_z_size,
                 _overlap_width,
-                root, 
+                root,
                 comm );
 }
 
-   
+ 
 template< typename Real, typename Device, typename Index >
 bool tnlMPIMesh< 3, Real, Device, Index > :: CreateMesh( const tnlGridOld< 3, Real, Device, Index >& u,
                                                          tnlGridOld< 3, Real, Device, Index >& sub_u,
@@ -587,10 +580,10 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: CreateMesh( const tnlGridOld< 3, Re
    :: MPIBcast< double >( hz, 1, root, original_comm );
    name. MPIBcast( root, original_comm );
    dbgMPIBarrier;
-   dbgCout( "Global domain is as: Ax = " << ax << 
-                                " Ay = " << ay << 
+   dbgCout( "Global domain is as: Ax = " << ax <<
+                                " Ay = " << ay <<
                                 " Az = " << az <<
-                                " hx = " << hx << 
+                                " hx = " << hx <<
                                 " hy = " << hy <<
                                 " hz = " << hz );
 
@@ -608,17 +601,17 @@ bool tnlMPIMesh< 3, Real, Device, Index > :: CreateMesh( const tnlGridOld< 3, Re
                         hx, hy, hz );
    if( ! sub_u )
    {
-      cerr << "Unable to allocate subdomain grids for '" << name 
-           << "' on the node ( " << node_x_pos << ", " << node_y_pos 
+      cerr << "Unable to allocate subdomain grids for '" << name
+           << "' on the node ( " << node_x_pos << ", " << node_y_pos
            << " rank " << MPIGetRank( original_comm ) << "." << endl;
       err = 1;
    }
    dbgMPIBarrier;
-   dbgCout( "Subdomain is as: Ax = " << sub_u. GetAx() << 
-                            " Ay = " << sub_u. GetAy() << 
+   dbgCout( "Subdomain is as: Ax = " << sub_u. GetAx() <<
+                            " Ay = " << sub_u. GetAy() <<
                             " Az = " << sub_u. GetAz() <<
-                            " hx = " << sub_u. GetHx() << 
-                            " hy = " << sub_u. GetHy() << 
+                            " hx = " << sub_u. GetHx() <<
+                            " hy = " << sub_u. GetHy() <<
                             " hz = " << sub_u. GetHz() );
 
    MPI_Allreduce( &err, &all_err, 1, MPI_INT,MPI_SUM, mesh_comm );
@@ -661,10 +654,10 @@ void tnlMPIMesh< 3, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 3,
       if( dest_y_pos < mesh_y_size - 1 ) dest_top_overlap = overlap_width;
       if( dest_z_pos > 0 ) dest_closer_overlap = overlap_width;
       if( dest_z_pos < mesh_z_size - 1 ) dest_further_overlap = overlap_width;
-     
-      dbgCout( "Dest edges:  Lft. " << dest_left_overlap << 
+ 
+      dbgCout( "Dest edges:  Lft. " << dest_left_overlap <<
                            " Rght. " << dest_right_overlap <<
-                           " Btm. " << dest_bottom_overlap << 
+                           " Btm. " << dest_bottom_overlap <<
                            " Top. " << dest_top_overlap <<
                            " Clsr. " << dest_closer_overlap <<
                            " Frth. " << dest_further_overlap );
@@ -677,7 +670,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 3,
       }
       else
       {
-          dbgCout( "Allocating MPI buffer - dimensions are: " 
+          dbgCout( "Allocating MPI buffer - dimensions are: "
                    << subdomain_x_size + dest_left_overlap + dest_right_overlap << "x"
                    << subdomain_y_size + dest_bottom_overlap + dest_top_overlap << "x"
                    << subdomain_z_size + dest_closer_overlap + dest_further_overlap );
@@ -685,7 +678,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: ScatterToNode( const tnlGridOld< 3,
                                        subdomain_y_size + dest_bottom_overlap + dest_top_overlap,
                                        subdomain_z_size + dest_closer_overlap + dest_further_overlap,
                                        0.0, 1.0, 0.0, 1.0, 0.0, 1.0 );
-         dbgExpr( mpi_buff -> GetSize() ); 
+         dbgExpr( mpi_buff -> GetSize() );
          if( ! mpi_buff )
          {
             cerr << "Unable to allocate MPI buffer." << endl;
@@ -770,7 +763,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Scatter( const tnlGridOld< 3, Real,
    sub_u = u;
 #endif
 }
-    
+ 
 template< typename Real, typename Device, typename Index >
 void tnlMPIMesh< 3, Real, Device, Index > :: Gather( tnlGridOld< 3, Real, Device, Index >& u,
                                                      const tnlGridOld< 3, Real, Device, Index >& sub_u,
@@ -788,7 +781,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Gather( tnlGridOld< 3, Real, Device
       for( src = 0; src < mesh_size; src ++ )
       {
          int coords[ 3 ];
-         MPI_Cart_coords( mesh_comm, src, 3, coords ); 
+         MPI_Cart_coords( mesh_comm, src, 3, coords );
          int src_x_pos = coords[ 0 ];
          int src_y_pos = coords[ 1 ];
          int src_z_pos = coords[ 2 ];
@@ -809,7 +802,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Gather( tnlGridOld< 3, Real, Device
          if( src_z_pos < mesh_z_size - 1 ) src_further_overlap = overlap_width;
          if( src != root )
          {
-            
+ 
             dbgCout( "Allocating supporting buffer < " <<
                       src_x_pos * subdomain_x_size - src_left_overlap <<
                       ", " << ( src_x_pos + 1 ) * subdomain_x_size + src_right_overlap <<
@@ -817,14 +810,14 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Gather( tnlGridOld< 3, Real, Device
                       ", " << ( src_y_pos + 1 ) * subdomain_y_size + src_top_overlap <<
                       " >" << src_z_pos * subdomain_z_size - src_closer_overlap <<
                       ", " << ( src_z_pos + 1 ) * subdomain_z_size + src_further_overlap << " >" );
-                  
+ 
             tnlGridOld< 3, Real, Device, Index > mpi_buff( subdomain_x_size + src_left_overlap + src_right_overlap,
                                    subdomain_y_size + src_bottom_overlap + src_top_overlap,
                                    subdomain_z_size + src_closer_overlap + src_further_overlap,
                                    0.0, 1.0, 0.0, 1.0, 0.0, 1.0 );
             int buf_size = mpi_buff. GetSize();
             dbgExpr( buf_size );
-            
+ 
             dbgCout( "RECEIVING data from node " << src  );
             MPI_Recv( mpi_buff. getData(),
                       buf_size * sizeof( T ),
@@ -905,7 +898,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
   int max_z = min_z + subdomain_z_size;
   int wdth = overlap_width;
   MPI_Status status;
-   
+ 
   MPI_Request lft_snd_rqst, rght_snd_rqst,
               lwr_snd_rqst, uppr_snd_rqst,
               clsr_snd_rqst, frth_snd_rqst,
@@ -916,10 +909,10 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
               clsr_rcv_rqst, frth_rcv_rqst,
               lwr_lft_rcv_rqst, lwr_rght_rcv_rqst,
               uppr_lft_rcv_rqst, uppr_rght_rcv_rqst;
-  
-  
+ 
+ 
   dbgMPIBarrier;
-  
+ 
   int buff_iter;
   dbgCout( "Starting communication with the left neighbour ... " );
   if( left_neighbour != MPI_PROC_NULL )
@@ -937,7 +930,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm ,
                 &lft_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - is RECEIVING data from the LEFT neighbour" );
      MPI_Irecv( left_recieve_buff,
                 wdth * subdomain_y_size * subdomain_z_size * sizeof( T ),
@@ -948,7 +941,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 &lft_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Starting communication with the right neighbour ... " );
   if( right_neighbour != MPI_PROC_NULL )
   {
@@ -965,7 +958,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &rght_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - is RECEIVING data from the RIGHT neighbour" );
      MPI_Irecv( right_recieve_buff,
                 wdth * subdomain_y_size * subdomain_z_size * sizeof( T ),
@@ -976,7 +969,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 &rght_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Starting communication with the bottom neighbour ... " );
   if( bottom_neighbour != MPI_PROC_NULL )
   {
@@ -993,7 +986,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &lwr_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - is RECEIVING data from the BOTTOM neighbour" );
      MPI_Irecv( bottom_recieve_buff,
                 wdth * subdomain_y_size * subdomain_z_size * sizeof( T ),
@@ -1021,7 +1014,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &uppr_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - RECEIVING data from the TOP neighbour" );
      MPI_Irecv( top_recieve_buff,
                 wdth * subdomain_y_size * subdomain_z_size * sizeof( T ),
@@ -1032,7 +1025,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 &uppr_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Starting communication with the closer neighbour ... " );
   if( closer_neighbour != MPI_PROC_NULL )
   {
@@ -1049,7 +1042,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &clsr_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - is RECEIVING data from the CLOSER neighbour" );
      MPI_Irecv( closer_recieve_buff,
                 wdth * subdomain_x_size * subdomain_y_size * sizeof( T ),
@@ -1077,7 +1070,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &frth_snd_rqst );
-     
+ 
      dbgCout( "Node ( " << node_x_pos << ", " << node_y_pos << ", " << node_z_pos << " ) - is RECEIVING data from the FURTHER neighbour" );
      MPI_Irecv( further_recieve_buff,
                 wdth * subdomain_x_size * subdomain_y_size * sizeof( T ),
@@ -1088,7 +1081,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 &frth_rcv_rqst );
   }
   dbgMPIBarrier;
-  
+ 
   int wdth_2 = wdth * wdth;
   /*
   // starting communication with lower left neighbour
@@ -1106,7 +1099,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &lwr_lft_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the BOTTOM LEFT neighbour." );
      MPI_Irecv( bottom_left_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -1117,7 +1110,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 &lwr_lft_rcv_rqst );
   }
   DBG_MPI_BARRIER;
-  
+ 
   // starting communication with lower right neighbour
   if( right_bottom_neighbour != MPI_PROC_NULL )
   {
@@ -1133,7 +1126,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &lwr_rght_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the BOTTOM RIGHT neighbour." );
      MPI_Irecv( bottom_right_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -1160,7 +1153,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &uppr_lft_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the TOP LEFT neighbour." );
      MPI_Irecv( top_left_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -1187,7 +1180,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
                 0,
                 mesh_comm,
                 &uppr_rght_snd_rqst );
-     
+ 
      dbgCout( "node ( " << node_x_pos << ", " << node_y_pos << " ) - RECEIVING small square from the TOP RIGHT neighbour." );
      MPI_Irecv( top_right_recieve_buff,
                 wdth_2 * sizeof( T ),
@@ -1213,7 +1206,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &lft_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Finishing communication with the right neighbour ..." );
   if( right_neighbour != MPI_PROC_NULL )
   {
@@ -1227,7 +1220,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &rght_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Finishing communication with the lower neighbour ... " );
   if( bottom_neighbour != MPI_PROC_NULL )
   {
@@ -1241,7 +1234,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &lwr_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Finishing communication with the upper neighbour ..." );
   if( top_neighbour != MPI_PROC_NULL )
   {
@@ -1255,7 +1248,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &uppr_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Finishing communication with the closer neighbour ... " );
   if( closer_neighbour != MPI_PROC_NULL )
   {
@@ -1269,7 +1262,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &clsr_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
+ 
   dbgCout( "Finishing communication with the further neighbour ... " );
   if( further_neighbour != MPI_PROC_NULL )
   {
@@ -1283,8 +1276,8 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &frth_snd_rqst, &status );
   }
   dbgMPIBarrier;
-  
-  
+ 
+ 
   /*
   // finishing communication with the lower left neighbour
   if( left_bottom_neighbour != MPI_PROC_NULL  )
@@ -1324,7 +1317,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      MPI_Wait( &uppr_rght_snd_rqst, &status );
   }
   DBG_MPI_BARRIER;
-  
+ 
   // finishing communication with the upper left neighbour
   if( left_top_neighbour != MPI_PROC_NULL )
   {
@@ -1336,7 +1329,7 @@ void tnlMPIMesh< 3, Real, Device, Index > :: Synchronize( tnlGridOld< 3, Real, D
      //      top_left_recieve_buff[ j * wdth + i ];
      MPI_Wait( &uppr_lft_snd_rqst, &status );
   }*/
-  
+ 
   dbgCout( "Synchronisation done..." );
   dbgMPIBarrier;
 #endif
diff --git a/src/legacy/matrices/tnlAdaptiveRgCSRMatrix.h b/src/legacy/matrices/tnlAdaptiveRgCSRMatrix.h
index ac14fc2576462d6831915b6ac90ea4ff2b13e51c..d48cc8fe79a66390c37709e97b0f2a2c01931910 100644
--- a/src/legacy/matrices/tnlAdaptiveRgCSRMatrix.h
+++ b/src/legacy/matrices/tnlAdaptiveRgCSRMatrix.h
@@ -6,14 +6,7 @@
     email                : hellemar@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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLARgCSRMATRIX_H_
@@ -337,7 +330,7 @@ bool tnlAdaptiveRgCSRMatrix< Real, Device, Index > :: copyFrom( const tnlCSRMatr
   dbgFunctionName( "tnlAdaptiveRgCSRMatrix< Real, tnlHost >", "copyFrom" );
   if( ! this->setSize( csrMatrix. getSize() ) )
           return false;
-  
+ 
   if( Device :: getDevice() == tnlHostDevice )
   {
       Index nonzerosInGroup( 0 );
@@ -595,15 +588,15 @@ bool tnlAdaptiveRgCSRMatrix< Real, Device, Index > :: copyFrom( const tnlAdaptiv
    cudaBlockSize = adaptiveRgCSRMatrix. cudaBlockSize;
    lastNonzeroElement = adaptiveRgCSRMatrix. lastNonzeroElement;
    numberOfGroups = adaptiveRgCSRMatrix. numberOfGroups;
-  
+ 
 
    if( ! this->setSize( adaptiveRgCSRMatrix. getSize() ) )
-      return false;   
+      return false;
 
    /****
     * Allocate the non-zero elements (they contains some artificial zeros.)
     */
-   Index total_elements = adaptiveRgCSRMatrix. getNonzeroElements() + 
+   Index total_elements = adaptiveRgCSRMatrix. getNonzeroElements() +
                           adaptiveRgCSRMatrix. getArtificialZeroElements() ;
    dbgCout( "Allocating " << total_elements << " elements.");
    if( ! setNonzeroElements( total_elements ) )
@@ -926,7 +919,7 @@ void tnlAdaptiveRgCSRMatrix< Real, Device, Index > :: printOutGroup( ostream& st
 
 template< typename Real, typename Device, typename Index >
 void tnlAdaptiveRgCSRMatrix< Real, Device, Index > :: printOut( ostream& str,
-                                                                const tnlString& name, 
+                                                                const tnlString& name,
                                                                 const tnlString& format,
 		                                                          const Index lines ) const
 {
diff --git a/src/legacy/matrices/tnlCSRMatrix.h b/src/legacy/matrices/tnlCSRMatrix.h
index 73e3d9f2e665a56fe0155e05f35246c0ada346f0..5a4385ad0a26d1750e21e2e37d8b26e52f66109e 100644
--- a/src/legacy/matrices/tnlCSRMatrix.h
+++ b/src/legacy/matrices/tnlCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCSRMATRIX_H_
 #define TNLCSRMATRIX_H_
@@ -743,9 +736,9 @@ bool tnlCSRMatrix< Real, Device, Index > :: save( tnlFile& file ) const
    if( ! row_offsets. save( file ) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< const Index, tnlHost >( &last_nonzero_element ) )
-#else      
+#else
    if( ! file. write( &last_nonzero_element ) )
-#endif      
+#endif
       return false;
    return true;
 };
@@ -759,9 +752,9 @@ bool tnlCSRMatrix< Real, Device, Index > :: load( tnlFile& file )
    if( ! row_offsets. load( file ) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< Index, tnlHost >( &last_nonzero_element ) )
-#else      
+#else
    if( ! file. read( &last_nonzero_element ) )
-#endif      
+#endif
       return false;
    return true;
 };
@@ -798,7 +791,7 @@ tnlCSRMatrix< Real, Device, Index >& tnlCSRMatrix< Real, Device, Index > :: oper
 
 template< typename Real, typename Device, typename Index >
 void tnlCSRMatrix< Real, Device, Index > :: printOut( ostream& str,
-                                                      const tnlString& name, 
+                                                      const tnlString& name,
                                                       const tnlString& format,
 		                                                const Index lines ) const
 {
diff --git a/src/legacy/matrices/tnlCusparseCSRMatrix.h b/src/legacy/matrices/tnlCusparseCSRMatrix.h
index e993b1727bfc549404e06c5761f7af60f304cc1b..dea06912b480eb10c1d136e7e81e1ba3de6a10be 100644
--- a/src/legacy/matrices/tnlCusparseCSRMatrix.h
+++ b/src/legacy/matrices/tnlCusparseCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLCUSPARSECSRMATRIX_H
diff --git a/src/legacy/matrices/tnlEllpackMatrix.h b/src/legacy/matrices/tnlEllpackMatrix.h
index 118a7b393ed9b4e4d9d8f2996d3ba64b9c86bdd6..e41e20e23ffc842f6e74f0cf5bf5cffc52dec4c7 100644
--- a/src/legacy/matrices/tnlEllpackMatrix.h
+++ b/src/legacy/matrices/tnlEllpackMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLELLPACKMATRIX_H_
 #define TNLELLPACKMATRIX_H_
diff --git a/src/legacy/matrices/tnlEllpackMatrixCUDA.h b/src/legacy/matrices/tnlEllpackMatrixCUDA.h
index 95aef4d66a8ec2f6772d169f9d9a0e39cfe4c45d..87834b294be69b7b31c9865f5699b3d336499aab 100644
--- a/src/legacy/matrices/tnlEllpackMatrixCUDA.h
+++ b/src/legacy/matrices/tnlEllpackMatrixCUDA.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLELLPACKMATRIXCUDA_H_
 #define TNLELLPACKMATRIXCUDA_H_
diff --git a/src/legacy/matrices/tnlFastCSRMatrix.h b/src/legacy/matrices/tnlFastCSRMatrix.h
index 4faf3e7509da8ff43fd37a77c7a3bbb056c8b060..08962def960b5eb3b3e6438e753b8105011d1d31 100644
--- a/src/legacy/matrices/tnlFastCSRMatrix.h
+++ b/src/legacy/matrices/tnlFastCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLFASTCSRMATRIX_H_
 #define TNLFASTCSRMATRIX_H_
diff --git a/src/legacy/matrices/tnlFastRgCSRMatrix.h b/src/legacy/matrices/tnlFastRgCSRMatrix.h
index 44e4b287b9b2f9a4c741990372f3ad1dd371b96a..569beb9cdd4ecbe68b1d9906ed4c2085472ba575 100644
--- a/src/legacy/matrices/tnlFastRgCSRMatrix.h
+++ b/src/legacy/matrices/tnlFastRgCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLFastRgCSRMATRIX_H_
 #define TNLFastRgCSRMATRIX_H_
@@ -610,7 +603,7 @@ void tnlFastRgCSRMatrix< Real, tnlHost, Index > :: vectorProduct( const tnlVecto
 
 template< typename Real, typename Index >
 void tnlFastRgCSRMatrix< Real, tnlHost, Index > :: printOut( ostream& str,
-                                                             const tnlString& name, 
+                                                             const tnlString& name,
 		                                                       const Index lines ) const
 {
    str << "Structure of tnlFastRgCSRMatrix" << endl;
diff --git a/src/legacy/matrices/tnlFastRgCSRMatrixCUDA.h b/src/legacy/matrices/tnlFastRgCSRMatrixCUDA.h
index 643531c294a7e3f3c9fb0c0e17042b0f9871bdd4..c567c1130126230734d88f299fad2811c84a1fe5 100644
--- a/src/legacy/matrices/tnlFastRgCSRMatrixCUDA.h
+++ b/src/legacy/matrices/tnlFastRgCSRMatrixCUDA.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLFastRgCSRMATRIXCUDA_H_
 #define TNLFastRgCSRMATRIXCUDA_H_
diff --git a/src/legacy/matrices/tnlFullMatrix.h b/src/legacy/matrices/tnlFullMatrix.h
index 1c81fd60eb15a216a46504e389e8b871a96b9d2f..8b4bb677cd4ada00572ffc6b2b013b60512cc556 100644
--- a/src/legacy/matrices/tnlFullMatrix.h
+++ b/src/legacy/matrices/tnlFullMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlFullMatrixH
 #define tnlFullMatrixH
@@ -51,7 +44,7 @@ class tnlFullMatrix : public tnlMatrix< Real, Device, Index >,
    Index getNonzeroElements() const;
 
    Index getSize() const;
-   
+ 
    Real getElement( Index i, Index j ) const;
 
    bool setElement( Index i, Index j, const Real& v );
@@ -296,7 +289,7 @@ void MatrixProduct( const tnlFullMatrix< Real, tnlHost, Index >& m1,
       {
          Real res( 0.0 );
          for( Index k = 0; k < size; k ++ )
-            res += m1( i, k ) * m2( k, j ); 
+            res += m1( i, k ) * m2( k, j );
          result( i, j ) = res;
       }
 };
diff --git a/src/legacy/matrices/tnlMatrix.cpp b/src/legacy/matrices/tnlMatrix.cpp
index 42928b86ae0d435a9ad9d4d12dec8380e040b58d..679c9f1754020304f10a2860f3057cf5b320baac 100644
--- a/src/legacy/matrices/tnlMatrix.cpp
+++ b/src/legacy/matrices/tnlMatrix.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlMatrix.h"
 
diff --git a/src/legacy/matrices/tnlMatrix.h b/src/legacy/matrices/tnlMatrix.h
index f3c2afdc563f4e792b42caa2483a43fd80c9b5c6..941c739c11d28e667442a73ff79758f833082f0d 100644
--- a/src/legacy/matrices/tnlMatrix.h
+++ b/src/legacy/matrices/tnlMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMatrixH
 #define tnlMatrixH
@@ -21,7 +14,7 @@
 #include <ostream>
 #include <iomanip>
 #include <string.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlString.h>
 #include <core/tnlList.h>
 #include <core/tnlFile.h>
@@ -89,10 +82,10 @@ class tnlMatrix : public tnlObject
    virtual bool setElement( Index row, Index column, const Real& v ) = 0;
 
    virtual bool addToElement( Index row, Index column, const Real& v ) = 0;
-   
+ 
    virtual Real rowProduct( const Index row,
                             const tnlVector< Real, Device, Index >& vec ) const = 0;
-   
+ 
    template< typename Vector1, typename Vector2 >
    void vectorProduct( const Vector1& vec,
                        Vector2& result ) const{}
@@ -240,9 +233,9 @@ bool tnlMatrix< Real, Device, Index > :: save( tnlFile& file ) const
    if( ! tnlObject :: save( file ) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< const Index, tnlHost >( &size ) )
-#else      
+#else
    if( ! file. write( &size ) )
-#endif      
+#endif
       return false;
    return true;
 }
@@ -253,9 +246,9 @@ bool tnlMatrix< Real, Device, Index > :: load( tnlFile& file )
    if( ! tnlObject :: load( file ) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< Index, tnlHost >( &size ) )
-#else      
+#else
    if( ! file. read( &size ) )
-#endif      
+#endif
       return false;
    return true;
 }
@@ -432,7 +425,7 @@ bool tnlMatrix< Real, Device, Index > :: sortRowsDecreasingly( tnlVector< Index,
    for( Index i = 0; i < matrixSize; i ++ )
    {
       tnlAssert( this->getNonzeroElementsInRow( i ) <= matrixSize,
-                 cerr << "getNonzeroElementsInRow( " << i << " ) = " << getNonzeroElementsInRow( i ) 
+                 cerr << "getNonzeroElementsInRow( " << i << " ) = " << getNonzeroElementsInRow( i )
                       << "; matrixSize = " << matrixSize );
       permutation[ this->getNonzeroElementsInRow( i ) ] ++;
    }
diff --git a/src/legacy/matrices/tnlPETSCMatrix.h b/src/legacy/matrices/tnlPETSCMatrix.h
index c8db5705ea50489689709582395cdf7416155d4a..88fb2a1a81e1304bd8c33c1c098314e9f45f7639 100644
--- a/src/legacy/matrices/tnlPETSCMatrix.h
+++ b/src/legacy/matrices/tnlPETSCMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlPETSCMatrixH
 #define tnlPETSCMatrixH
@@ -66,7 +59,7 @@ template< typename T > class tnlPETSCMatrix : public tnlMatrix< T >
    {
       return tnlMatrixClass :: petsc;
    };
-   
+ 
    void GetData( Mat& _matrix )
    {
 #ifdef HAVE_PETSC
@@ -75,7 +68,7 @@ template< typename T > class tnlPETSCMatrix : public tnlMatrix< T >
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
 #endif
    }
-   
+ 
    int getSize() const
    {
       return size;
@@ -124,10 +117,10 @@ template< typename T > class tnlPETSCMatrix : public tnlMatrix< T >
       return false;
 #endif
    };
-   
+ 
    T rowProduct( const int row,
                  const tnlVector< T >& vec ) const {};
-   
+ 
    void vectorProduct( const tnlVector< T >&* vec,
                        tnlVector< T >&* result ) const
    {
@@ -135,20 +128,20 @@ template< typename T > class tnlPETSCMatrix : public tnlMatrix< T >
       Vec petsc_vec, petsc_res;
       VecCreateSeqWithArray( MPI_COMM_SELF, size, vec, &petsc_vec );
       VecCreateSeqWithArray( MPI_COMM_SELF, size, result, &petsc_res );
-      
+ 
       MatAssemblyBegin( matrix, MAT_FINAL_ASSEMBLY );
       MatAssemblyEnd( matrix, MAT_FINAL_ASSEMBLY );
-      
+ 
       MatMult( matrix, petsc_vec, petsc_res );
-      
+ 
       VecDestroy( petsc_vec );
       VecDestroy( petsc_res );
 #else
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
 #endif
-      
+ 
    };
-   
+ 
    T getRowL1Norm( int row ) const {};
 
    void multiplyRow( int row, const T& value ) {};
diff --git a/src/legacy/matrices/tnlRgCSRMatrix.h b/src/legacy/matrices/tnlRgCSRMatrix.h
index c7d5faeeb8642a7f45013309ad179e482790f0d3..a1e84697502f734635677b8c3d1728a019e377d3 100644
--- a/src/legacy/matrices/tnlRgCSRMatrix.h
+++ b/src/legacy/matrices/tnlRgCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLRGCSRMATRIX_H
@@ -513,7 +506,7 @@ copyFrom( const tnlRgCSRMatrix< Real, Device2, Index >& rgCSRMatrix )
    /****
     * Allocate the non-zero elements (they contains some artificial zeros.)
     */
-   Index total_elements = rgCSRMatrix. getNonzeroElements() + 
+   Index total_elements = rgCSRMatrix. getNonzeroElements() +
                           rgCSRMatrix. getArtificialZeroElements();
    dbgCout( "Allocating " << total_elements << " elements.");
    if( ! setNonzeroElements( total_elements ) )
diff --git a/src/legacy/mesh/tnlDistributedGrid.h b/src/legacy/mesh/tnlDistributedGrid.h
index cd9d96b3be2b6bd75bbb42c508dce438d8c7d13e..92869db7d8c4da8969422c98bfb494ddfa64d5af 100644
--- a/src/legacy/mesh/tnlDistributedGrid.h
+++ b/src/legacy/mesh/tnlDistributedGrid.h
@@ -6,19 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLDISTRIBUTEDGRID_H_
 #define TNLDISTRIBUTEDGRID_H_
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlCommunicator.h>
 
 template< int Dimensions,
diff --git a/src/legacy/solvers/tnlBICGSolver.h b/src/legacy/solvers/tnlBICGSolver.h
index 255aa5f73c768b66549fb892ccc0477d16fd12e9..9128889f104268a1adcad352bb8f73f1298047db 100644
--- a/src/legacy/solvers/tnlBICGSolver.h
+++ b/src/legacy/solvers/tnlBICGSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlBICGSolverH
 #define tnlBICGSolverH
@@ -35,10 +28,10 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
    {
       A_T = _A_T;
    };
-   
+ 
    bool Solve( const tnlMatrix< T >& A,
                const T* b,
-               T* x, 
+               T* x,
                const double& max_residue,
                const int max_iterations,
                tnlPreconditioner< T >* precond = 0 )
@@ -60,17 +53,17 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
 
       // r_0 = b - A x_0, p_0 = r_0
       // r^ast_0 = r_0, p^ast_0 = r^ast_0
-      
+ 
       //dbgCout( "Computing Ax" );
       A. VectorProduct( x, r );
-      
+ 
       //dbgCout( "Computing r_0, r_ast_0, p_0 and p_ast_0..." );
       for( i = 0; i < size; i ++ )
-         r[ i ] = r_ast[ i ] = 
+         r[ i ] = r_ast[ i ] =
          p[ i ] = p_ast[ i ] = b[ i ] - r[ i ];
-      
+ 
 
-      while( tnlMatrixSolver< T > :: iteration < max_iterations && 
+      while( tnlMatrixSolver< T > :: iteration < max_iterations &&
              tnlMatrixSolver< T > :: residue > max_residue )
       {
          //dbgCout( "Starting BiCG iteration " << iter + 1 );
@@ -88,7 +81,7 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
          }
          if( s2 == 0.0 ) alpha = 0.0;
          else alpha = s1 / s2;
-         
+ 
          // x_{j+1} = x_j + alpha_j * p_j
          // r_{j+1} = r_j - alpha_j * A * p_j
          //dbgCout( "Computing new x and new r." );
@@ -97,7 +90,7 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
             x[ i ] += alpha * p[ i ];
             r_new[ i ] = r[ i ] - alpha * tmp[ i ];
          }
-         
+ 
          //dbgCout( "Computing (A^T)p." );
          A_T -> VectorProduct( p_ast, tmp );
 
@@ -121,7 +114,7 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
             p[ i ] = r_new[ i ] + beta * p[ i ];
             p_ast[ i ] = r_ast_new[ i ] + beta * p_ast[ i ];
          }
-         
+ 
          T* q;
          q = r_new;
          r_new = r;
@@ -129,17 +122,17 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
          q = r_ast_new;
          r_ast_new = r_ast;
          r_ast = q;
-         
+ 
          if( tnlMatrixSolver< T > :: iteration % 10 == 0 )
          {
             tnlMatrixSolver< T > :: residue = GetResidue( A, b, x, b_norm, tmp );
-            if( tnlMatrixSolver< T > :: verbosity > 1 ) 
+            if( tnlMatrixSolver< T > :: verbosity > 1 )
                tnlMatrixSolver< T > :: PrintOut();
          }
          tnlMatrixSolver< T > :: iteration ++;
       }
       tnlMatrixSolver< T > :: residue = GetResidue( A, b, x, b_norm, r );
-      if( tnlMatrixSolver< T > :: verbosity > 0 ) 
+      if( tnlMatrixSolver< T > :: verbosity > 0 )
          tnlMatrixSolver< T > :: PrintOut();
    };
 
@@ -154,7 +147,7 @@ template< typename T > class tnlBICGSolver : public tnlMatrixSolver< T >
                       const T* b,
                       const T* x,
                       const T& b_norm,
-                      T* tmp ) 
+                      T* tmp )
    {
       A. VectorProduct( x, tmp );
       T res = 0.0;
diff --git a/src/legacy/solvers/tnlBICGStabSolver.h b/src/legacy/solvers/tnlBICGStabSolver.h
index 0496b3262153aebdedd2b04089e1d563bccb29aa..05d736afcea2ff40f0b399c829260b2950066a49 100644
--- a/src/legacy/solvers/tnlBICGStabSolver.h
+++ b/src/legacy/solvers/tnlBICGStabSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlBICGStabSolverOldH
 #define tnlBICGStabSolverOldH
@@ -34,7 +27,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
 
    bool Solve( const tnlMatrix< T >& A,
                const T* b,
-               T* x, 
+               T* x,
                const double& max_residue,
                const int max_iterations,
                tnlPreconditioner< T >* precond = 0 )
@@ -44,15 +37,15 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
 
       tnlMatrixSolver< T > :: residue =  max_residue + 1.0;
       tnlMatrixSolver< T > :: iteration = 0;
-      
+ 
       T alpha, beta, omega, s1, s2, rho( 0.0 ), b_norm( 0.0 );
       int i;
       // r_0 = b - A x_0, p_0 = r_0
       // r^ast_0 = r_0
-      
+ 
       dbgCout( "Computing Ax" );
       A. VectorProduct( x, r );
-      
+ 
       dbgCout( "Computing r_0, r_ast_0, p_0 and b_norm ..." );
       /*if( M )
       {
@@ -78,9 +71,9 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
          }
       if( b_norm == 0.0 ) b_norm = 1.0;
       //dbgExpr( b_norm );
-      
+ 
 
-      while( tnlMatrixSolver< T > :: iteration < max_iterations && 
+      while( tnlMatrixSolver< T > :: iteration < max_iterations &&
              tnlMatrixSolver< T > :: residue > max_residue )
       {
          //dbgCout( "Starting BiCGStab iteration " << iter + 1 );
@@ -96,7 +89,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
          }
          else*/
              A. VectorProduct( p, Ap );
-      
+ 
          //dbgCout( "Computing alpha" );
          s2 = 0.0;
          for( i = 0; i < size; i ++ )
@@ -135,7 +128,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
          if( s2 == 0.0 ) omega = 0.0;
          else omega = s1 / s2;
          //dbgExpr( omega );
-         
+ 
          //DrawVector( "p", p, ( m_int ) sqrt( ( m_real ) size ) );
          //DrawVector( "s", s, ( m_int ) sqrt( ( m_real ) size ) );
          // x_{j+1} = x_j + alpha_j * p_j + omega_j * s_j
@@ -148,7 +141,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
          }
          //DrawVector( "x", x, ( m_int ) sqrt( ( m_real ) size ) );
          //DrawVector( "r", r, ( m_int ) sqrt( ( m_real ) size ) );
-         
+ 
          // beta = alpha_j / omega_j * ( r_{j+1}, r^ast_0 ) / ( r_j, r^ast_0 )
          s1 = 0.0;
          for( i = 0; i < size; i ++ )
@@ -157,7 +150,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
          else beta = ( s1 / rho ) * ( alpha / omega );
          rho = s1;
 
-         // p_{j+1} = r_{j+1} + beta_j * ( p_j - omega_j * A p_j )     
+         // p_{j+1} = r_{j+1} + beta_j * ( p_j - omega_j * A p_j )
          tnlMatrixSolver< T > :: residue = 0.0;
          for( i = 0; i < size; i ++ )
          {
@@ -167,14 +160,14 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
             //dbgExpr( res );
          }
          tnlMatrixSolver< T > :: residue = sqrt( tnlMatrixSolver< T > :: residue / b_norm );
-         
+ 
          if( tnlMatrixSolver< T > :: iteration % 10 == 0 &&
-             tnlMatrixSolver< T > :: verbosity > 1 ) 
+             tnlMatrixSolver< T > :: verbosity > 1 )
                   tnlMatrixSolver< T > :: PrintOut();
          tnlMatrixSolver< T > :: iteration ++;
       }
       tnlMatrixSolver< T > :: residue = GetResidue( A, b, x, b_norm, r );
-      if( tnlMatrixSolver< T > :: verbosity > 0 ) 
+      if( tnlMatrixSolver< T > :: verbosity > 0 )
          tnlMatrixSolver< T > :: PrintOut();
    };
 
@@ -189,7 +182,7 @@ template< typename T > class tnlBICGStabSolverOld : public tnlMatrixSolver< T >
                       const T* b,
                       const T* x,
                       const T& b_norm,
-                      T* tmp ) 
+                      T* tmp )
    {
       A. VectorProduct( x, tmp );
       T res = 0.0;
diff --git a/src/legacy/solvers/tnlCGSolver.h b/src/legacy/solvers/tnlCGSolver.h
index 461b25cf81ce365b176fc0fc5c731d49078497dc..01ee8ac5bbbbf78da753241c6ff07b12c2dc6eed 100644
--- a/src/legacy/solvers/tnlCGSolver.h
+++ b/src/legacy/solvers/tnlCGSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlCGSolverH
 #define tnlCGSolverH
@@ -28,21 +21,21 @@ template< typename T > class tnlCGSolverOld : public tnlMatrixSolver< T >
    tnlCGSolverOld()
    : r( 0 ), new_r( 0 ), p( 0 ), Ap( 0 ), size( 0 )
    {};
-   
+ 
    bool Solve( const tnlMatrix< T >& A,
                const T* b,
-               T* x, 
+               T* x,
                const double& max_residue,
                const int max_iterations,
                tnlPreconditioner< T >* precond = 0 )
    {
       if( ! SetSize( A. GetSize() ) ) return false;
-      
+ 
       T alpha, beta, s1, s2;
       int i;
       tnlMatrixSolver< T > :: residue = max_residue + 1.0;
       tnlMatrixSolver< T > :: iteration = 0;
-      
+ 
       T b_norm( 0.0 );
       for( i = 0; i < size; i ++ )
          b_norm += b[ i ] * b[ i ];
@@ -52,14 +45,14 @@ template< typename T > class tnlCGSolverOld : public tnlMatrixSolver< T >
       A. VectorProduct( x, r );
       for( i = 0; i < size; i ++ )
          p[ i ] = r[ i ] = b[ i ] - r[ i ];
-      
+ 
 
-      while( tnlMatrixSolver< T > :: iteration < max_iterations && 
+      while( tnlMatrixSolver< T > :: iteration < max_iterations &&
              tnlMatrixSolver< T > :: residue > max_residue )
       {
          // 1. alpha_j = ( r_j, r_j ) / ( A * p_j, p_j )
          A. VectorProduct( p, Ap );
-         
+ 
          s1 = s2 = 0.0;
          for( i = 0; i < size; i ++ )
          {
@@ -69,11 +62,11 @@ template< typename T > class tnlCGSolverOld : public tnlMatrixSolver< T >
          // if s2 = 0 => p = 0 => r = 0 => we have the solution (provided A != 0)
          if( s2 == 0.0 ) alpha = 0.0;
          else alpha = s1 / s2;
-         
+ 
          // 2. x_{j+1} = x_j + \alpha_j p_j
          for( i = 0; i < size; i ++ )
             x[ i ] += alpha * p[ i ];
-         
+ 
          // 3. r_{j+1} = r_j - \alpha_j A * p_j
          for( i = 0; i < size; i ++ )
             new_r[ i ] = r[ i ] - alpha * Ap[ i ];
@@ -92,22 +85,22 @@ template< typename T > class tnlCGSolverOld : public tnlMatrixSolver< T >
          // 5. p_{j+1} = r_{j+1} + beta_j * p_j
          for( i = 0; i < size; i ++ )
             p[ i ] = new_r[ i ] + beta * p[ i ];
-     
+ 
          // 6. r_{j+1} = new_r
          T* tmp = r;
          r = new_r;
          new_r = tmp;
-         
+ 
          if( tnlMatrixSolver< T > :: iteration % 10 == 0 )
          {
             tnlMatrixSolver< T > :: residue = GetResidue( A, b, x, b_norm, tmp );
-            if( tnlMatrixSolver< T > :: verbosity > 1 ) 
+            if( tnlMatrixSolver< T > :: verbosity > 1 )
                tnlMatrixSolver< T > :: PrintOut();
          }
          tnlMatrixSolver< T > :: iteration ++;
       }
       tnlMatrixSolver< T > :: residue = GetResidue( A, b, x, b_norm, r );
-      if( tnlMatrixSolver< T > :: verbosity > 0 ) 
+      if( tnlMatrixSolver< T > :: verbosity > 0 )
          tnlMatrixSolver< T > :: PrintOut();
    };
 
@@ -122,7 +115,7 @@ template< typename T > class tnlCGSolverOld : public tnlMatrixSolver< T >
                       const T* b,
                       const T* x,
                       const T& b_norm,
-                      T* tmp ) 
+                      T* tmp )
    {
       A. VectorProduct( x, tmp );
       T res = 0.0;
diff --git a/src/legacy/solvers/tnlGMRESSolverOld.h b/src/legacy/solvers/tnlGMRESSolverOld.h
index 98d8dae911497480603596410591a9738d22763e..42687800af078ffbc6e2a39dbf8feb5a69a92859 100644
--- a/src/legacy/solvers/tnlGMRESSolverOld.h
+++ b/src/legacy/solvers/tnlGMRESSolverOld.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlGMRESSolverOldH
 #define tnlGMRESSolverOldH
@@ -90,7 +83,7 @@ tnlGMRESSolverOld< Real, Device, Index > :: tnlGMRESSolverOld( const tnlString&
   restarting( 0 )
 {
 };
-   
+ 
 template< typename Real, typename Device, typename Index >
 tnlString tnlGMRESSolverOld< Real, Device, Index > :: getType() const
 {
@@ -129,7 +122,7 @@ bool tnlGMRESSolverOld< Real, Device, Index > :: solve( const tnlMatrix< Real, D
 
 
    Index i, j = 1, k, l;
-   
+ 
    Index _size = size;
 
    Real *r = _r. getData();
@@ -184,7 +177,7 @@ bool tnlGMRESSolverOld< Real, Device, Index > :: solve( const tnlMatrix< Real, D
 
       /****
        * v = 0
-       */   
+       */
       _v. setValue( ( Real ) 0.0 );
 
       /***
@@ -192,10 +185,10 @@ bool tnlGMRESSolverOld< Real, Device, Index > :: solve( const tnlMatrix< Real, D
        */
       vi. bind( _v. getData(), size );
       vi. alphaXPlusY( ( Real ) 1.0 / beta, _r );
-                
+ 
       _s. setValue( ( Real ) 0.0 );
       _s[ 0 ] = beta;
-      
+ 
 
 
       //dbgCout( " ----------- Starting m-loop -----------------" );
@@ -207,12 +200,12 @@ bool tnlGMRESSolverOld< Real, Device, Index > :: solve( const tnlMatrix< Real, D
           */
          if( precond )
          {
-            A. vectorProduct( vi, _M_tmp );            
+            A. vectorProduct( vi, _M_tmp );
             precond -> Solve( M_tmp, w );
          }
          else
              A. vectorProduct( vi, _w );
-         
+ 
          for( k = 0; k <= i; k++ )
          {
             vk. bind( &( _v. getData()[ k * _size ] ), _size );
@@ -221,7 +214,7 @@ bool tnlGMRESSolverOld< Real, Device, Index > :: solve( const tnlMatrix< Real, D
              */
             Real H_k_i = vk. scalarProduct( _w );
             H[ k + i * ( m + 1 ) ] = H_k_i;
-            
+ 
             /****
              * w = w - H_{k,i} v_k
              */
diff --git a/src/legacy/solvers/tnlILUPreconditioner.h b/src/legacy/solvers/tnlILUPreconditioner.h
index 1053b2a7eb233c50ba3aac1cab7898a98b2fafb6..29c7b3c908cea674d27849161dbfb7ed61b1bfe5 100644
--- a/src/legacy/solvers/tnlILUPreconditioner.h
+++ b/src/legacy/solvers/tnlILUPreconditioner.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlILUPreconditionerH
 #define tnlILUPreconditionerH
@@ -26,7 +19,7 @@
 template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T >
 {
    public:
-   
+ 
    tnlILUPreconditioner( const int _size,
                        const int initial_size,
                        const int segment_size,
@@ -65,7 +58,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
       const tnlCSRMatrixOldElement< T > *A_data;
       const tnlCSRMatrixOldRowInfo *A_rows_info;
       A. Data( A_data, A_rows_info );
-      
+ 
 #ifdef ILU_DEBUG
       // 1. Copy data of A to full_M
       bzero( full_M, size * size * sizeof( T ) );
@@ -134,7 +127,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
                //return 0;
             }
          }
-        cout << "Computing ILUT ... " << 100.0 * ( float ) ( i + 1 ) / ( float ) ( size ) << "%    \r" << flush; 
+        cout << "Computing ILUT ... " << 100.0 * ( float ) ( i + 1 ) / ( float ) ( size ) << "%    \r" << flush;
          dbgExpr( i );
          //dbgExpr( * M );
       }
@@ -146,7 +139,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
       /*file. open( "orig_full_M2", ios :: out );
       WriteFullMatrix( file, full_M, size );
       file. close();*/
-      
+ 
       /*file. open( "M", ios :: out );
       file << *M << endl;
       file. close();*/
@@ -202,7 +195,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
                fabs( full_M[ i * size + j ] - ( *M )( i, j ) ) << endl;
                break;
             }
-      
+ 
       /*cout << "Checking  if LU = A" << endl;
       // check whether L U == A
       for( i = 0; i < size; i ++ )
@@ -230,9 +223,9 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
 #ifdef CSR_MATRIX_TUNING
       M -> PrintStatistics();
 #endif
-      return 1;  
-      
-        
+      return 1;
+ 
+ 
       /*
       // For i = 1 ... n - 1
       for( i = 1; i < size; i ++ )
@@ -265,7 +258,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
 
    }
 
-   
+ 
    bool Solve( const T* b, T* x ) const
    {
       dbgFunctionName( "tnlILUPreconditioner", "Solve" );
@@ -274,7 +267,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
       const tnlCSRMatrixOldRowInfo *M_rows_info;
       M -> Data( M_data, M_rows_info );
       int i, j;
-      
+ 
       dbgCout( "Solving Ly = b" );
       // L is unit lower triangular
       for( i = 0; i < size; i ++ )
@@ -290,7 +283,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
          //for( j = 0; j < i; j ++ )
          //   y[ i ] -= y[ j ] * ( * M )( i, j );
       }
-      
+ 
       dbgCout( "Solving Ux = y" );
       for( i = size - 1; i >=0 ; i -- )
       {
@@ -303,7 +296,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
               j < i_row_end && ( col = M_data[ j ]. column ) != -1;
               j ++ )
             x[ i ] -= x[ col ] * M_data[ j ]. value;
-         
+ 
          assert( M_data[ i_row_beg ]. value != 0.0 );
          x[ i ] /= M_data[ i_row_beg ]. value;
          //for( j = i + 1; j < size; j ++ )
@@ -317,7 +310,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
          for( j = 0; j < i; j ++ )
             y[ i ] -= y[ j ] * full_M[ i * size + j ];
       }
-      
+ 
       dbgCout( "Solving Ux = y" );
       for( i = size - 1; i >=0 ; i -- )
       {
@@ -329,7 +322,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
 #endif
       return true;
    }
-   
+ 
    ~tnlILUPreconditioner()
    {
       if( M ) delete M;
@@ -347,7 +340,7 @@ template< typename T > class tnlILUPreconditioner : public tnlPreconditioner< T
    T* y;
 
    int size;
-   
+ 
 #ifdef ILU_DEBUG
    T* full_M, *ilu_check;
 #endif
diff --git a/src/legacy/solvers/tnlMatrixSolver.h b/src/legacy/solvers/tnlMatrixSolver.h
index 21077d1432951197196451d1e065426e2420e498..2d1983035e539f259e43ec6a526b3a1a07891983 100644
--- a/src/legacy/solvers/tnlMatrixSolver.h
+++ b/src/legacy/solvers/tnlMatrixSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMatrixSolverH
 #define tnlMatrixSolverH
@@ -21,7 +14,7 @@
 #include <core/tnlTimerCPU.h>
 #include <core/tnlTimerRT.h>
 #include <core/mpi-supp.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <matrices/tnlMatrix.h>
 #include <legacy/solvers/tnlPreconditioner.h>
 
@@ -41,7 +34,7 @@ class tnlMatrixSolver : public tnlObject
    void setTimerCPU( tnlTimerCPU* timer );
 
    void setTimerRT( tnlTimerRT* timer );
-   
+ 
    virtual void printOut();
 
    virtual bool solve( const tnlMatrix< Real, Device, Index >& A,
@@ -65,11 +58,11 @@ class tnlMatrixSolver : public tnlObject
    Real residue;
 
    MPI_Comm solver_comm;
-   
+ 
    int verbosity;
 
    tnlTimerCPU* cpu_timer;
-   
+ 
    tnlTimerRT* rt_timer;
 
 };
diff --git a/src/legacy/solvers/tnlPETSCPreconditioner.h b/src/legacy/solvers/tnlPETSCPreconditioner.h
index 126877fc9462f7afc617a74e01418689f2b3f9c8..76cd9d408cb3d8f26b9bbef9024cd05af4759660 100644
--- a/src/legacy/solvers/tnlPETSCPreconditioner.h
+++ b/src/legacy/solvers/tnlPETSCPreconditioner.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlPETSCPreconditionerH
 #define tnlPETSCPreconditionerH
@@ -53,7 +46,7 @@ template< typename T > class tnlPETSCPreconditioner : public tnlPreconditioner<
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
 #endif
    };
-   
+ 
    void GetData( PC& precond ) const
    {
 #ifdef HAVE_PETSC
@@ -62,7 +55,7 @@ template< typename T > class tnlPETSCPreconditioner : public tnlPreconditioner<
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
 #endif
    };
-   
+ 
    bool Solve( const T* b, T* x ) const
    {
       cerr << "Do not call tnlPETSCPreconditioner :: Solve. Connect it to tnlPETSCSolver using tnlPETSCPreconditioner :: GetData( PC& precond )." << endl;
diff --git a/src/legacy/solvers/tnlPETSCSolver.h b/src/legacy/solvers/tnlPETSCSolver.h
index f234e83f99bdabc06278d43a73aa28551f31448e..799c1857bdf9b2ccfa73ad0b5929e067f47576b9 100644
--- a/src/legacy/solvers/tnlPETSCSolver.h
+++ b/src/legacy/solvers/tnlPETSCSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlPETSCSolverH
 #define tnlPETSCSolverH
@@ -66,7 +59,7 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
 #endif
    };
-   
+ 
    void PrintOut()
    {
 #ifdef HAVE_PETSC
@@ -84,7 +77,7 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
 
    bool Solve( const tnlMatrix< T >& A,
                const T* b,
-               T* x, 
+               T* x,
                const double& max_residue,
                const int max_iterations,
                tnlPreconditioner< T >* precond = 0 )
@@ -98,12 +91,12 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
 
       MatAssemblyBegin( matrix, MAT_FINAL_ASSEMBLY );
       MatAssemblyEnd( matrix, MAT_FINAL_ASSEMBLY );
-      
+ 
       const int size = petsc_matrix -> getSize();
 
       VecCreateSeqWithArray( MPI_COMM_SELF, size, x, &petsc_x );
       VecCreateSeqWithArray( MPI_COMM_SELF, size, b, &petsc_b );
-      
+ 
       T normb;
       int i;
       for( i = 0; i < size; i ++ )
@@ -111,9 +104,9 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
          normb += b[ i ] * b[ i ];
       }
       normb = sqrt( normb );
-      
+ 
       KSPGMRESSetCGSRefinementType( petsc_solver, KSP_GMRES_CGS_REFINE_IFNEEDED );
-      
+ 
       KSPMonitorSet( petsc_solver, PETSCSolverMonitorCallback< T >, this, PETSC_NULL );
 
       KSPSetTolerances( petsc_solver, max_residue, PETSC_DEFAULT, PETSC_DEFAULT, max_iterations );
@@ -126,7 +119,7 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
       //PCFactorSetUseDropTolerance( pc, 1.0e-10, 0.1, 100 );
       PCFactorSetShiftPd( pc, PETSC_TRUE );
 
-      KSPSolve( petsc_solver, petsc_b, petsc_x); 
+      KSPSolve( petsc_solver, petsc_b, petsc_x);
 
       VecDestroy( petsc_x );
       VecDestroy( petsc_b );
@@ -134,15 +127,15 @@ template< typename T > class tnlPETSCSolver : public tnlMatrixSolver< T >
       PetscInt its;
       KSPGetIterationNumber( petsc_solver, &its );
       tnlMatrixSolver< T > :: iteration = its;
-      
+ 
       if( tnlMatrixSolver< T > :: iteration < 0 ) return false;
-      
+ 
       PetscReal res;
       KSPGetResidualNorm( petsc_solver, &res );
       tnlMatrixSolver< T > :: residue = res / normb;
-      
+ 
       //KSPDestroy( petsc_solver );
-      
+ 
       return true;
 #else
       cerr << "Missing support for PETSC at the file " << __FILE__ << " line " << __LINE__ << endl;
@@ -167,7 +160,7 @@ template< typename T > inline PetscErrorCode PETSCSolverMonitorCallback( KSP ksp
 {
    tnlPETSCSolver< T >* petsc_solver = ( tnlPETSCSolver< T > * ) ctx;
    petsc_solver -> PrintOut();
-      
+ 
    return 0;
 }
 #endif
diff --git a/src/legacy/solvers/tnlPreconditioner.h b/src/legacy/solvers/tnlPreconditioner.h
index c36bbb9431dc15516937d906be41d9fa904b6ace..cff0ead3f1323a052ee77596e18c4940d78c688b 100644
--- a/src/legacy/solvers/tnlPreconditioner.h
+++ b/src/legacy/solvers/tnlPreconditioner.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlPreconditionerH
 #define tnlPreconditionerH
diff --git a/src/legacy/solvers/tnlSORSolver.h b/src/legacy/solvers/tnlSORSolver.h
index 4cb3e4c97a330dba100faad6664a3fa436a2631c..ec4372e888e7d9c0999c04d082c77b532e69a824 100644
--- a/src/legacy/solvers/tnlSORSolver.h
+++ b/src/legacy/solvers/tnlSORSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlSORSolverOldH
 #define tnlSORSolverOldH
@@ -25,7 +18,7 @@ template< typename Real, typename Device = tnlHost, typename Index = int >
 class tnlSORSolverOld : public tnlMatrixSolver< Real, Device, Index >
 {
    public:
-   
+ 
    tnlSORSolverOld( const tnlString& name );
 
    tnlString getType() const;
diff --git a/src/tnl-benchmarks.cpp b/src/legacy/tnl-benchmarks.cpp
similarity index 72%
rename from src/tnl-benchmarks.cpp
rename to src/legacy/tnl-benchmarks.cpp
index 8a6f86c51d5a5dcea9c0849a7a2046af9ce8be1d..16ce4ae5fe784e7f654631af0fe13f6207fdeff2 100644
--- a/src/tnl-benchmarks.cpp
+++ b/src/legacy/tnl-benchmarks.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlTimerRT.h>
 #include <core/vectors/tnlVector.h>
diff --git a/src/tnl-benchmarks.h b/src/legacy/tnl-benchmarks.h
similarity index 93%
rename from src/tnl-benchmarks.h
rename to src/legacy/tnl-benchmarks.h
index 9bb1727a4d9227153676c0035999d87a11c8c9ea..57fa7315e96d6d2e73a85fd8eea87692c09bb2ea 100644
--- a/src/tnl-benchmarks.h
+++ b/src/legacy/tnl-benchmarks.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLBENCHMARKS_H_
 #define TNLBENCHMARKS_H_
diff --git a/src/matrices/tnlCSRMatrix.h b/src/matrices/tnlCSRMatrix.h
index ac272baf2247aaa93622eb8e4ed8888f23e13ec8..236b8a0ed2362e6645eda1706dd39d2353d6c8a9 100644
--- a/src/matrices/tnlCSRMatrix.h
+++ b/src/matrices/tnlCSRMatrix.h
@@ -6,21 +6,20 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCSRMATRIX_H_
-#define TNLCSRMATRIX_H_
+#pragma once 
 
 #include <matrices/tnlSparseMatrix.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
+#ifdef HAVE_UMFPACK
+    template< typename Matrix, typename Preconditioner >
+    class tnlUmfpackWrapper;
+#endif
+
 template< typename Real >
 class tnlCusparseCSRMatrix;
 
@@ -63,7 +62,7 @@ class tnlCSRMatrix : public tnlSparseMatrix< Real, Device, Index >
 
    void reset();
 
-   __cuda_callable__ 
+   __cuda_callable__
    bool setElementFast( const IndexType row,
                         const IndexType column,
                         const RealType& value );
@@ -209,10 +208,14 @@ class tnlCSRMatrix : public tnlSparseMatrix< Real, Device, Index >
    typedef tnlCSRMatrixDeviceDependentCode< DeviceType > DeviceDependentCode;
    friend class tnlCSRMatrixDeviceDependentCode< DeviceType >;
    friend class tnlCusparseCSRMatrix< RealType >;
+#ifdef HAVE_UMFPACK
+    template< typename Matrix, typename Preconditioner >
+    friend class tnlUmfpackWrapper;
+#endif
 
 };
 
-#include <matrices/tnlCSRMatrix_impl.h>
+} // namespace TNL
 
+#include <matrices/tnlCSRMatrix_impl.h>
 
-#endif /* TNLCSRMATRIX_H_ */
diff --git a/src/matrices/tnlCSRMatrix_impl.h b/src/matrices/tnlCSRMatrix_impl.h
index 9db14b9094c313a968e8ccdba9d70f5dbd9be2f0..645fcad8885dbb501c512fe85b317198e9312e7a 100644
--- a/src/matrices/tnlCSRMatrix_impl.h
+++ b/src/matrices/tnlCSRMatrix_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCSRMATRIX_IMPL_H_
-#define TNLCSRMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlCSRMatrix.h>
 #include <core/vectors/tnlVector.h>
@@ -25,7 +17,11 @@
 
 #ifdef HAVE_CUSPARSE
 #include <cusparse.h>
+#endif
 
+namespace TNL {
+
+#ifdef HAVE_CUSPARSE
 template< typename Real, typename Index >
 class tnlCusparseCSRWrapper {};
 #endif
@@ -717,7 +713,7 @@ class tnlCSRMatrixDeviceDependentCode< tnlHost >
                 typename Index,
                 typename InVector,
                 typename OutVector >
-      static void vectorProduct( const tnlCSRMatrix< Real, Device, Index >& matrix,      
+      static void vectorProduct( const tnlCSRMatrix< Real, Device, Index >& matrix,
                                  const InVector& inVector,
                                  OutVector& outVector )
       {
@@ -726,8 +722,8 @@ class tnlCSRMatrixDeviceDependentCode< tnlHost >
          const InVector* inVectorPtr = &inVector;
          OutVector* outVectorPtr = &outVector;
 #ifdef HAVE_OPENMP
-#pragma omp parallel for firstprivate( matrixPtr, inVectorPtr, outVectorPtr ), schedule(static ), if( tnlOmp::isEnabled() )
-#endif         
+#pragma omp parallel for firstprivate( matrixPtr, inVectorPtr, outVectorPtr ), schedule(static ), if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < rows; row ++ )
             ( *outVectorPtr )[ row ] = matrixPtr->rowVectorProduct( row, *inVectorPtr );
       }
@@ -843,10 +839,10 @@ template<>
 class tnlCusparseCSRWrapper< float, int >
 {
    public:
-      
+ 
       typedef float Real;
       typedef int Index;
-      
+ 
       static void vectorProduct( const Index rows,
                                  const Index columns,
                                  const Index nnz,
@@ -857,7 +853,7 @@ class tnlCusparseCSRWrapper< float, int >
                                  Real* y )
       {
          cusparseHandle_t   cusparseHandle;
-         cusparseMatDescr_t cusparseMatDescr;         
+         cusparseMatDescr_t cusparseMatDescr;
          cusparseCreate( &cusparseHandle );
          cusparseCreateMatDescr( &cusparseMatDescr );
          cusparseSetMatType( cusparseMatDescr, CUSPARSE_MATRIX_TYPE_GENERAL );
@@ -883,10 +879,10 @@ template<>
 class tnlCusparseCSRWrapper< double, int >
 {
    public:
-      
+ 
       typedef double Real;
       typedef int Index;
-      
+ 
       static void vectorProduct( const Index rows,
                                  const Index columns,
                                  const Index nnz,
@@ -897,7 +893,7 @@ class tnlCusparseCSRWrapper< double, int >
                                  Real* y )
       {
          cusparseHandle_t   cusparseHandle;
-         cusparseMatDescr_t cusparseMatDescr;         
+         cusparseMatDescr_t cusparseMatDescr;
          cusparseCreate( &cusparseHandle );
          cusparseCreateMatDescr( &cusparseMatDescr );
          cusparseSetMatType( cusparseMatDescr, CUSPARSE_MATRIX_TYPE_GENERAL );
@@ -936,7 +932,7 @@ class tnlCSRMatrixDeviceDependentCode< tnlCuda >
                                  const InVector& inVector,
                                  OutVector& outVector )
       {
-#ifdef HAVE_CUSPARSE         
+#ifdef HAVE_CUSPARSE
          tnlCusparseCSRWrapper< Real, Index >::vectorProduct( matrix.getRows(),
                                                               matrix.getColumns(),
                                                               matrix.values.getSize(),
@@ -947,11 +943,9 @@ class tnlCSRMatrixDeviceDependentCode< tnlCuda >
                                                               outVector.getData() );
 #else
          tnlCSRMatrixVectorProductCuda( matrix, inVector, outVector );
-#endif         
+#endif
       }
 
 };
 
-
-
-#endif /* TNLCSRMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlChunkedEllpackMatrix.h b/src/matrices/tnlChunkedEllpackMatrix.h
index 8c39d44d5d6c19939efa0332432ba7d88e0c57a3..f22dbe7be6fd62564f4d21f8420a7e8edfbb03d1 100644
--- a/src/matrices/tnlChunkedEllpackMatrix.h
+++ b/src/matrices/tnlChunkedEllpackMatrix.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
  * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz
  * Heller Martin
- * 
+ *
  * The algorithm/method was published in:
  * Heller M., Oberhuber T., Improved Row-grouped CSR Format for Storing of
  * Sparse Matrices on GPU, Proceedings of Algoritmy 2012, 2012, Handlovičová A.,
@@ -27,12 +20,13 @@
  */
 
 
-#ifndef TNLCHUNKEDELLPACKMATRIX_H_
-#define TNLCHUNKEDELLPACKMATRIX_H_
+#pragma once
 
 #include <matrices/tnlSparseMatrix.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlChunkedEllpackMatrixDeviceDependentCode;
 
@@ -328,7 +322,7 @@ class tnlChunkedEllpackMatrix : public tnlSparseMatrix< Real, Device, Index >
 #endif
 };
 
-#include <matrices/tnlChunkedEllpackMatrix_impl.h>
+} // namespace TNL
 
+#include <matrices/tnlChunkedEllpackMatrix_impl.h>
 
-#endif /* TNLCHUNKEDELLPACKMATRIX_H_ */
diff --git a/src/matrices/tnlChunkedEllpackMatrix_impl.h b/src/matrices/tnlChunkedEllpackMatrix_impl.h
index d62dd2fd2ccb84f5b65840beb5e8863d8960bcf8..72fd006b4477ea6200db8b005ac2c9ab2b2f568f 100644
--- a/src/matrices/tnlChunkedEllpackMatrix_impl.h
+++ b/src/matrices/tnlChunkedEllpackMatrix_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCHUNKEDELLPACKMATRIX_IMPL_H_
-#define TNLCHUNKEDELLPACKMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlChunkedEllpackMatrix.h>
 #include <core/vectors/tnlVector.h>
@@ -26,6 +18,8 @@
 #include <cuda.h>
 #endif
 
+namespace TNL {
+
 template< typename Real,
           typename Index,
           typename Vector >
@@ -1337,14 +1331,14 @@ class tnlChunkedEllpackMatrixDeviceDependentCode< tnlCuda >
    public:
 
       typedef tnlCuda Device;
-      
+ 
       template< typename Real,
                 typename Index >
       static void resolveSliceSizes( tnlChunkedEllpackMatrix< Real, Device, Index >& matrix,
                                      const typename tnlChunkedEllpackMatrix< Real, Device, Index >::CompressedRowsLengthsVector& rowLengths )
       {
       }
-      
+ 
       template< typename Index >
       __cuda_callable__
       static void initChunkTraverse( const Index sliceOffset,
@@ -1365,7 +1359,7 @@ class tnlChunkedEllpackMatrixDeviceDependentCode< tnlCuda >
       }
 
       template< typename Real,
-                typename Index, 
+                typename Index,
                 typename InVector,
                 typename OutVector >
       static void vectorProduct( const tnlChunkedEllpackMatrix< Real, Device, Index >& matrix,
@@ -1405,4 +1399,4 @@ class tnlChunkedEllpackMatrixDeviceDependentCode< tnlCuda >
 
 };
 
-#endif /* TNLCHUNKEDELLPACKMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlDenseMatrix.h b/src/matrices/tnlDenseMatrix.h
index b9862b0d4adbb5bab80ac825986c74d97a45a969..df27e22d6faea32dd817e9a3967aea44e59ca2df 100644
--- a/src/matrices/tnlDenseMatrix.h
+++ b/src/matrices/tnlDenseMatrix.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDENSEMATRIX_H_
-#define TNLDENSEMATRIX_H_
+#pragma once
 
 #include <core/tnlHost.h>
 #include <matrices/tnlMatrix.h>
 #include <matrices/tnlDenseMatrixRow.h>
 #include <core/arrays/tnlArray.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlDenseMatrixDeviceDependentCode;
 
@@ -169,7 +163,7 @@ class tnlDenseMatrix : public tnlMatrix< Real, Device, Index >
                        const Matrix2& matrix2,
                        const RealType& matrix1Multiplicator = 1.0,
                        const RealType& matrix2Multiplicator = 1.0 );
-#endif   
+#endif
 
 #ifdef HAVE_NOT_CXX11
    template< typename Matrix, int tileDim >
@@ -208,6 +202,7 @@ class tnlDenseMatrix : public tnlMatrix< Real, Device, Index >
 
 };
 
+} // namespace TNL
+
 #include <matrices/tnlDenseMatrix_impl.h>
 
-#endif /* TNLDENSEMATRIX_H_ */
diff --git a/src/matrices/tnlDenseMatrixRow.h b/src/matrices/tnlDenseMatrixRow.h
index 0882c960b0e59e099ed0d57ed73f5ca17e871c1a..4c88784800174275963e0473877abd87dc25c64e 100644
--- a/src/matrices/tnlDenseMatrixRow.h
+++ b/src/matrices/tnlDenseMatrixRow.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLDENSEMATRIXROW_H_
-#define TNLDENSEMATRIXROW_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 class tnlDenseMatrixRow
@@ -48,7 +42,7 @@ class tnlDenseMatrixRow
       Index columns, step;
 };
 
-#include <matrices/tnlDenseMatrixRow_impl.h>
+} // namespace TNL
 
+#include <matrices/tnlDenseMatrixRow_impl.h>
 
-#endif /* TNLDENSEMATRIXROW_H_ */
diff --git a/src/matrices/tnlDenseMatrixRow_impl.h b/src/matrices/tnlDenseMatrixRow_impl.h
index 3ad6af7f2b83533c02016467bbf9f5307b0cf2ca..d8875fd032f80861cca34a773946474c9c710915 100644
--- a/src/matrices/tnlDenseMatrixRow_impl.h
+++ b/src/matrices/tnlDenseMatrixRow_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDENSEMATRIXROW_IMPL_H_
-#define TNLDENSEMATRIXROW_IMPL_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Real, typename Index >
 __cuda_callable__
@@ -69,5 +63,4 @@ setElement( const Index& elementIndex,
    this->values[ column * this->step ] = value;
 }
 
-
-#endif /* TNLDENSEMATRIXROW_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlDenseMatrix_impl.h b/src/matrices/tnlDenseMatrix_impl.h
index eaa22b230b8e75fc95d30b9749a97a1794fabb14..4b97f30b0b044d0df6e3bb8bf5e11e8dba130d29 100644
--- a/src/matrices/tnlDenseMatrix_impl.h
+++ b/src/matrices/tnlDenseMatrix_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDENSEMATRIX_IMPL_H_
-#define TNLDENSEMATRIX_IMPL_H_
+#pragma once
 
 #include <core/tnlAssert.h>
 #include <matrices/tnlDenseMatrix.h>
@@ -25,6 +17,8 @@
 #include <core/cuda/reduction-operations.h>
 #endif
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -750,10 +744,10 @@ void tnlDenseMatrix< Real, Device, Index >::getTransposition( const Matrix& matr
    tnlAssert( this->getColumns() == matrix.getRows() &&
               this->getRows() == matrix.getColumns(),
                cerr << "This matrix columns: " << this->getColumns() << endl
-                    << "This matrix rows: " << this->getRows() << endl                    
+                    << "This matrix rows: " << this->getRows() << endl
                     << "That matrix columns: " << matrix.getColumns() << endl
                     << "That matrix rows: " << matrix.getRows() << endl );
-   
+ 
    if( Device::getDevice() == tnlHostDevice )
    {
       const IndexType& rows = matrix.getRows();
@@ -932,8 +926,8 @@ class tnlDenseMatrixDeviceDependentCode< tnlHost >
                                  OutVector& outVector )
       {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() )
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < matrix.getRows(); row ++ )
             outVector[ row ] = matrix.rowVectorProduct( row, inVector );
       }
@@ -958,4 +952,4 @@ class tnlDenseMatrixDeviceDependentCode< tnlCuda >
       }
 };
 
-#endif /* TNLDENSEMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlEllpackMatrix.h b/src/matrices/tnlEllpackMatrix.h
index 78efa93cc24d46ebd4e909d121a03c98d8b50e44..183820882e5870c40423e1ea07f411765082f37c 100644
--- a/src/matrices/tnlEllpackMatrix.h
+++ b/src/matrices/tnlEllpackMatrix.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKMATRIX_H_
-#define TNLELLPACKMATRIX_H_
+#pragma once
 
 #include <matrices/tnlSparseMatrix.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlEllpackMatrixDeviceDependentCode;
 
@@ -60,7 +54,7 @@ class tnlEllpackMatrix : public tnlSparseMatrix< Real, Device, Index >
    bool setLike( const tnlEllpackMatrix< Real2, Device2, Index2 >& matrix );
 
    void reset();
-   
+ 
    template< typename Real2, typename Device2, typename Index2 >
    bool operator == ( const tnlEllpackMatrix< Real2, Device2, Index2 >& matrix ) const;
 
@@ -180,7 +174,6 @@ class tnlEllpackMatrix : public tnlSparseMatrix< Real, Device, Index >
    friend class tnlEllpackMatrixDeviceDependentCode< DeviceType >;
 };
 
-#include <matrices/tnlEllpackMatrix_impl.h>
-
+} // namespace TNL
 
-#endif /* TNLELLPACKMATRIX_H_ */
+#include <matrices/tnlEllpackMatrix_impl.h>
diff --git a/src/matrices/tnlEllpackMatrix_impl.h b/src/matrices/tnlEllpackMatrix_impl.h
index b56bdfaf38c627fd81672eebf7dfbdbbe7ff8af7..809926b038782dfb501e828618b718dbdb245e5c 100644
--- a/src/matrices/tnlEllpackMatrix_impl.h
+++ b/src/matrices/tnlEllpackMatrix_impl.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLELLPACKMATRIX_IMPL_H_
-#define TNLELLPACKMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlEllpackMatrix.h>
 #include <core/vectors/tnlVector.h>
 #include <core/mfuncs.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -40,7 +34,7 @@ tnlString tnlEllpackMatrix< Real, Device, Index > :: getType()
           tnlString( ", " ) +
           Device :: getDeviceType() +
           tnlString( ", " ) +
-          tnlString( ::getType< Index >() ) +          
+          tnlString( ::getType< Index >() ) +
           tnlString( " >" );
 }
 
@@ -62,7 +56,7 @@ bool tnlEllpackMatrix< Real, Device, Index >::setDimensions( const IndexType row
               cerr << "rows = " << rows
                    << " columns = " << columns << endl );
    this->rows = rows;
-   this->columns = columns;   
+   this->columns = columns;
    if( Device::DeviceType == ( int ) tnlCudaDevice )
       this->alignedRows = roundToMultiple( columns, tnlCuda::getWarpSize() );
    else this->alignedRows = rows;
@@ -577,9 +571,9 @@ bool tnlEllpackMatrix< Real, Device, Index >::save( tnlFile& file ) const
    if( ! tnlSparseMatrix< Real, Device, Index >::save( file) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file.write< IndexType, tnlHost, IndexType >( &this->rowLengths, 1 ) ) return false;
-#else      
+#else
    if( ! file.write( &this->rowLengths ) ) return false;
-#endif   
+#endif
    return true;
 }
 
@@ -591,9 +585,9 @@ bool tnlEllpackMatrix< Real, Device, Index >::load( tnlFile& file )
    if( ! tnlSparseMatrix< Real, Device, Index >::load( file) ) return false;
 #ifdef HAVE_NOT_CXX11
    if( ! file.read< IndexType, tnlHost, IndexType >( &this->rowLengths, 1 ) ) return false;
-#else   
+#else
    if( ! file.read( &this->rowLengths ) ) return false;
-#endif   
+#endif
    return true;
 }
 
@@ -688,8 +682,8 @@ class tnlEllpackMatrixDeviceDependentCode< tnlHost >
                                  OutVector& outVector )
       {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() )
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < matrix.getRows(); row ++ )
             outVector[ row ] = matrix.rowVectorProduct( row, inVector );
          /*Index col;
@@ -704,8 +698,8 @@ class tnlEllpackMatrixDeviceDependentCode< tnlHost >
       }
 };
 
-#ifdef HAVE_CUDA    
-template< 
+#ifdef HAVE_CUDA
+template<
    typename Real,
    typename Index >
 __global__ void tnlEllpackMatrixVectorProductCudaKernel(
@@ -727,14 +721,14 @@ __global__ void tnlEllpackMatrixVectorProductCudaKernel(
    Index el( 0 );
    Real result( 0.0 );
    Index columnIndex;
-   while( el++ < compressedRowsLengths && 
+   while( el++ < compressedRowsLengths &&
           ( columnIndex = columnIndexes[ i ] ) < columns &&
           columnIndex != paddingIndex )
    {
       result += values[ i ] * inVector[ columnIndex ];
       i += alignedRows;
    }
-   outVector[ rowIdx ] = result;   
+   outVector[ rowIdx ] = result;
 }
 #endif
 
@@ -782,7 +776,7 @@ class tnlEllpackMatrixDeviceDependentCode< tnlCuda >
                                  OutVector& outVector )
       {
          //tnlMatrixVectorProductCuda( matrix, inVector, outVector );
-         #ifdef HAVE_CUDA    
+         #ifdef HAVE_CUDA
             typedef tnlEllpackMatrix< Real, Device, Index > Matrix;
             typedef typename Matrix::IndexType IndexType;
             //Matrix* kernel_this = tnlCuda::passToDevice( matrix );
@@ -816,8 +810,8 @@ class tnlEllpackMatrixDeviceDependentCode< tnlCuda >
             checkCudaDevice;
             cudaThreadSynchronize();
          #endif
-         
+ 
       }
 };
 
-#endif /* TNLELLPACKMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMatrix.h b/src/matrices/tnlMatrix.h
index 7c0bfb8e452bab36171029bee6b07f0a45ffd647..7ef8b1c33a96fffbc3d89f66fee35dcdd20bde8e 100644
--- a/src/matrices/tnlMatrix.h
+++ b/src/matrices/tnlMatrix.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIX_H_
-#define TNLMATRIX_H_
+#pragma once
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlHost.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Real = double,
           typename Device = tnlHost,
           typename Index = int >
@@ -131,7 +125,6 @@ void tnlMatrixVectorProductCuda( const Matrix& matrix,
                                  const InVector& inVector,
                                  OutVector& outVector );
 
+} // namespace TNL
 
 #include <matrices/tnlMatrix_impl.h>
-
-#endif /* TNLMATRIX_H_ */
diff --git a/src/matrices/tnlMatrixReader.h b/src/matrices/tnlMatrixReader.h
index 8675f584e6aaa2abd5b2cb88bfa42cf2d77ca1da..33ddc5afb9909221c8eec83e5b600366fcc23ae4 100644
--- a/src/matrices/tnlMatrixReader.h
+++ b/src/matrices/tnlMatrixReader.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIXREADER_H_
-#define TNLMATRIXREADER_H_
+#pragma once
 
 #include <istream>
 #include <core/tnlString.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlMatrixReaderDeviceDependentCode
 {};
@@ -86,8 +80,6 @@ class tnlMatrixReader
                                         RealType& value );
 };
 
-
+} // namespace TNL
 
 #include <matrices/tnlMatrixReader_impl.h>
-
-#endif /* TNLMATRIXREADER_H_ */
diff --git a/src/matrices/tnlMatrixReader_impl.h b/src/matrices/tnlMatrixReader_impl.h
index bad296e16658915624d6bf2771b6d5185b5fdb69..bfeadc2737fdcf27b2fa88ecc468595be55bb8b7 100644
--- a/src/matrices/tnlMatrixReader_impl.h
+++ b/src/matrices/tnlMatrixReader_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIXREADER_IMPL_H_
-#define TNLMATRIXREADER_IMPL_H_
+#pragma once
 
 #include <iomanip>
 #include <core/tnlList.h>
@@ -24,7 +16,7 @@
 #include <core/vectors/tnlVector.h>
 #include <core/tnlTimerRT.h>
 
-using namespace std;
+namespace TNL {
 
 template< typename Matrix >
 bool tnlMatrixReader< Matrix >::readMtxFile( const tnlString& fileName,
@@ -421,5 +413,4 @@ class tnlMatrixReaderDeviceDependentCode< tnlCuda >
    }
 };
 
-
-#endif /* TNLMATRIXREADER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMatrixSetter.h b/src/matrices/tnlMatrixSetter.h
index 0a9989bb04d3c34d696ab6fe21f88f5ddd698ea0..6534d29aa6c92aafb1dd56b403d864576a1dde71 100644
--- a/src/matrices/tnlMatrixSetter.h
+++ b/src/matrices/tnlMatrixSetter.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMATRIXSETTER_H_
-#define TNLMATRIXSETTER_H_
+namespace TNL {
 
 template< typename DifferentialOperator,
           typename BoundaryConditions,
@@ -130,7 +124,7 @@ class tnlMatrixSetter< tnlGrid< Dimensions, Real, Device, Index >,
          template< typename EntityType >
          __cuda_callable__
          static void processEntity( const MeshType& mesh,
-                                    TraversalUserData& userData,                                    
+                                    TraversalUserData& userData,
                                     const EntityType& entity )
          {
             ( *userData.rowLengths )[ entity.getIndex() ] =
@@ -142,7 +136,7 @@ class tnlMatrixSetter< tnlGrid< Dimensions, Real, Device, Index >,
    class TraversalInteriorEntitiesProcessor
    {
       public:
-         
+ 
          template< typename EntityType >
          __cuda_callable__
          static void processEntity( const MeshType& mesh,
@@ -156,6 +150,6 @@ class tnlMatrixSetter< tnlGrid< Dimensions, Real, Device, Index >,
 
 };
 
-#include <matrices/tnlMatrixSetter_impl.h>
+} // namespace TNL
 
-#endif /* TNLMATRIXSETTER_H_ */
+#include <matrices/tnlMatrixSetter_impl.h>
diff --git a/src/matrices/tnlMatrixSetter_impl.h b/src/matrices/tnlMatrixSetter_impl.h
index 84fdfa30ebf172a143ec372855068e30a5de7612..4d5c9ae1e2bba6324c5d8d5cf229c7bd8c9e97dc 100644
--- a/src/matrices/tnlMatrixSetter_impl.h
+++ b/src/matrices/tnlMatrixSetter_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIXSETTER_IMPL_H_
-#define TNLMATRIXSETTER_IMPL_H_
+#pragma once
 
 #include <mesh/tnlTraverser.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename DifferentialOperator,
           typename BoundaryConditions,
@@ -123,5 +117,4 @@ getCompressedRowsLengths( const MeshType& mesh,
    }
 }
 
-
-#endif /* TNLMATRIXSETTER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMatrixWriter.h b/src/matrices/tnlMatrixWriter.h
index 2a36f60af168bc72ae3885e37c3ef62c49e07e72..0912e1c3069aec83c19c8d6e5e03ee69f8a06121 100644
--- a/src/matrices/tnlMatrixWriter.h
+++ b/src/matrices/tnlMatrixWriter.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIXWRITER_H_
-#define TNLMATRIXWRITER_H_
+#pragma once
 
 #include <ostream>
 
+namespace TNL {
+
 template< typename Matrix >
 class tnlMatrixWriter
 {
@@ -49,5 +43,4 @@ class tnlMatrixWriter
 
 };
 
-
-#endif /* TNLMATRIXWRITER_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMatrixWriter_impl.h b/src/matrices/tnlMatrixWriter_impl.h
index e972d1f9e4b2a50a203c03da7c5e3f06dd8f475c..ff706a5221b278ee87fda10c77fe6de10aca8fe1 100644
--- a/src/matrices/tnlMatrixWriter_impl.h
+++ b/src/matrices/tnlMatrixWriter_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMATRIXWRITER_IMPL_H_
-#define TNLMATRIXWRITER_IMPL_H_
+namespace TNL {
 
 template< typename Matrix >
 bool tnlMatrixWriter< Matrix >::writeToGnuplot( std::ostream str,
@@ -99,4 +93,4 @@ bool tnlMatrixWriter< Matrix >::writeEpsBody( std::ostream str,
    return true;
 }
 
-#endif /* TNLMATRIXWRITER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMatrix_impl.h b/src/matrices/tnlMatrix_impl.h
index 2ffa98e2134a612f361b8037187bcd9f45651674..f47088680d07ff371ae844e61a7f440cadda4cee 100644
--- a/src/matrices/tnlMatrix_impl.h
+++ b/src/matrices/tnlMatrix_impl.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMATRIX_IMPL_H_
-#define TNLMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlMatrix.h>
 #include <core/tnlAssert.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -184,13 +178,13 @@ bool tnlMatrix< Real, Device, Index >::save( tnlFile& file ) const
        ! file.write< IndexType, tnlHost, Index >( &this->columns, 1 ) ||
        ! this->values.save( file ) )
       return false;
-#else   
+#else
    if( ! tnlObject::save( file ) ||
        ! file.write( &this->rows ) ||
        ! file.write( &this->columns ) ||
        ! this->values.save( file ) )
       return false;
-#endif      
+#endif
    return true;
 }
 
@@ -205,13 +199,13 @@ bool tnlMatrix< Real, Device, Index >::load( tnlFile& file )
        ! file.read< IndexType, tnlHost, Index >( &this->columns, 1 ) ||
        ! this->values.load( file ) )
       return false;
-#else   
+#else
    if( ! tnlObject::load( file ) ||
        ! file.read( &this->rows ) ||
        ! file.read( &this->columns ) ||
        ! this->values.load( file ) )
       return false;
-#endif      
+#endif
    return true;
 }
 
@@ -245,7 +239,7 @@ void tnlMatrixVectorProductCuda( const Matrix& matrix,
                                  const InVector& inVector,
                                  OutVector& outVector )
 {
-#ifdef HAVE_CUDA    
+#ifdef HAVE_CUDA
    typedef typename Matrix::IndexType IndexType;
    Matrix* kernel_this = tnlCuda::passToDevice( matrix );
    InVector* kernel_inVector = tnlCuda::passToDevice( inVector );
@@ -271,4 +265,4 @@ void tnlMatrixVectorProductCuda( const Matrix& matrix,
 #endif
 }
 
-#endif /* TNLMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMultidiagonalMatrix.h b/src/matrices/tnlMultidiagonalMatrix.h
index b09f548aa62a12682b730d21f927368ca4c4498d..8b58401b8d9a9ff8ea8233ceda9451c3be7ee2fd 100644
--- a/src/matrices/tnlMultidiagonalMatrix.h
+++ b/src/matrices/tnlMultidiagonalMatrix.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIDIAGONALMATRIX_H_
-#define TNLMULTIDIAGONALMATRIX_H_
+#pragma once
 
 #include <matrices/tnlMatrix.h>
 #include <core/vectors/tnlVector.h>
 #include <matrices/tnlMultidiagonalMatrixRow.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlMultidiagonalMatrixDeviceDependentCode;
 
@@ -204,6 +198,6 @@ class tnlMultidiagonalMatrix : public tnlMatrix< Real, Device, Index >
 
 };
 
-#include <matrices/tnlMultidiagonalMatrix_impl.h>
+} // namespace TNL
 
-#endif /* TNLMULTIDIAGONALMATRIX_H_ */
+#include <matrices/tnlMultidiagonalMatrix_impl.h>
diff --git a/src/matrices/tnlMultidiagonalMatrixRow.h b/src/matrices/tnlMultidiagonalMatrixRow.h
index 0ec3b8b19ef7d5370e7dffcd807628ea2ed95501..5df82f3b4af809044d79b05992f8384799d17938 100644
--- a/src/matrices/tnlMultidiagonalMatrixRow.h
+++ b/src/matrices/tnlMultidiagonalMatrixRow.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMULTIDIAGONALMATRIXROW_H_
-#define TNLMULTIDIAGONALMATRIXROW_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 class tnlMultidiagonalMatrixRow
@@ -56,7 +50,7 @@ class tnlMultidiagonalMatrixRow
       Index row, columns, maxRowLength, step;
 };
 
-#include <matrices/tnlMultidiagonalMatrixRow_impl.h>
+} // namespace TNL
 
+#include <matrices/tnlMultidiagonalMatrixRow_impl.h>
 
-#endif /* TNLMULTIDIAGONALMATRIXROW_H_ */
diff --git a/src/matrices/tnlMultidiagonalMatrixRow_impl.h b/src/matrices/tnlMultidiagonalMatrixRow_impl.h
index 3c2864b4e34fa7fcbe0be40d12d618a71c573531..1c480fe628cec5c1791293ae2f8fb8e139f63b29 100644
--- a/src/matrices/tnlMultidiagonalMatrixRow_impl.h
+++ b/src/matrices/tnlMultidiagonalMatrixRow_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIDIAGONALMATRIXROW_IMPL_H_
-#define TNLMULTIDIAGONALMATRIXROW_IMPL_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Real, typename Index >
 __cuda_callable__
@@ -88,7 +82,7 @@ setElement( const Index& elementIndex,
    tnlAssert( row + this->diagonals[ aux ] == column,
               cerr << "row = " << row
                    << " aux = " << aux
-                   << " this->diagonals[ aux ] = " << this->diagonals[ aux] 
+                   << " this->diagonals[ aux ] = " << this->diagonals[ aux]
                    << " row + this->diagonals[ aux ] " << row + this->diagonals[ aux ]
                    << " column = " << column );
 
@@ -96,5 +90,4 @@ setElement( const Index& elementIndex,
    this->values[ aux * this->step ] = value;
 }
 
-
-#endif /* TNLMULTIDIAGONALMATRIXROW_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMultidiagonalMatrixSetter.h b/src/matrices/tnlMultidiagonalMatrixSetter.h
index efc0a8188ac9e04ee5fba4247394c779c227ba42..3693ec52e7d389aca8c044ce19276b0fc0c4cc0b 100644
--- a/src/matrices/tnlMultidiagonalMatrixSetter.h
+++ b/src/matrices/tnlMultidiagonalMatrixSetter.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIDIAGONALMATRIXSETTER_H_
-#define TNLMULTIDIAGONALMATRIXSETTER_H_
+#pragma once
 
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshType >
 class tnlMultidiagonalMatrixSetter
 {
@@ -86,6 +80,6 @@ class tnlMultidiagonalMatrixSetter< tnlGrid< 3, MeshReal, Device, MeshIndex > >
                                bool crossStencil = false );
 };
 
-#include <matrices/tnlMultidiagonalMatrixSetter_impl.h>
+} // namespace TNL
 
-#endif /* TNLMULTIDIAGONALMATRIXSETTER_H_ */
+#include <matrices/tnlMultidiagonalMatrixSetter_impl.h>
diff --git a/src/matrices/tnlMultidiagonalMatrixSetter_impl.h b/src/matrices/tnlMultidiagonalMatrixSetter_impl.h
index 9169ecab1b2e0174ddfa732735369491378b5b14..9cc632694b5f9b4f84784c1ec7e2b328530f0c83 100644
--- a/src/matrices/tnlMultidiagonalMatrixSetter_impl.h
+++ b/src/matrices/tnlMultidiagonalMatrixSetter_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMULTIDIAGONALMATRIXSETTER_IMPL_H_
-#define TNLMULTIDIAGONALMATRIXSETTER_IMPL_H_
+namespace TNL {
 
 template< typename MeshReal,
           typename Device,
@@ -102,4 +96,4 @@ setupMatrix( const MeshType& mesh,
    return matrix.setDiagonals( diagonals );
 }
 
-#endif /* TNLMULTIDIAGONALMATRIXSETTER_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlMultidiagonalMatrix_impl.h b/src/matrices/tnlMultidiagonalMatrix_impl.h
index ae89ffa4335c444cd86c2ba52d50c4c272f68d8a..991d6263d0bc6bc2be2b68150809a5c4aa0764a4 100644
--- a/src/matrices/tnlMultidiagonalMatrix_impl.h
+++ b/src/matrices/tnlMultidiagonalMatrix_impl.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMULTIDIAGONALMATRIX_IMPL_H_
-#define TNLMULTIDIAGONALMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlMultidiagonalMatrix.h>
 #include <core/vectors/tnlVector.h>
 #include <core/mfuncs.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlMultidiagonalMatrixDeviceDependentCode;
 
@@ -735,8 +729,8 @@ class tnlMultidiagonalMatrixDeviceDependentCode< tnlHost >
                                  OutVector& outVector )
       {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() )
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < matrix.getRows(); row ++ )
             outVector[ row ] = matrix.rowVectorProduct( row, inVector );
       }
@@ -771,5 +765,4 @@ class tnlMultidiagonalMatrixDeviceDependentCode< tnlCuda >
       }
 };
 
-
-#endif /* TNLMULTIDIAGONALMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlSlicedEllpackMatrix.h b/src/matrices/tnlSlicedEllpackMatrix.h
index a0b573dec7288ecf4787ad604b9083c7cbc0fd11..b08dbc192f10e1ef4fff4b00cc713ffb0d2ddab3 100644
--- a/src/matrices/tnlSlicedEllpackMatrix.h
+++ b/src/matrices/tnlSlicedEllpackMatrix.h
@@ -6,32 +6,26 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
  * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz
  * Vacata Jan
- * 
+ *
  * The algorithm/method was published in:
  *  Oberhuber T., Suzuki A., Vacata J., New Row-grouped CSR format for storing
  *  the sparse matrices on GPU with implementation in CUDA, Acta Technica, 2011,
  *  vol. 56, no. 4, pp. 447-466.
  */
 
-#ifndef TNLSLICEDELLPACKMATRIX_H_
-#define TNLSLICEDELLPACKMATRIX_H_
+#pragma once
 
 #include <matrices/tnlSparseMatrix.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlSlicedEllpackMatrixDeviceDependentCode;
 
@@ -213,7 +207,6 @@ class tnlSlicedEllpackMatrix : public tnlSparseMatrix< Real, Device, Index >
 
 };
 
-#include <matrices/tnlSlicedEllpackMatrix_impl.h>
-
+} // namespace TNL
 
-#endif /* TNLSLICEDELLPACKMATRIX_H_ */
+#include <matrices/tnlSlicedEllpackMatrix_impl.h>
diff --git a/src/matrices/tnlSlicedEllpackMatrix_impl.h b/src/matrices/tnlSlicedEllpackMatrix_impl.h
index dd0c6ed78e3902c5ff351965b0c7e4bac18f4049..f7112a9f9aa60102396d01236662b2a71132dc8b 100644
--- a/src/matrices/tnlSlicedEllpackMatrix_impl.h
+++ b/src/matrices/tnlSlicedEllpackMatrix_impl.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSLICEDELLPACKMATRIX_IMPL_H_
-#define TNLSLICEDELLPACKMATRIX_IMPL_H_
+#pragma once
 
 #include <matrices/tnlSlicedEllpackMatrix.h>
 #include <core/vectors/tnlVector.h>
 #include <core/mfuncs.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index,
@@ -756,8 +750,8 @@ class tnlSlicedEllpackMatrixDeviceDependentCode< tnlHost >
                                  OutVector& outVector )
       {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() )
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < matrix.getRows(); row ++ )
             outVector[ row ] = matrix.rowVectorProduct( row, inVector );
       }
@@ -777,8 +771,8 @@ __global__ void tnlSlicedEllpackMatrix_computeMaximalRowLengthInSlices_CudaKerne
 }
 #endif
 
-#ifdef HAVE_CUDA    
-template< 
+#ifdef HAVE_CUDA
+template<
    typename Real,
    typename Index,
    int SliceSize >
@@ -799,7 +793,7 @@ __global__ void tnlSlicedEllpackMatrixVectorProductCudaKernel(
       return;
    const Index sliceIdx = rowIdx / SliceSize;
    const Index slicePointer = slicePointers[ sliceIdx ];
-   const Index rowLength = sliceCompressedRowsLengths[ sliceIdx ];   
+   const Index rowLength = sliceCompressedRowsLengths[ sliceIdx ];
    Index i = slicePointer + rowIdx - sliceIdx * SliceSize;
    const Index rowEnd = i + rowLength * SliceSize;
    Real result( 0.0 );
@@ -811,7 +805,7 @@ __global__ void tnlSlicedEllpackMatrixVectorProductCudaKernel(
       result += values[ i ] * inVector[ columnIndex ];
       i += SliceSize;
    }
-   outVector[ rowIdx ] = result;   
+   outVector[ rowIdx ] = result;
 }
 #endif
 
@@ -902,7 +896,7 @@ class tnlSlicedEllpackMatrixDeviceDependentCode< tnlCuda >
                                  OutVector& outVector )
       {
          //tnlMatrixVectorProductCuda( matrix, inVector, outVector );
-         #ifdef HAVE_CUDA    
+         #ifdef HAVE_CUDA
             typedef tnlSlicedEllpackMatrix< Real, Device, Index, SliceSize > Matrix;
             typedef typename Matrix::IndexType IndexType;
             //Matrix* kernel_this = tnlCuda::passToDevice( matrix );
@@ -940,4 +934,4 @@ class tnlSlicedEllpackMatrixDeviceDependentCode< tnlCuda >
 
 };
 
-#endif /* TNLSLICEDELLPACKMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlSparseMatrix.h b/src/matrices/tnlSparseMatrix.h
index 0c8f6a35a5ace48568efee9e1c92b8356a37f8b6..b0c6d6f97a49c932bdfced37fc82b31f9f78c576 100644
--- a/src/matrices/tnlSparseMatrix.h
+++ b/src/matrices/tnlSparseMatrix.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSPARSEMATRIX_H_
-#define TNLSPARSEMATRIX_H_
+#pragma once
 
 #include <matrices/tnlMatrix.h>
 #include <matrices/tnlSparseMatrixRow.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -70,6 +64,6 @@ class tnlSparseMatrix : public tnlMatrix< Real, Device, Index >
    Index maxRowLength;
 };
 
-#include <matrices/tnlSparseMatrix_impl.h>
+} // namespace TNL
 
-#endif /* TNLSPARSEMATRIX_H_ */
+#include <matrices/tnlSparseMatrix_impl.h>
diff --git a/src/matrices/tnlSparseMatrixRow.h b/src/matrices/tnlSparseMatrixRow.h
index b2c7372033563aba1103fe8dd304e62d4c64efeb..571d354ad1e0e58808e0d6ad37a3d5038aff37b3 100644
--- a/src/matrices/tnlSparseMatrixRow.h
+++ b/src/matrices/tnlSparseMatrixRow.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
 
+#pragma once
 
-#ifndef TNLSPARSEMATRIXROW_H_
-#define TNLSPARSEMATRIXROW_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 class tnlSparseMatrixRow
@@ -43,7 +37,7 @@ class tnlSparseMatrixRow
       void setElement( const Index& elementIndex,
                        const Index& column,
                        const Real& value );
-      
+ 
       void print( ostream& str ) const;
 
    protected:
@@ -62,6 +56,6 @@ ostream& operator << ( ostream& str, const tnlSparseMatrixRow< Real, Index >& ro
    return str;
 }
 
-#include <matrices/tnlSparseMatrixRow_impl.h>
+} // namespace TNL
 
-#endif /* TNLSPARSEMATRIXROW_H_ */
+#include <matrices/tnlSparseMatrixRow_impl.h>
diff --git a/src/matrices/tnlSparseMatrixRow_impl.h b/src/matrices/tnlSparseMatrixRow_impl.h
index 3728cdcf32d675f4b1b98b307911ca2661ef7c3f..95bf0bd68b3b7345f8760b047b7a27ee1480d881 100644
--- a/src/matrices/tnlSparseMatrixRow_impl.h
+++ b/src/matrices/tnlSparseMatrixRow_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLSPARSEMATRIXROW_IMPL_H_
-#define TNLSPARSEMATRIXROW_IMPL_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 __cuda_callable__
@@ -86,8 +80,8 @@ print( ostream& str ) const
    for( Index i = 0; i < length; i++ )
    {
       str << " [ " << columns[ pos ] << " ] = " << values[ pos ] << ", ";
-      pos += step;   
+      pos += step;
    }
 }
 
-#endif /* TNLSPARSEMATRIXROW_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlSparseMatrix_impl.h b/src/matrices/tnlSparseMatrix_impl.h
index 830b54252abb0f7350cf52669578b430319a404d..ad7ebeffc5bdd0f0a5d32d20557a197cc9d4dbee 100644
--- a/src/matrices/tnlSparseMatrix_impl.h
+++ b/src/matrices/tnlSparseMatrix_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma ocne
 
-#ifndef TNLSPARSEMATRIX_IMPL_H_
-#define TNLSPARSEMATRIX_IMPL_H_
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -138,4 +132,4 @@ void tnlSparseMatrix< Real, Device, Index >::printStructure( ostream& str ) cons
 {
 }
 
-#endif /* TNLSPARSEMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlTridiagonalMatrix.h b/src/matrices/tnlTridiagonalMatrix.h
index 91e29af727ef69fa1bbbefa2e8aed10c6475a61a..2ae2a4acf33f6235cd934965edfd72493e6a2ee8 100644
--- a/src/matrices/tnlTridiagonalMatrix.h
+++ b/src/matrices/tnlTridiagonalMatrix.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRIDIAGONALMATRIX_H_
-#define TNLTRIDIAGONALMATRIX_H_
+#pragma once
 
 #include <matrices/tnlMatrix.h>
 #include <core/vectors/tnlVector.h>
 #include <matrices/tnlTridiagonalMatrixRow.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlTridiagonalMatrixDeviceDependentCode;
 
@@ -161,7 +155,7 @@ class tnlTridiagonalMatrix : public tnlMatrix< Real, Device, Index >
    template< typename Real2, typename Index2 >
    void getTransposition( const tnlTridiagonalMatrix< Real2, Device, Index2 >& matrix,
                           const RealType& matrixMultiplicator = 1.0 );
-#endif   
+#endif
 
    template< typename Vector >
    __cuda_callable__
@@ -192,7 +186,6 @@ class tnlTridiagonalMatrix : public tnlMatrix< Real, Device, Index >
    friend class tnlTridiagonalMatrixDeviceDependentCode< DeviceType >;
 };
 
-#include <matrices/tnlTridiagonalMatrix_impl.h>
-
+} // namespace TNL
 
-#endif /* TNLTRIDIAGONALMATRIX_H_ */
+#include <matrices/tnlTridiagonalMatrix_impl.h>
diff --git a/src/matrices/tnlTridiagonalMatrixRow.h b/src/matrices/tnlTridiagonalMatrixRow.h
index 4872e67fccb81cb87c0cf668f25402ac8275d8df..e5ee657e7e230397d12ffb04804d2fc2ab865282 100644
--- a/src/matrices/tnlTridiagonalMatrixRow.h
+++ b/src/matrices/tnlTridiagonalMatrixRow.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLTRIDIAGONALMATRIXROW_H_
-#define TNLTRIDIAGONALMATRIXROW_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 class tnlTridiagonalMatrixRow
@@ -50,7 +44,6 @@ class tnlTridiagonalMatrixRow
       Index row, columns, step;
 };
 
-#include <matrices/tnlTridiagonalMatrixRow_impl.h>
-
+} // namespace TNL
 
-#endif /* TNLTRIDIAGONALMATRIXROW_H_ */
+#include <matrices/tnlTridiagonalMatrixRow_impl.h>
diff --git a/src/matrices/tnlTridiagonalMatrixRow_impl.h b/src/matrices/tnlTridiagonalMatrixRow_impl.h
index c9cd1682fe491c3a6f07e735d28f0541ea9a65f6..305439ac1fb724270b1a692a2dd6abe37e70daaa 100644
--- a/src/matrices/tnlTridiagonalMatrixRow_impl.h
+++ b/src/matrices/tnlTridiagonalMatrixRow_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLTRIDIAGONALMATRIXROW_IMPL_H_
-#define TNLTRIDIAGONALMATRIXROW_IMPL_H_
+namespace TNL {
 
 template< typename Real, typename Index >
 __cuda_callable__
@@ -79,6 +73,4 @@ setElement( const Index& elementIndex,
    this->values[ ( column - row ) * this->step ] = value;
 }
 
-
-
-#endif /* TNLTRIDIAGONALMATRIXROW_IMPL_H_ */
+} // namespace TNL
diff --git a/src/matrices/tnlTridiagonalMatrix_impl.h b/src/matrices/tnlTridiagonalMatrix_impl.h
index 9857c0b172bce4c635c7ef88269464316fb1a161..2cfd20ff15d1cefccd20b4675b7afdc7bc805b0a 100644
--- a/src/matrices/tnlTridiagonalMatrix_impl.h
+++ b/src/matrices/tnlTridiagonalMatrix_impl.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRIDIAGONALMATRIX_IMPL_H_
-#define TNLTRIDIAGONALMATRIX_IMPL_H_
+#pragma once
 
 #include <core/tnlAssert.h>
 #include <matrices/tnlTridiagonalMatrix.h>
 
+namespace TNL {
+
 template< typename Device >
 class tnlTridiagonalMatrixDeviceDependentCode;
 
@@ -445,7 +439,7 @@ void tnlTridiagonalMatrix< Real, Device, Index >::addMatrix( const tnlTridiagona
 template< typename Real,
           typename Real2,
           typename Index,
-          typename Index2 >          
+          typename Index2 >
 __global__ void tnlTridiagonalMatrixTranspositionCudaKernel( const tnlTridiagonalMatrix< Real2, tnlCuda, Index2 >* inMatrix,
                                                              tnlTridiagonalMatrix< Real, tnlCuda, Index >* outMatrix,
                                                              const Real matrixMultiplicator,
@@ -654,8 +648,8 @@ class tnlTridiagonalMatrixDeviceDependentCode< tnlHost >
                                  OutVector& outVector )
       {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for if( tnlOmp::isEnabled() )
-#endif           
+#pragma omp parallel for if( tnlHost::isOMPEnabled() )
+#endif
          for( Index row = 0; row < matrix.getRows(); row ++ )
             outVector[ row ] = matrix.rowVectorProduct( row, inVector );
       }
@@ -665,7 +659,7 @@ template<>
 class tnlTridiagonalMatrixDeviceDependentCode< tnlCuda >
 {
    public:
-      
+ 
       typedef tnlCuda Device;
 
       template< typename Index >
@@ -710,6 +704,4 @@ class tnlTridiagonalMatrixDeviceDependentCode< tnlCuda >
       }
 };
 
-
-
-#endif /* TNLTRIDIAGONALMATRIX_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/config/tnlMeshConfigBase.h b/src/mesh/config/tnlMeshConfigBase.h
index 34a8c608a0ee8a0c4be8ae1217bcf5cc9942ec97..cf0dab905bce71ca77e340bfc7ebdf555f98da4f 100644
--- a/src/mesh/config/tnlMeshConfigBase.h
+++ b/src/mesh/config/tnlMeshConfigBase.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHCONFIGBASE_H_
-#define TNLMESHCONFIGBASE_H_
+#pragma once
+
+namespace TNL {
 
 /****
  * Basic structure for mesh configuration.
@@ -45,7 +39,7 @@ struct tnlMeshConfigBase
    {
       return tnlString( "tnlMeshConfigBase< >");
    };
-   
+ 
    /****
     * Storage of mesh entities.
     */
@@ -53,11 +47,11 @@ struct tnlMeshConfigBase
 	{
       /****
        *  Vertices and cells must always be stored
-       */ 
+       */
       return true;
 		//return ( dimensions == 0 || dimensions == cellDimensions );
 	}
-   
+ 
    /****
     *  Storage of subentities of mesh entities
     */
@@ -90,8 +84,8 @@ struct tnlMeshConfigBase
       return true;
 		//return false;
 	}
-   
+ 
    static_assert( WorldDimensions >= Cell::dimensions, "The number of the cell dimensions cannot be larger than the world dimension." );
 };
 
-#endif /* TNLMESHCONFIGBASE_H_ */
+} // namespace TNL
diff --git a/src/mesh/config/tnlMeshConfigValidator.h b/src/mesh/config/tnlMeshConfigValidator.h
index c9f8e5bed7f46897cc95be680a0b5204a3f89d76..40546ed3d42925a0bdc925343342f355e6625866 100644
--- a/src/mesh/config/tnlMeshConfigValidator.h
+++ b/src/mesh/config/tnlMeshConfigValidator.h
@@ -6,33 +6,27 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHCONFIGVALIDATOR_H
-#define	TNLMESHCONFIGVALIDATOR_H
+#pragma once
 
 #include <core/tnlAssert.h>
 #include <mesh/topologies/tnlMeshEntityTopology.h>
 #include <mesh/tnlDimensionsTag.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename MeshEntity,
           typename dimensions >
 class tnlMeshConfigValidatorSubtopologyLayer :
 public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, typename dimensions::Decrement >
 {
-   static_assert( ! MeshConfig::subentityStorage( MeshEntity(), dimensions::value ) || 
+   static_assert( ! MeshConfig::subentityStorage( MeshEntity(), dimensions::value ) ||
                     MeshConfig::entityStorage( MeshEntity::dimensions ), "entities of which subentities are stored must be stored" );
    static_assert( ! MeshConfig::subentityStorage( MeshEntity(), dimensions::value ) ||
                     MeshConfig::entityStorage( dimensions::value ), "entities that are stored as subentities must be stored");
-   static_assert( ! MeshConfig::subentityOrientationStorage( MeshEntity(), dimensions::value ) || 
+   static_assert( ! MeshConfig::subentityOrientationStorage( MeshEntity(), dimensions::value ) ||
                     MeshConfig::subentityStorage( MeshEntity(), dimensions::value ), "orientation can be stored only for subentities that are stored");
 };
 
@@ -67,10 +61,10 @@ class tnlMeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, tnlDimen
 template< typename MeshConfig, int dimensions >
 class tnlMeshConfigValidatorLayer :
  public tnlMeshConfigValidatorLayer< MeshConfig, dimensions - 1 >,
- public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig, 
+ public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig,
                                                 typename tnlMeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology,
                                                 tnlDimensionsTag< dimensions - 1 > >,
- public tnlMeshConfigValidatorSupertopologyLayer< MeshConfig, 
+ public tnlMeshConfigValidatorSupertopologyLayer< MeshConfig,
                                                   typename tnlMeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology,
                                                   tnlDimensionsTag< MeshConfig::CellTopology::dimensions > >
 {
@@ -87,7 +81,7 @@ class tnlMeshConfigValidatorLayer< MeshConfig, 0 >
 template< typename MeshConfig >
 class tnlMeshConfigValidatorLayerCell :
    public tnlMeshConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimensions - 1 >,
-   public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig, 
+   public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig,
                                                   typename MeshConfig::CellTopology,
                                                   tnlDimensionsTag< MeshConfig::CellTopology::dimensions - 1 > >
 {
@@ -109,6 +103,5 @@ class tnlMeshConfigValidator : public tnlMeshConfigValidatorLayerCell< MeshConfi
 	static_assert( MeshConfig::entityStorage( meshDimensions ), "mesh cells must be stored");
 };
 
-
-#endif	/* TNLMESHCONFIGVALIDATOR_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlBoundaryGridEntityChecker.h b/src/mesh/grids/tnlBoundaryGridEntityChecker.h
index aa03b092443e4af1dbe31e6432d3ac11c3206315..1b495c1b18c2c247e8570b6ea91aad13d92cda8e 100644
--- a/src/mesh/grids/tnlBoundaryGridEntityChecker.h
+++ b/src/mesh/grids/tnlBoundaryGridEntityChecker.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
 
+#pragma once
 
-#ifndef TNLBOUNDARYGRIDENTITYCHECKER_H
-#define	TNLBOUNDARYGRIDENTITYCHECKER_H
+namespace TNL{
 
 template< typename GridEntity >
 class tnlBoundaryGridEntityChecker
@@ -34,10 +28,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1, Config  > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 1, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -53,10 +47,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 1, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -75,10 +69,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 2, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -96,20 +90,20 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 1, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 2, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
          return( entity.getCoordinates().x() == 0 ||
                  entity.getCoordinates().y() == 0 ||
-                 entity.getCoordinates().x() == 
+                 entity.getCoordinates().x() ==
                     entity.grid.getDimensions().x() - entity.getBasis().x() ||
-                 entity.getCoordinates().y() == 
+                 entity.getCoordinates().y() ==
                     entity.grid.getDimensions().y() - entity.getBasis().y() );
-         
+ 
       }
 };
 
@@ -121,10 +115,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 2, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -132,7 +126,7 @@ class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Ind
                  entity.getCoordinates().y() == 0 ||
                  entity.getCoordinates().x() == entity.grid.getDimensions().x() ||
                  entity.getCoordinates().y() == entity.grid.getDimensions().y() );
-         
+ 
       }
 };
 
@@ -148,23 +142,23 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, EntityDimensions, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 3, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
          return( entity.getCoordinates().x() == 0 ||
                  entity.getCoordinates().y() == 0 ||
                  entity.getCoordinates().z() == 0 ||
-                 entity.getCoordinates().x() == 
+                 entity.getCoordinates().x() ==
                     entity.grid.getDimensions().x() - entity.getBasis().x() ||
-                 entity.getCoordinates().y() == 
+                 entity.getCoordinates().y() ==
                     entity.grid.getDimensions().y() - entity.getBasis().y() ||
-                 entity.getCoordinates().z() == 
+                 entity.getCoordinates().z() ==
                     entity.grid.getDimensions().z() - entity.getBasis().z() );
-         
+ 
       }
 };
 
@@ -175,10 +169,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 3, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -198,10 +192,10 @@ template< typename Real,
 class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 3, Config > GridEntityType;
-      
+ 
       __cuda_callable__ inline
       static bool isBoundaryEntity( const GridEntityType& entity )
       {
@@ -214,5 +208,5 @@ class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Ind
       }
 };
 
-#endif	/* TNLBOUNDARYGRIDENTITYCHECKER_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGrid1D.h b/src/mesh/grids/tnlGrid1D.h
index 9d9962ce61b4849b8b6c68ca376c0f51381d915b..3ce2782b0359ccaefcb60b952e0518176ddcaa9d 100644
--- a/src/mesh/grids/tnlGrid1D.h
+++ b/src/mesh/grids/tnlGrid1D.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef SRC_MESH_TNLGRID1D_H_
-#define SRC_MESH_TNLGRID1D_H_
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <core/tnlLogger.h>
@@ -26,6 +18,8 @@
 #include <mesh/grids/tnlGridEntity.h>
 #include <mesh/grids/tnlGridEntityConfig.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -37,23 +31,23 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlStaticVector< 1, Real > VertexType;
-   typedef tnlStaticVector< 1, Index > CoordinatesType;   
+   typedef tnlStaticVector< 1, Index > CoordinatesType;
    typedef tnlGrid< 1, Real, tnlHost, Index > HostType;
    typedef tnlGrid< 1, Real, tnlCuda, Index > CudaType;
    typedef tnlGrid< 1, Real, Device, Index > ThisType;
-   
+ 
    static const int meshDimensions = 1;
-   
-   template< int EntityDimensions, 
+ 
+   template< int EntityDimensions,
              typename Config = tnlGridEntityCrossStencilStorage< 1 > >
    using MeshEntity = tnlGridEntity< ThisType, EntityDimensions, Config >;
-     
+ 
    typedef MeshEntity< meshDimensions, tnlGridEntityCrossStencilStorage< 1 > > Cell;
    typedef MeshEntity< 0 > Face;
    typedef MeshEntity< 0 > Vertex;
 
    static constexpr int getMeshDimensions() { return meshDimensions; };
-   
+ 
    tnlGrid();
 
    static tnlString getType();
@@ -79,33 +73,33 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
 
    __cuda_callable__
    inline const VertexType& getProportions() const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline IndexType getEntitiesCount() const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline EntityType getEntity( const IndexType& entityIndex ) const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline Index getEntityIndex( const EntityType& entity ) const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    RealType getEntityMeasure( const EntityType& entity ) const;
-   
+ 
    __cuda_callable__
    RealType getCellMeasure() const;
-   
+ 
    __cuda_callable__
    inline VertexType getSpaceSteps() const;
 
    template< int xPow >
    __cuda_callable__
    inline const RealType& getSpaceStepsProducts() const;
-   
+ 
    __cuda_callable__
    inline RealType getSmallestSpaceStep() const;
 
@@ -148,16 +142,16 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
    void computeSpaceSteps();
 
    CoordinatesType dimensions;
-   
+ 
    IndexType numberOfCells, numberOfVertices;
 
    VertexType origin, proportions;
-   
+ 
    VertexType spaceSteps;
-   
+ 
    RealType spaceStepsProducts[ 5 ];
 };
 
-#include <mesh/grids/tnlGrid1D_impl.h>
+} // namespace TNL
 
-#endif /* SRC_MESH_TNLGRID1D_H_ */
+#include <mesh/grids/tnlGrid1D_impl.h>
diff --git a/src/mesh/grids/tnlGrid1D_impl.h b/src/mesh/grids/tnlGrid1D_impl.h
index c62ce6d88f994146759b73e130036b5312673356..4f5c3a4e8133a5b1683dd0eb67e49226bc684ffb 100644
--- a/src/mesh/grids/tnlGrid1D_impl.h
+++ b/src/mesh/grids/tnlGrid1D_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRID1D_IMPL_H_
-#define TNLGRID1D_IMPL_H_
+#pragma once
 
 #include <fstream>
 #include <iomanip>
@@ -28,7 +20,7 @@
 #include <mesh/grids/tnlGrid1D.h>
 #include <mesh/grids/tnlGridEntityMeasureGetter.h>
 
-using namespace std;
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -137,7 +129,7 @@ template< typename Real,
           typename Device,
           typename Index  >
 __cuda_callable__ inline
-const typename tnlGrid< 1, Real, Device, Index >::VertexType& 
+const typename tnlGrid< 1, Real, Device, Index >::VertexType&
   tnlGrid< 1, Real, Device, Index >::getOrigin() const
 {
    return this->origin;
@@ -147,7 +139,7 @@ template< typename Real,
           typename Device,
           typename Index >
 __cuda_callable__ inline
-const typename tnlGrid< 1, Real, Device, Index >::VertexType& 
+const typename tnlGrid< 1, Real, Device, Index >::VertexType&
    tnlGrid< 1, Real, Device, Index >::getProportions() const
 {
    return this->proportions;
@@ -159,19 +151,19 @@ template< typename Real,
    template< typename EntityType >
 __cuda_callable__  inline
 Index
-tnlGrid< 1, Real, Device, Index >:: 
+tnlGrid< 1, Real, Device, Index >::
 getEntitiesCount() const
 {
    static_assert( EntityType::entityDimensions <= 1 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    switch( EntityType::entityDimensions )
    {
       case 1:
          return this->numberOfCells;
       case 0:
          return this->numberOfVertices;
-   }            
+   }
    return -1;
 }
 
@@ -186,7 +178,7 @@ getEntity( const IndexType& entityIndex ) const
 {
    static_assert( EntityType::entityDimensions <= 1 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex );
 }
 
@@ -201,7 +193,7 @@ getEntityIndex( const EntityType& entity ) const
 {
    static_assert( EntityType::entityDimensions <= 1 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity );
 }
 
@@ -243,12 +235,12 @@ template< typename Real,
           typename Device,
           typename Index >
    template< int xPow >
-__cuda_callable__ inline 
-const Real& 
+__cuda_callable__ inline
+const Real&
 tnlGrid< 1, Real, Device, Index >::
 getSpaceStepsProducts() const
 {
-   tnlAssert( xPow >= -2 && xPow <= 2, 
+   tnlAssert( xPow >= -2 && xPow <= 2,
               cerr << " xPow = " << xPow );
    return this->spaceStepsProducts[ xPow + 2 ];
 }
@@ -272,7 +264,7 @@ tnlGrid< 1, Real, Device, Index >::getDifferenceAbsMax( const GridFunction& f1,
                                                         const GridFunction& f2 ) const
 {
    typename GridFunction::RealType maxDiff( -1.0 );
-   
+ 
    Cell cell( *this );
    for( cell.getCoordinates().x() = 0;
         cell.getCoordinates().x() < getDimensions().x();
@@ -383,7 +375,7 @@ bool tnlGrid< 1, Real, Device, Index >::write( const MeshFunction& function,
    if( this->template getEntitiesCount< Cell >() != function. getSize() )
    {
       cerr << "The size ( " << function. getSize()
-           << " ) of the mesh function does not agree with the DOFs ( " 
+           << " ) of the mesh function does not agree with the DOFs ( "
            << this->template getEntitiesCount< Cell >() << " ) of a mesh." << endl;
       return false;
    }
@@ -427,4 +419,4 @@ writeProlog( tnlLogger& logger )
    logger.writeParameter( "Space steps:", this->getSpaceSteps() );
 }
 
-#endif /* TNLGRID1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/grids/tnlGrid2D.h b/src/mesh/grids/tnlGrid2D.h
index 06b6111b3aae0b42ccfcab91aec297124f62992c..8a44cbaaeff2fe92a7a131b25073cdef895f8ef2 100644
--- a/src/mesh/grids/tnlGrid2D.h
+++ b/src/mesh/grids/tnlGrid2D.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef SRC_MESH_TNLGRID2D_H_
-#define SRC_MESH_TNLGRID2D_H_
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <mesh/grids/tnlGridEntityTopology.h>
 #include <mesh/grids/tnlGridEntityGetter.h>
 #include <mesh/grids/tnlNeighbourGridEntityGetter.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -36,19 +30,19 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
    typedef tnlStaticVector< 2, Real > VertexType;
    typedef tnlStaticVector< 2, Index > CoordinatesType;
    typedef tnlGrid< 2, Real, tnlHost, Index > HostType;
-   typedef tnlGrid< 2, Real, tnlCuda, Index > CudaType;   
+   typedef tnlGrid< 2, Real, tnlCuda, Index > CudaType;
    typedef tnlGrid< 2, Real, Device, Index > ThisType;
-   
+ 
    static const int meshDimensions = 2;
 
-   template< int EntityDimensions, 
+   template< int EntityDimensions,
              typename Config = tnlGridEntityNoStencilStorage >//CrossStencilStorage< 1 > >
    using MeshEntity = tnlGridEntity< ThisType, EntityDimensions, Config >;
-   
+ 
    typedef MeshEntity< meshDimensions, tnlGridEntityCrossStencilStorage< 1 > > Cell;
    typedef MeshEntity< meshDimensions - 1, tnlGridEntityNoStencilStorage > Face;
    typedef MeshEntity< 0 > Vertex;
-   
+ 
    static constexpr int getMeshDimensions() { return meshDimensions; };
 
    tnlGrid();
@@ -79,11 +73,11 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
    template< typename EntityType >
    __cuda_callable__
    inline IndexType getEntitiesCount() const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline EntityType getEntity( const IndexType& entityIndex ) const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline Index getEntityIndex( const EntityType& entity ) const;
@@ -91,21 +85,21 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
    template< typename EntityType >
    __cuda_callable__
    RealType getEntityMeasure( const EntityType& entity ) const;
-      
+ 
    __cuda_callable__
    RealType getCellMeasure() const;
-   
+ 
    __cuda_callable__
    inline VertexType getSpaceSteps() const;
 
    template< int xPow, int yPow >
    __cuda_callable__
    inline const RealType& getSpaceStepsProducts() const;
-   
+ 
    __cuda_callable__
    inline RealType getSmallestSpaceStep() const;
 
-   
+ 
    template< typename GridFunction >
    typename GridFunction::RealType getAbsMax( const GridFunction& f ) const;
 
@@ -148,19 +142,19 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
    void computeSpaceSteps();
 
    CoordinatesType dimensions;
-   
+ 
    IndexType numberOfCells, numberOfNxFaces, numberOfNyFaces, numberOfFaces, numberOfVertices;
 
    VertexType origin, proportions;
-   
+ 
    VertexType spaceSteps;
-   
+ 
    RealType spaceStepsProducts[ 5 ][ 5 ];
-  
-   template< typename, typename, int > 
+ 
+   template< typename, typename, int >
    friend class tnlGridEntityGetter;
 };
 
-#include <mesh/grids/tnlGrid2D_impl.h>
+} // namespace TNL
 
-#endif /* SRC_MESH_TNLGRID2D_H_ */
+#include <mesh/grids/tnlGrid2D_impl.h>
diff --git a/src/mesh/grids/tnlGrid2D_impl.h b/src/mesh/grids/tnlGrid2D_impl.h
index bfd4364aa2da8f6d43f25750451b9d65e6b70c77..3600b142c58549de35507748a99905e7ec1c7fe6 100644
--- a/src/mesh/grids/tnlGrid2D_impl.h
+++ b/src/mesh/grids/tnlGrid2D_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRID2D_IMPL_H_
-#define TNLGRID2D_IMPL_H_
+#pragma once
 
 #include <fstream>
 #include <iomanip>
@@ -26,7 +18,7 @@
 #include <mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h>
 #include <mesh/grids/tnlGridEntityMeasureGetter.h>
 
-using namespace std;
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -86,9 +78,9 @@ void tnlGrid< 2, Real, Device, Index > :: computeSpaceSteps()
    {
       this->spaceSteps.x() = this->proportions.x() / ( Real ) this->getDimensions().x();
       this->spaceSteps.y() = this->proportions.y() / ( Real ) this->getDimensions().y();
-      const RealType& hx = this->spaceSteps.x(); 
+      const RealType& hx = this->spaceSteps.x();
       const RealType& hy = this->spaceSteps.y();
-      
+ 
       Real auxX, auxY;
       for( int i = 0; i < 5; i++ )
       {
@@ -130,7 +122,7 @@ void tnlGrid< 2, Real, Device, Index > :: computeSpaceSteps()
                   auxY = hy * hy;
                   break;
             }
-            this->spaceStepsProducts[ i ][ j ] = auxX * auxY;         
+            this->spaceStepsProducts[ i ][ j ] = auxX * auxY;
          }
       }
    }
@@ -186,7 +178,7 @@ void tnlGrid< 2, Real, Device, Index > :: setDomain( const VertexType& origin,
 template< typename Real,
           typename Device,
           typename Index >
-__cuda_callable__ inline 
+__cuda_callable__ inline
 const typename tnlGrid< 2, Real, Device, Index >::VertexType&
 tnlGrid< 2, Real, Device, Index >::getOrigin() const
 {
@@ -196,7 +188,7 @@ tnlGrid< 2, Real, Device, Index >::getOrigin() const
 template< typename Real,
           typename Device,
           typename Index >
-__cuda_callable__ inline 
+__cuda_callable__ inline
 const typename tnlGrid< 2, Real, Device, Index > :: VertexType&
    tnlGrid< 2, Real, Device, Index > :: getProportions() const
 {
@@ -207,23 +199,23 @@ template< typename Real,
           typename Device,
           typename Index >
    template< typename EntityType >
-__cuda_callable__ inline 
+__cuda_callable__ inline
 Index
-tnlGrid< 2, Real, Device, Index >:: 
+tnlGrid< 2, Real, Device, Index >::
 getEntitiesCount() const
 {
    static_assert( EntityType::entityDimensions <= 2 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    switch( EntityType::entityDimensions )
    {
       case 2:
          return this->numberOfCells;
       case 1:
-         return this->numberOfFaces;         
+         return this->numberOfFaces;
       case 0:
          return this->numberOfVertices;
-   }            
+   }
    return -1;
 }
 
@@ -231,14 +223,14 @@ template< typename Real,
           typename Device,
           typename Index >
    template< typename EntityType >
-__cuda_callable__ inline 
+__cuda_callable__ inline
 EntityType
 tnlGrid< 2, Real, Device, Index >::
 getEntity( const IndexType& entityIndex ) const
 {
    static_assert( EntityType::entityDimensions <= 2 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex );
 }
 
@@ -246,14 +238,14 @@ template< typename Real,
           typename Device,
           typename Index >
    template< typename EntityType >
-__cuda_callable__ inline 
+__cuda_callable__ inline
 Index
 tnlGrid< 2, Real, Device, Index >::
 getEntityIndex( const EntityType& entity ) const
 {
    static_assert( EntityType::entityDimensions <= 2 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity );
 }
 
@@ -296,14 +288,14 @@ template< typename Real,
           typename Device,
           typename Index >
    template< int xPow, int yPow  >
-__cuda_callable__ inline 
-const Real& 
+__cuda_callable__ inline
+const Real&
 tnlGrid< 2, Real, Device, Index >::
 getSpaceStepsProducts() const
 {
-   tnlAssert( xPow >= -2 && xPow <= 2, 
+   tnlAssert( xPow >= -2 && xPow <= 2,
               cerr << " xPow = " << xPow );
-   tnlAssert( yPow >= -2 && yPow <= 2, 
+   tnlAssert( yPow >= -2 && yPow <= 2,
               cerr << " yPow = " << yPow );
 
    return this->spaceStepsProducts[ yPow + 2 ][ xPow + 2 ];
@@ -575,8 +567,8 @@ bool tnlGrid< 2, Real, Device, Index > :: write( const MeshFunction& function,
 {
    if( this->template getEntitiesCount< Cell >() != function. getSize() )
    {
-      cerr << "The size ( " << function. getSize() 
-           << " ) of a mesh function does not agree with the DOFs ( " 
+      cerr << "The size ( " << function. getSize()
+           << " ) of a mesh function does not agree with the DOFs ( "
            << this->template getEntitiesCount< Cell >() << " ) of a mesh." << endl;
       return false;
    }
@@ -622,5 +614,4 @@ writeProlog( tnlLogger& logger )
    logger.writeParameter( "Space steps:", this->getSpaceSteps() );
 }
 
-
-#endif /* TNLGRID2D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/grids/tnlGrid3D.h b/src/mesh/grids/tnlGrid3D.h
index e05258eba4c621b6028a09c574ae8d699030812c..2e7d92d6b0382a797e85c4dbc60d6dbc9d57b790 100644
--- a/src/mesh/grids/tnlGrid3D.h
+++ b/src/mesh/grids/tnlGrid3D.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef SRC_MESH_TNLGRID3D_H_
-#define SRC_MESH_TNLGRID3D_H_
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <mesh/grids/tnlGridEntityTopology.h>
 #include <mesh/grids/tnlGridEntityGetter.h>
 #include <mesh/grids/tnlNeighbourGridEntityGetter.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -38,10 +32,10 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject
    typedef tnlGrid< 3, Real, tnlHost, Index > HostType;
    typedef tnlGrid< 3, Real, tnlCuda, Index > CudaType;
    typedef tnlGrid< 3, Real, Device, Index > ThisType;
-   
+ 
    static const int meshDimensions = 3;
 
-   template< int EntityDimensions, 
+   template< int EntityDimensions,
              typename Config = tnlGridEntityCrossStencilStorage< 1 > >
    using MeshEntity = tnlGridEntity< ThisType, EntityDimensions, Config >;
 
@@ -80,33 +74,33 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject
    template< typename EntityType >
    __cuda_callable__
    inline IndexType getEntitiesCount() const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline EntityType getEntity( const IndexType& entityIndex ) const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    inline Index getEntityIndex( const EntityType& entity ) const;
-   
+ 
    template< typename EntityType >
    __cuda_callable__
    RealType getEntityMeasure( const EntityType& entity ) const;
-      
+ 
    __cuda_callable__
    RealType getCellMeasure() const;
 
    __cuda_callable__
    inline VertexType getSpaceSteps() const;
-   
+ 
    template< int xPow, int yPow, int zPow >
    __cuda_callable__
    inline const RealType& getSpaceStepsProducts() const;
 
-   
+ 
    __cuda_callable__
    inline RealType getSmallestSpaceStep() const;
-      
+ 
    template< typename GridFunction >
    typename GridFunction::RealType getAbsMax( const GridFunction& f ) const;
 
@@ -148,7 +142,7 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject
    void computeSpaceSteps();
 
    CoordinatesType dimensions;
-   
+ 
    IndexType numberOfCells,
           numberOfNxFaces, numberOfNyFaces, numberOfNzFaces, numberOfNxAndNyFaces, numberOfFaces,
           numberOfDxEdges, numberOfDyEdges, numberOfDzEdges, numberOfDxAndDyEdges, numberOfEdges,
@@ -157,18 +151,18 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject
    VertexType origin, proportions;
 
    IndexType cellZNeighboursStep;
-   
+ 
    VertexType spaceSteps;
-   
+ 
    RealType spaceStepsProducts[ 5 ][ 5 ][ 5 ];
 
    template< typename, typename, int >
    friend class tnlGridEntityGetter;
-      
+ 
    template< typename, int, typename >
    friend class tnlNeighbourGridEntityGetter;
 };
 
-#include <mesh/grids/tnlGrid3D_impl.h>
+} // namespace TNL
 
-#endif /* SRC_MESH_TNLGRID3D_H_ */
+#include <mesh/grids/tnlGrid3D_impl.h>
diff --git a/src/mesh/grids/tnlGrid3D_impl.h b/src/mesh/grids/tnlGrid3D_impl.h
index e1608d67d184caed263a2e6b2e7e22c9e4a83498..934b1d88ecde585645b4f05353a297c4c8527e9a 100644
--- a/src/mesh/grids/tnlGrid3D_impl.h
+++ b/src/mesh/grids/tnlGrid3D_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRID3D_IMPL_H_
-#define TNLGRID3D_IMPL_H_
+#pragma once
 
 #include <iomanip>
 #include <core/tnlAssert.h>
@@ -25,6 +17,8 @@
 #include <mesh/grids/tnlGrid3D.h>
 #include <mesh/grids/tnlGridEntityMeasureGetter.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -91,11 +85,11 @@ void tnlGrid< 3, Real, Device, Index > :: computeSpaceSteps()
    {
       this->spaceSteps.x() = this->proportions.x() / ( Real ) this->getDimensions().x();
       this->spaceSteps.y() = this->proportions.y() / ( Real ) this->getDimensions().y();
-      this->spaceSteps.z() = this->proportions.z() / ( Real ) this->getDimensions().z();      
-      const RealType& hx = this->spaceSteps.x(); 
+      this->spaceSteps.z() = this->proportions.z() / ( Real ) this->getDimensions().z();
+      const RealType& hx = this->spaceSteps.x();
       const RealType& hy = this->spaceSteps.y();
-      const RealType& hz = this->spaceSteps.z();      
-      
+      const RealType& hz = this->spaceSteps.z();
+ 
       Real auxX, auxY, auxZ;
       for( int i = 0; i < 5; i++ )
       {
@@ -156,8 +150,8 @@ void tnlGrid< 3, Real, Device, Index > :: computeSpaceSteps()
                   case 4:
                      auxZ = hz * hz;
                      break;
-               }            
-               this->spaceStepsProducts[ i ][ j ][ k ] = auxX * auxY * auxZ;         
+               }
+               this->spaceStepsProducts[ i ][ j ][ k ] = auxX * auxY * auxZ;
             }
          }
       }
@@ -192,7 +186,7 @@ void tnlGrid< 3, Real, Device, Index > :: setDimensions( const Index xSize, cons
                          this->numberOfDyEdges +
                          this->numberOfDzEdges;
    this->numberOfVertices = ( xSize + 1 ) * ( ySize + 1 ) * ( zSize + 1 );
-   
+ 
    this->cellZNeighboursStep = xSize * ySize;
 
    computeSpaceSteps();
@@ -253,23 +247,23 @@ template< typename Real,
    template< typename EntityType >
 __cuda_callable__  inline
 Index
-tnlGrid< 3, Real, Device, Index >:: 
+tnlGrid< 3, Real, Device, Index >::
 getEntitiesCount() const
 {
    static_assert( EntityType::entityDimensions <= 3 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    switch( EntityType::entityDimensions )
    {
       case 3:
          return this->numberOfCells;
       case 2:
-         return this->numberOfFaces;         
+         return this->numberOfFaces;
       case 1:
-         return this->numberOfEdges;                  
+         return this->numberOfEdges;
       case 0:
          return this->numberOfVertices;
-   }            
+   }
    return -1;
 }
 
@@ -284,7 +278,7 @@ getEntity( const IndexType& entityIndex ) const
 {
    static_assert( EntityType::entityDimensions <= 3 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex );
 }
 
@@ -299,7 +293,7 @@ getEntityIndex( const EntityType& entity ) const
 {
    static_assert( EntityType::entityDimensions <= 3 &&
                   EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." );
-   
+ 
    return tnlGridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity );
 }
 
@@ -341,16 +335,16 @@ template< typename Real,
           typename Device,
           typename Index >
    template< int xPow, int yPow, int zPow >
-__cuda_callable__ inline 
-const Real& 
+__cuda_callable__ inline
+const Real&
 tnlGrid< 3, Real, Device, Index >::
 getSpaceStepsProducts() const
 {
-   tnlAssert( xPow >= -2 && xPow <= 2, 
+   tnlAssert( xPow >= -2 && xPow <= 2,
               cerr << " xPow = " << xPow );
-   tnlAssert( yPow >= -2 && yPow <= 2, 
+   tnlAssert( yPow >= -2 && yPow <= 2,
               cerr << " yPow = " << yPow );
-   tnlAssert( zPow >= -2 && zPow <= 2, 
+   tnlAssert( zPow >= -2 && zPow <= 2,
               cerr << " zPow = " << zPow );
 
    return this->spaceStepsProducts[ zPow + 2 ][ yPow + 2 ][ xPow + 2 ];
@@ -530,7 +524,7 @@ bool tnlGrid< 3, Real, Device, Index > :: write( const MeshFunction& function,
 {
    if( this->template getEntitiesCount< Cell >() != function. getSize() )
    {
-      cerr << "The size ( " << function. getSize() 
+      cerr << "The size ( " << function. getSize()
            << " ) of a mesh function does not agree with the DOFs ( " << this->template getEntitiesCount< Cell >() << " ) of a mesh." << endl;
       return false;
    }
@@ -585,5 +579,4 @@ writeProlog( tnlLogger& logger )
    logger.writeParameter( "Space steps:", this->getSpaceSteps() );
 }
 
-
-#endif /* TNLGRID3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/grids/tnlGridEntity.h b/src/mesh/grids/tnlGridEntity.h
index 8e0666bcf66bcc2857f4347959d63de584a70de5..d69f9e7100067809088fcfa32d48913cdee31af0 100644
--- a/src/mesh/grids/tnlGridEntity.h
+++ b/src/mesh/grids/tnlGridEntity.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRIDENTITY_H
-#define	TNLGRIDENTITY_H
+#pragma once
 
 #include <mesh/grids/tnlNeighbourGridEntitiesStorage.h>
 
+namespace TNL {
+
 template< typename GridEntity,
           int NeighbourEntityDimensions,
           typename StencilStorage >
@@ -32,7 +26,7 @@ template< typename GridEntityType >
 class tnlGridEntityCenterGetter;
 
 
-template< typename Grid,          
+template< typename Grid,
           int EntityDimensions,
           typename Config >
 class tnlGridEntity
@@ -43,58 +37,58 @@ class tnlGridEntity
 template< int Dimensions,
           typename Real,
           typename Device,
-          typename Index,          
+          typename Index,
           int EntityDimensions,
           typename Config >
 class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, Real, Device, Index > GridType;
       typedef GridType MeshType;
       typedef typename GridType::RealType RealType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef Config ConfigType;
-      
+ 
       static const int meshDimensions = GridType::meshDimensions;
-      
+ 
       static const int entityDimensions = EntityDimensions;
-            
+ 
       constexpr static int getDimensions() { return EntityDimensions; };
-      
+ 
       constexpr static int getMeshDimensions() { return meshDimensions; };
-      
+ 
       typedef tnlStaticVector< meshDimensions, IndexType > EntityOrientationType;
       typedef tnlStaticVector< meshDimensions, IndexType > EntityBasisType;
       typedef tnlGridEntity< GridType, entityDimensions, Config > ThisType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
-      
+ 
       template< int NeighbourEntityDimensions = entityDimensions >
-      using NeighbourEntities = 
+      using NeighbourEntities =
          tnlNeighbourGridEntityGetter<
             tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                            EntityDimensions,
                            Config >,
             NeighbourEntityDimensions >;
-      
+ 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid );
-      
+ 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid,
                      const CoordinatesType& coordinates,
                      const EntityOrientationType& orientation,
                      const EntityBasisType& basis );
-      
+ 
       __cuda_callable__ inline
       const CoordinatesType& getCoordinates() const;
-      
+ 
       __cuda_callable__ inline
       CoordinatesType& getCoordinates();
-      
+ 
       __cuda_callable__ inline
       void setCoordinates( const CoordinatesType& coordinates );
 
@@ -109,58 +103,58 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimension
 
       __cuda_callable__ inline
       Index getIndex() const;
-      
+ 
       __cuda_callable__ inline
       const EntityOrientationType& getOrientation() const;
-      
+ 
       __cuda_callable__ inline
       void setOrientation( const EntityOrientationType& orientation );
-      
+ 
       __cuda_callable__ inline
       const EntityBasisType& getBasis() const;
-      
+ 
       __cuda_callable__ inline
       EntityBasisType& getBasis();
-      
+ 
       __cuda_callable__ inline
       void setBasis( const EntityBasisType& basis );
-      
+ 
       template< int NeighbourEntityDimensions = entityDimensions >
       __cuda_callable__ inline
       const NeighbourEntities< NeighbourEntityDimensions >&
       getNeighbourEntities() const;
-      
+ 
       __cuda_callable__ inline
       bool isBoundaryEntity() const;
-      
+ 
       __cuda_callable__ inline
       VertexType getCenter() const;
-      
+ 
       __cuda_callable__ inline
       const RealType& getMeasure() const;
-      
+ 
       __cuda_callable__ inline
       const GridType& getMesh() const;
-      
+ 
    protected:
-      
+ 
       const GridType& grid;
-      
+ 
       IndexType entityIndex;
-      
+ 
       CoordinatesType coordinates;
-      
+ 
       EntityOrientationType orientation;
-      
+ 
       EntityBasisType basis;
-      
+ 
       NeighbourGridEntitiesStorageType neighbourEntitiesStorage;
-      
+ 
       //__cuda_callable__ inline
       //tnlGridEntity();
-      
+ 
       friend class tnlBoundaryGridEntityChecker< ThisType >;
-      
+ 
       friend class tnlGridEntityCenterGetter< ThisType >;
 };
 
@@ -175,7 +169,7 @@ template< int Dimensions,
 class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, Real, Device, Index > GridType;
       typedef GridType MeshType;
       typedef typename GridType::RealType RealType;
@@ -183,23 +177,23 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Con
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef typename GridType::VertexType VertexType;
       typedef Config ConfigType;
-      
+ 
       static const int meshDimensions = GridType::meshDimensions;
-      
+ 
       static const int entityDimensions = meshDimensions;
 
       constexpr static int getDimensions() { return entityDimensions; };
-      
+ 
       constexpr static int getMeshDimensions() { return meshDimensions; };
-      
-      
+ 
+ 
       typedef tnlStaticVector< meshDimensions, IndexType > EntityOrientationType;
       typedef tnlStaticVector< meshDimensions, IndexType > EntityBasisType;
       typedef tnlGridEntity< GridType, entityDimensions, Config > ThisType;
       typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
-      
+ 
       template< int NeighbourEntityDimensions = entityDimensions >
-      using NeighbourEntities = 
+      using NeighbourEntities =
          tnlNeighbourGridEntityGetter<
             tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                            entityDimensions,
@@ -209,19 +203,19 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Con
 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid );
-      
+ 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid,
                      const CoordinatesType& coordinates,
                      const EntityOrientationType& orientation = EntityOrientationType( 0 ),
                      const EntityBasisType& basis = EntityBasisType( 1 ) );
-      
+ 
       __cuda_callable__ inline
-      const CoordinatesType& getCoordinates() const;      
-      
+      const CoordinatesType& getCoordinates() const;
+ 
       __cuda_callable__ inline
-      CoordinatesType& getCoordinates();  
-      
+      CoordinatesType& getCoordinates();
+ 
       __cuda_callable__ inline
       void setCoordinates( const CoordinatesType& coordinates );
 
@@ -236,58 +230,58 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Con
 
       __cuda_callable__ inline
       Index getIndex() const;
-            
+ 
       __cuda_callable__ inline
       const EntityOrientationType getOrientation() const;
-      
+ 
       __cuda_callable__ inline
       void setOrientation( const EntityOrientationType& orientation ){};
-      
+ 
       __cuda_callable__ inline
       const EntityBasisType getBasis() const;
-      
+ 
       __cuda_callable__ inline
       void setBasis( const EntityBasisType& basis ){};
-      
+ 
       template< int NeighbourEntityDimensions = Dimensions >
       __cuda_callable__ inline
       const NeighbourEntities< NeighbourEntityDimensions >&
       getNeighbourEntities() const;
-      
+ 
       __cuda_callable__ inline
       bool isBoundaryEntity() const;
-      
+ 
       __cuda_callable__ inline
       VertexType getCenter() const;
-      
+ 
       __cuda_callable__ inline
-      const RealType& getMeasure() const;      
-      
+      const RealType& getMeasure() const;
+ 
       __cuda_callable__ inline
-      const VertexType& getEntityProportions() const;      
-      
+      const VertexType& getEntityProportions() const;
+ 
       __cuda_callable__ inline
       const GridType& getMesh() const;
 
    protected:
-      
+ 
       const GridType& grid;
-      
-      IndexType entityIndex;      
-      
+ 
+      IndexType entityIndex;
+ 
       CoordinatesType coordinates;
-      
+ 
       EntityOrientationType orientation;
-      
+ 
       EntityBasisType basis;
-      
+ 
       NeighbourGridEntitiesStorageType neighbourEntitiesStorage;
-      
+ 
       //__cuda_callable__ inline
       //tnlGridEntity();
-      
+ 
       friend class tnlBoundaryGridEntityChecker< ThisType >;
-      
+ 
       friend class tnlGridEntityCenterGetter< ThisType >;
 };
 
@@ -302,7 +296,7 @@ template< int Dimensions,
 class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, Real, Device, Index > GridType;
       typedef GridType MeshType;
       typedef typename GridType::RealType RealType;
@@ -310,22 +304,22 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef typename GridType::VertexType VertexType;
       typedef Config ConfigType;
-      
+ 
       static const int meshDimensions = GridType::meshDimensions;
-      
+ 
       static const int entityDimensions = 0;
-      
+ 
       constexpr static int getDimensions() { return entityDimensions; };
-      
-      constexpr static int getMeshDimensions() { return meshDimensions; };      
-      
+ 
+      constexpr static int getMeshDimensions() { return meshDimensions; };
+ 
       typedef tnlStaticVector< meshDimensions, IndexType > EntityOrientationType;
       typedef tnlStaticVector< meshDimensions, IndexType > EntityBasisType;
       typedef tnlGridEntity< GridType, entityDimensions, Config > ThisType;
       typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
-      
+ 
       template< int NeighbourEntityDimensions = entityDimensions >
-      using NeighbourEntities = 
+      using NeighbourEntities =
          tnlNeighbourGridEntityGetter<
             tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                            entityDimensions,
@@ -335,19 +329,19 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid );
-      
+ 
       __cuda_callable__ inline
       tnlGridEntity( const GridType& grid,
                      const CoordinatesType& coordinates,
                      const EntityOrientationType& orientation,
                      const EntityBasisType& basis );
-      
+ 
       __cuda_callable__ inline
       const CoordinatesType& getCoordinates() const;
-      
+ 
       __cuda_callable__ inline
       CoordinatesType& getCoordinates();
-      
+ 
       __cuda_callable__ inline
       void setCoordinates( const CoordinatesType& coordinates );
 
@@ -362,60 +356,60 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
 
       __cuda_callable__ inline
       Index getIndex() const;
-            
+ 
       __cuda_callable__ inline
-      const EntityOrientationType getOrientation() const;     
-      
+      const EntityOrientationType getOrientation() const;
+ 
       __cuda_callable__ inline
       void setOrientation( const EntityOrientationType& orientation ){};
-      
+ 
       __cuda_callable__ inline
       const EntityBasisType getBasis() const;
-      
+ 
       __cuda_callable__ inline
       void setBasis( const EntityBasisType& basis ){};
 
-      
+ 
       template< int NeighbourEntityDimensions = entityDimensions >
       __cuda_callable__ inline
       const NeighbourEntities< NeighbourEntityDimensions >&
       getNeighbourEntities() const;
-      
+ 
       __cuda_callable__ inline
       bool isBoundaryEntity() const;
-      
+ 
       __cuda_callable__ inline
       VertexType getCenter() const;
 
       __cuda_callable__ inline
-      const RealType getMeasure() const;      
-      
+      const RealType getMeasure() const;
+ 
       __cuda_callable__ inline
       VertexType getEntityProportions() const;
-      
+ 
       __cuda_callable__ inline
       const GridType& getMesh() const;
-      
+ 
    protected:
-      
+ 
       const GridType& grid;
-      
-      IndexType entityIndex;      
-      
+ 
+      IndexType entityIndex;
+ 
       CoordinatesType coordinates;
-      
+ 
       EntityOrientationType orientation;
-      
+ 
       EntityBasisType basis;
-      
+ 
       NeighbourGridEntitiesStorageType neighbourEntitiesStorage;
-            
+ 
       friend class tnlBoundaryGridEntityChecker< ThisType >;
-      
+ 
       friend class tnlGridEntityCenterGetter< ThisType >;
 };
 
-#include <mesh/grids/tnlGridEntity_impl.h>
+} // namespace TNL
 
-#endif	/* TNLGRIDENTITY_H */
+#include <mesh/grids/tnlGridEntity_impl.h>
 
diff --git a/src/mesh/grids/tnlGridEntityCenterGetter.h b/src/mesh/grids/tnlGridEntityCenterGetter.h
index 914781c0fc62bb877b5354ca9d4e08eb455b8db1..c2659554e6f63810b63ac76d400000b9c2a85dfc 100644
--- a/src/mesh/grids/tnlGridEntityCenterGetter.h
+++ b/src/mesh/grids/tnlGridEntityCenterGetter.h
@@ -6,18 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
 
+#pragma once
 
-#ifndef TNLGRIDENTITYCENTERGETTER_H
-#define	TNLGRIDENTITYCENTERGETTER_H
+namespace TNL {
 
 template< typename GridEntity >
 class tnlGridEntityCenterGetter
@@ -34,11 +28,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 1, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -55,11 +49,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 0, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -79,11 +73,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 2, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -101,19 +95,19 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 1, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 1, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
          const GridType& grid = entity.grid;
          return VertexType(
-            grid.getOrigin().x() + 
+            grid.getOrigin().x() +
                ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() + 
+            grid.getOrigin().y() +
                ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y() );
       }
 };
@@ -126,11 +120,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 0, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -153,21 +147,21 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, EntityDimensions, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, EntityDimensions, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
          const GridType& grid = entity.grid;
          return VertexType(
-            grid.getOrigin().x() + 
+            grid.getOrigin().x() +
                ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() + 
+            grid.getOrigin().y() +
                ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y(),
-            grid.getOrigin().z() + 
+            grid.getOrigin().z() +
                ( entity.getCoordinates().z() + 0.5 * entity.getBasis().z() ) * grid.getSpaceSteps().z() );
       }
 };
@@ -179,11 +173,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 3, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -202,11 +196,11 @@ template< typename Real,
 class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 0, Config > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef tnlGridEntity< GridType, 0, Config > GridEntityType;
       typedef typename GridType::VertexType VertexType;
-      
+ 
       __cuda_callable__ inline
       static VertexType getEntityCenter( const GridEntityType& entity )
       {
@@ -218,5 +212,5 @@ class tnlGridEntityCenterGetter< tnlGridEntity< tnlGrid< 3, Real, Device, Index
       }
 };
 
-#endif	/* TNLGRIDENTITYCENTERGETTER_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntityConfig.h b/src/mesh/grids/tnlGridEntityConfig.h
index c876bfd28de85967d1dd158008937fd4c353c8bd..acf4c16d6cc80a3df5e426d9802f6280869d4643 100644
--- a/src/mesh/grids/tnlGridEntityConfig.h
+++ b/src/mesh/grids/tnlGridEntityConfig.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRIDENTITYCONFIG_H
-#define	TNLGRIDENTITYCONFIG_H
+#pragma once
+
+namespace TNL {
 
 /****
  * This class says what neighbour grid entity indexes shall be pre-computed and stored in the
@@ -28,9 +22,9 @@
  *  XOX    or   XXOXX   etc.
  *   X            X
  *                X
- * 
+ *
  * or all neighbour entities like this
- * 
+ *
  *           XXXXX
  *  XXX      XXXXX
  *  XOX  or  XXOXX  etc.
@@ -41,13 +35,13 @@
 class tnlGridEntityNoStencilStorage
 {
    public:
-      
+ 
       template< typename GridEntity >
       constexpr static bool neighbourEntityStorage( int neighbourEntityStorage )
       {
          return tnlGridEntityNoStencil;
       }
-      
+ 
       constexpr static int getStencilSize()
       {
          return 0;
@@ -58,23 +52,21 @@ template< int stencilSize = 1 >
 class tnlGridEntityCrossStencilStorage
 {
    public:
-      
+ 
       template< typename GridEntity >
       constexpr static bool neighbourEntityStorage( const int neighbourEntityDimensions )
       {
          //return tnlGridEntityNoStencil;
          return ( GridEntity::entityDimensions == GridEntity::GridType::meshDimensions &&
                   neighbourEntityDimensions == GridEntity::GridType::meshDimensions )
-                * tnlGridEntityCrossStencil;         
+                * tnlGridEntityCrossStencil;
       }
-            
+ 
       constexpr static int getStencilSize()
       {
          return stencilSize;
       }
 };
 
-
-
-#endif	/* TNLGRIDENTITYCONFIG_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntityGetter.h b/src/mesh/grids/tnlGridEntityGetter.h
index 8944b6b5268ad41ca928cf2997e5b38b470e18a6..b738938648bd4a212322e1f3bb9e960be74527ab 100644
--- a/src/mesh/grids/tnlGridEntityGetter.h
+++ b/src/mesh/grids/tnlGridEntityGetter.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLGRIDENTITYGETTER_H
-#define TNLGRIDENTITYGETTER_H
+namespace TNL {
 
 template< typename Grid,
           typename GridEntity,
@@ -27,8 +21,8 @@ class tnlGridEntityGetter
 };
 
 /***
- * The main code is in template specializations in tnlGridEntityIndexer.h 
+ * The main code is in template specializations in tnlGridEntityIndexer.h
  */
 
-#endif	/* TNLGRIDENTITYGETTER_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntityGetter_impl.h b/src/mesh/grids/tnlGridEntityGetter_impl.h
index 4c1b232bbad992a4c1dfe82005284e5215357a1a..fa328d1c54507228940140b6a558d06794cd64ff 100644
--- a/src/mesh/grids/tnlGridEntityGetter_impl.h
+++ b/src/mesh/grids/tnlGridEntityGetter_impl.h
@@ -6,23 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRIDENTITYINDEXER_IMPL_H
-#define	TNLGRIDENTITYINDEXER_IMPL_H
+#pragma once
 
 #include <mesh/grids/tnlGridEntityGetter.h>
 #include <mesh/grids/tnlGrid1D.h>
 #include <mesh/grids/tnlGrid2D.h>
 #include <mesh/grids/tnlGrid3D.h>
 
+namespace TNL {
 
 /****
  * 1D grid
@@ -32,24 +25,24 @@ template< typename Real,
           typename Index,
           typename GridEntity,
           int EntityDimensions >
-class tnlGridEntityGetter< 
+class tnlGridEntityGetter<
    tnlGrid< 1, Real, Device, Index >,
    GridEntity,
    EntityDimensions >
 {
    public:
-      
+ 
       static const int entityDimensions = EntityDimensions;
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
-      {         
+      {
          tnlAssert( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(),
               cerr << " index = " << index
                    << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >()
@@ -60,7 +53,7 @@ class tnlGridEntityGetter<
               typename GridEntity::EntityOrientationType( 0 ),
               typename GridEntity::EntityBasisType( EntityDimensions ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -84,14 +77,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 2 >
 {
    public:
-      
+ 
       static const int entityDimensions = 2;
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -101,7 +94,7 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 2 >
                 << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >()
                 << " entityDimensions = " << entityDimensions );
 
-         const CoordinatesType dimensions = grid.getDimensions();         
+         const CoordinatesType dimensions = grid.getDimensions();
 
          return GridEntity
             ( grid,
@@ -110,7 +103,7 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 2 >
               typename GridEntity::EntityOrientationType( 0, 0 ),
               typename GridEntity::EntityBasisType( 1, 1 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -122,11 +115,11 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 2 >
 
          //const CoordinatesType coordinates = entity.getCoordinates();
          //const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          return entity.getCoordinates().y() * grid.getDimensions().x() + entity.getCoordinates().x();
       }
-      
-      
+ 
+ 
 };
 
 template< typename Real,
@@ -136,14 +129,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 1 >
 {
    public:
-      
+ 
       static const int entityDimensions = 1;
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions, EntityConfig > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -152,7 +145,7 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 1 >
            cerr << " index = " << index
                 << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >()
                 << " entityDimensions = " << entityDimensions );
-         
+ 
          const CoordinatesType dimensions = grid.getDimensions();
 
          if( index < grid.numberOfNxFaces )
@@ -172,7 +165,7 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 1 >
               typename GridEntity::EntityOrientationType( 0, 1 ),
               typename GridEntity::EntityBasisType( 1, 0 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -182,10 +175,10 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 1 >
                  cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                       << " dimensions.x() = " << grid.getDimensions()
                       << " tnlAbs( entity.getOrientation() ) = " << tnlAbs( entity.getOrientation() ) );
-                  
+ 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          if( entity.getOrientation().x() )
             return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
          return grid.numberOfNxFaces + coordinates.y() * dimensions.x() + coordinates.x();
@@ -199,14 +192,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 0 >
 {
    public:
-      
+ 
       static const int entityDimensions = 0;
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -221,12 +214,12 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 0 >
          const IndexType aux = dimensions.x() + 1;
          return GridEntity
             ( grid,
-              CoordinatesType( index % aux, 
+              CoordinatesType( index % aux,
                                index / aux ),
               typename GridEntity::EntityOrientationType( 0, 0 ),
               typename GridEntity::EntityBasisType( 0, 0 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -234,10 +227,10 @@ class tnlGridEntityGetter< tnlGrid< 2, Real, Device, Index >, GridEntity, 0 >
          tnlAssert( entity.getCoordinates() >= 0 && entity.getCoordinates() <= grid.getDimensions(),
             cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                  << " grid.getDimensions() = " << grid.getDimensions() );
-         
+ 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
       }
 };
@@ -252,14 +245,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 3 >
 {
    public:
-      
+ 
       static const int entityDimensions = 3;
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -279,7 +272,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 3 >
               typename GridEntity::EntityOrientationType( 0, 0, 0 ),
               typename GridEntity::EntityBasisType( 1, 1, 1 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -291,7 +284,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 3 >
 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          return ( coordinates.z() * dimensions.y() + coordinates.y() ) *
             dimensions.x() + coordinates.x();
       }
@@ -304,14 +297,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 2 >
 {
    public:
-      
+ 
       static const int entityDimensions = 2;
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -322,7 +315,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 2 >
                 << " entityDimensions = " << entityDimensions );
 
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          if( index < grid.numberOfNxFaces )
          {
             const IndexType aux = dimensions.x() + 1;
@@ -355,7 +348,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 2 >
               typename GridEntity::EntityOrientationType( 0, 0, 1 ),
               typename GridEntity::EntityBasisType( 1, 1, 0 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -365,23 +358,23 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 2 >
                  cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                       << " dimensions.x() = " << grid.getDimensions()
                       << " tnlAbs( entity.getOrientation() ) = " << tnlAbs( entity.getOrientation() ) );
-         
+ 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
 
-         
+ 
          if( entity.getOrientation().x() )
          {
-            return ( coordinates.z() * dimensions.y() + coordinates.y() ) * 
+            return ( coordinates.z() * dimensions.y() + coordinates.y() ) *
                ( dimensions.x() + 1 ) + coordinates.x();
          }
          if( entity.getOrientation().y() )
          {
-            return grid.numberOfNxFaces + 
-               ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * 
+            return grid.numberOfNxFaces +
+               ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) *
                dimensions.x() + coordinates.x();
          }
-         return grid.numberOfNxAndNyFaces + 
+         return grid.numberOfNxAndNyFaces +
             ( coordinates.z() * dimensions.y() + coordinates.y() ) *
             dimensions.x() + coordinates.x();
       }
@@ -394,14 +387,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 1 >
 {
    public:
-      
+ 
       static const int entityDimensions = 1;
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -410,7 +403,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 1 >
            cerr << " index = " << index
                 << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >()
                 << " entityDimensions = " << entityDimensions );
-         
+ 
          const CoordinatesType dimensions = grid.getDimensions();
 
          if( index < grid.numberOfDxEdges )
@@ -448,29 +441,29 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 1 >
               typename GridEntity::EntityOrientationType( 0, 0, 0 ),
               typename GridEntity::EntityBasisType( 0, 0, 1 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
       {
          tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() < grid.getDimensions() + 
+                    entity.getCoordinates() < grid.getDimensions() +
                        CoordinatesType( 1, 1, 1 ) - entity.getBasis(),
             cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                  << " dimensions.x() = " << grid.getDimensions()
                  << " CoordinatesType( 1, 1, 1 ) - entity.getBasis() = " << CoordinatesType( 1, 1, 1 ) - entity.getBasis() );
-         
+ 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          if( entity.getBasis().x() )
-            return ( coordinates.z() * ( dimensions.y() + 1 ) + 
-                     coordinates.y() ) * dimensions.x() + coordinates.x();   
+            return ( coordinates.z() * ( dimensions.y() + 1 ) +
+                     coordinates.y() ) * dimensions.x() + coordinates.x();
          if( entity.getBasis().y() )
-            return grid.numberOfDxEdges + 
+            return grid.numberOfDxEdges +
                ( coordinates.z() * dimensions.y() + coordinates.y() ) * ( dimensions.x() + 1 ) +
                coordinates.x();
-         return grid.numberOfDxAndDyEdges + 
+         return grid.numberOfDxAndDyEdges +
             ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * ( dimensions.x() + 1 ) +
             coordinates.x();
 
@@ -484,14 +477,14 @@ template< typename Real,
 class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 0 >
 {
    public:
-      
+ 
       static const int entityDimensions = 0;
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
       typedef typename GridType::IndexType IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       //typedef typename GridType::template GridEntity< entityDimensions > GridEntity;
-      
+ 
       __cuda_callable__ inline
       static GridEntity getEntity( const GridType& grid,
                                    const IndexType& index )
@@ -502,7 +495,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 0 >
                 << " entityDimensions = " << entityDimensions );
 
          const CoordinatesType dimensions = grid.getDimensions();
-         
+ 
          const IndexType auxX = dimensions.x() + 1;
          const IndexType auxY = dimensions.y() + 1;
          return GridEntity
@@ -513,7 +506,7 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 0 >
               typename GridEntity::EntityOrientationType( 0, 0, 0 ),
               typename GridEntity::EntityBasisType( 0, 0, 0 ) );
       }
-      
+ 
       __cuda_callable__ inline
       static IndexType getEntityIndex( const GridType& grid,
                                        const GridEntity& entity )
@@ -521,16 +514,15 @@ class tnlGridEntityGetter< tnlGrid< 3, Real, Device, Index >, GridEntity, 0 >
          tnlAssert( entity.getCoordinates() >= 0 && entity.getCoordinates() <= grid.getDimensions(),
             cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                  << " grid.getDimensions() = " << grid.getDimensions() );
-         
+ 
          const CoordinatesType coordinates = entity.getCoordinates();
          const CoordinatesType dimensions = grid.getDimensions();
-         
-         return ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * 
-                ( dimensions.x() + 1 ) + 
+ 
+         return ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) *
+                ( dimensions.x() + 1 ) +
                 coordinates.x();
       }
 };
 
-
-#endif	/* TNLGRIDENTITYINDEXER_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntityMeasureGetter.h b/src/mesh/grids/tnlGridEntityMeasureGetter.h
index 9c8ec01eaa3e63aa7d63dde1a89cbe1c4fa0681b..778cb43be9cdb7bb928704302c0525cbe147dcd4 100644
--- a/src/mesh/grids/tnlGridEntityMeasureGetter.h
+++ b/src/mesh/grids/tnlGridEntityMeasureGetter.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRIDENTITYMEASUREGETTER_H
-#define	TNLGRIDENTITYMEASUREGETTER_H
+#pragma once
+
+namespace TNL {
 
 template< typename Grid,
           int EntityDimensions >
 class tnlGridEntityMeasureGetter
-{   
+{
 };
 
 /***
@@ -34,9 +28,9 @@ template< int Dimensions,
 class tnlGridEntityMeasureGetter< tnlGrid< Dimensions, Real, Device, Index >, 0 >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, Real, Device, Index > GridType;
-            
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -55,9 +49,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 1, Real, Device, Index >, 1 >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -75,9 +69,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 2, Real, Device, Index >, 2 >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -92,9 +86,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 2, Real, Device, Index >, 1 >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -115,9 +109,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 3, Real, Device, Index >, 3 >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -132,9 +126,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 3, Real, Device, Index >, 2 >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -154,9 +148,9 @@ template< typename Real,
 class tnlGridEntityMeasureGetter< tnlGrid< 3, Real, Device, Index >, 1 >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > GridType;
-      
+ 
       template< typename EntityType >
       static const Real& getMeasure( const GridType& grid,
                                      const EntityType& entity )
@@ -170,5 +164,5 @@ class tnlGridEntityMeasureGetter< tnlGrid< 3, Real, Device, Index >, 1 >
       }
 };
 
-#endif	/* TNLGRIDENTITYMEASUREGETTER_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntityTopology.h b/src/mesh/grids/tnlGridEntityTopology.h
index f8c51bd195d5c29ec813ea76393540ea0b319078..148bf522d040424dabb47394992366c993a89591 100644
--- a/src/mesh/grids/tnlGridEntityTopology.h
+++ b/src/mesh/grids/tnlGridEntityTopology.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLGRIDTOPOLOGIES_H
-#define	TNLGRIDTOPOLOGIES_H
+namespace TNL {
 
 template< typename Grid,
           int EntityDimensions,
@@ -25,25 +19,23 @@ template< typename Grid,
 class tnlGridEntityTopology
 {
    public:
-      
+ 
       typedef Grid GridType;
-      
+ 
       // TODO: restore when CUDA allows it
       //static const int meshDimensions = GridType::Dimensions;
       enum { meshDimensions = GridType::Dimensions };
-      
+ 
       static const int entityDimensions = EntityDimensions;
-      
+ 
       typedef EntityOrientation_ EntityOrientation;
-           
+ 
       typedef EntityProportions_ EntityProportions;
-      
+ 
       // TODO: restore when CUDA allows it
-   //static_assert( meshDimensions == EntityOrientation_::size, 
+   //static_assert( meshDimensions == EntityOrientation_::size,
    //               "Entity orientation is not a proper static multiindex." );
 };
 
-
-
-#endif	/* TNLGRIDTOPOLOGIES_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridEntity_impl.h b/src/mesh/grids/tnlGridEntity_impl.h
index 2a4660778c4082e644c0767a0348013024504f7f..273069a0f2a49891851e7cc2f70796c587e11a3e 100644
--- a/src/mesh/grids/tnlGridEntity_impl.h
+++ b/src/mesh/grids/tnlGridEntity_impl.h
@@ -6,24 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
-#ifndef TNLGRIDENTITY_IMPL_H
-#define TNLGRIDENTITY_IMPL_H
+#pragma once
 
 #include <mesh/grids/tnlBoundaryGridEntityChecker.h>
 #include <mesh/grids/tnlGridEntityCenterGetter.h>
 #include <mesh/grids/tnlGridEntityMeasureGetter.h>
 #include <mesh/grids/tnlGridEntity.h>
 
+namespace TNL {
 
 /*template< int Dimensions,
           typename Real,
@@ -72,7 +65,7 @@ tnlGridEntity( const tnlGrid< Dimensions, Real, Device, Index >& grid,
   orientation( orientation ),
   basis( basis ),
   neighbourEntitiesStorage( *this )
-{  
+{
 }
 
 template< int Dimensions,
@@ -82,7 +75,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType& 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 getCoordinates() const
 {
@@ -96,7 +89,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType& 
+typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 getCoordinates()
 {
@@ -162,7 +155,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityOrientationType& 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityOrientationType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 getOrientation() const
 {
@@ -176,7 +169,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-void 
+void
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 setOrientation( const EntityOrientationType& orientation )
 {
@@ -191,7 +184,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityBasisType& 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityBasisType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 getBasis() const
 {
@@ -205,7 +198,7 @@ template< int Dimensions,
           int EntityDimensions,
           typename Config >
 __cuda_callable__ inline
-void 
+void
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
 setBasis( const EntityBasisType& basis )
 {
@@ -223,7 +216,7 @@ template< int Dimensions,
 __cuda_callable__ inline
 const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::template NeighbourEntities< NeighbourEntityDimensions >&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
-getNeighbourEntities() const 
+getNeighbourEntities() const
 {
    return neighbourEntitiesStorage.template getNeighbourEntities< NeighbourEntityDimensions >();
 }
@@ -340,7 +333,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType& 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::
 getCoordinates() const
 {
@@ -353,7 +346,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType& 
+typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::
 getCoordinates()
 {
@@ -413,7 +406,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityOrientationType 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityOrientationType
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::
 getOrientation() const
 {
@@ -426,7 +419,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityBasisType 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityBasisType
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::
 getBasis() const
 {
@@ -549,7 +542,7 @@ tnlGridEntity( const GridType& grid,
   entityIndex( -1 ),
   coordinates( coordinates ),
   neighbourEntitiesStorage( *this )
-{  
+{
 }
 
 template< int Dimensions,
@@ -558,7 +551,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType& 
+const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::
 getCoordinates() const
 {
@@ -571,7 +564,7 @@ template< int Dimensions,
           typename Index,
           typename Config >
 __cuda_callable__ inline
-typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType& 
+typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType&
 tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::
 getCoordinates()
 {
@@ -733,5 +726,5 @@ getMesh() const
    return this->grid;
 }
 
-#endif	/* TNLGRIDENTITY_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGridTraverser.h b/src/mesh/grids/tnlGridTraverser.h
index 8b05a88e4eeec5212c3b8a67f33c92f4372a0ca4..c43bf9c252297a186571250a898ea481e592914c 100644
--- a/src/mesh/grids/tnlGridTraverser.h
+++ b/src/mesh/grids/tnlGridTraverser.h
@@ -6,42 +6,36 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRIDTRAVERSER_H
-#define	TNLGRIDTRAVERSER_H
+#pragma once
 
 
+namespace TNL {
+
 /****
  * This is only a helper class for tnlTraverser specializations for tnlGrid.
  */
 template< typename Grid >
 class tnlGridTraverser
-{   
+{
 };
 
 /****
  * 1D grid, tnlHost
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 1, Real, tnlHost, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, tnlHost, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -60,18 +54,18 @@ class tnlGridTraverser< tnlGrid< 1, Real, tnlHost, Index > >
 /****
  * 1D grid, tnlCuda
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 1, Real, tnlCuda, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, tnlCuda, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -83,25 +77,25 @@ class tnlGridTraverser< tnlGrid< 1, Real, tnlCuda, Index > >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          const CoordinatesType& entityOrientation,
-         const CoordinatesType& entityBasis,         
+         const CoordinatesType& entityBasis,
          UserData& userData );
 };
 
 /****
  * 2D grid, tnlHost
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 2, Real, tnlHost, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, tnlHost, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -112,28 +106,28 @@ class tnlGridTraverser< tnlGrid< 2, Real, tnlHost, Index > >
       static void
       processEntities(
          const GridType& grid,
-         const CoordinatesType& begin,
-         const CoordinatesType& end,
+         const CoordinatesType begin,
+         const CoordinatesType end,
          const CoordinatesType& entityOrientation,
-         const CoordinatesType& entityBasis,         
+         const CoordinatesType& entityBasis,
          UserData& userData );
 };
 
 /****
  * 2D grid, tnlCuda
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 2, Real, tnlCuda, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, tnlCuda, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -147,25 +141,25 @@ class tnlGridTraverser< tnlGrid< 2, Real, tnlCuda, Index > >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          const CoordinatesType& entityOrientation,
-         const CoordinatesType& entityBasis,         
+         const CoordinatesType& entityBasis,
          UserData& userData );
 };
 
 /****
  * 3D grid, tnlHost
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 3, Real, tnlHost, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, tnlHost, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -180,25 +174,25 @@ class tnlGridTraverser< tnlGrid< 3, Real, tnlHost, Index > >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          const CoordinatesType& entityOrientation,
-         const CoordinatesType& entityBasis,         
+         const CoordinatesType& entityBasis,
          UserData& userData );
 };
 
 /****
  * 3D grid, tnlCuda
  */
-template< typename Real,           
+template< typename Real,
           typename Index >
 class tnlGridTraverser< tnlGrid< 3, Real, tnlCuda, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, tnlCuda, Index > GridType;
       typedef Real RealType;
       typedef tnlHost DeviceType;
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
-      
+ 
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -213,11 +207,11 @@ class tnlGridTraverser< tnlGrid< 3, Real, tnlCuda, Index > >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          const CoordinatesType& entityOrientation,
-         const CoordinatesType& entityBasis,         
+         const CoordinatesType& entityBasis,
          UserData& userData );
 };
 
-#include <mesh/grids/tnlGridTraverser_impl.h>
+} // namespace TNL
 
-#endif	/* TNLGRIDTRAVERSER_H */
+#include <mesh/grids/tnlGridTraverser_impl.h>
 
diff --git a/src/mesh/grids/tnlGridTraverser_impl.h b/src/mesh/grids/tnlGridTraverser_impl.h
index 93a6fdac22bae92f285b42c94dd559ead740eb25..8d5b0ac6e62ba63bee1e1164fd3aa7cee2ecdac7 100644
--- a/src/mesh/grids/tnlGridTraverser_impl.h
+++ b/src/mesh/grids/tnlGridTraverser_impl.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLGRIDTRAVERSER_IMPL_H
-#define	TNLGRIDTRAVERSER_IMPL_H
+namespace TNL {
 
 /****
  * 1D traverser, host
  */
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -35,13 +29,14 @@ processEntities(
    const CoordinatesType& begin,
    const CoordinatesType& end,
    const CoordinatesType& entityOrientation,
-   const CoordinatesType& entityBasis,   
+   const CoordinatesType& entityBasis,
    UserData& userData )
 {
+
+ 
    GridEntity entity( grid );
    entity.setOrientation( entityOrientation );
    entity.setBasis( entityBasis );
-   
    if( processOnlyBoundaryEntities )
    {
       entity.getCoordinates() = begin;
@@ -71,40 +66,75 @@ template< typename Real,
           typename Index,
           typename GridEntity,
           typename UserData,
-          typename EntitiesProcessor,
-          bool processOnlyBoundaryEntities >
-__global__ void 
+          typename EntitiesProcessor >
+__global__ void
 tnlGridTraverser1D(
    const tnlGrid< 1, Real, tnlCuda, Index >* grid,
    UserData* userData,
    const typename GridEntity::CoordinatesType* begin,
    const typename GridEntity::CoordinatesType* end,
    const typename GridEntity::CoordinatesType* entityOrientation,
-   const typename GridEntity::CoordinatesType* entityBasis,   
+   const typename GridEntity::CoordinatesType* entityBasis,
    const Index gridIdx )
 {
    typedef Real RealType;
    typedef Index IndexType;
    typedef tnlGrid< 1, Real, tnlCuda, Index > GridType;
    typename GridType::CoordinatesType coordinates;
-   
+ 
    coordinates.x() = begin->x() + ( gridIdx * tnlCuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   
+ 
    GridEntity entity( *grid, coordinates, *entityOrientation, *entityBasis );
-   
+ 
    if( coordinates.x() <= end->x() )
    {
-      if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
+      //if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
       {
          entity.refresh();
          EntitiesProcessor::processEntity( entity.getMesh(), *userData, entity );
       }
    }
 }
+
+template< typename Real,
+          typename Index,
+          typename GridEntity,
+          typename UserData,
+          typename EntitiesProcessor >
+__global__ void
+tnlGridBoundaryTraverser1D(
+   const tnlGrid< 1, Real, tnlCuda, Index >* grid,
+   UserData* userData,
+   const typename GridEntity::CoordinatesType* begin,
+   const typename GridEntity::CoordinatesType* end,
+   const typename GridEntity::CoordinatesType* entityOrientation,
+   const typename GridEntity::CoordinatesType* entityBasis )
+{
+   typedef Real RealType;
+   typedef Index IndexType;
+   typedef tnlGrid< 1, Real, tnlCuda, Index > GridType;
+   typename GridType::CoordinatesType coordinates;
+ 
+   if( threadIdx.x == 0 )
+   {
+      coordinates.x() = begin->x();
+      GridEntity entity( *grid, coordinates, *entityOrientation, *entityBasis );
+      entity.refresh();
+      EntitiesProcessor::processEntity( entity.getMesh(), *userData, entity );
+   }
+   if( threadIdx.x == 1 )
+   {
+      coordinates.x() = end->x();
+      GridEntity entity( *grid, coordinates, *entityOrientation, *entityBasis );
+      entity.refresh();
+      EntitiesProcessor::processEntity( entity.getMesh(), *userData, entity );
+   }
+}
+
 #endif
 
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -117,32 +147,48 @@ processEntities(
    const CoordinatesType& begin,
    const CoordinatesType& end,
    const CoordinatesType& entityOrientation,
-   const CoordinatesType& entityBasis,   
+   const CoordinatesType& entityBasis,
    UserData& userData )
 {
-#ifdef HAVE_CUDA   
+#ifdef HAVE_CUDA
    CoordinatesType* kernelBegin = tnlCuda::passToDevice( begin );
    CoordinatesType* kernelEnd = tnlCuda::passToDevice( end );
    CoordinatesType* kernelEntityOrientation = tnlCuda::passToDevice( entityOrientation );
    CoordinatesType* kernelEntityBasis = tnlCuda::passToDevice( entityBasis );
    typename GridEntity::MeshType* kernelGrid = tnlCuda::passToDevice( grid );
    UserData* kernelUserData = tnlCuda::passToDevice( userData );
-      
-   dim3 cudaBlockSize( 256 );
-   dim3 cudaBlocks;
-   cudaBlocks.x = tnlCuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x );
-   const IndexType cudaXGrids = tnlCuda::getNumberOfGrids( cudaBlocks.x );
+ 
+   if( processOnlyBoundaryEntities )
+   {
+      dim3 cudaBlockSize( 2 );
+      dim3 cudaBlocks( 1 );
+      tnlGridBoundaryTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor >
+            <<< cudaBlocks, cudaBlockSize >>>
+            ( kernelGrid,
+              kernelUserData,
+              kernelBegin,
+              kernelEnd,
+              kernelEntityOrientation,
+              kernelEntityBasis );
+   }
+   else
+   {
+      dim3 cudaBlockSize( 256 );
+      dim3 cudaBlocks;
+      cudaBlocks.x = tnlCuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x );
+      const IndexType cudaXGrids = tnlCuda::getNumberOfGrids( cudaBlocks.x );
 
-   for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ )
-      tnlGridTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities >
-         <<< cudaBlocks, cudaBlockSize >>>
-         ( kernelGrid,
-           kernelUserData,
-           kernelBegin,
-           kernelEnd,
-           kernelEntityOrientation,
-           kernelEntityBasis,
-           gridXIdx );
+      for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ )
+         tnlGridTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor >
+            <<< cudaBlocks, cudaBlockSize >>>
+            ( kernelGrid,
+              kernelUserData,
+              kernelBegin,
+              kernelEnd,
+              kernelEntityOrientation,
+              kernelEntityBasis,
+              gridXIdx );
+   }
    cudaThreadSynchronize();
    checkCudaDevice;
    tnlCuda::freeFromDevice( kernelGrid );
@@ -159,8 +205,8 @@ processEntities(
 /****
  * 2D traverser, host
  */
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -172,10 +218,10 @@ void
 tnlGridTraverser< tnlGrid< 2, Real, tnlHost, Index > >::
 processEntities(
    const GridType& grid,
-   const CoordinatesType& begin,
-   const CoordinatesType& end,
+   const CoordinatesType begin,
+   const CoordinatesType end,
    const CoordinatesType& entityOrientation,
-   const CoordinatesType& entityBasis,      
+   const CoordinatesType& entityBasis,
    UserData& userData )
 {
    GridEntity entity( grid );
@@ -211,6 +257,7 @@ processEntities(
    }
    else
    {
+//#pragma omp parallel for firstprivate( entity, begin, end ) if( tnlHost::isOMPEnabled() )
       for( entity.getCoordinates().y() = begin.y();
            entity.getCoordinates().y() <= end.y();
            entity.getCoordinates().y() ++ )
@@ -234,14 +281,14 @@ template< typename Real,
           typename UserData,
           typename EntitiesProcessor,
           bool processOnlyBoundaryEntities >
-__global__ void 
+__global__ void
 tnlGridTraverser2D(
    const tnlGrid< 2, Real, tnlCuda, Index >* grid,
    UserData* userData,
    const typename GridEntity::CoordinatesType* begin,
    const typename GridEntity::CoordinatesType* end,
    const typename GridEntity::CoordinatesType* entityOrientation,
-   const typename GridEntity::CoordinatesType* entityBasis,   
+   const typename GridEntity::CoordinatesType* entityBasis,
    const Index gridXIdx,
    const Index gridYIdx )
 {
@@ -249,8 +296,8 @@ tnlGridTraverser2D(
    typename GridType::CoordinatesType coordinates;
 
    coordinates.x() = begin->x() + ( gridXIdx * tnlCuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   coordinates.y() = begin->y() + ( gridYIdx * tnlCuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y;  
-   
+   coordinates.y() = begin->y() + ( gridYIdx * tnlCuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y;
+ 
    GridEntity entity( *grid, coordinates, *entityOrientation, *entityBasis );
 
    if( entity.getCoordinates().x() <= end->x() &&
@@ -258,7 +305,7 @@ tnlGridTraverser2D(
    {
       entity.refresh();
       if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
-      {         
+      {
          EntitiesProcessor::processEntity
          ( *grid,
            *userData,
@@ -268,8 +315,8 @@ tnlGridTraverser2D(
 }
 #endif
 
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -287,14 +334,14 @@ processEntities(
    const CoordinatesType& entityBasis,
    UserData& userData )
 {
-#ifdef HAVE_CUDA   
+#ifdef HAVE_CUDA
    CoordinatesType* kernelBegin = tnlCuda::passToDevice( begin );
    CoordinatesType* kernelEnd = tnlCuda::passToDevice( end );
    CoordinatesType* kernelEntityOrientation = tnlCuda::passToDevice( entityOrientation );
    CoordinatesType* kernelEntityBasis = tnlCuda::passToDevice( entityBasis );
    typename GridEntity::MeshType* kernelGrid = tnlCuda::passToDevice( grid );
    UserData* kernelUserData = tnlCuda::passToDevice( userData );
-      
+ 
    dim3 cudaBlockSize( 16, 16 );
    dim3 cudaBlocks;
    cudaBlocks.x = tnlCuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x );
@@ -314,8 +361,9 @@ processEntities(
               kernelEntityBasis,
               gridXIdx,
               gridYIdx );
+ 
    cudaThreadSynchronize();
-   checkCudaDevice;   
+   checkCudaDevice;
    tnlCuda::freeFromDevice( kernelGrid );
    tnlCuda::freeFromDevice( kernelBegin );
    tnlCuda::freeFromDevice( kernelEnd );
@@ -329,8 +377,8 @@ processEntities(
 /****
  * 3D traverser, host
  */
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -346,7 +394,7 @@ processEntities(
    const CoordinatesType& begin,
    const CoordinatesType& end,
    const CoordinatesType& entityOrientation,
-   const CoordinatesType& entityBasis,      
+   const CoordinatesType& entityBasis,
    UserData& userData )
 {
    GridEntity entity( grid );
@@ -429,14 +477,14 @@ template< typename Real,
           typename UserData,
           typename EntitiesProcessor,
           bool processOnlyBoundaryEntities >
-__global__ void 
+__global__ void
 tnlGridTraverser3D(
    const tnlGrid< 3, Real, tnlCuda, Index >* grid,
    UserData* userData,
    const typename GridEntity::CoordinatesType* begin,
    const typename GridEntity::CoordinatesType* end,
    const typename GridEntity::CoordinatesType* entityOrientation,
-   const typename GridEntity::CoordinatesType* entityBasis,   
+   const typename GridEntity::CoordinatesType* entityBasis,
    const Index gridXIdx,
    const Index gridYIdx,
    const Index gridZIdx )
@@ -445,18 +493,18 @@ tnlGridTraverser3D(
    typename GridType::CoordinatesType coordinates;
 
    coordinates.x() = begin->x() + ( gridXIdx * tnlCuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   coordinates.y() = begin->y() + ( gridYIdx * tnlCuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y;  
-   coordinates.z() = begin->z() + ( gridZIdx * tnlCuda::getMaxGridSize() + blockIdx.z ) * blockDim.z + threadIdx.z;  
-   
+   coordinates.y() = begin->y() + ( gridYIdx * tnlCuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y;
+   coordinates.z() = begin->z() + ( gridZIdx * tnlCuda::getMaxGridSize() + blockIdx.z ) * blockDim.z + threadIdx.z;
+ 
    GridEntity entity( *grid, coordinates, *entityOrientation, *entityBasis );
 
    if( entity.getCoordinates().x() <= end->x() &&
-       entity.getCoordinates().y() <= end->y() && 
+       entity.getCoordinates().y() <= end->y() &&
        entity.getCoordinates().z() <= end->z() )
    {
       entity.refresh();
       if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
-      {         
+      {
          EntitiesProcessor::processEntity
          ( *grid,
            *userData,
@@ -466,8 +514,8 @@ tnlGridTraverser3D(
 }
 #endif
 
-template< typename Real,           
-          typename Index >      
+template< typename Real,
+          typename Index >
    template<
       typename GridEntity,
       typename EntitiesProcessor,
@@ -486,14 +534,14 @@ processEntities(
    const CoordinatesType& entityBasis,
    UserData& userData )
 {
-#ifdef HAVE_CUDA   
+#ifdef HAVE_CUDA
    CoordinatesType* kernelBegin = tnlCuda::passToDevice( begin );
    CoordinatesType* kernelEnd = tnlCuda::passToDevice( end );
    CoordinatesType* kernelEntityOrientation = tnlCuda::passToDevice( entityOrientation );
    CoordinatesType* kernelEntityBasis = tnlCuda::passToDevice( entityBasis );
    typename GridEntity::MeshType* kernelGrid = tnlCuda::passToDevice( grid );
    UserData* kernelUserData = tnlCuda::passToDevice( userData );
-      
+ 
    dim3 cudaBlockSize( 8, 8, 8 );
    dim3 cudaBlocks;
    cudaBlocks.x = tnlCuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x );
@@ -518,7 +566,7 @@ processEntities(
                  gridYIdx,
                  gridZIdx );
    cudaThreadSynchronize();
-   checkCudaDevice;   
+   checkCudaDevice;
    tnlCuda::freeFromDevice( kernelGrid );
    tnlCuda::freeFromDevice( kernelBegin );
    tnlCuda::freeFromDevice( kernelEnd );
@@ -529,6 +577,5 @@ processEntities(
 #endif
 }
 
-
-#endif	/* TNLGRIDTRAVERSER_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlGrid_impl.cpp b/src/mesh/grids/tnlGrid_impl.cpp
index fbf9ba34508088c78cc555c7d4fb4201758c54c4..0465aa2fc7a00f682c609eec63a0ff1cb40e7c5b 100644
--- a/src/mesh/grids/tnlGrid_impl.cpp
+++ b/src/mesh/grids/tnlGrid_impl.cpp
@@ -6,17 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 #ifdef TEMPLATE_EXPLICIT_INSTANTIATION
 
 template class tnlGrid< 1, float,  tnlHost, int >;
@@ -66,7 +61,7 @@ template class tnlGrid< 3, double, tnlCuda, long int >;
 
 #endif
 
-
+} // namespace TNL
 
 
 
diff --git a/src/mesh/grids/tnlNeighbourGridEntitiesStorage.h b/src/mesh/grids/tnlNeighbourGridEntitiesStorage.h
index 8e396099aec85ec51f5b07df73decde5c6015e6a..a31e23f657a9a75b17a3d99619ecca71cda34db4 100644
--- a/src/mesh/grids/tnlNeighbourGridEntitiesStorage.h
+++ b/src/mesh/grids/tnlNeighbourGridEntitiesStorage.h
@@ -6,56 +6,49 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLNEIGHBOURGRIDENTITIESSTORAGE_H
-#define	TNLNEIGHBOURGRIDENTITIESSTORAGE_H
+#pragma once
 
 #include <core/tnlCuda.h>
 #include <mesh/tnlDimensionsTag.h>
 
+namespace TNL {
+
 template< typename GridEntity,
           int NeighbourEntityDimensions >
-class tnlNeighbourGridEntityLayer 
+class tnlNeighbourGridEntityLayer
 : public tnlNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 >
-{   
+{
    public:
-      
+ 
       typedef tnlNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 > BaseType;
       typedef tnlNeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > NeighbourEntityGetterType;
-      
+ 
       using BaseType::getNeighbourEntities;
-      
+ 
       __cuda_callable__
       tnlNeighbourGridEntityLayer( const GridEntity& entity )
       : neighbourEntities( entity ),
-        BaseType( entity ) 
+        BaseType( entity )
       {}
-      
+ 
       __cuda_callable__
       const NeighbourEntityGetterType& getNeighbourEntities( const tnlDimensionsTag< NeighbourEntityDimensions>& tag ) const
       {
          return this->neighbourEntities;
       }
-      
+ 
       __cuda_callable__
-      void refresh( const typename GridEntity::GridType& grid, 
+      void refresh( const typename GridEntity::GridType& grid,
                     const typename GridEntity::GridType::IndexType& entityIndex )
       {
          BaseType::refresh( grid, entityIndex );
          neighbourEntities.refresh( grid, entityIndex );
       };
-      
+ 
    protected:
-      
+ 
       NeighbourEntityGetterType neighbourEntities;
 };
 
@@ -63,9 +56,9 @@ template< typename GridEntity >
 class tnlNeighbourGridEntityLayer< GridEntity, 0 >
 {
    public:
-      
-      typedef tnlNeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType;     
-      
+ 
+      typedef tnlNeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType;
+ 
       __cuda_callable__
       tnlNeighbourGridEntityLayer( const GridEntity& entity )
       : neighbourEntities( entity )
@@ -76,18 +69,18 @@ class tnlNeighbourGridEntityLayer< GridEntity, 0 >
       {
          return this->neighbourEntities;
       }
-      
+ 
       __cuda_callable__
-      void refresh( const typename GridEntity::GridType& grid, 
+      void refresh( const typename GridEntity::GridType& grid,
                     const typename GridEntity::GridType::IndexType& entityIndex )
       {
          neighbourEntities.refresh( grid, entityIndex );
       };
-      
+ 
    protected:
-      
+ 
       NeighbourEntityGetterType neighbourEntities;
-   
+ 
 };
 
 template< typename GridEntity >
@@ -95,33 +88,33 @@ class tnlNeighbourGridEntitiesStorage
 : public tnlNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions >
 {
    typedef tnlNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions > BaseType;
-   
+ 
    public:
-      
+ 
       using BaseType::getNeighbourEntities;
-      
+ 
       __cuda_callable__
       tnlNeighbourGridEntitiesStorage( const GridEntity& entity )
       : BaseType( entity )
       {}
 
-      
-      template< int EntityDimensions >      
+ 
+      template< int EntityDimensions >
       __cuda_callable__
       const tnlNeighbourGridEntityGetter< GridEntity, EntityDimensions >&
       getNeighbourEntities() const
       {
          return BaseType::getNeighbourEntities( tnlDimensionsTag< EntityDimensions >() );
-      }            
+      }
 
       __cuda_callable__
-      void refresh( const typename GridEntity::GridType& grid, 
+      void refresh( const typename GridEntity::GridType& grid,
                     const typename GridEntity::GridType::IndexType& entityIndex )
       {
          BaseType::refresh( grid, entityIndex );
       };
-      
+ 
 };
 
-#endif	/* TNLNEIGHBOURGRIDENTIESSTORAGE_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlNeighbourGridEntityGetter.h b/src/mesh/grids/tnlNeighbourGridEntityGetter.h
index 95dc471d0605edf34cfb01cccf55f47b116c5c2c..3038731faa104e801b2d4327706be2942ed94d80 100644
--- a/src/mesh/grids/tnlNeighbourGridEntityGetter.h
+++ b/src/mesh/grids/tnlNeighbourGridEntityGetter.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLNEIGHBOURGRIDENTITYGETTER_H
-#define	TNLNEIGHBOURGRIDENTITYGETTER_H
+#pragma once
 
 #include <core/tnlAssert.h>
 
+namespace TNL {
+
 enum tnlGridEntityStencilStorage
-{ 
+{
    tnlGridEntityNoStencil = 0,
    tnlGridEntityCrossStencil,
    tnlGridEntityFullStencil
@@ -31,26 +25,26 @@ template< int storage >
 class tnlGridEntityStencilStorageTag
 {
    public:
-      
+ 
       static const int stencilStorage = storage;
 };
 
 template< typename GridEntity,
           int NeighbourEntityDimensions,
-          typename EntityStencilTag = 
+          typename EntityStencilTag =
             tnlGridEntityStencilStorageTag< GridEntity::ConfigType::template neighbourEntityStorage< GridEntity >( NeighbourEntityDimensions ) > >
 class tnlNeighbourGridEntityGetter
 {
    public:
 
       // TODO: not all specializations are implemented yet
-      
+ 
       __cuda_callable__
       tnlNeighbourGridEntityGetter( const GridEntity& entity )
       {
          //tnlAssert( false, );
       };
-      
+ 
       __cuda_callable__
       void refresh( const typename GridEntity::GridType& grid,
                     const typename GridEntity::IndexType& entityIndex )
@@ -60,6 +54,5 @@ class tnlNeighbourGridEntityGetter
 
 };
 
-
-#endif	/* TNLNEIGHBOURGRIDENTITYGETTER_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h b/src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h
index 858ca7d91a1ee88af78928d11c2f02665852e4a3..51c2a04c9c9872b3c802020b33ecd4716944f7de 100644
--- a/src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h
+++ b/src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLNEIGHBOURGRIDENTITYGETTER1D_IMPL_H
-#define	TNLNEIGHBOURGRIDENTITYGETTER1D_IMPL_H
+#pragma once
 
 #include <mesh/grids/tnlNeighbourGridEntityGetter.h>
 #include <mesh/grids/tnlGrid1D.h>
@@ -24,6 +16,8 @@
 #include <mesh/grids/tnlGrid3D.h>
 #include <core/tnlStaticFor.h>
 
+namespace TNL {
+
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
@@ -35,13 +29,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1, Config >,
    1,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 1;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -51,12 +45,12 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -73,7 +67,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -90,13 +84,13 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + step;
       }
-      
+ 
       __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};      
-      
+      void refresh( const GridType& grid, const IndexType& entityIndex ){};
+ 
    protected:
 
-      const GridEntityType& entity;         
+      const GridEntityType& entity;
 };
 
 
@@ -112,13 +106,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1, Config >,
    1,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 1;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -129,14 +123,14 @@ class tnlNeighbourGridEntityGetter<
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
       typedef tnlNeighbourGridEntityGetter< GridEntityType, 1, StencilStorage > ThisType;
-      
+ 
       static const int stencilSize = Config::getStencilSize();
-      
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -153,7 +147,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + step ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -172,42 +166,42 @@ class tnlNeighbourGridEntityGetter<
          if( step < -stencilSize || step > stencilSize )
             return this->entity.getIndex() + step;
          return stencil[ stencilSize + step ];
-#else         
+#else
          return this->entity.getIndex() + step;
-#endif         
-         
+#endif
+ 
       }
-     
-      template< IndexType index > 
+ 
+      template< IndexType index >
       class StencilRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
-            {               
+            {
                neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index;
             }
       };
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex )
       {
-#ifndef HAVE_CUDA  // TODO: fix it -- does not work with nvcc         
+#ifndef HAVE_CUDA  // TODO: fix it -- does not work with nvcc
          tnlStaticFor< IndexType, -stencilSize, stencilSize + 1, StencilRefresher >::exec( *this, entityIndex );
-#endif         
-      };      
-      
+#endif
+      };
+ 
    protected:
 
       const GridEntityType& entity;
-      
+ 
       IndexType stencil[ 2 * stencilSize + 1 ];
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       1         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -216,13 +210,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1, Config >,
    0,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 1;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -232,12 +226,12 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -254,7 +248,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step + ( step < 0 ) ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -271,21 +265,21 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + step + ( step < 0 );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
+ 
       //tnlNeighbourGridEntityGetter(){};
-      
+ 
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       0         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -295,13 +289,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0, Config >,
    1,
-   StencilStorage > //tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > > 
+   StencilStorage > //tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 0;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -311,14 +305,14 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       void test() const { cerr << "***" << endl; };
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -335,7 +329,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -352,7 +346,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + step - ( step > 0 );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
@@ -363,7 +357,7 @@ class tnlNeighbourGridEntityGetter<
 
 /****   TODO: Implement this, now it is only a copy of specialization for none stencil storage
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       0         |              1            |       Cross       |
  * +-----------------+---------------------------+-------------------+
@@ -372,13 +366,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0, Config >,
    1,
-   tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > > 
+   tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 0;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -388,13 +382,13 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
 
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -411,7 +405,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -428,7 +422,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + step - ( step > 0 );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
@@ -440,7 +434,7 @@ class tnlNeighbourGridEntityGetter<
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -449,13 +443,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0, Config >,
    0,
-   tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > > 
+   tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 0;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 1, Real, Device, Index > GridType;
@@ -470,7 +464,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int step >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -487,7 +481,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
       }
-      
+ 
       template< int step >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -505,16 +499,15 @@ class tnlNeighbourGridEntityGetter<
 
          return this->entity.getIndex() + step;
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
-   
+ 
    protected:
 
       const GridEntityType& entity;
 };
 
-
-#endif	/* TNLNEIGHBOURGRIDENTITYGETTER1D_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h b/src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h
index 338c207b3b8bccc394e3f7ca2efa6eebbce1158f..a2f16bd1c625c630a26772bf3b546cbd96d526f1 100644
--- a/src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h
+++ b/src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLNEIGHBOURGRIDENTITYGETTER2D_IMPL_H
-#define	TNLNEIGHBOURGRIDENTITYGETTER2D_IMPL_H
+#pragma once
 
 #include <mesh/grids/tnlNeighbourGridEntityGetter.h>
 #include <mesh/grids/tnlGrid1D.h>
 #include <mesh/grids/tnlGrid2D.h>
 #include <mesh/grids/tnlGrid3D.h>
 
+namespace TNL {
+
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |
@@ -35,13 +29,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config >,
    2,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 2;
       static const int NeighbourEntityDimensions = 2;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -56,7 +50,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -75,7 +69,7 @@ class tnlNeighbourGridEntityGetter<
                                          CoordinatesType( entity.getCoordinates().x() + stepX,
                                                           entity.getCoordinates().y() + stepY ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -92,15 +86,15 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};      
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
@@ -114,13 +108,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config >,
    2,
    tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 2;
       static const int NeighbourEntityDimensions = 2;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -132,15 +126,15 @@ class tnlNeighbourGridEntityGetter<
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
       typedef tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > StencilStorage;
       typedef tnlNeighbourGridEntityGetter< GridEntityType, 2, StencilStorage > ThisType;
-      
-      
+ 
+ 
       static const int stencilSize = Config::getStencilSize();
 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -159,7 +153,7 @@ class tnlNeighbourGridEntityGetter<
                                             CoordinatesType( entity.getCoordinates().x() + stepX,
                                                              entity.getCoordinates().y() + stepY ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -174,25 +168,25 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates()  + CoordinatesType( stepX, stepY )
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA         
+#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
          if( ( stepX != 0 && stepY != 0 ) ||
              ( stepX < -stencilSize || stepX > stencilSize ||
-               stepY < -stencilSize || stepY > stencilSize ) )         
+               stepY < -stencilSize || stepY > stencilSize ) )
             return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
          if( stepY == 0 )
             return stencilX[ stepX + stencilSize ];
          return stencilY[ stepY + stencilSize ];
 #else
          return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
-#endif         
-         
+#endif
+ 
       }
-      
-      template< IndexType index > 
+ 
+      template< IndexType index >
       class StencilXRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
             {
@@ -200,20 +194,20 @@ class tnlNeighbourGridEntityGetter<
             }
       };
 
-      template< IndexType index > 
+      template< IndexType index >
       class StencilYRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
             {
-               neighbourEntityGetter.stencilY[ index + stencilSize ] = 
+               neighbourEntityGetter.stencilY[ index + stencilSize ] =
                   entityIndex + index * neighbourEntityGetter.entity.getMesh().getDimensions().x();
             }
       };
 
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex )
       {
@@ -223,20 +217,20 @@ class tnlNeighbourGridEntityGetter<
          tnlStaticFor< IndexType, -stencilSize, stencilSize + 1, StencilXRefresher >::exec( *this, entityIndex );
 #endif
       };
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
+ 
       IndexType stencilX[ 2 * stencilSize + 1 ];
       IndexType stencilY[ 2 * stencilSize + 1 ];
-      
-      //tnlNeighbourGridEntityGetter(){};      
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |
  * +-----------------+---------------------------+-------------------+
  * |       2         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -246,13 +240,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config >,
    1,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 2;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -269,7 +263,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -281,12 +275,12 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
+         tnlAssert( entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() + 
-                       CoordinatesType( stepX + ( stepX < 0 ), 
-                                        stepY + ( stepY < 0 ) ) 
+                    entity.getCoordinates() +
+                       CoordinatesType( stepX + ( stepX < 0 ),
+                                        stepY + ( stepY < 0 ) )
                        < entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
@@ -299,14 +293,14 @@ class tnlNeighbourGridEntityGetter<
                                                                 stepY > 0 ? 1 : -1 ),
                                          EntityBasisType( ! stepX, ! stepY ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
@@ -317,7 +311,7 @@ class tnlNeighbourGridEntityGetter<
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |
  * +-----------------+---------------------------+-------------------+
  * |       2         |            0              |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -327,13 +321,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2, Config >,
    0,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 2;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -343,13 +337,13 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;      
+      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -361,41 +355,41 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
+         tnlAssert( entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() + 
-                       CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) 
+                    entity.getCoordinates() +
+                       CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
                        < entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
-                   << " entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ) ) = " 
+                   << " entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ) ) = "
                    << entity.getMesh().getDimensions()  + CoordinatesType( Sign( stepX ), Sign( stepY ) )
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntityType( this->grid,
                                          CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
                                                           entity.getCoordinates().y() + stepY + ( stepY < 0 ) ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};      
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |
  * +-----------------+---------------------------+-------------------+
  * |       1         |              2            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -405,13 +399,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 1, Config >,
    2,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 1;
       static const int NeighbourEntityDimensions = 2;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -427,7 +421,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -441,11 +435,11 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() + entity.getOrientation() = " << entity.getMesh().getDimensions() + entity.getOrientation()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), 
+         tnlAssert( entity.getCoordinates() +
+                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                         stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() + 
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), 
+                    entity.getCoordinates() +
+                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                         stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) < entity.getMesh().getDimensions(),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 )  * ( entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
@@ -455,17 +449,17 @@ class tnlNeighbourGridEntityGetter<
                      CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                       entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
@@ -473,7 +467,7 @@ class tnlNeighbourGridEntityGetter<
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stencil Storage  |
  * +-----------------+---------------------------+-------------------+
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -483,13 +477,13 @@ template< typename Real,
           typename Index,
           typename Config,
           typename StencilStorage >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 0, Config >,
    0,
    StencilStorage >
 {
    public:
-      
+ 
       static const int EntityDimensions = 0;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 2, Real, Device, Index > GridType;
@@ -504,7 +498,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-            
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -523,7 +517,7 @@ class tnlNeighbourGridEntityGetter<
                                          CoordinatesType( entity.getCoordinates().x() + stepX,
                                                           entity.getCoordinates().y() + stepY ) );
       }
-      
+ 
       template< int stepX, int stepY >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -540,16 +534,16 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + stepY * ( entity.getMesh().getDimensions().x() + 1 ) + stepX;
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};      
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
-#endif	/* TNLNEIGHBOURGRIDENTITYGETTER2D_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h b/src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h
index a30fe9ee895838986533084b39bbd0ab79cca532..46b17e81c9f7e4a0c630f27bebb13ba12c2a14de 100644
--- a/src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h
+++ b/src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLNEIGHBOURGRIDENTITYGETTER3D_IMPL_H
-#define	TNLNEIGHBOURGRIDENTITYGETTER3D_IMPL_H
+#pragma once
 
 #include <mesh/grids/tnlNeighbourGridEntityGetter.h>
 #include <mesh/grids/tnlGrid1D.h>
@@ -24,10 +16,11 @@
 #include <mesh/grids/tnlGrid3D.h>
 #include <core/tnlStaticFor.h>
 
+namespace TNL {
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |              3            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -36,13 +29,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
    3,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 3;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -57,7 +50,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -76,7 +69,7 @@ class tnlNeighbourGridEntityGetter<
                                                       entity.getCoordinates().y() + stepY,
                                                       entity.getCoordinates().z() + stepZ ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -88,28 +81,28 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          tnlAssert( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) &&
                     entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) < entity.getMesh().getDimensions(),
-              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = " 
+              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ )
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};      
-      
+ 
+      //tnlNeighbourGridEntityGetter(){};
+ 
 };
 
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |              3            |       Cross       |
  * +-----------------+---------------------------+-------------------+
@@ -118,13 +111,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
    3,
    tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 3;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -137,13 +130,13 @@ class tnlNeighbourGridEntityGetter<
       typedef tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > StencilStorage;
       typedef tnlNeighbourGridEntityGetter< GridEntityType, 3, StencilStorage > ThisType;
 
-      static const int stencilSize = Config::getStencilSize();      
-      
+      static const int stencilSize = Config::getStencilSize();
+ 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -162,7 +155,7 @@ class tnlNeighbourGridEntityGetter<
                                                       entity.getCoordinates().y() + stepY,
                                                       entity.getCoordinates().z() + stepZ ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -174,15 +167,15 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          tnlAssert( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) &&
                     entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) < entity.getMesh().getDimensions(),
-              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = " 
+              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ )
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA         
+#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
          if( ( stepX != 0 && stepY != 0 && stepZ != 0 ) ||
              ( stepX < -stencilSize || stepX > stencilSize ||
                stepY < -stencilSize || stepY > stencilSize ||
-               stepZ < -stencilSize || stepZ > stencilSize ) )                  
+               stepZ < -stencilSize || stepZ > stencilSize ) )
             return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
          if( stepY == 0 && stepZ == 0 )
             return stencilX[ stepX + stencilSize ];
@@ -191,15 +184,15 @@ class tnlNeighbourGridEntityGetter<
          return stencilZ[ stepZ + stencilSize ];
 #else
          return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
-#endif         
+#endif
 
       }
-      
-      template< IndexType index > 
+ 
+      template< IndexType index >
       class StencilXRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
             {
@@ -207,59 +200,59 @@ class tnlNeighbourGridEntityGetter<
             }
       };
 
-      template< IndexType index > 
+      template< IndexType index >
       class StencilYRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
             {
-               neighbourEntityGetter.stencilY[ index + stencilSize ] = 
+               neighbourEntityGetter.stencilY[ index + stencilSize ] =
                   entityIndex + index * neighbourEntityGetter.entity.getMesh().getDimensions().x();
             }
       };
-      
-      template< IndexType index > 
+ 
+      template< IndexType index >
       class StencilZRefresher
       {
          public:
-            
+ 
             __cuda_callable__
             static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex )
             {
-               neighbourEntityGetter.stencilZ[ index + stencilSize ] = 
+               neighbourEntityGetter.stencilZ[ index + stencilSize ] =
                   entityIndex + index * neighbourEntityGetter.entity.getMesh().cellZNeighboursStep;
             }
       };
 
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex )
       {
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA                  
+#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
          tnlStaticFor< IndexType, -stencilSize, 0, StencilZRefresher >::exec( *this, entityIndex );
          tnlStaticFor< IndexType, 1, stencilSize + 1, StencilZRefresher >::exec( *this, entityIndex );
          tnlStaticFor< IndexType, -stencilSize, 0, StencilYRefresher >::exec( *this, entityIndex );
-         tnlStaticFor< IndexType, 1, stencilSize + 1, StencilYRefresher >::exec( *this, entityIndex );         
+         tnlStaticFor< IndexType, 1, stencilSize + 1, StencilYRefresher >::exec( *this, entityIndex );
          tnlStaticFor< IndexType, -stencilSize, stencilSize + 1, StencilXRefresher >::exec( *this, entityIndex );
-#endif         
+#endif
       };
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
+ 
       IndexType stencilX[ 2 * stencilSize + 1 ];
       IndexType stencilY[ 2 * stencilSize + 1 ];
       IndexType stencilZ[ 2 * stencilSize + 1 ];
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |              2            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -268,13 +261,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
    2,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 2;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -291,13 +284,13 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
       {
          tnlAssert( ! stepX + ! stepY + ! stepZ == 2,
-                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX 
+                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX
                          << " stepY = " << stepY
                          << " stepZ = " << stepZ );
          tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
@@ -305,15 +298,15 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
-                       CoordinatesType( stepX + ( stepX < 0 ), 
+         tnlAssert( entity.getCoordinates() +
+                       CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
                                         stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() + 
+                    entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) 
-                       < entity.getMesh().getDimensions() + 
+                                        stepZ + ( stepZ < 0 ) )
+                       < entity.getMesh().getDimensions() +
                         CoordinatesType( Sign( stepX ), Sign( stepY ), Sign(  stepZ ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
@@ -328,27 +321,27 @@ class tnlNeighbourGridEntityGetter<
                                                                 stepZ > 0 ? 1 : -1 ),
                                          EntityBasisType( ! stepX, !stepY, !stepZ ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****      TODO: Finish it, knonw it is only a copy of specialization for none stored stencil
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |              2            |       Cross       |
  * +-----------------+---------------------------+-------------------+
@@ -357,13 +350,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
    2,
    tnlGridEntityStencilStorageTag< tnlGridEntityCrossStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 2;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -380,13 +373,13 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
       {
          tnlAssert( ! stepX + ! stepY + ! stepZ == 2,
-                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX 
+                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX
                          << " stepY = " << stepY
                          << " stepZ = " << stepZ );
          tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
@@ -394,15 +387,15 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
-                       CoordinatesType( stepX + ( stepX < 0 ), 
+         tnlAssert( entity.getCoordinates() +
+                       CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
                                         stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() + 
+                    entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) 
-                       < entity.getMesh().getDimensions() + 
+                                        stepZ + ( stepZ < 0 ) )
+                       < entity.getMesh().getDimensions() +
                         CoordinatesType( Sign( stepX ), Sign( stepY ), Sign(  stepZ ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
@@ -417,28 +410,28 @@ class tnlNeighbourGridEntityGetter<
                                                                 stepZ > 0 ? 1 : -1 ),
                                          EntityBasisType( ! stepX, !stepY, !stepZ ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -447,13 +440,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
    1,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 1;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -470,13 +463,13 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
       {
          tnlAssert( ! stepX + ! stepY + ! stepZ == 1,
-                    cerr << "Exactly two of the steps must be non-zero: stepX = " << stepX 
+                    cerr << "Exactly two of the steps must be non-zero: stepX = " << stepX
                          << " stepY = " << stepY
                          << " stepZ = " << stepZ );
          tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
@@ -484,15 +477,15 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
-                       CoordinatesType( stepX + ( stepX < 0 ), 
+         tnlAssert( entity.getCoordinates() +
+                       CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
                                         stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() + 
+                    entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) 
-                       < entity.getMesh().getDimensions() + 
+                                        stepZ + ( stepZ < 0 ) )
+                       < entity.getMesh().getDimensions() +
                         CoordinatesType( Sign( stepX ), Sign( stepY ), Sign(  stepZ ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
@@ -504,28 +497,28 @@ class tnlNeighbourGridEntityGetter<
                                      EntityOrientationType( !!stepX, !!stepY, !!stepZ ),
                                      EntityBasisType( !stepX, !stepY, !stepZ ));
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >( entity ) );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
-      
+ 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       3         |            0              |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -534,13 +527,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3, Config >,
-   0, 
+   0,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 3;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -550,19 +543,19 @@ class tnlNeighbourGridEntityGetter<
       typedef Index IndexType;
       typedef typename GridType::CoordinatesType CoordinatesType;
       typedef tnlGridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;      
+      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
 
       __cuda_callable__ inline
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY,int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
       {
          tnlAssert( stepX != 0 && stepY != 0 && stepZ != 0,
-                    cerr << " stepX = " << stepX 
+                    cerr << " stepX = " << stepX
                          << " stepY = " << stepY
                          << " stepZ = " << stepZ );
          tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
@@ -570,46 +563,46 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
+         tnlAssert( entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
                                         stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() + 
+                    entity.getCoordinates() +
                        CoordinatesType( stepX + ( stepX < 0 ),
                                         stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) 
-                       < entity.getMesh().getDimensions() + 
+                                        stepZ + ( stepZ < 0 ) )
+                       < entity.getMesh().getDimensions() +
                             CoordinatesType( Sign( stepX ), Sign( stepY ), Sign( stepZ ) ),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 )  ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
-                   << " entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ), Sign( stepZ ) ) = " 
+                   << " entity.getMesh().getDimensions() + CoordinatesType( Sign( stepX ), Sign( stepY ), Sign( stepZ ) ) = "
                    << entity.getMesh().getDimensions()  + CoordinatesType( Sign( stepX ), Sign( stepY ), Sign( stepZ ) )
                    << " EntityDimensions = " << EntityDimensions );
          return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
                                                       entity.getCoordinates().y() + stepY + ( stepY < 0 ),
                                                       entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >( entity ) );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       2         |              3            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -618,13 +611,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 2, Config >,
-   3, 
+   3,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 2;
       static const int NeighbourEntityDimensions = 3;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -640,7 +633,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -656,16 +649,16 @@ class tnlNeighbourGridEntityGetter<
               cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                    << " entity.getMesh().getDimensions() + entity.getOrientation() = " << entity.getMesh().getDimensions() + entity.getOrientation()
                    << " EntityDimensions = " << EntityDimensions );
-         tnlAssert( entity.getCoordinates() + 
+         tnlAssert( entity.getCoordinates() +
                        CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                         stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                         stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() + 
+                    entity.getCoordinates() +
                        CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                         stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                         stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) < entity.getMesh().getDimensions(),
               cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ), stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) ) = "
-                   << entity.getCoordinates()  + CoordinatesType( 
+                   << entity.getCoordinates()  + CoordinatesType(
                         stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ),
                         stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ),
                         stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) )
@@ -676,27 +669,27 @@ class tnlNeighbourGridEntityGetter<
                                                           entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                                           entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
       {
          return GridEntityGetter::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};            
+ 
+      //tnlNeighbourGridEntityGetter(){};
 };
 
 /****
  * +-----------------+---------------------------+-------------------+
- * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |       
+ * | EntityDimenions | NeighbourEntityDimensions |  Stored Stencil   |
  * +-----------------+---------------------------+-------------------+
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
@@ -705,13 +698,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename Config >
-class tnlNeighbourGridEntityGetter< 
+class tnlNeighbourGridEntityGetter<
    tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 0, Config >,
    0,
    tnlGridEntityStencilStorageTag< tnlGridEntityNoStencil > >
 {
    public:
-      
+ 
       static const int EntityDimensions = 0;
       static const int NeighbourEntityDimensions = 0;
       typedef tnlGrid< 3, Real, Device, Index > GridType;
@@ -726,7 +719,7 @@ class tnlNeighbourGridEntityGetter<
       tnlNeighbourGridEntityGetter( const GridEntityType& entity )
       : entity( entity )
       {}
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       NeighbourGridEntityType getEntity() const
@@ -738,7 +731,7 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          tnlAssert( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) &&
                     entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) <= entity.getMesh().getDimensions(),
-              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = " 
+              cerr << "entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ ) = "
                    << entity.getCoordinates()  + CoordinatesType( stepX, stepY, stepZ )
                    << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                    << " EntityDimensions = " << EntityDimensions );
@@ -746,7 +739,7 @@ class tnlNeighbourGridEntityGetter<
                                                       entity.getCoordinates().y() + stepY,
                                                       entity.getCoordinates().z() + stepZ ) );
       }
-      
+ 
       template< int stepX, int stepY, int stepZ >
       __cuda_callable__ inline
       IndexType getEntityIndex() const
@@ -764,18 +757,17 @@ class tnlNeighbourGridEntityGetter<
                    << " EntityDimensions = " << EntityDimensions );
          return this->entity.getIndex() + stepZ * ( entity.getMesh().getDimensions().y() + 1 + stepY ) * ( entity.getMesh().getDimensions().x() + 1 ) + stepX;
       }
-      
+ 
       __cuda_callable__
       void refresh( const GridType& grid, const IndexType& entityIndex ){};
 
    protected:
 
       const GridEntityType& entity;
-      
-      //tnlNeighbourGridEntityGetter(){};      
-      
+ 
+      //tnlNeighbourGridEntityGetter(){};
+ 
 };
 
-
-#endif	/* TNLNEIGHBOURGRIDENTITYGETTER3D_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/grids/tnlTraverser_Grid1D.h b/src/mesh/grids/tnlTraverser_Grid1D.h
index f4036af9985ff155f39bf57121886bc4bcfcb363..9f1c2fe5f92c9a19f8609f43e7afaebd3c66ca92 100644
--- a/src/mesh/grids/tnlTraverser_Grid1D.h
+++ b/src/mesh/grids/tnlTraverser_Grid1D.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRAVERSER_GRID1D_H_
-#define TNLTRAVERSER_GRID1D_H_
+#pragma once
 
 #include <mesh/tnlTraverser.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index,
@@ -42,12 +36,12 @@ class tnlTraverser< tnlGrid< 1, Real, Device, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 
@@ -73,7 +67,7 @@ class tnlTraverser< tnlGrid< 1, Real, Device, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
@@ -107,12 +101,12 @@ class tnlTraverser< tnlGrid< 1, Real, tnlCuda, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -123,7 +117,7 @@ class tnlTraverser< tnlGrid< 1, Real, tnlCuda, Index >, GridEntity, 1 >
          const CoordinatesType& end,
          GridEntity& entity,
          UserData& userData ) const;
-      
+ 
 
 
 };
@@ -150,12 +144,12 @@ class tnlTraverser< tnlGrid< 1, Real, tnlCuda, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -165,11 +159,11 @@ class tnlTraverser< tnlGrid< 1, Real, tnlCuda, Index >, GridEntity, 0 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
+         UserData& userData ) const;
 };
 
 #endif
 
-#include <mesh/grids/tnlTraverser_Grid1D_impl.h>
+} // namespace TNL
 
-#endif /* TNLTRAVERSER_GRID1D_H_ */
+#include <mesh/grids/tnlTraverser_Grid1D_impl.h>
diff --git a/src/mesh/grids/tnlTraverser_Grid1D_impl.h b/src/mesh/grids/tnlTraverser_Grid1D_impl.h
index 3dc0a5168cafe4a1c3fbda90adf7c8690db37c80..41d35bd95fa89b1e62cfe26c055655b07bca45fb 100644
--- a/src/mesh/grids/tnlTraverser_Grid1D_impl.h
+++ b/src/mesh/grids/tnlTraverser_Grid1D_impl.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRAVERSER_GRID1D_IMPL_H_
-#define TNLTRAVERSER_GRID1D_IMPL_H_
+#pragma once
 
 #include <mesh/grids/tnlGridTraverser.h>
 
+namespace TNL {
 
 /****
  * Grid 1D, cells
@@ -179,4 +172,4 @@ processAllEntities(
       userData );
 }
 
-#endif /* TNLTRAVERSER_GRID1D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/grids/tnlTraverser_Grid2D.h b/src/mesh/grids/tnlTraverser_Grid2D.h
index 18baa41ae8abc280ef55112d22ac3507924c7c21..aa3c4bf0ffe3c4bcd60c27d186c229c879275f3f 100644
--- a/src/mesh/grids/tnlTraverser_Grid2D.h
+++ b/src/mesh/grids/tnlTraverser_Grid2D.h
@@ -6,19 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRAVERSER_GRID2D_H_
-#define TNLTRAVERSER_GRID2D_H_
+#pragma once
 
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -46,7 +38,7 @@ class tnlTraverser< tnlGrid< 2, Real, Device, Index >, GridEntity, 2 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 template< typename Real,
@@ -76,7 +68,7 @@ class tnlTraverser< tnlGrid< 2, Real, Device, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 template< typename Real,
@@ -101,7 +93,7 @@ class tnlTraverser< tnlGrid< 2, Real, Device, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
@@ -137,7 +129,7 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 2 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -147,7 +139,7 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 2 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
+         UserData& userData ) const;
 };
 
 template< typename Real,
@@ -175,7 +167,7 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -185,7 +177,7 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 1 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 template< typename Real,
@@ -214,7 +206,7 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -224,11 +216,11 @@ class tnlTraverser< tnlGrid< 2, Real, tnlCuda, Index >, GridEntity, 0 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 #endif // UNDEF
 
-#include <mesh/grids/tnlTraverser_Grid2D_impl.h>
+} // namespace TNL
 
-#endif /* TNLTRAVERSER_GRID2D_H_ */
+#include <mesh/grids/tnlTraverser_Grid2D_impl.h>
diff --git a/src/mesh/grids/tnlTraverser_Grid2D_impl.h b/src/mesh/grids/tnlTraverser_Grid2D_impl.h
index c59b2773fe8589547dbca9b0717a2fbaee3711cd..30c70b5ea9aefcd67cefbc3e57b6bb232b7e7ca7 100644
--- a/src/mesh/grids/tnlTraverser_Grid2D_impl.h
+++ b/src/mesh/grids/tnlTraverser_Grid2D_impl.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
-#ifndef TNLTRAVERSER_GRID2D_IMPL_H_
-#define TNLTRAVERSER_GRID2D_IMPL_H_
+#pragma once
 
 #include <mesh/grids/tnlGridTraverser.h>
 
+namespace TNL {
+
 /****
  * Grid 2D, cells
  */
@@ -64,7 +58,7 @@ processInteriorEntities( const GridType& grid,
     * Interior cells
     */
    static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." );
-      
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 1 ),
@@ -89,7 +83,7 @@ processAllEntities( const GridType& grid,
     * All cells
     */
    static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." );
-      
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0 ),
@@ -115,9 +109,9 @@ processBoundaryEntities( const GridType& grid,
 {
    /****
     * Boundary faces
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0 >(
       grid,
       CoordinatesType( 0, 0 ),
@@ -132,7 +126,7 @@ processBoundaryEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 0 ),
       CoordinatesType( 0, 1 ),
       CoordinatesType( 1, 0 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -150,7 +144,7 @@ processInteriorEntities( const GridType& grid,
     * Interior faces
     */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 0 ),
@@ -165,7 +159,7 @@ processInteriorEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 1 ),
       CoordinatesType( 0, 1 ),
       CoordinatesType( 1, 0 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -181,9 +175,9 @@ processAllEntities( const GridType& grid,
 {
    /****
     * All faces
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0 ),
@@ -198,7 +192,7 @@ processAllEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 0 ),
       CoordinatesType( 0, 1 ),
       CoordinatesType( 1, 0 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -216,7 +210,7 @@ processBoundaryEntities( const GridType& grid,
     * Boundary vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1 >(
       grid,
       CoordinatesType( 0, 0 ),
@@ -241,7 +235,7 @@ processInteriorEntities( const GridType& grid,
     * Interior vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 1 ),
@@ -250,7 +244,7 @@ processInteriorEntities( const GridType& grid,
       CoordinatesType(),
       userData );
 }
-   
+ 
 template< typename Real,
           typename Device,
           typename Index,
@@ -266,7 +260,7 @@ processAllEntities( const GridType& grid,
     * All vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0 ),
@@ -275,4 +269,5 @@ processAllEntities( const GridType& grid,
       CoordinatesType(),
       userData );
 }
-#endif /* TNLTRAVERSER_GRID2D_IMPL_H_ */
+
+} // namespace TNL
diff --git a/src/mesh/grids/tnlTraverser_Grid3D.h b/src/mesh/grids/tnlTraverser_Grid3D.h
index c00b1c4c50365ce97eba8ffd2860734d7c096527..afef31c831fa8fbf3af427629b4e0ab8e64054d0 100644
--- a/src/mesh/grids/tnlTraverser_Grid3D.h
+++ b/src/mesh/grids/tnlTraverser_Grid3D.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLTRAVERSER_GRID3D_H_
-#define TNLTRAVERSER_GRID3D_H_
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -44,7 +38,7 @@ class tnlTraverser< tnlGrid< 3, Real, Device, Index >, GridEntity, 3 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 template< typename Real,
@@ -73,7 +67,7 @@ class tnlTraverser< tnlGrid< 3, Real, Device, Index >, GridEntity, 2 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 template< typename Real,
@@ -103,7 +97,7 @@ class tnlTraverser< tnlGrid< 3, Real, Device, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
 };
 
 template< typename Real,
@@ -128,7 +122,7 @@ class tnlTraverser< tnlGrid< 3, Real, Device, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
@@ -166,7 +160,7 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 3 >
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -176,8 +170,8 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 3 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
-      
+         UserData& userData ) const;
+ 
 };
 
 template< typename Real,
@@ -201,12 +195,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 2 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -216,8 +210,8 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 2 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
-      
+         UserData& userData ) const;
+ 
 };
 
 template< typename Real,
@@ -241,12 +235,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -256,7 +250,7 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 1 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 template< typename Real,
@@ -280,12 +274,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -295,7 +289,7 @@ class tnlTraverser< tnlGrid< 3, Real, tnlHost, Index >, GridEntity, 0 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 /****
@@ -323,12 +317,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 3 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -338,7 +332,7 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 3 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 template< typename Real,
@@ -362,12 +356,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 2 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -377,7 +371,7 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 2 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;            
+         UserData& userData ) const;
 };
 
 template< typename Real,
@@ -401,12 +395,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 1 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -416,8 +410,8 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 1 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
-      
+         UserData& userData ) const;
+ 
 };
 
 template< typename Real,
@@ -441,12 +435,12 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 0 >
                 typename EntitiesProcessor >
       void processInteriorEntities( const GridType& grid,
                                     UserData& userData ) const;
-      
+ 
       template< typename UserData,
                 typename EntitiesProcessor >
       void processAllEntities( const GridType& grid,
                                UserData& userData ) const;
-      
+ 
    protected:
 
       template< typename UserData,
@@ -456,11 +450,11 @@ class tnlTraverser< tnlGrid< 3, Real, tnlCuda, Index >, GridEntity, 0 >
          const CoordinatesType& begin,
          const CoordinatesType& end,
          GridEntity& entity,
-         UserData& userData ) const;      
-      
+         UserData& userData ) const;
+ 
 };
 #endif // UNDEF
 
-#include <mesh/grids/tnlTraverser_Grid3D_impl.h>
+} // namespace TNL
 
-#endif /* TNLTRAVERSER_GRID3D_H_ */
+#include <mesh/grids/tnlTraverser_Grid3D_impl.h>
diff --git a/src/mesh/grids/tnlTraverser_Grid3D_impl.h b/src/mesh/grids/tnlTraverser_Grid3D_impl.h
index 0e4ba1e39a067963d83772b9b026d3afa222d13c..90ddb8e8c40a06d0d1d469b8851b7c57b7ac534e 100644
--- a/src/mesh/grids/tnlTraverser_Grid3D_impl.h
+++ b/src/mesh/grids/tnlTraverser_Grid3D_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRAVERSER_GRID3D_IMPL_H_
-#define TNLTRAVERSER_GRID3D_IMPL_H_
+#pragma once
 
 #include <mesh/grids/tnlGridTraverser.h>
 
+namespace TNL {
+
 /****
  * Grid 3D, cells
  */
@@ -63,7 +57,7 @@ processInteriorEntities( const GridType& grid,
     * Interior cells
     */
    static_assert( GridEntity::entityDimensions == 3, "The entity has wrong dimensions." );
-      
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 1, 1 ),
@@ -88,7 +82,7 @@ processAllEntities( const GridType& grid,
     * All cells
     */
    static_assert( GridEntity::entityDimensions == 3, "The entity has wrong dimensions." );
-      
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0, 0 ),
@@ -114,9 +108,9 @@ processBoundaryEntities( const GridType& grid,
 {
    /****
     * Boundary faces
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 0 >(
       grid,
       CoordinatesType( 0, 0, 0 ),
@@ -131,15 +125,15 @@ processBoundaryEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 0, 1, 0 ),
       CoordinatesType( 1, 0, 1 ),
-      userData );   
-   
+      userData );
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 0, 1 >(
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 0, 1, 0 ),
       CoordinatesType( 1, 1, 0 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -155,9 +149,9 @@ processInteriorEntities( const GridType& grid,
 {
    /****
     * Interior faces
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 0, 0 ),
@@ -172,7 +166,7 @@ processInteriorEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 1, 1 ),
       CoordinatesType( 0, 1, 0 ),
       CoordinatesType( 1, 0, 1 ),
-      userData );   
+      userData );
 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
@@ -180,7 +174,7 @@ processInteriorEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 1, 1 ),
       CoordinatesType( 0, 0, 1 ),
       CoordinatesType( 1, 1, 0 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -196,7 +190,7 @@ processAllEntities( const GridType& grid,
 {
    /****
     * All faces
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." );
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
@@ -212,15 +206,15 @@ processAllEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 0, 1, 0 ),
       CoordinatesType( 1, 0, 1 ),
-      userData );   
-   
+      userData );
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 0, 0, 1 ),
       CoordinatesType( 1, 1, 0 ),
-      userData );      
+      userData );
 }
 
 /****
@@ -239,9 +233,9 @@ processBoundaryEntities( const GridType& grid,
 {
    /****
     * Boundary edges
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 1 >(
       grid,
       CoordinatesType( 0, 0, 0 ),
@@ -256,15 +250,15 @@ processBoundaryEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 0, 1, 0 ),
       CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 0, 1, 0 ),
-      userData );   
-   
+      userData );
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 0 >(
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 0, 0, 1 ),
       CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 0, 0, 1 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -280,9 +274,9 @@ processInteriorEntities( const GridType& grid,
 {
    /****
     * Interior edges
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 1, 1 ),
@@ -297,7 +291,7 @@ processInteriorEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 0, 1, 0 ),
-      userData );   
+      userData );
 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
@@ -305,7 +299,7 @@ processInteriorEntities( const GridType& grid,
       grid.getDimensions() - CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 0, 0, 1 ),
-      userData );   
+      userData );
 }
 
 template< typename Real,
@@ -321,13 +315,13 @@ processAllEntities( const GridType& grid,
 {
    /****
     * All edges
-    */ 
+    */
    static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." );
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 1, 0, 0 ),
-      CoordinatesType( 0, 1, 1 ),      
+      CoordinatesType( 0, 1, 1 ),
       CoordinatesType( 1, 0, 0 ),
       userData );
 
@@ -335,17 +329,17 @@ processAllEntities( const GridType& grid,
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 0, 1, 0 ),
-      CoordinatesType( 1, 0, 1 ),      
+      CoordinatesType( 1, 0, 1 ),
       CoordinatesType( 0, 1, 0 ),
-      userData );   
-   
+      userData );
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0, 0 ),
       grid.getDimensions() - CoordinatesType( 0, 0, 1 ),
-      CoordinatesType( 1, 1, 0 ),      
+      CoordinatesType( 1, 1, 0 ),
       CoordinatesType( 0, 0, 1 ),
-      userData );      
+      userData );
 }
 
 /****
@@ -366,7 +360,7 @@ processBoundaryEntities( const GridType& grid,
     * Boundary vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 1 >(
       grid,
       CoordinatesType( 0, 0, 0 ),
@@ -391,7 +385,7 @@ processInteriorEntities( const GridType& grid,
     * Interior vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 1, 1, 1 ),
@@ -400,7 +394,7 @@ processInteriorEntities( const GridType& grid,
       CoordinatesType(),
       userData );
 }
-   
+ 
 template< typename Real,
           typename Device,
           typename Index,
@@ -416,7 +410,7 @@ processAllEntities( const GridType& grid,
     * All vertices
     */
    static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." );
-   
+ 
    tnlGridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
       grid,
       CoordinatesType( 0, 0, 0 ),
@@ -426,4 +420,4 @@ processAllEntities( const GridType& grid,
       userData );
 }
 
-#endif /* TNLTRAVERSER_GRID3D_IMPL_H_ */
+} // namespace TNL
diff --git a/src/mesh/initializer/tnlMeshEntityInitializer.h b/src/mesh/initializer/tnlMeshEntityInitializer.h
index 064de82f76d7e021f8c94a3b5658fc5cf881d77b..0d1bbc19e23eaaec382a203ef421a4fc62eeba40 100644
--- a/src/mesh/initializer/tnlMeshEntityInitializer.h
+++ b/src/mesh/initializer/tnlMeshEntityInitializer.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYINITIALIZER_H_
-#define TNLMESHENTITYINITIALIZER_H_
+#pragma once
 
 #include <core/tnlStaticFor.h>
 #include <mesh/initializer/tnlMeshSuperentityStorageInitializer.h>
@@ -24,6 +16,8 @@
 
 #include "tnlMeshEntitySeed.h"
 
+namespace TNL {
+
 template< typename MeshConfig >
 class tnlMeshInitializer;
 
@@ -41,16 +35,16 @@ template< typename MeshConfig,
           typename EntityTopology >
 class tnlMeshEntityInitializer
    : public tnlMeshEntityInitializerLayer< MeshConfig,
-                                           EntityTopology, 
+                                           EntityTopology,
                                            tnlDimensionsTag< EntityTopology::dimensions - 1 > >
 {
    typedef tnlDimensionsTag< EntityTopology::dimensions >                                 DimensionsTag;
    private:
 
       typedef tnlMeshEntityInitializerLayer< MeshConfig,
-                                           EntityTopology, 
+                                           EntityTopology,
                                            tnlDimensionsTag< EntityTopology::dimensions - 1 > > BaseType;
-      
+ 
    typedef
       tnlMeshEntityInitializerLayer< MeshConfig,
                                      EntityTopology,
@@ -66,10 +60,10 @@ class tnlMeshEntityInitializer
    typedef typename MeshTraits::GlobalIndexType                                 GlobalIndexType;
    typedef typename MeshTraits::LocalIndexType                                  LocalIndexType;
    typedef typename MeshTraits::template EntityTraits< Dimensions >             EntityTraits;
-   
-   typedef typename EntityTraits::EntityType                                    EntityType;   
+ 
+   typedef typename EntityTraits::EntityType                                    EntityType;
    typedef typename MeshTraits::template SubentityTraits< EntityTopology, 0 >   SubvertexTraits;
-   
+ 
 
    typedef tnlMeshInitializer< MeshConfig >                                                   InitializerType;
    typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >                            SeedType;
@@ -89,7 +83,7 @@ class tnlMeshEntityInitializer
       entity = EntityType( entitySeed );
       BaseType::initSubentities( entity, entityIndex, entitySeed, initializer );
    }
-   
+ 
    template< typename SuperentityDimensionTag >
    typename tnlMeshSuperentityTraits< MeshConfig, EntityTopology, SuperentityDimensionTag::value >::SharedContainerType& getSuperentityContainer( SuperentityDimensionTag )
    {
@@ -118,8 +112,8 @@ class tnlMeshEntityInitializer< MeshConfig, tnlMeshVertexTopology >
       typedef tnlMeshInitializer< MeshConfig >                 InitializerType;
 
       static tnlString getType() {};
-      
-      static void setVertexPoint( VertexType& vertex, 
+ 
+      static void setVertexPoint( VertexType& vertex,
                                   const PointType& point,
                                   InitializerType& initializer )
       {
@@ -130,9 +124,9 @@ class tnlMeshEntityInitializer< MeshConfig, tnlMeshVertexTopology >
 
 /****
  *       Mesh entity initializer layer with specializations
- * 
+ *
  *  SUBENTITY STORAGE     SUBENTITY ORIENTATION    SUPERENTITY STORAGE
- *      TRUE                    FALSE                    TRUE 
+ *      TRUE                    FALSE                    TRUE
  */
 template< typename MeshConfig,
           typename EntityTopology,
@@ -176,9 +170,9 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
 
       IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity );
       for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ )
-      {         
+      {
          //cout << "    Adding subentity " << subentityIdsArray[ i ] << endl;
-         subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] );         
+         subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] );
          meshInitializer.
             template getSuperentityInitializer< DimensionsTag >().
                addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex );
@@ -189,9 +183,9 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
 
 /****
  *       Mesh entity initializer layer with specializations
- * 
+ *
  *  SUBENTITY STORAGE     SUBENTITY ORIENTATION    SUPERENTITY STORAGE
- *      TRUE                    TRUE                    TRUE 
+ *      TRUE                    TRUE                    TRUE
  */
 template< typename MeshConfig,
           typename EntityTopology,
@@ -235,7 +229,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
       IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity );
       OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionsTag >( entity );
       for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ )
-      {         
+      {
          //cout << "    Adding subentity " << subentityIdsArray[ i ] << endl;
          GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] );
          subentityIdsArray[ i ] = subentityIndex;
@@ -245,14 +239,14 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
             template getSuperentityInitializer< DimensionsTag >().
                addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex );
       }
-      
+ 
       BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer );
    }
 };
 
 /****
  *       Mesh entity initializer layer with specializations
- * 
+ *
  *  SUBENTITY STORAGE     SUBENTITY ORIENTATION    SUPERENTITY STORAGE
  *      TRUE                    TRUE                    FALSE
  */
@@ -298,9 +292,9 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
       IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity );
       OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionsTag >( entity );
       for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ )
-      {         
+      {
          //cout << "    Adding subentity " << subentityIdsArray[ i ] << endl;
-         subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] );         
+         subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] );
          subentityOrientationsArray[ i ] = meshInitializer.template getReferenceOrientation< DimensionsTag >( subentitySeeds[ i ] ).createOrientation( subentitySeeds[ i ] );
       }
       BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer );
@@ -392,7 +386,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
 
 
    protected:
-      
+ 
       static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed,
                                    InitializerType& meshInitializer )
       {
@@ -452,7 +446,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
 
 
    protected:
-      
+ 
       static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed,
                                    InitializerType& meshInitializer )
       {
@@ -490,10 +484,10 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
 
 
    protected:
-   
+ 
       static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed,
                                    InitializerType& meshInitializer ) {};
-   
+ 
 };
 
 template< typename MeshConfig,
@@ -545,5 +539,4 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
                          InitializerType& ) {}
 };
 
-
-#endif /* TNLMESHENTITYINITIALIZER_H_ */
+} // namespace TNL
diff --git a/src/mesh/initializer/tnlMeshEntitySeed.h b/src/mesh/initializer/tnlMeshEntitySeed.h
index d3e25036ece15c7d8cbb7e2101751cb77ce81d6c..466eff95b7b7dc8df45fd3f649860706da91dbdc 100644
--- a/src/mesh/initializer/tnlMeshEntitySeed.h
+++ b/src/mesh/initializer/tnlMeshEntitySeed.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYSEED_H
-#define	TNLMESHENTITYSEED_H
+#pragma once
 
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology >
 class tnlMeshEntitySeed
@@ -34,7 +28,7 @@ class tnlMeshEntitySeed
       typedef typename SubvertexTraits::IdArrayType                                                      IdArrayType;
 
       static tnlString getType() { return tnlString( "tnlMeshEntitySeed<>" ); }
-      
+ 
       static constexpr LocalIndexType getCornersCount()
       {
          return SubvertexTraits::count;
@@ -55,7 +49,7 @@ class tnlMeshEntitySeed
          return accessor;
       }
 
-      
+ 
       const IdArrayAccessorType getCornerIds() const
       {
          IdArrayAccessorType accessor;
@@ -75,5 +69,5 @@ ostream& operator << ( ostream& str, const tnlMeshEntitySeed< MeshConfig, Entity
    return str;
 };
 
-#endif	/* TNLMESHENTITYSEED_H */
+} // namespace TNL
 
diff --git a/src/mesh/initializer/tnlMeshEntitySeedKey.h b/src/mesh/initializer/tnlMeshEntitySeedKey.h
index 5220d8a3bd8632d56b45bb21bf0ed826a0880910..0a88667ecf3c4ffc6572495ec58ee134e41e89ab 100644
--- a/src/mesh/initializer/tnlMeshEntitySeedKey.h
+++ b/src/mesh/initializer/tnlMeshEntitySeedKey.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYSEEDKEY_H_
-#define TNLMESHENTITYSEEDKEY_H_
+#pragma once
 
 #include <mesh/tnlDimensionsTag.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology >
 class tnlMeshEntitySeed;
@@ -49,7 +43,7 @@ class tnlMeshEntitySeedKey
 
    explicit tnlMeshEntitySeedKey( const EntitySeedType& entitySeed )
    {
-      for( typename StorageArrayType::IndexType i = 0; 
+      for( typename StorageArrayType::IndexType i = 0;
            i < entitySeed.getCornersCount();
            i++ )
          this->sortedCorners[ i ] = entitySeed.getCornerIds()[ i ];
@@ -76,5 +70,4 @@ class tnlMeshEntitySeedKey
    StorageArrayType sortedCorners;
 };
 
-
-#endif /* TNLMESHENTITYKSEEDEY_H_ */
+} // namespace TNL
diff --git a/src/mesh/initializer/tnlMeshInitializer.h b/src/mesh/initializer/tnlMeshInitializer.h
index ef8566709d193e40c2ee537a8e0344bd52bcbf06..cccee8a52883f6cdab65a09ce7dec6e19c3cb4a9 100644
--- a/src/mesh/initializer/tnlMeshInitializer.h
+++ b/src/mesh/initializer/tnlMeshInitializer.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHINITIALIZER_H_
-#define TNLMESHINITIALIZER_H_
+#pragma once
 
 #include <mesh/tnlDimensionsTag.h>
 #include <mesh/traits/tnlMeshEntityTraits.h>
@@ -30,14 +22,16 @@
 #include <mesh/initializer/tnlMeshEntitySeed.h>
 #include <mesh/initializer/tnlMeshEntitySeedKey.h>
 
+namespace TNL {
+
 template< typename MeshConfig >
 class tnlMesh;
 
 template< typename MeshConfig,
           typename DimensionsTag,
-          bool EntityStorage = 
+          bool EntityStorage =
              tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::storageEnabled,
-          bool EntityReferenceOrientationStorage = 
+          bool EntityReferenceOrientationStorage =
              tnlMeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::orientationNeeded >
 class tnlMeshInitializerLayer;
 
@@ -52,7 +46,7 @@ class tnlMeshInitializer
                                      typename tnlMeshTraits< MeshConfig >::DimensionsTag >
 {
    public:
-   
+ 
       typedef tnlMesh< MeshConfig >                                  MeshType;
       typedef tnlMeshTraits< MeshConfig >                            MeshTraits;
       static const int Dimensions = MeshTraits::meshDimensions;
@@ -61,9 +55,9 @@ class tnlMeshInitializer
       typedef typename MeshTraits::PointArrayType                    PointArrayType;
       typedef typename MeshTraits::CellSeedArrayType                 CellSeedArrayType;
       typedef typename MeshTraits::GlobalIndexType                   GlobalIndexType;
-      
+ 
       template< typename DimensionsTag, typename SuperdimensionsTag > using SuperentityStorageNetwork =
-      typename MeshTraits::template SuperentityTraits< 
+      typename MeshTraits::template SuperentityTraits<
          typename MeshTraits::template EntityTraits< DimensionsTag::value >::EntityTopology,
          SuperdimensionsTag::value >::StorageNetworkType;
 
@@ -79,8 +73,8 @@ class tnlMeshInitializer
 
       bool createMesh( const PointArrayType& points,
                        const CellSeedArrayType& cellSeeds,
-                       MeshType& mesh )   
-      {      
+                       MeshType& mesh )
+      {
          cout << "======= Starting mesh initiation ========" << endl;
          this->mesh = &mesh;
 
@@ -130,7 +124,7 @@ class tnlMeshInitializer
       {
          return mesh->template superentityIdsArray< DimensionsTag, SuperDimensionsTag >();
       }
-      
+ 
       template< typename EntityTopology, typename SuperdimensionsTag >
       typename MeshTraits::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType&
       meshSuperentityStorageNetwork()
@@ -151,7 +145,7 @@ class tnlMeshInitializer
          return BaseType::getSuperentityInitializer( DimensionsTag() );
       }
 
-      
+ 
       template< typename DimensionsTag >
       const tnlMeshEntityReferenceOrientation< MeshConfig, typename MeshTraits::template EntityTraits< DimensionsTag::value >::EntityTopology >&
       getReferenceOrientation( GlobalIndexType index) const
@@ -221,7 +215,7 @@ class tnlMeshInitializerLayer< MeshConfig,
          /***
           * There are no superentities in this layer storing mesh cells.
           */
-         
+ 
          BaseType::initEntities( initializer, points );
       }
 
@@ -236,7 +230,7 @@ class tnlMeshInitializerLayer< MeshConfig,
       {
          return this->superentityInitializer;
       }
-   
+ 
       bool checkCells()
       {
          typedef typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentitiesTraits< 0 >::LocalIndexType LocalIndexType;
@@ -266,7 +260,7 @@ class tnlMeshInitializerLayer< MeshConfig,
       }
 
    private:
-      typedef  typename tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType                     SeedIndexedSet;      
+      typedef  typename tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType                     SeedIndexedSet;
 
       SeedIndexedSet seedsIndexedSet;
       SuperentityInitializerType superentityInitializer;
@@ -325,7 +319,7 @@ class tnlMeshInitializerLayer< MeshConfig,
       {
          typedef tnlMeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionsTag >  SubentitySeedsCreator;
          //cout << " Creating mesh entities with " << DimensionsTag::value << " dimensions ... " << endl;
-         for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ )         
+         for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ )
          {
             //cout << "  Creating mesh entities from cell number " << i << " : " << cellSeeds[ i ] << endl;
             typedef typename SubentitySeedsCreator::SubentitySeedArray SubentitySeedArray;
@@ -347,7 +341,7 @@ class tnlMeshInitializerLayer< MeshConfig,
          this->seedsIndexedSet.find( seed, index );
          return index;
       }
-      
+ 
       using BaseType::getSuperentityInitializer;
       SuperentityInitializerType& getSuperentityInitializer( DimensionsTag )
       {
@@ -376,7 +370,7 @@ class tnlMeshInitializerLayer< MeshConfig,
 
       void createEntityReferenceOrientations() const {}
    private:
-      
+ 
       typedef  typename tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType                     SeedIndexedSet;
       SeedIndexedSet seedsIndexedSet;
       SuperentityInitializerType superentityInitializer;
@@ -399,7 +393,7 @@ class tnlMeshInitializerLayer< MeshConfig,
    typedef tnlMeshInitializerLayer< MeshConfig,
                                     typename DimensionsTag::Decrement >       BaseType;
    typedef tnlMesh< MeshConfig >                                              MeshType;
-   typedef typename MeshType::MeshTraits                                      MeshTraits;                     
+   typedef typename MeshType::MeshTraits                                      MeshTraits;
 
    typedef typename MeshType::template EntityTraits< DimensionsTag::value >   EntityTraits;
    typedef typename EntityTraits::EntityTopology                              EntityTopology;
@@ -429,8 +423,8 @@ class tnlMeshInitializerLayer< MeshConfig,
                                 typename MeshConfig::CellTopology,
                                 DimensionsTag::value >::SubentityContainerType SubentitiesContainerType;
 
-   public:      
-      
+   public:
+ 
       using BaseType::getEntityInitializer;
       EntityInitializerType& getEntityInitializer( DimensionsTag, GlobalIndexType index )
       {
@@ -441,7 +435,7 @@ class tnlMeshInitializerLayer< MeshConfig,
       {
          typedef tnlMeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionsTag >  SubentitySeedsCreator;
          //cout << " Creating mesh entities with " << DimensionsTag::value << " dimensions ... " << endl;
-         for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ )         
+         for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ )
          {
             //cout << "  Creating mesh entities from cell number " << i << " : " << cellSeeds[ i ] << endl;
             typedef typename SubentitySeedsCreator::SubentitySeedArray SubentitySeedArray;
@@ -463,7 +457,7 @@ class tnlMeshInitializerLayer< MeshConfig,
          this->seedsIndexedSet.find( seed, index );
          return index;
       }
-      
+ 
       using BaseType::getSuperentityInitializer;
       SuperentityInitializerType& getSuperentityInitializer( DimensionsTag )
       {
@@ -495,7 +489,7 @@ class tnlMeshInitializerLayer< MeshConfig,
       {
          return this->referenceOrientations[ index ];
       }
-      
+ 
       void createEntityReferenceOrientations()
       {
          //cout << " Creating entity reference orientations with " << DimensionsTag::value << " dimensions ... " << endl;
@@ -510,9 +504,9 @@ class tnlMeshInitializerLayer< MeshConfig,
          }
          BaseType::createEntityReferenceOrientations();
 		}	
-      
+ 
    private:
-      
+ 
       typedef  typename tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType                     SeedIndexedSet;
       SeedIndexedSet seedsIndexedSet;
       SuperentityInitializerType superentityInitializer;
@@ -586,9 +580,9 @@ class tnlMeshInitializerLayer< MeshConfig,
                        << " vertexInitializerContainer.getSize() = " << vertexInitializerContainer.getSize() << endl; );
          return vertexInitializerContainer[ index ];
       }
-      
+ 
       void createEntitySeedsFromCellSeeds( const CellSeedArrayType& cellSeeds ){};
-      
+ 
       void initEntities( InitializerType& initializer, const PointArrayType& points )
       {
          EntityArrayType &vertexArray = initializer.template meshEntitiesArray< DimensionsTag >();
@@ -598,25 +592,25 @@ class tnlMeshInitializerLayer< MeshConfig,
 
          superentityInitializer.initSuperentities( initializer );
       }
-         
+ 
       void findEntitySeedIndex() const                               {} // This method is due to 'using BaseType::findEntityIndex;' in the derived class.
 
       void createEntityInitializers()
       {
          vertexInitializerContainer.setSize( this->getMesh().template getNumberOfEntities< DimensionsTag::value >() );
       }
-      
+ 
       SuperentityInitializerType& getSuperentityInitializer( DimensionsTag )
       {
          return this->superentityInitializer;
       }
 
       void createEntityReferenceOrientations() const {}
-      
+ 
       void getReferenceOrientation() const {}
-      
+ 
    private:
-      
+ 
       SuperentityInitializerType superentityInitializer;
 
       VertexInitializerContainerType vertexInitializerContainer;
@@ -624,7 +618,4 @@ class tnlMeshInitializerLayer< MeshConfig,
       MeshType* mesh;
 };
 
-
-
-
-#endif /* TNLMESHINITIALIZER_H_ */
+} // namespace TNL
diff --git a/src/mesh/initializer/tnlMeshSubentitySeedCreator.h b/src/mesh/initializer/tnlMeshSubentitySeedCreator.h
index 35dd6abbd7c23b6c760f9390e0df7c6ba8ad29cd..9a770d3dd82c450f589d7025cf2d3fda4328564d 100644
--- a/src/mesh/initializer/tnlMeshSubentitySeedCreator.h
+++ b/src/mesh/initializer/tnlMeshSubentitySeedCreator.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUBENTITYSEEDCREATOR_H
-#define	TNLMESHSUBENTITYSEEDCREATOR_H
+#pragma once
 
 #include <core/tnlStaticFor.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology,
           typename SubDimensionsTag >
@@ -45,7 +39,7 @@ class tnlMeshSubentitySeedsCreator
          SubentitySeedArray subentitySeeds;
          tnlStaticFor< LocalIndexType, 0, SUBENTITIES_COUNT, CreateSubentitySeeds >::exec( subentitySeeds, entitySeed.getCornerIds() );
          //tnlStaticFor< LocalIndexType, 0, SUBENTITIES_COUNT, CreateSubentitySeeds >::exec( indexedSet, entitySeed.getCornerIds() );
-         
+ 
          return subentitySeeds;
       }
 
@@ -78,5 +72,5 @@ class tnlMeshSubentitySeedsCreator
       };
 };
 
-#endif	/* TNLMESHSUBENTITYSEEDCREATOR_H */
+} // namespace TNL
 
diff --git a/src/mesh/initializer/tnlMeshSuperentityStorageInitializer.h b/src/mesh/initializer/tnlMeshSuperentityStorageInitializer.h
index 89c18bf540a2c9154a71c9e31855b7c1391db369..fa92824ffc74d3d1b5311215fae18840b1328b3c 100644
--- a/src/mesh/initializer/tnlMeshSuperentityStorageInitializer.h
+++ b/src/mesh/initializer/tnlMeshSuperentityStorageInitializer.h
@@ -6,20 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUPERENTITYSTORAGEINITIALIZER_H_
-#define TNLMESHSUPERENTITYSTORAGEINITIALIZER_H_
+#pragma once
 
 #include <mesh/tnlDimensionsTag.h>
 #include <algorithm>
+#include <vector>
+
+namespace TNL {
 
 template< typename MeshConfig >
 class tnlMeshInitializer;
@@ -56,16 +51,16 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
 	
    typedef tnlMeshTraits< MeshConfig >                                                      MeshTraits;
    typedef typename MeshTraits::GlobalIdArrayType                                           GlobalIdArrayType;
-      
+ 
    typedef typename MeshTraits::GlobalIndexType                                             GlobalIndexType;
    typedef typename MeshTraits::LocalIndexType                                              LocalIndexType;
    typedef tnlMeshInitializer< MeshConfig >                                                 MeshInitializer;
    typedef typename MeshTraits::template SuperentityTraits< EntityTopology, Dimensions >    SuperentityTraits;
    typedef typename SuperentityTraits::StorageNetworkType                                   SuperentityStorageNetwork;
 
-   public:      
+   public:
       using BaseType::addSuperentity;
-	   
+	
       void addSuperentity( DimensionsTag, GlobalIndexType entityIndex, GlobalIndexType superentityIndex)
       {
          //cout << "Adding superentity with " << DimensionsTag::value << " dimensions of enity with " << EntityDimensions::value << " ... " << endl;
@@ -79,7 +74,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
                     indexPairs.end(),
                     []( IndexPair pair0, IndexPair pair1 ){ return ( pair0.entityIndex < pair1.entityIndex ); } );
 
-         GlobalIdArrayType &superentityIdsArray = meshInitializer.template meshSuperentityIdsArray< EntityDimensions, DimensionsTag >();         
+         GlobalIdArrayType &superentityIdsArray = meshInitializer.template meshSuperentityIdsArray< EntityDimensions, DimensionsTag >();
          superentityIdsArray.setSize( static_cast< GlobalIndexType >( indexPairs.size() )  );
          GlobalIndexType currentBegin = 0;
          GlobalIndexType lastEntityIndex = 0;
@@ -87,7 +82,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
          for( GlobalIndexType i = 0; i < superentityIdsArray.getSize(); i++)
          {
             superentityIdsArray[ i ] = indexPairs[i].superentityIndex;
-            
+ 
             //cout << "Adding superentity " << indexPairs[i].superentityIndex << " to entity " << lastEntityIndex << endl;
             if( indexPairs[ i ].entityIndex != lastEntityIndex )
             {
@@ -99,7 +94,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
 
          meshInitializer.template superentityIdsArray< DimensionsTag >( meshInitializer.template meshEntitiesArray< EntityDimensions >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, superentityIdsArray.getSize() - currentBegin );
          indexPairs.clear();
-         
+ 
          /****
           * Network initializer
           */
@@ -117,12 +112,12 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
             if( indexPairs[ i ].entityIndex == lastEntityIndex )
                storageNetworkAllocationVector[ lastEntityIndex ]++;
             else
-               lastEntityIndex++;                           
+               lastEntityIndex++;
          }
          superentityStorageNetwork.allocate( storageNetworkAllocationVector );
          lastEntityIndex = 0;
          LocalIndexType superentitiesCount( 0 );
-         typename SuperentityStorageNetwork::ValuesAccessorType superentitiesIndecis = 
+         typename SuperentityStorageNetwork::ValuesAccessorType superentitiesIndecis =
             superentityStorageNetwork.getValues( lastEntityIndex );
          for( GlobalIndexType i = 0; i < superentityIdsArray.getSize(); i++)
          {
@@ -144,7 +139,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
       };
 
       std::vector< IndexPair > indexPairs;
-   
+ 
 };
 
 template< typename MeshConfig,
@@ -162,11 +157,11 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
                                                 EntityTopology,
                                                 typename DimensionsTag::Decrement > BaseType;
    typedef tnlMeshInitializer< MeshConfig >                                      MeshInitializerType;
-   
+ 
    public:
    void addSuperentity()                           {} // This method is due to 'using BaseType::...;' in the derived classes.
    using BaseType::initSuperentities;
-   void initSuperentities( MeshInitializerType& ) {cerr << "***" << endl;} 
+   void initSuperentities( MeshInitializerType& ) {cerr << "***" << endl;}
 };
 
 template< typename MeshConfig,
@@ -177,7 +172,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
                                           true >
 {
    typedef tnlMeshInitializer< MeshConfig >                                      MeshInitializerType;
-   
+ 
    public:
    void addSuperentity()                           {} // This method is due to 'using BaseType::...;' in the derived classes.
    void initSuperentities( MeshInitializerType& ) {}
@@ -197,7 +192,4 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
    void initSuperentities( MeshInitializerType& ) {}
 };
 
-
-
-
-#endif /* TNLMESHSUPERENTITYSTORAGEINITIALIZER_H_ */
+} // namespace TNL
diff --git a/src/mesh/layers/tnlMeshStorageLayer.h b/src/mesh/layers/tnlMeshStorageLayer.h
index 62ea6701c9a2871db2687aa45031177524ed0db0..a5399087812a6c0fef4a703c8b8479dd3463b60e 100644
--- a/src/mesh/layers/tnlMeshStorageLayer.h
+++ b/src/mesh/layers/tnlMeshStorageLayer.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSTORAGELAYER_H_
-#define TNLMESHSTORAGELAYER_H_
+#pragma once
 
 #include <core/tnlFile.h>
 #include <mesh/traits/tnlMeshTraits.h>
 #include <mesh/traits/tnlMeshEntityTraits.h>
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename DimensionsTag,
           bool EntityStorage = tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::storageEnabled >
@@ -42,17 +36,17 @@ class tnlMeshStorageLayer< MeshConfig,
                            DimensionsTag,
                            true >
    : public tnlMeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement >,
-     public tnlMeshSuperentityStorageLayers< MeshConfig, 
+     public tnlMeshSuperentityStorageLayers< MeshConfig,
                                              typename tnlMeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::EntityTopology >
 {
    public:
 
       static const int Dimensions = DimensionsTag::value;
       typedef tnlMeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement >   BaseType;
-      typedef tnlMeshSuperentityStorageLayers< MeshConfig, 
+      typedef tnlMeshSuperentityStorageLayers< MeshConfig,
                                                typename tnlMeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::EntityTopology > SuperentityStorageBaseType;
       typedef tnlMeshTraits< MeshConfig >                                          MeshTraits;
-      typedef typename MeshTraits::template EntityTraits< Dimensions >             EntityTraits; 
+      typedef typename MeshTraits::template EntityTraits< Dimensions >             EntityTraits;
 
       typedef typename EntityTraits::StorageArrayType                              StorageArrayType;
       typedef typename EntityTraits::AccessArrayType                               AccessArrayType;
@@ -122,7 +116,7 @@ class tnlMeshStorageLayer< MeshConfig,
 
       void print( ostream& str ) const
       {
-         BaseType::print( str );         
+         BaseType::print( str );
          str << "The entities with " << DimensionsTag::value << " dimensions are: " << endl;
          for( GlobalIndexType i = 0; i < entities.getSize();i ++ )
          {
@@ -143,17 +137,17 @@ class tnlMeshStorageLayer< MeshConfig,
       StorageArrayType entities;
 
       AccessArrayType entitiesAccess;
-   
+ 
    // TODO: this is only for the mesh initializer - fix it
    public:
 
       using BaseType::entitiesArray;
-      
+ 
       typename EntityTraits::StorageArrayType& entitiesArray( DimensionsTag )
       {
-         return entities; 
+         return entities;
       }
-              
+ 
       using BaseType::superentityIdsArray;
 	
       template< typename SuperDimensionsTag >
@@ -161,10 +155,10 @@ class tnlMeshStorageLayer< MeshConfig,
       {
          return SuperentityStorageBaseType::superentityIdsArray( SuperDimensionsTag() );
       }
-      
+ 
       using BaseType::getSuperentityStorageNetwork;
       template< typename SuperdimensionsTag >
-      typename MeshTraits::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType& 
+      typename MeshTraits::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType&
       getSuperentityStorageNetwork( tnlDimensionsTag< EntityTopology::dimensions > )
       {
          return SuperentityStorageBaseType::getStorageNetwork( SuperdimensionsTag() );
@@ -180,27 +174,27 @@ class tnlMeshStorageLayer< MeshConfig, DimensionsTag, false >
 
 template< typename MeshConfig >
 class tnlMeshStorageLayer< MeshConfig, tnlDimensionsTag< 0 >, true > :
-   public tnlMeshSuperentityStorageLayers< MeshConfig, 
+   public tnlMeshSuperentityStorageLayers< MeshConfig,
                                            tnlMeshVertexTopology >
 
 {
    public:
 
    typedef tnlDimensionsTag< 0 >                        DimensionsTag;
-   
-   typedef tnlMeshSuperentityStorageLayers< MeshConfig, 
+ 
+   typedef tnlMeshSuperentityStorageLayers< MeshConfig,
                                             tnlMeshVertexTopology > SuperentityStorageBaseType;
 
    typedef tnlMeshTraits< MeshConfig >                                          MeshTraits;
-   typedef typename MeshTraits::template EntityTraits< 0 >                      EntityTraits; 
-   
+   typedef typename MeshTraits::template EntityTraits< 0 >                      EntityTraits;
+ 
    typedef typename EntityTraits::StorageArrayType                              StorageArrayType;
    typedef typename EntityTraits::AccessArrayType                               AccessArrayType;
    typedef typename EntityTraits::GlobalIndexType                               GlobalIndexType;
    typedef typename EntityTraits::EntityType                                    VertexType;
    typedef typename VertexType::PointType                                       PointType;
    typedef tnlMeshVertexTopology                                                EntityTopology;
-   
+ 
    tnlMeshStorageLayer()
    {
    }
@@ -287,7 +281,7 @@ class tnlMeshStorageLayer< MeshConfig, tnlDimensionsTag< 0 >, true > :
    }
 
    void print( ostream& str ) const
-   {      
+   {
       str << "The mesh vertices are: " << endl;
       for( GlobalIndexType i = 0; i < vertices.getSize();i ++ )
       {
@@ -306,16 +300,16 @@ class tnlMeshStorageLayer< MeshConfig, tnlDimensionsTag< 0 >, true > :
    StorageArrayType vertices;
 
    AccessArrayType verticesAccess;
-   
+ 
    // TODO: this is only for the mesh initializer - fix it
    public:
-      
+ 
       typename EntityTraits::StorageArrayType& entitiesArray( DimensionsTag )
       {
-         return vertices; 
+         return vertices;
       }
 
-      
+ 
       template< typename SuperDimensionsTag >
       typename MeshTraits::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
       {
@@ -338,5 +332,4 @@ class tnlMeshStorageLayer< MeshConfig, tnlDimensionsTag< 0 >, false >
 {
 };
 
-
-#endif /* TNLMESHSTORAGELAYER_H_ */
+} // namespace TNL
\ No newline at end of file
diff --git a/src/mesh/layers/tnlMeshSubentityStorageLayer.h b/src/mesh/layers/tnlMeshSubentityStorageLayer.h
index 89e96a859455819894674b432ae5760a19a1c83c..ac7f7523bcc9fb23d65f7bcd899d35b0341d5982 100644
--- a/src/mesh/layers/tnlMeshSubentityStorageLayer.h
+++ b/src/mesh/layers/tnlMeshSubentityStorageLayer.h
@@ -6,27 +6,21 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUBENTITYSTORAGELAYER_H_
-#define TNLMESHSUBENTITYSTORAGELAYER_H_
+#pragma once
 
 #include <core/tnlFile.h>
 #include <mesh/tnlDimensionsTag.h>
 #include <mesh/traits/tnlMeshSubentityTraits.h>
 #include <mesh/tnlMeshEntityOrientation.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology,
           typename DimensionsTag,
-          bool SubentityStorage = 
+          bool SubentityStorage =
             tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::storageEnabled,
           bool SubentityOrientationStorage =
             tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::orientationEnabled >
@@ -146,18 +140,18 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
 
    using BaseType::subentityIdsArray;
    IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; }
-   
+ 
    using BaseType::subentityOrientation;
    IdPermutationArrayAccessorType subentityOrientation( DimensionsTag, LocalIndexType index) const
    {
       tnlAssert( 0 <= index && index < SubentityTraits::count, );
-       
+ 
       return this->subentityOrientations[ index ].getSubvertexPermutation();
    }
 
    using BaseType::subentityOrientationsArray;
 	OrientationArrayType& subentityOrientationsArray( DimensionsTag ) { return this->subentityOrientations; }
-   
+ 
    private:
       IdArrayType subentitiesIndices;
 
@@ -182,7 +176,7 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
                                          typename DimensionsTag::Decrement > BaseType;
 
    protected:
-   
+ 
    static const int Dimensions = DimensionsTag::value;
    typedef tnlMeshTraits< MeshConfig >                                                   MeshTraits;
    typedef typename MeshTraits::template SubentityTraits< EntityTopology, Dimensions >   SubentityTraits;
@@ -268,10 +262,10 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
 
    using BaseType::subentityIdsArray;
    IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; }
-   
+ 
    using BaseType::subentityOrientationsArray;
    void subentityOrientationsArray() {}
-   
+ 
    private:
       IdArrayType subentitiesIndices;
 };
@@ -369,9 +363,9 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
    }
 
    IdArrayType& subentityIdsArray( DimensionsTag ) { return this->verticesIndices; }
-   
+ 
    protected:
-      
+ 
       /***
        *  Necessary because of 'using TBase::...;' in the derived classes
        */
@@ -403,5 +397,4 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
 
 };
 
-
-#endif /* TNLMESHSUBENTITYSTORAGELAYER_H_ */
+} // namespace TNL
diff --git a/src/mesh/layers/tnlMeshSuperentityAccess.h b/src/mesh/layers/tnlMeshSuperentityAccess.h
index 2c0679642573ae4534831d14985a4607cf8a0186..8b40844c48df1ef3acb3c924c2422e23675ede69 100644
--- a/src/mesh/layers/tnlMeshSuperentityAccess.h
+++ b/src/mesh/layers/tnlMeshSuperentityAccess.h
@@ -6,25 +6,18 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLSUPERENTITYACCESS_H
-#define	TNLSUPERENTITYACCESS_H
+#pragma once
 
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
 
 template< typename MeshConfig,
           typename MeshEntity,
           typename DimensionsTag,
-          bool SuperentityStorage = 
+          bool SuperentityStorage =
              tnlMeshTraits< MeshConfig >::template SuperentityTraits< MeshEntity, DimensionsTag::value >::storageEnabled >
 class tnlMeshSuperentityAccessLayer;
 
@@ -32,17 +25,17 @@ class tnlMeshSuperentityAccessLayer;
 template< typename MeshConfig,
           typename MeshEntity >
 class tnlMeshSuperentityAccess :
-   public tnlMeshSuperentityAccessLayer< MeshConfig, 
+   public tnlMeshSuperentityAccessLayer< MeshConfig,
                                          MeshEntity,
                                          tnlDimensionsTag< tnlMeshTraits< MeshConfig >::meshDimensions > >
 {
    public:
-      typedef tnlMeshSuperentityAccessLayer< MeshConfig, 
+      typedef tnlMeshSuperentityAccessLayer< MeshConfig,
                                              MeshEntity,
                                              tnlDimensionsTag< tnlMeshTraits< MeshConfig >::meshDimensions > > BaseType;
-      
+ 
       bool operator == ( const tnlMeshSuperentityAccess< MeshConfig, MeshEntity>& a ) const { return true; } // TODO: fix
-      
+ 
       void print( ostream& str ) const
       {
          BaseType::print( str );
@@ -62,10 +55,10 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
 	typedef tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > BaseType;
 
    public:
-      
+ 
       typedef tnlMeshTraits< MeshConfig >                                   MeshTraits;
-      typedef typename MeshTraits::template SuperentityTraits< MeshEntity, Dimensions::value > SuperentityTraits;      
-	   typedef typename MeshTraits::IdArrayAccessorType                          IdArrayAccessorType;            
+      typedef typename MeshTraits::template SuperentityTraits< MeshEntity, Dimensions::value > SuperentityTraits;
+	   typedef typename MeshTraits::IdArrayAccessorType                          IdArrayAccessorType;
       typedef typename SuperentityTraits::StorageNetworkType                    StorageNetworkType;
       typedef typename SuperentityTraits::SuperentityAccessorType               SuperentityAccessorType;
       //typedef typename StorageNetworkType::PortsType                            SuperentityAccessorType;
@@ -75,34 +68,34 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
 
 	   using BaseType::superentityIdsArray;
 	   IdArrayAccessorType &superentityIdsArray( Dimensions ) { return m_superentityIndices; }
-      
+ 
       using BaseType::getSuperentityIndices;
       const SuperentityAccessorType& getSuperentityIndices( Dimensions ) const
       {
          cerr << "###" << endl;
          return this->superentityIndices;
       }
-      
+ 
       SuperentityAccessorType& getSuperentityIndices( Dimensions )
       {
          cerr << "######" << endl;
          return this->superentityIndices;
       }
-      
+ 
       void print( ostream& str ) const
       {
-         str << "Superentities with " << Dimensions::value << " dimensions are: " << 
+         str << "Superentities with " << Dimensions::value << " dimensions are: " <<
             this->superentityIndices << endl;
          BaseType::print( str );
       }
-      
+ 
       //bool operator == ( const tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, Dimensions, tnlStorageTraits< true > >& l ) { return true; } // TODO: fix
 
    private:
 	   IdArrayAccessorType m_superentityIndices;
-      
+ 
       SuperentityAccessorType superentityIndices;
-                  
+ 
 };
 
 template< typename MeshConfig,
@@ -129,9 +122,9 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
        */
 	   void superentityIds()      {}
 	   void superentityIdsArray() {}
-      
+ 
       void getSuperentityIndices() {};
-      
+ 
       void print( ostream& str ) const {};
 };
 
@@ -148,12 +141,11 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
        */
 	   void superentityIds()      {}
 	   void superentityIdsArray() {}
-      
+ 
       void getSuperentityIndices() {};
-      
+ 
       void print( ostream& str ) const {};
 };
 
-
-#endif	/* TNLSUPERENTITYACCESS_H */
+} // namespace TNL
 
diff --git a/src/mesh/layers/tnlMeshSuperentityAccessor.h b/src/mesh/layers/tnlMeshSuperentityAccessor.h
index 35139059c6d22637d95bbf2d262df9a3255fe142..f09cdc3846925f880042e10e632aaec6b43d956f 100644
--- a/src/mesh/layers/tnlMeshSuperentityAccessor.h
+++ b/src/mesh/layers/tnlMeshSuperentityAccessor.h
@@ -6,63 +6,57 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMESHSUPERENTITYACCESSOR_H
-#define	TNLMESHSUPERENTITYACCESSOR_H
+namespace TNL {
 
 template< typename IndexMultimapValues >
 class tnlMeshSuperentityAccessor
 {
    public:
-      
+ 
       typedef typename IndexMultimapValues::IndexType   GlobalIndexType;
       typedef typename IndexMultimapValues::IndexType   LocalIndexType;
-      
+ 
       // TODO: Add LocalIndexType to EllpackIndexMultimap
-           
+ 
       LocalIndexType getSupernetitiesCount() const
       {
          return this->indexes.getPortsCount();
       };
-      
+ 
       void setSuperentityIndex( const LocalIndexType localIndex,
                                 const GlobalIndexType globalIndex )
       {
          indexes.setOutput( localIndex, globalIndex );
       }
-      
+ 
       GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const
       {
          return indexes.getOutput( localIndex );
       }
-      
+ 
       GlobalIndexType& operator[]( const LocalIndexType localIndex )
       {
          return this->indexes[ localIndex ];
       }
-      
+ 
       const GlobalIndexType& operator[]( const LocalIndexType localIndex ) const
       {
          return this->indexes[ localIndex ];
       }
-      
+ 
       void print( ostream& str ) const
       {
          str << indexes;
       }
-      
+ 
    protected:
-      
+ 
       IndexMultimapValues indexes;
-      
+ 
 };
 
 template< typename IndexMultimapValues >
@@ -72,5 +66,5 @@ ostream& operator << ( ostream& str, const tnlMeshSuperentityAccessor< IndexMult
    return str;
 }
 
-#endif	/* TNLMESHSUPERENTITYACCESSOR_H */
+} // namespace TNL
 
diff --git a/src/mesh/layers/tnlMeshSuperentityStorageLayer.h b/src/mesh/layers/tnlMeshSuperentityStorageLayer.h
index e31a839cc9f4835b598242114b3e6645ce176797..5dd2e6d73c0053c22d6094e7fbc2c47cf6932463 100644
--- a/src/mesh/layers/tnlMeshSuperentityStorageLayer.h
+++ b/src/mesh/layers/tnlMeshSuperentityStorageLayer.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUPERENTITYSTORAGELAYER_H_
-#define TNLMESHSUPERENTITYSTORAGELAYER_H_
+#pragma once
 
 #include <core/tnlFile.h>
 #include <mesh/tnlDimensionsTag.h>
 #include <mesh/traits/tnlMeshTraits.h>
 #include <mesh/traits/tnlMeshSuperentityTraits.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology,
           typename DimensionsTag,
@@ -60,7 +54,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,
    typedef typename SuperentityTraits::LocalIndexType         LocalIndexType;
 
    typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
-   
+ 
    /****
      * Make visible setters and getters of the lower superentities
      */
@@ -164,23 +158,23 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,
                 superentitiesIndices == layer.superentitiesIndices );
     }
 
-    private:              
+    private:
 
     StorageArrayType superentitiesIndices;
 
     AccessArrayType sharedSuperentitiesIndices;
-    
+ 
     StorageNetworkType storageNetwork;
-    
+ 
    // TODO: this is only for the mesh initializer - fix it
    public:
-              
-      using BaseType::superentityIdsArray;               
+ 
+      using BaseType::superentityIdsArray;
       typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
       {
          return this->superentitiesIndices;
       }
-      
+ 
       using BaseType::getStorageNetwork;
       StorageNetworkType& getStorageNetwork( DimensionsTag )
       {
@@ -219,7 +213,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, tnlDimensionsT
    typedef int                                                 LocalIndexType;
 
    typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
-   
+ 
    /****
     * These methods are due to 'using BaseType::...;' in the derived classes.
     */
@@ -252,7 +246,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, tnlDimensionsT
    {
       return true;
    }
-   
+ 
    typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
    {
       tnlAssert( false, );
@@ -292,7 +286,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
    typedef typename SuperentityTraits::LocalIndexType                LocalIndexType;
 
    typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
-   
+ 
    /****
     * These methods are due to 'using BaseType::...;' in the derived classes.
     */
@@ -325,7 +319,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
    {
       return true;
    }
-   
+ 
    typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
    {
       tnlAssert( false, );
@@ -338,7 +332,7 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
       //return this->storageNetwork;
    }
 
-   
+ 
 };
 
-#endif /* TNLMESHSUPERENTITYSTORAGELAYER_H_ */
+} // namespace TNL
diff --git a/src/mesh/mesh-comments.txt b/src/mesh/mesh-comments.txt
deleted file mode 100644
index 603cb5791432575fab15ce74350b2037ba6c4f42..0000000000000000000000000000000000000000
--- a/src/mesh/mesh-comments.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-- zakladem tridy mesh je MeshLayer
-  - ten v sobe obsahuje MeshEntity
-  - podle MeshConfig se urcuje, ktere layery se ukladaji v pameti
-- MeshEntity jsou vrcholy, hrany, apod.
-  - kazda entita obsahuje odkazy na hranicni entity - border entities
-    a coborder entites (to je co? asi entity vyssi dimenze)
-    - tj. trojuhelnik obsaju tri border entities jako hrany a kazda hrana
-      se odkazuje na dve coborder entities, coz jsou prihlehle trojuhelniky
-      - tady je problem s normalama tech border entit, zrejme by u kazde coborder entity
-        mel byt nejaky korekcni koeficient pro normalu, normala je ovsem definovana jen u entity
-        s codimenzi 1
-      - mesh entity border a coborder jsou opet layery entit, takze trojuhleni muze obsahovat i layer
-      vrcholu (je to tak???)
-        
-  - Postup implementace:
-  0. Udelat static array a static vector
-  1. Implementovat kontejnery
-  2. Implementovat range
-  3. Implementovat entity
-    
\ No newline at end of file
diff --git a/src/mesh/tnlDimensionsTag.h b/src/mesh/tnlDimensionsTag.h
index 3d3c48f68c6d0974c88823e41aa3b7c3990db084..d5b3caddb9ed8252f65802a1b0bdc1688b0451b3 100644
--- a/src/mesh/tnlDimensionsTag.h
+++ b/src/mesh/tnlDimensionsTag.h
@@ -6,28 +6,22 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDIMENSIONSTAG_H_
-#define TNLDIMENSIONSTAG_H_
+#pragma once
 
 #include <core/tnlAssert.h>
 
+namespace TNL {
+
 /***
  * This tag or integer wrapper is necessary for C++ templates specializations.
  * As th C++ standard says:
- *  
+ *
  *   A partially specialized non-type argument expression shall not involve
  *   a template parameter of the partial specialization except when the argument
- *   expression is a simple identifier. 
- *  
+ *   expression is a simple identifier.
+ *
  * Therefore one cannot specialize the mesh layers just by integers saying the mesh
  * layer dimensions but instead this tag must be used. This makes the code more difficult
  * to read and we would like to avoid it if it is possible sometime.
@@ -52,8 +46,8 @@ template<>
 class tnlDimensionsTag< 0 >
 {
    public:
-   
+ 
       static const int value = 0;
 };
 
-#endif /* TNLDIMENSIONSTAG_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlDummyMesh.h b/src/mesh/tnlDummyMesh.h
index 255d75fa5011e59b050b9ff6d7a7ba423ef88318..3f6f32dddadecd2d25893b9e16c9ac3bbc7fc408 100644
--- a/src/mesh/tnlDummyMesh.h
+++ b/src/mesh/tnlDummyMesh.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDUMMYMESH_H_
-#define TNLDUMMYMESH_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Real = double,
           typename Device = tnlHost,
@@ -29,14 +23,14 @@ class tnlDummyMesh
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlDummyMesh< Real, Device, Index > ThisType;
-   
+ 
    static const int meshDimensions = 1;
-   
+ 
    constexpr static int getMeshDimensions() { return meshDimensions; }
-      
-   
+ 
+ 
    const Real& getParametricStep(){ return 0.0; }
-   
+ 
    tnlString getSerializationType() const { return tnlString( "tnlDummyMesh" ); }
 
    template< typename GridFunction >
@@ -67,5 +61,4 @@ class tnlDummyMesh
                 const tnlString& format ) const { return true; }
 };
 
-
-#endif /* TNLDUMMYMESH_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlGnuplotWriter.h b/src/mesh/tnlGnuplotWriter.h
index d4bb1000819a9b40e645386e7f1ff1dac21e02fa..bdfed28b08c920e5026db0b64539e72d0b68b489 100644
--- a/src/mesh/tnlGnuplotWriter.h
+++ b/src/mesh/tnlGnuplotWriter.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGNUPLOTWRITER_H_
-#define TNLGNUPLOTWRITER_H_
+#pragma once
 
 #include <ostream>
 #include <core/vectors/tnlStaticVector.h>
 
+namespace TNL {
+
 class tnlGnuplotWriter
 {
    public:
@@ -55,5 +49,4 @@ class tnlGnuplotWriter
 
 };
 
-
-#endif /* TNLGNUPLOTWRITER_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlGrid.h b/src/mesh/tnlGrid.h
index 671a4ccf793739c45291db13ebfbcdcd5d439dd4..59b12c1c14a5dcb192761889654163d9d121c45e 100644
--- a/src/mesh/tnlGrid.h
+++ b/src/mesh/tnlGrid.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLGRID_H_
-#define TNLGRID_H_
+#pragma once
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlHost.h>
 #include <core/vectors/tnlStaticVector.h>
 #include <core/vectors/tnlVector.h>
 
+namespace TNL {
+
 template< int Dimensions,
           typename Real = double,
           typename Device = tnlHost,
@@ -31,8 +25,8 @@ class tnlGrid : public tnlObject
 {
 };
 
+} // namespace TNL
+
 #include <mesh/grids/tnlGrid1D.h>
 #include <mesh/grids/tnlGrid2D.h>
 #include <mesh/grids/tnlGrid3D.h>
-
-#endif /* TNLGRID_H_ */
diff --git a/src/mesh/tnlMesh.h b/src/mesh/tnlMesh.h
index a7b64a23860ef1d8c6bb77afe5d481b0a0ecb8cd..15a7d59ba301fd70c57328171f5fc55bb987db76 100644
--- a/src/mesh/tnlMesh.h
+++ b/src/mesh/tnlMesh.h
@@ -6,33 +6,27 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESH_H_
-#define TNLMESH_H_
+#pragma once
 
 #include <ostream>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <mesh/tnlMeshEntity.h>
 #include <mesh/traits/tnlMeshTraits.h>
 #include <mesh/layers/tnlMeshStorageLayer.h>
 #include <mesh/config/tnlMeshConfigValidator.h>
 #include <mesh/initializer/tnlMeshInitializer.h>
 
+namespace TNL {
+
 template< typename MeshConfig > //,
           //typename Device = tnlHost >
 class tnlMesh : public tnlObject/*,
                 public tnlMeshStorageLayers< MeshConfig >*/
 {
    public:
-      
+ 
       typedef MeshConfig                                        Config;
       typedef tnlMeshTraits< MeshConfig >                       MeshTraits;
       typedef typename MeshTraits::DeviceType                   DeviceType;
@@ -46,14 +40,14 @@ class tnlMesh : public tnlObject/*,
       template< int Dimensions > using EntityType = typename EntityTraits< Dimensions >::EntityType;
 
       static tnlString getType();
-      
+ 
       virtual tnlString getTypeVirtual() const;
-      
+ 
       static constexpr int getDimensions();
 
       template< int Dimensions >
       bool entitiesAvalable() const;
-      
+ 
       GlobalIndexType getNumberOfCells() const;
 
       // TODO: rename to getEntitiesCount
@@ -66,17 +60,17 @@ class tnlMesh : public tnlObject/*,
 
       template< int Dimensions >
        EntityType< Dimensions >& getEntity( const GlobalIndexType entityIndex );
-    
+ 
       template< int Dimensions >
       const EntityType< Dimensions >& getEntity( const GlobalIndexType entityIndex ) const;
 
       bool save( tnlFile& file ) const;
 
       bool load( tnlFile& file );
-      
+ 
       using tnlObject::load;
       using tnlObject::save;
-      
+ 
       void print( ostream& str ) const;
 
       bool operator==( const tnlMesh& mesh ) const;
@@ -85,31 +79,31 @@ class tnlMesh : public tnlObject/*,
       template< typename DimensionsTag >
            typename EntityTraits< DimensionsTag::value >::StorageArrayType& entitiesArray();
 
-     
+ 
       template< typename DimensionsTag, typename SuperDimensionsTag >
            typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray();
-      
+ 
       template< typename EntityTopology, typename SuperdimensionsTag >
       typename MeshTraits::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType&
       getSuperentityStorageNetwork()
       {
          return entitiesStorage.template getSuperentityStorageNetwork< SuperdimensionsTag >( tnlDimensionsTag< EntityTopology::dimensions >() );
       }
-      
+ 
       bool init( const typename MeshTraits::PointArrayType& points,
                  const typename MeshTraits::CellSeedArrayType& cellSeeds );
-   
-   
+ 
+ 
    protected:
-            
+ 
       tnlMeshStorageLayers< MeshConfig > entitiesStorage;
-      
+ 
       tnlMeshConfigValidator< MeshConfig > configValidator;
 };
 
 template< typename MeshConfig >
 std::ostream& operator <<( std::ostream& str, const tnlMesh< MeshConfig >& mesh );
 
-#include <mesh/tnlMesh_impl.h>
+} // namespace TNL
 
-#endif /* TNLMESH_H_ */
+#include <mesh/tnlMesh_impl.h>
diff --git a/src/mesh/tnlMeshBuilder.h b/src/mesh/tnlMeshBuilder.h
index 884e980781ba56c6d7bf76ca2bc2321985903c9d..0c840d63aa5aab3d51b77235fa9a245246cd2a9c 100644
--- a/src/mesh/tnlMeshBuilder.h
+++ b/src/mesh/tnlMeshBuilder.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHBUILDER_H
-#define	TNLMESHBUILDER_H
+#pragma once
 
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
+
 template< typename Mesh >
 class tnlMeshBuilder
 {
@@ -42,14 +36,14 @@ class tnlMeshBuilder
       pointsSet.setValue( false );
       return true;
    }
-   
+ 
    bool setCellsCount( const GlobalIndexType& cellsCount )
    {
       tnlAssert( 0 <= cellsCount, cerr << "cellsCount = " << cellsCount );
       this->cellSeeds.setSize( cellsCount );
       return true;
    }
-   
+ 
    GlobalIndexType getPointsCount() const { return this->points.getSize(); }
 	
    GlobalIndexType getCellsCount() const  { return this->cellSeeds.getSize(); }
@@ -66,7 +60,7 @@ class tnlMeshBuilder
    CellSeedType& getCellSeed( GlobalIndexType index )
    {
       tnlAssert( 0 <= index && index < getCellsCount(), cerr << "Index = " << index );
-  
+ 
       return this->cellSeeds[ index ];
    }
 
@@ -118,5 +112,5 @@ class tnlMeshBuilder
       tnlArray< bool, tnlHost, GlobalIndexType > pointsSet;
 };
 
-#endif	/* TNLMESHBUILDER_H */
+} // namespace TNL
 
diff --git a/src/mesh/tnlMeshEntity.h b/src/mesh/tnlMeshEntity.h
index 368af21d737a1a6ab480cd60c35d87a7d7795214..b02b65227afd55c68be98b58f47ee799b1fd02f0 100644
--- a/src/mesh/tnlMeshEntity.h
+++ b/src/mesh/tnlMeshEntity.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITY_H_
-#define TNLMESHENTITY_H_
+#pragma once
 
 #include <core/tnlFile.h>
 #include <core/tnlDynamicTypeTag.h>
@@ -29,13 +21,15 @@
 #include <mesh/layers/tnlMeshSuperentityAccess.h>
 #include <mesh/initializer/tnlMeshEntitySeed.h>
 
+namespace TNL {
+
 template< typename MeshConfig >
 class tnlMeshInitializer;
 
 template< typename MeshConfig,
           typename EntityTopology_ >
 class tnlMeshEntity
-   : public tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology_ >,     
+   : public tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology_ >,
      public tnlMeshSuperentityAccess< MeshConfig, EntityTopology_ >,
      public tnlMeshEntityId< typename MeshConfig::IdType,
                              typename MeshConfig::GlobalIndexType >
@@ -47,19 +41,19 @@ class tnlMeshEntity
       typedef typename MeshTraits::GlobalIndexType                GlobalIndexType;
       typedef typename MeshTraits::LocalIndexType                 LocalIndexType;
       typedef typename MeshTraits::IdPermutationArrayAccessorType IdPermutationArrayAccessorType;
-      typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >     SeedType;   
+      typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >     SeedType;
 
-      template< int Subdimensions > using SubentityTraits = 
+      template< int Subdimensions > using SubentityTraits =
       typename MeshTraits::template SubentityTraits< EntityTopology, Subdimensions >;
-      
-      template< int SuperDimensions > using SuperentityTraits = 
+ 
+      template< int SuperDimensions > using SuperentityTraits =
       typename MeshTraits::template SuperentityTraits< EntityTopology, SuperDimensions >;
-      
+ 
       tnlMeshEntity( const SeedType& entitySeed );
 
       tnlMeshEntity();
-      
-      ~tnlMeshEntity();      
+ 
+      ~tnlMeshEntity();
 
       static tnlString getType();
 
@@ -72,12 +66,12 @@ class tnlMeshEntity
       void print( ostream& str ) const;
 
       bool operator==( const tnlMeshEntity& entity ) const;
-      
+ 
       constexpr int getEntityDimensions() const;
 
       /****
        * Subentities
-       */      
+       */
       template< int Subdimensions >
       constexpr bool subentitiesAvailable() const;
 
@@ -95,7 +89,7 @@ class tnlMeshEntity
 
       /****
        * Superentities
-       */      
+       */
       template< int SuperDimensions >
       LocalIndexType getNumberOfSuperentities() const;
 
@@ -121,7 +115,7 @@ class tnlMeshEntity
 
       template< int Dimensions >
       IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const;
-      
+ 
    protected:
 
       /****
@@ -134,7 +128,7 @@ class tnlMeshEntity
       template< int Subdimensions >
       void setSubentityIndex( const LocalIndexType localIndex,
                               const GlobalIndexType globalIndex );
-      
+ 
       template< int Subdimensions >
       typename SubentityTraits< Subdimensions >::IdArrayType& subentityIdsArray();
 
@@ -143,9 +137,9 @@ class tnlMeshEntity
 
       template< int Subdimensions >
       typename SubentityTraits< Subdimensions >::OrientationArrayType& subentityOrientationsArray();
-      
+ 
    friend tnlMeshInitializer< MeshConfig >;
-      
+ 
 };
 
 /****
@@ -165,9 +159,9 @@ class tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >
       typedef typename MeshTraits::LocalIndexType                 LocalIndexType;
       typedef typename MeshTraits::PointType                      PointType;
       typedef typename MeshTraits::IdPermutationArrayAccessorType IdPermutationArrayAccessorType;
-      typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >     SeedType; 
-      
-      template< int SuperDimensions > using SuperentityTraits = 
+      typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >     SeedType;
+ 
+      template< int SuperDimensions > using SuperentityTraits =
       typename MeshTraits::template SuperentityTraits< EntityTopology, SuperDimensions >;
 
       static tnlString getType();
@@ -183,7 +177,7 @@ class tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >
       void print( ostream& str ) const;
 
       bool operator==( const tnlMeshEntity& entity ) const;
-      
+ 
       constexpr int getEntityDimensions() const;
 
       template< int Superdimensions > LocalIndexType getNumberOfSuperentities() const;
@@ -205,15 +199,15 @@ class tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >
       void setPoint( const PointType& point );
 
    protected:
-      
+ 
       typedef typename MeshTraits::IdArrayAccessorType                          IdArrayAccessorType;
       typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >     SuperentityAccessBase;
-   
+ 
       template< int Superdimensions >
       IdArrayAccessorType& superentityIdsArray();
 
       PointType point;
-      
+ 
    friend tnlMeshInitializer< MeshConfig >;
 };
 
@@ -232,6 +226,6 @@ struct tnlDynamicTypeTag< tnlMeshEntity< MeshConfig, EntityTopology > >
    enum { value = true };
 };
 
-#include <mesh/tnlMeshEntity_impl.h>
+} // namespace TNL
 
-#endif /* TNLMESHENTITY_H_ */
+#include <mesh/tnlMeshEntity_impl.h>
diff --git a/src/mesh/tnlMeshEntityId.h b/src/mesh/tnlMeshEntityId.h
index 734779e4ac0ab1d3c4c6bd284919eab644118c26..156ea3bf3431143fc2a800063062ed027128356d 100644
--- a/src/mesh/tnlMeshEntityId.h
+++ b/src/mesh/tnlMeshEntityId.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYID_H_
-#define TNLMESHENTITYID_H_
+#pragma once
+
+namespace TNL {
 
 template< typename IDType,
           typename GlobalIndexType >
@@ -61,5 +55,4 @@ class tnlMeshEntityId< void, GlobalIndexType >
    }
 };
 
-
-#endif /* TNLMESHENTITYID_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshEntityIntegrityChecker.h b/src/mesh/tnlMeshEntityIntegrityChecker.h
index 028e140f8b17cbd540d3c946ee2ac6b35104abc0..cab34df698831d053c9dac96f738fbfc9ff2bd06 100644
--- a/src/mesh/tnlMeshEntityIntegrityChecker.h
+++ b/src/mesh/tnlMeshEntityIntegrityChecker.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYINTEGRITYCHECKER_H_
-#define TNLMESHENTITYINTEGRITYCHECKER_H_
+#pragma once
+
+namespace TNL {
 
 template< typename MeshEntity >
 class tnlMeshEntityIntegrityChecker
@@ -30,5 +24,4 @@ class tnlMeshEntityIntegrityChecker
 
 };
 
-
-#endif /* TNLMESHENTITYINTEGRITYCHECKER_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshEntityIntegrityCheckerLayer.h b/src/mesh/tnlMeshEntityIntegrityCheckerLayer.h
deleted file mode 100644
index 0b221403a8cb8150edfe2032bc7a4a88688afde4..0000000000000000000000000000000000000000
--- a/src/mesh/tnlMeshEntityIntegrityCheckerLayer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/***************************************************************************
-                          tnlMeshEntityIntegrityCheckerLayer.h  -  description
-                             -------------------
-    begin                : Mar 23, 2014
-    copyright            : (C) 2014 by Tomas 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 TNLMESHENTITYINTEGRITYCHECKERLAYER_H_
-#define TNLMESHENTITYINTEGRITYCHECKERLAYER_H_
-
-
-
-
-#endif /* TNLMESHENTITYINTEGRITYCHECKERLAYER_H_ */
diff --git a/src/mesh/tnlMeshEntityOrientation.h b/src/mesh/tnlMeshEntityOrientation.h
index 12ba48d04a8eb41e80ae1698f13483c9262d0121..242ca9e8d219a8cc0073c6bdda3c284c01522e47 100644
--- a/src/mesh/tnlMeshEntityOrientation.h
+++ b/src/mesh/tnlMeshEntityOrientation.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYORIENTATION_H
-#define	TNLMESHENTITYORIENTATION_H
+#pragma once
 
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology>
 class tnlMeshEntityOrientation
@@ -49,6 +43,5 @@ class tnlMeshEntityOrientation
       IdPermutationArrayType subvertexPermutation;
 };
 
-
-#endif	/* TNLMESHENTITYORIENTATION_H */
+} // namespace TNL
 
diff --git a/src/mesh/tnlMeshEntityReferenceOrientation.h b/src/mesh/tnlMeshEntityReferenceOrientation.h
index 4cd6c8cb5e512a26ec9f61416fedad9fc261c3f7..fffaffc9ff9355e06b25bbb6596ce40a6bf88413 100644
--- a/src/mesh/tnlMeshEntityReferenceOrientation.h
+++ b/src/mesh/tnlMeshEntityReferenceOrientation.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYREFERENCEORIENTATION_H
-#define	TNLMESHENTITYREFERENCEORIENTATION_H
+#pragma once
+
+namespace TNL {
 
 template< typename MeshConfig, typename EntityTopology >
 class tnlMeshEntityReferenceOrientation
@@ -39,7 +33,7 @@ class tnlMeshEntityReferenceOrientation
             this->cornerIdsMap.insert( std::make_pair( referenceCornerIds[i], i ) );
          }
       }
-      
+ 
       static tnlString getType(){};
 
       EntityOrientation createOrientation( const SeedType& seed ) const
@@ -58,6 +52,5 @@ class tnlMeshEntityReferenceOrientation
       std::map< GlobalIndexType, LocalIndexType > cornerIdsMap;
 };
 
-
-#endif	/* TNLMESHENTITYREFERENCEORIENTATION_H */
+} // namespace TNL
 
diff --git a/src/mesh/tnlMeshEntity_impl.h b/src/mesh/tnlMeshEntity_impl.h
index 8b58e02acaab3f8c75f2d1e1bfd256b8020d7db9..6d41bc8109bff920b0e57f3b616eece8a99e377c 100644
--- a/src/mesh/tnlMeshEntity_impl.h
+++ b/src/mesh/tnlMeshEntity_impl.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITY_IMPL_H
-#define	TNLMESHENTITY_IMPL_H
+#pragma once
 
 #include "tnlMeshEntity.h"
 
+namespace TNL {
 
 template< typename MeshConfig,
           typename EntityTopology >
@@ -28,7 +21,7 @@ tnlMeshEntity( const SeedType& entitySeed )
 {
    typedef typename SeedType::LocalIndexType LocalIndexType;
    for( LocalIndexType i = 0; i < entitySeed.getCornerIds().getSize(); i++ )
-      this->template setSubentityIndex< 0 >( i, entitySeed.getCornerIds()[ i ] );         
+      this->template setSubentityIndex< 0 >( i, entitySeed.getCornerIds()[ i ] );
 }
 
 
@@ -58,7 +51,7 @@ getType()
 
 template< typename MeshConfig,
           typename EntityTopology >
-tnlString 
+tnlString
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getTypeVirtual() const
 {
@@ -114,7 +107,7 @@ operator==( const tnlMeshEntity& entity ) const
 
 template< typename MeshConfig,
           typename EntityTopology >
-constexpr int 
+constexpr int
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getEntityDimensions() const
 {
@@ -189,7 +182,7 @@ getSubentitiesIndices() const
 template< typename MeshConfig,
           typename EntityTopology >
    template< int SuperDimensions >
-typename tnlMeshEntity< MeshConfig, EntityTopology >::LocalIndexType 
+typename tnlMeshEntity< MeshConfig, EntityTopology >::LocalIndexType
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getNumberOfSuperentities() const
 {
@@ -201,7 +194,7 @@ getNumberOfSuperentities() const
 template< typename MeshConfig,
           typename EntityTopology >
    template< int SuperDimensions >
-typename tnlMeshEntity< MeshConfig, EntityTopology >::GlobalIndexType 
+typename tnlMeshEntity< MeshConfig, EntityTopology >::GlobalIndexType
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getSuperentityIndex( const LocalIndexType localIndex ) const
 {
@@ -217,7 +210,7 @@ getSuperentityIndex( const LocalIndexType localIndex ) const
 template< typename MeshConfig,
           typename EntityTopology >
    template< int SuperDimensions >
-typename tnlMeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType& 
+typename tnlMeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType&
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getSuperentitiesIndices()
 {
@@ -267,7 +260,7 @@ getVerticesIndices()
 
 template< typename MeshConfig,
           typename EntityTopology >
-const typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< 0 >::AccessArrayType& 
+const typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< 0 >::AccessArrayType&
 tnlMeshEntity< MeshConfig, EntityTopology >::
 getVerticesIndices() const
 {
@@ -285,7 +278,7 @@ subentityOrientation( LocalIndexType index ) const
    tnlAssert( 0 <= index && index < subentitiesCount, );
 
    return SubentityStorageLayers::subentityOrientation( tnlDimensionsTag< Dimensions >(), index );
-}  
+}
 
 /****
  * Mesh initialization method
@@ -339,7 +332,7 @@ tnlMeshEntity< MeshConfig, EntityTopology >::
 subentityOrientationsArray()
 {
    return SubentityStorageLayers::subentityOrientationsArray( tnlDimensionsTag< Subdimensions >() );
-}      
+}
 
 /****
  * Vertex entity specialization
@@ -411,7 +404,7 @@ operator==( const tnlMeshEntity& entity ) const
 }
 
 template< typename MeshConfig >
-constexpr int 
+constexpr int
 tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::
 getEntityDimensions() const
 {
@@ -430,7 +423,7 @@ getNumberOfSuperentities() const
 
 template< typename MeshConfig >
    template< int Superdimensions >
-typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType& 
+typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType&
 tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::
 getSuperentitiesIndices()
 {
@@ -440,7 +433,7 @@ getSuperentitiesIndices()
 
 template< typename MeshConfig >
    template< int Superdimensions >
-const typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType& 
+const typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType&
 tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::
 getSuperentitiesIndeces() const
 {
@@ -463,10 +456,10 @@ getSuperentityIndex( const LocalIndexType localIndex ) const
 }
 
 template< typename MeshConfig >
-typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::PointType 
+typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::PointType
 tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::
 getPoint() const
-{ 
+{
    return this->point;
 }
 
@@ -480,7 +473,7 @@ setPoint( const PointType& point )
 
 template< typename MeshConfig >
    template< int Superdimensions >
-typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::MeshTraits::IdArrayAccessorType& 
+typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::MeshTraits::IdArrayAccessorType&
 tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::
 superentityIdsArray()
 {
@@ -495,5 +488,5 @@ ostream& operator <<( ostream& str, const tnlMeshEntity< MeshConfig, EntityTopol
    return str;
 }
 
-#endif	/* TNLMESHENTITY_IMPL_H */
+} // namespace TNL
 
diff --git a/src/mesh/tnlMeshIntegrityChecker.h b/src/mesh/tnlMeshIntegrityChecker.h
index 9cfd9e97ef528b2669e3dfba5235ecb98e3b865e..062133bbca3007120b5f47cacac019b0ad739ca5 100644
--- a/src/mesh/tnlMeshIntegrityChecker.h
+++ b/src/mesh/tnlMeshIntegrityChecker.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHINTEGRITYCHECKER_H_
-#define TNLMESHINTEGRITYCHECKER_H_
+#pragma once
 
 #include <mesh/tnlMesh.h>
 #include <mesh/tnlMeshIntegrityCheckerLayer.h>
 
+namespace TNL {
+
 template< typename MeshType >
 class tnlMeshIntegrityChecker
 : public tnlMeshIntegrityCheckerLayer< MeshType,
@@ -38,5 +32,4 @@ class tnlMeshIntegrityChecker
       }
 };
 
-
-#endif /* TNLMESHINTEGRITYCHECKER_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshIntegrityCheckerLayer.h b/src/mesh/tnlMeshIntegrityCheckerLayer.h
index 8d40a2eafa8049e3d8e42defffafae5b2f4c84e0..751334684d1e67500461cccb78deb362a4facc25 100644
--- a/src/mesh/tnlMeshIntegrityCheckerLayer.h
+++ b/src/mesh/tnlMeshIntegrityCheckerLayer.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHINTEGRITYCHECKERLAYER_H_
-#define TNLMESHINTEGRITYCHECKERLAYER_H_
+#pragma once
 
 #include <mesh/traits/tnlMeshEntityTraits.h>
 #include <mesh/tnlDimensionsTag.h>
 
+namespace TNL {
+
 template< typename MeshType,
           typename DimensionsTag,
           bool EntityStorageTag = tnlMeshEntityTraits< typename MeshType::Config,
@@ -36,12 +30,12 @@ class tnlMeshIntegrityCheckerLayer< MeshType,
                                           typename DimensionsTag::Decrement >
 {
    public:
-      typedef tnlMeshIntegrityCheckerLayer< MeshType, 
+      typedef tnlMeshIntegrityCheckerLayer< MeshType,
                                             typename DimensionsTag::Decrement >     BaseType;
       enum { dimensions = DimensionsTag::value };
 
       static bool checkEntities( const MeshType& mesh )
-      {         
+      {
          typedef typename MeshType::template EntitiesTraits< dimensions >::ContainerType ContainerType;
          typedef typename ContainerType::IndexType                                       GlobalIndexType;
          cout << "Checking entities with " << dimensions << " dimensions ..." << endl;
@@ -102,5 +96,4 @@ class tnlMeshIntegrityCheckerLayer< MeshType,
 
 };
 
-
-#endif /* TNLMESHINTEGRITYCHECKERLAYER_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshReaderNetgen.h b/src/mesh/tnlMeshReaderNetgen.h
index 007c607af973aded1d6be3cc342700c84ab1c098..8793382854c0cdd8ff4b3ae61b78da259d1b7c42 100644
--- a/src/mesh/tnlMeshReaderNetgen.h
+++ b/src/mesh/tnlMeshReaderNetgen.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHREADERNETGEN_H_
-#define TNLMESHREADERNETGEN_H_
+#pragma once
 
 #include <fstream>
 #include <istream>
@@ -24,7 +16,7 @@
 
 #include <mesh/tnlMeshBuilder.h>
 
-using namespace std;
+namespace TNL {
 
 class tnlMeshReaderNetgen
 {
@@ -32,7 +24,7 @@ class tnlMeshReaderNetgen
 
       tnlMeshReaderNetgen()
       : dimensions( 0 ){}
-      
+ 
    bool detectMesh( const tnlString& fileName )
    {
       fstream inputFile( fileName.getString() );
@@ -49,7 +41,7 @@ class tnlMeshReaderNetgen
        * Skip whitespaces
        */
       inputFile >> ws;
-      
+ 
       /****
        * Skip number of vertices
        */
@@ -59,7 +51,7 @@ class tnlMeshReaderNetgen
       iss.str( line );
       long int numberOfVertices;
       iss >> numberOfVertices;
-      
+ 
       //cout << "There are " << numberOfVertices << " vertices." << endl;
 
       /****
@@ -77,7 +69,7 @@ class tnlMeshReaderNetgen
          iss >> aux;
          this->dimensions++;
       }
-      
+ 
       /****
        * Skip vertices
        */
@@ -92,12 +84,12 @@ class tnlMeshReaderNetgen
          }
          verticesRead++;
       }
-      
+ 
       /****
        * Skip whitespaces
        */
       inputFile >> ws;
-         
+ 
       /****
        * Get number of cells
        */
@@ -107,7 +99,7 @@ class tnlMeshReaderNetgen
       iss.str( line );
       iss >> numberOfCells;
       //cout << "There are " << numberOfCells << " cells." << endl;
-      
+ 
       /****
        * Get number of vertices in a cell
        */
@@ -132,7 +124,7 @@ class tnlMeshReaderNetgen
    {
       typedef typename MeshType::PointType PointType;
       typedef tnlMeshBuilder< MeshType > MeshBuilder;
-      
+ 
       const int dimensions = PointType::size;
 
       fstream inputFile( fileName.getString() );
@@ -232,21 +224,20 @@ class tnlMeshReaderNetgen
        return true;
    }
 
-   int getDimensions() const 
+   int getDimensions() const
    {
-      return this->dimensions;      
+      return this->dimensions;
    }
-   
+ 
    int getVerticesInCell() const
    {
       return this->verticesInCell;
    }
-   
+ 
    protected:
 
       int dimensions, verticesInCell;
 
 };
 
-
-#endif /* TNLMESHREADERNETGEN_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshWriterNetgen.h b/src/mesh/tnlMeshWriterNetgen.h
index 4b5455fd637697b3362432205ebdc515103d60e4..b0c263f77b10241296ab3b96427ca5d266302b37 100644
--- a/src/mesh/tnlMeshWriterNetgen.h
+++ b/src/mesh/tnlMeshWriterNetgen.h
@@ -6,24 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHWRITERNETGEN_H_
-#define TNLMESHWRITERNETGEN_H_
+#pragma once
 
 #include <fstream>
 #include <istream>
 #include <sstream>
 #include <iomanip>
 
-using namespace std;
+namespace TNL {
 
 class tnlMeshWriterNetgen
 {
@@ -79,5 +71,4 @@ class tnlMeshWriterNetgen
    }
 };
 
-
-#endif /* TNLMESHWRITERNETGEN_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMeshWriterVTKLegacy.h b/src/mesh/tnlMeshWriterVTKLegacy.h
index 92be6e4c0f79a266d3a87c4c17d5d8afe8ef5511..e9fca9aac3a76989fbd8d144561412971894d963 100644
--- a/src/mesh/tnlMeshWriterVTKLegacy.h
+++ b/src/mesh/tnlMeshWriterVTKLegacy.h
@@ -6,18 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-
-#ifndef TNLMESHWRITERVTKLEGACY_H_
-#define TNLMESHWRITERVTKLEGACY_H_
+#pragma once
 
 #include <fstream>
 #include <istream>
@@ -30,8 +21,7 @@
 #include <mesh/topologies/tnlMeshHexahedronTopology.h>
 #include <mesh/tnlMeshEntity.h>
 
-
-using namespace std;
+namespace TNL {
 
 enum tnlVTKMeshEntities { tnlVTKVertex = 1,
                           tnlVTKPolyVertex = 2,
@@ -119,8 +109,8 @@ class tnlMeshWriterVTKLegacy
          file << mesh.getCell( i ).template getSubentityIndex< 0 >( numberOfVertices - 1 ) << endl;
       }
       file << endl;
-      file << "CELL_TYPES " <<  mesh.getNumberOfCells() << endl;      
-      for( int i = 0; i < mesh.getNumberOfCells(); i++ )      
+      file << "CELL_TYPES " <<  mesh.getNumberOfCells() << endl;
+      for( int i = 0; i < mesh.getNumberOfCells(); i++ )
       {
          file << tnlMeshEntityVTKType< CellType >::VTKType << endl;
       }
@@ -131,6 +121,4 @@ class tnlMeshWriterVTKLegacy
 
 };
 
-
-
-#endif /* TNLMESHWRITERVTKLEGACY_H_ */
+} // namespace TNL
diff --git a/src/mesh/tnlMesh_impl.h b/src/mesh/tnlMesh_impl.h
index 99caac9524493cae662a74bccd5f398ebde1aecc..1ad4d0c5983ce7f57b21f0bb9e3f11eb31202219 100644
--- a/src/mesh/tnlMesh_impl.h
+++ b/src/mesh/tnlMesh_impl.h
@@ -6,21 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESH_IMPL_H
-#define	TNLMESH_IMPL_H
+#pragma once
 
 #include "tnlMesh.h"
 
+namespace TNL {
 
 template< typename MeshConfig >
 tnlString
@@ -38,7 +30,7 @@ getTypeVirtual() const
    return this->getType();
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
 constexpr int
 tnlMesh< MeshConfig >::
 getDimensions()
@@ -46,7 +38,7 @@ getDimensions()
    return dimensions;
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
    template< int Dimensions >
 bool
 tnlMesh< MeshConfig >::
@@ -55,16 +47,16 @@ entitiesAvalable() const
    return MeshTraits::template EntityTraits< Dimensions >::available;
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
    template< int Dimensions >
-typename tnlMesh< MeshConfig >::GlobalIndexType 
+typename tnlMesh< MeshConfig >::GlobalIndexType
 tnlMesh< MeshConfig >::
 getNumberOfEntities() const
 {
    return entitiesStorage.getNumberOfEntities( tnlDimensionsTag< Dimensions >() );
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
 typename tnlMesh< MeshConfig >::GlobalIndexType
 tnlMesh< MeshConfig >::
 template getNumberOfCells() const
@@ -72,7 +64,7 @@ template getNumberOfCells() const
    return entitiesStorage.getNumberOfEntities( tnlDimensionsTag< dimensions >() );
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
 typename tnlMesh< MeshConfig >::CellType&
 tnlMesh< MeshConfig >::
 getCell( const GlobalIndexType cellIndex )
@@ -80,7 +72,7 @@ getCell( const GlobalIndexType cellIndex )
    return entitiesStorage.getEntity( tnlDimensionsTag< dimensions >(), cellIndex );
 }
 
-template< typename MeshConfig >   
+template< typename MeshConfig >
 const typename tnlMesh< MeshConfig >::CellType&
 tnlMesh< MeshConfig >::
 getCell( const GlobalIndexType cellIndex ) const
@@ -105,7 +97,7 @@ getEntity( const GlobalIndexType entityIndex ) const
 {
    return entitiesStorage.getEntity( tnlDimensionsTag< Dimensions >(), entityIndex );
 }
-   
+ 
 template< typename MeshConfig >
 bool
 tnlMesh< MeshConfig >::
@@ -156,20 +148,20 @@ typename tnlMesh< MeshConfig >::template EntityTraits< DimensionsTag::value >::S
 tnlMesh< MeshConfig >::
 entitiesArray()
 {
-   return entitiesStorage.entitiesArray( DimensionsTag() ); 
+   return entitiesStorage.entitiesArray( DimensionsTag() );
 }
 
 template< typename MeshConfig >
    template< typename DimensionsTag, typename SuperDimensionsTag >
-typename tnlMesh< MeshConfig >::MeshTraits::GlobalIdArrayType& 
+typename tnlMesh< MeshConfig >::MeshTraits::GlobalIdArrayType&
 tnlMesh< MeshConfig >::
 superentityIdsArray()
 {
-   return entitiesStorage.template superentityIdsArray< SuperDimensionsTag >( DimensionsTag() ); 
+   return entitiesStorage.template superentityIdsArray< SuperDimensionsTag >( DimensionsTag() );
 }
 
 template< typename MeshConfig >
-bool 
+bool
 tnlMesh< MeshConfig >::
 init( const typename tnlMesh< MeshConfig >::MeshTraits::PointArrayType& points,
       const typename tnlMesh< MeshConfig >::MeshTraits::CellSeedArrayType& cellSeeds )
@@ -186,5 +178,6 @@ std::ostream& operator <<( std::ostream& str, const tnlMesh< MeshConfig >& mesh
    return str;
 }
 
-#endif	/* TNLMESH_IMPL_H */
+
+} // namespace TNL
 
diff --git a/src/mesh/tnlTraverser.h b/src/mesh/tnlTraverser.h
index 66f4985405ad7e322a92f0e6e881250857b6e2db..c7734c737f957232201181ecab42f04f4770c1e5 100644
--- a/src/mesh/tnlTraverser.h
+++ b/src/mesh/tnlTraverser.h
@@ -6,22 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTRAVERSER_H_
-#define TNLTRAVERSER_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Mesh,
           typename MeshEntity,
           int EntitiesDimensions = MeshEntity::entityDimensions >
 class tnlTraverser{};
 
-
-#endif /* TNLTRAVERSER_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshEdgeTopology.h b/src/mesh/topologies/tnlMeshEdgeTopology.h
index 696bbe5d867acd13e91c48210b9951a499414293..b7b3259123f6e61f67ac76a65f8c7432356f4dc8 100644
--- a/src/mesh/topologies/tnlMeshEdgeTopology.h
+++ b/src/mesh/topologies/tnlMeshEdgeTopology.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHEDGETOPOLOGY_H_
-#define TNLMESHEDGETOPOLOGY_H_
+#pragma once
 
 #include <mesh/topologies/tnlMeshEntityTopology.h>
 #include <mesh/topologies/tnlMeshVertexTopology.h>
 
+namespace TNL {
+
 struct tnlMeshEdgeTopology
 {
    static const int dimensions = 1;
@@ -35,4 +29,4 @@ struct tnlMeshSubtopology< tnlMeshEdgeTopology, 0 >
    static const int count = 2;
 };
 
-#endif /* TNLMESHEDGETOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshEntityTopology.h b/src/mesh/topologies/tnlMeshEntityTopology.h
index 1b1e660c0df562099d408408c4c563b18635cb2c..81561e86af998b71bc303f18711fe938bf698d73 100644
--- a/src/mesh/topologies/tnlMeshEntityTopology.h
+++ b/src/mesh/topologies/tnlMeshEntityTopology.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYTOPOLOGY_H_
-#define TNLMESHENTITYTOPOLOGY_H_
+#pragma once
+
+namespace TNL {
 
 template< typename MeshEntityTopology,
           int SubentityDimension >
@@ -49,4 +43,5 @@ class tnlMeshEntityTopology< MeshConfig,
 
    typedef typename MeshConfig::CellTopology Topology;
 };
-#endif /* TNLMESHENTITYTOPOLOGY_H_ */
+
+} // namespace TNL
\ No newline at end of file
diff --git a/src/mesh/topologies/tnlMeshHexahedronTopology.h b/src/mesh/topologies/tnlMeshHexahedronTopology.h
index 0053a75df4e6333448e6984d84cda855a965e1be..6fddd90acae72b4830f8b6475c75b9f61a887c5d 100644
--- a/src/mesh/topologies/tnlMeshHexahedronTopology.h
+++ b/src/mesh/topologies/tnlMeshHexahedronTopology.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHHEXAHEDRONTOPOLOGY_H_
-#define TNLMESHHEXAHEDRONTOPOLOGY_H_
+#pragma once
 
 #include <mesh/topologies/tnlMeshQuadrilateralTopology.h>
 
+namespace TNL {
+
 struct tnlMeshHexahedronTopology
 {
    static const int dimensions = 3;
@@ -173,4 +167,4 @@ template<> struct tnlSubentityVertex< tnlMeshHexahedronTopology, tnlMeshQuadrila
 template<> struct tnlSubentityVertex< tnlMeshHexahedronTopology, tnlMeshQuadrilateralTopology, 5, 2> { enum { index = 6 }; };
 template<> struct tnlSubentityVertex< tnlMeshHexahedronTopology, tnlMeshQuadrilateralTopology, 5, 3> { enum { index = 7 }; };
 
-#endif /* TNLMESHHEXAHEDRONTOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshQuadrilateralTopology.h b/src/mesh/topologies/tnlMeshQuadrilateralTopology.h
index 7c09f35ee8e4ba0bbe05f3c7931d748070f08e5e..e961abcca6e1ce263358e11436416b90bf34f58a 100644
--- a/src/mesh/topologies/tnlMeshQuadrilateralTopology.h
+++ b/src/mesh/topologies/tnlMeshQuadrilateralTopology.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHQUADRILATERALTOPOLOGY_H_
-#define TNLMESHQUADRILATERALTOPOLOGY_H_
+#pragma once
 
 #include <mesh/topologies/tnlMeshEdgeTopology.h>
 
+namespace TNL {
+
 struct tnlMeshQuadrilateralTopology
 {
    static const int dimensions = 2;
@@ -82,5 +76,4 @@ template<> struct tnlSubentityVertex< tnlMeshQuadrilateralTopology, tnlMeshEdgeT
 template<> struct tnlSubentityVertex< tnlMeshQuadrilateralTopology, tnlMeshEdgeTopology, 3, 0> { enum { index = 3 }; };
 template<> struct tnlSubentityVertex< tnlMeshQuadrilateralTopology, tnlMeshEdgeTopology, 3, 1> { enum { index = 0 }; };
 
-
-#endif /* TNLMESHQUADRILATERALTOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshSimplexTopology.h b/src/mesh/topologies/tnlMeshSimplexTopology.h
index 0089c036709de66b8df1238b51df37d989f1275b..92eafd03976d9e8e1aa0b441b0023f63d7cd4dd5 100644
--- a/src/mesh/topologies/tnlMeshSimplexTopology.h
+++ b/src/mesh/topologies/tnlMeshSimplexTopology.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
-#ifndef TNLMESHSIMPLEXTOPOLOGY_H
-#define TNLMESHSIMPLEXTOPOLOGY_H
+#pragma once
 
 
+namespace TNL {
+
 template< int dimensions_ >
 class tnlMeshSimplexTopology
 {
@@ -135,7 +129,7 @@ class tnlCombinationValue
 };
 
 template< unsigned int n,
-          unsigned int k, 
+          unsigned int k,
           unsigned int valueIndex >
 class tnlCombinationValue< n, k, 0, valueIndex >
 {
@@ -184,5 +178,5 @@ class tnlCombinationIncrement
 	   static const unsigned int valueIndex = tnlCombinationIncrementImpl< n, k, combinationIndex, k - 1 >::valueIndex;
 };
 
-#endif	/* TNLMESHSIMPLEXTOPOLOGY_H */
+} // namespace TNL
 
diff --git a/src/mesh/topologies/tnlMeshSubtopology.h b/src/mesh/topologies/tnlMeshSubtopology.h
index f7b6affed98aa57bf50002094fbfc6ef057b5925..4c88936a95a6ce8f659a6b218c80c62b018a1ba0 100644
--- a/src/mesh/topologies/tnlMeshSubtopology.h
+++ b/src/mesh/topologies/tnlMeshSubtopology.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMESHSUBTOPOLOGY_H
-#define	TNLMESHSUBTOPOLOGY_H
+namespace TNL {
 
 template< typename Topology,
           int dimensions >
@@ -28,5 +22,5 @@ template< typename Topology,
           int vertexIndex >
 struct tnlMeshSubtopologyVertex;
 
-#endif	/* TNLMESHSUBTOPOLOGY_H */
+} // namespace TNL
 
diff --git a/src/mesh/topologies/tnlMeshTetrahedronTopology.h b/src/mesh/topologies/tnlMeshTetrahedronTopology.h
index c5a498d08381bd5035b2a66d3cf2014c9eb1b837..2b2cd0e568c04b7a8f62c29a7dfd4c6f9e3bb34a 100644
--- a/src/mesh/topologies/tnlMeshTetrahedronTopology.h
+++ b/src/mesh/topologies/tnlMeshTetrahedronTopology.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHTETRAHEDRONTOPOLOGY_H_
-#define TNLMESHTETRAHEDRONTOPOLOGY_H_
+#pragma once
 
 #include <mesh/topologies/tnlMeshTriangleTopology.h>
 
+namespace TNL {
+
 struct tnlMeshTetrahedronTopology
 {
    static const int dimensions = 3;
@@ -85,5 +79,4 @@ template<> struct tnlSubentityVertex< tnlMeshTetrahedronTopology, tnlMeshTriangl
 template<> struct tnlSubentityVertex< tnlMeshTetrahedronTopology, tnlMeshTriangleTopology, 3, 1> { enum { index = 0 }; };
 template<> struct tnlSubentityVertex< tnlMeshTetrahedronTopology, tnlMeshTriangleTopology, 3, 2> { enum { index = 3 }; };
 
-
-#endif /* TNLMESHTETRAHEDRONTOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshTriangleTopology.h b/src/mesh/topologies/tnlMeshTriangleTopology.h
index b80ca06373792d82db5fcb96b97bd5321594f7ca..755b39d7d3d85f31ccba76c7f096662dbf0a78c1 100644
--- a/src/mesh/topologies/tnlMeshTriangleTopology.h
+++ b/src/mesh/topologies/tnlMeshTriangleTopology.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHTRIANGLETOPOLOGY_H_
-#define TNLMESHTRIANGLETOPOLOGY_H_
+#pragma once
 
 #include <mesh/topologies/tnlMeshEdgeTopology.h>
 
+namespace TNL {
+
 struct tnlMeshTriangleTopology
 {
    static const int dimensions = 2;
@@ -52,5 +46,4 @@ template<> struct tnlSubentityVertex< tnlMeshTriangleTopology, tnlMeshEdgeTopolo
 template<> struct tnlSubentityVertex< tnlMeshTriangleTopology, tnlMeshEdgeTopology, 2, 0> { enum { index = 0 }; };
 template<> struct tnlSubentityVertex< tnlMeshTriangleTopology, tnlMeshEdgeTopology, 2, 1> { enum { index = 1 }; };
 
-
-#endif /* TNLMESHTRIANGLETOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/topologies/tnlMeshVertexTopology.h b/src/mesh/topologies/tnlMeshVertexTopology.h
index 6fc81f962ca756886a94fb5061d594a494e6d690..70ade43a6660d1d85762b06cdf284d7e312e88a1 100644
--- a/src/mesh/topologies/tnlMeshVertexTopology.h
+++ b/src/mesh/topologies/tnlMeshVertexTopology.h
@@ -6,22 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHVERTEXTOPOLOGY_H_
-#define TNLMESHVERTEXTOPOLOGY_H_
+#pragma once
+
+namespace TNL {
 
 struct tnlMeshVertexTopology
 {
    static const int dimensions = 0;
 };
 
-
-#endif /* TNLMESHVERTEXTOPOLOGY_H_ */
+} // namespace TNL
diff --git a/src/mesh/traits/tnlMeshEntityTraits.h b/src/mesh/traits/tnlMeshEntityTraits.h
index 6d5cc225cc9efe774c1f0052f199aa108e0ddb52..5c0f524a3a3d5977c0894f396f0f0fc63ae93d38 100644
--- a/src/mesh/traits/tnlMeshEntityTraits.h
+++ b/src/mesh/traits/tnlMeshEntityTraits.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITYTRAITS_H_
-#define TNLMESHENTITYTRAITS_H_
+#pragma once
 
 #include <core/vectors/tnlStaticVector.h>
 #include <core/arrays/tnlArray.h>
@@ -27,6 +19,8 @@
 #include <mesh/config/tnlMeshConfigBase.h>
 #include <mesh/traits/tnlMeshTraits.h>
 
+namespace TNL {
+
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntity;
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntitySeed;
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntitySeedKey;
@@ -62,7 +56,7 @@ class tnlMeshEntityOrientationNeeded< MeshConfig, DimensionsTag, DimensionsTag >
 template< typename MeshConfig,
           int Dimensions >
 class tnlMeshEntityTraits
-{   
+{
    public:
 
       static const bool storageEnabled = MeshConfig::entityStorage( Dimensions );
@@ -71,7 +65,7 @@ class tnlMeshEntityTraits
       typedef typename MeshConfig::GlobalIndexType                                 GlobalIndexType;
       typedef typename MeshConfig::LocalIndexType                                  LocalIndexType;
       typedef typename tnlMeshEntityTopology< MeshConfig, Dimensions >::Topology   EntityTopology;
-      
+ 
       typedef tnlMeshEntity< MeshConfig, EntityTopology >                          EntityType;
       typedef tnlMeshEntitySeed< MeshConfig, EntityTopology >                      SeedType;
       typedef tnlMeshEntityReferenceOrientation< MeshConfig, EntityTopology >      ReferenceOrientationType;
@@ -88,5 +82,4 @@ class tnlMeshEntityTraits
       typedef tnlConstSharedArray< EntityType, tnlHost, GlobalIndexType >          SharedArrayType;
 };
 
-
-#endif /* TNLMESHENTITYTRAITS_H_ */
+} // namespace TNL
diff --git a/src/mesh/traits/tnlMeshSubentityTraits.h b/src/mesh/traits/tnlMeshSubentityTraits.h
index d23c19c69dde59a23afad7ebef5c5e5070dd185c..8e99855212efe8f1b63589b6d8d30c3e7bb0b991 100644
--- a/src/mesh/traits/tnlMeshSubentityTraits.h
+++ b/src/mesh/traits/tnlMeshSubentityTraits.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUBENTITYTRAITS_H_
-#define TNLMESHSUBENTITYTRAITS_H_
+#pragma once
 
 #include <core/arrays/tnlStaticArray.h>
 #include <core/arrays/tnlSharedArray.h>
@@ -24,6 +16,7 @@
 #include <mesh/config/tnlMeshConfigBase.h>
 #include <mesh/topologies/tnlMeshEntityTopology.h>
 
+namespace TNL {
 
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntityOrientation;
 
@@ -32,12 +25,12 @@ template< typename MeshConfig,
           int Dimensions >
 class tnlMeshSubentityTraits
 {
-   public:   
+   public:
       static const bool storageEnabled = MeshConfig::subentityStorage( EntityTopology(), Dimensions );
-      static const bool orientationEnabled = MeshConfig::subentityOrientationStorage( EntityTopology(), Dimensions );      
+      static const bool orientationEnabled = MeshConfig::subentityOrientationStorage( EntityTopology(), Dimensions );
 
       typedef typename MeshConfig::GlobalIndexType                                GlobalIndexType;
-      typedef typename MeshConfig::LocalIndexType                                 LocalIndexType;      
+      typedef typename MeshConfig::LocalIndexType                                 LocalIndexType;
       typedef tnlMeshSubtopology< EntityTopology, Dimensions >                    Subtopology;
       typedef typename Subtopology::Topology                                      SubentityTopology;
       typedef tnlMeshEntity< MeshConfig, SubentityTopology >                      SubentityType;
@@ -70,6 +63,4 @@ class tnlMeshSubentityTraits
       static_assert( EntityTopology::dimensions > Dimensions, "You try to create subentities traits where subentity dimensions are not smaller than the entity dimensions." );
 };
 
-
-
-#endif /* TNLMESHSUBENTITYTRAITS_H_ */
+} // namespace TNL
diff --git a/src/mesh/traits/tnlMeshSuperentityTraits.h b/src/mesh/traits/tnlMeshSuperentityTraits.h
index 9195241fb2fa4a87e860e1cac77ff5c42a14b29d..7c1120ed135f17b0999d119bc79bd40635271773 100644
--- a/src/mesh/traits/tnlMeshSuperentityTraits.h
+++ b/src/mesh/traits/tnlMeshSuperentityTraits.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHSUPERENTITYTRAITS_H_
-#define TNLMESHSUPERENTITYTRAITS_H_
+#pragma once
 
 #include <core/arrays/tnlArray.h>
 #include <core/arrays/tnlConstSharedArray.h>
@@ -28,13 +20,15 @@
 #include <core/multimaps/tnlEllpackIndexMultimap.h>
 #include <mesh/layers/tnlMeshSuperentityAccessor.h>
 
+namespace TNL {
+
 template< typename MeshConfig,
           typename EntityTopology,
           int Dimensions >
 class tnlMeshSuperentityTraits
 {
    public:
-   
+ 
    typedef typename MeshConfig::GlobalIndexType                              GlobalIndexType;
    typedef typename MeshConfig::LocalIndexType                               LocalIndexType;
 
@@ -51,10 +45,10 @@ class tnlMeshSuperentityTraits
     * Type of container for storing of the superentities indecis.
     */
    typedef tnlArray< GlobalIndexType, tnlHost, LocalIndexType >             StorageArrayType;
-   
+ 
    typedef tnlEllpackIndexMultimap< GlobalIndexType, tnlHost >                        StorageNetworkType;
    typedef tnlMeshSuperentityAccessor< typename StorageNetworkType::ValuesAccessorType > SuperentityAccessorType;
-   
+ 
    /****
     * Type for passing the superentities indecis by the getSuperentitiesIndices()
     * method. We introduce it because of the compatibility with the subentities
@@ -69,5 +63,4 @@ class tnlMeshSuperentityTraits
 
 };
 
-
-#endif /* TNLMESHSUPERENTITYTRAITS_H_ */
+} // namespace TNL
diff --git a/src/mesh/traits/tnlMeshTraits.h b/src/mesh/traits/tnlMeshTraits.h
index d33f0503b59263c6fe47e572df87ee4c74a25f08..eabc67a32af58b1d4542f59cb6ee89b259a25a68 100644
--- a/src/mesh/traits/tnlMeshTraits.h
+++ b/src/mesh/traits/tnlMeshTraits.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHTRAITS_H_
-#define TNLMESHTRAITS_H_
+#pragma once
 
 #include <core/vectors/tnlStaticVector.h>
 #include <core/arrays/tnlArray.h>
@@ -24,6 +16,8 @@
 #include <core/arrays/tnlConstSharedArray.h>
 #include <mesh/tnlDimensionsTag.h>
 
+namespace TNL {
+
 struct tnlMeshVertexTopology;
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntity;
 template< typename MeshConfig, typename EntityTopology > class tnlMeshEntitySeed;
@@ -36,39 +30,38 @@ template< typename MeshConfig,
 class tnlMeshTraits
 {
    public:
-      
+ 
       static const int meshDimensions = MeshConfig::CellTopology::dimensions;
-      static const int worldDimensions = MeshConfig::worldDimensions;     
+      static const int worldDimensions = MeshConfig::worldDimensions;
 
       typedef Device                                                               DeviceType;
       typedef typename MeshConfig::GlobalIndexType                                 GlobalIndexType;
-      typedef typename MeshConfig::LocalIndexType                                  LocalIndexType;      
-            
+      typedef typename MeshConfig::LocalIndexType                                  LocalIndexType;
+ 
       typedef typename MeshConfig::CellTopology                                    CellTopology;
       typedef tnlMeshEntity< MeshConfig, CellTopology >                            CellType;
       typedef tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >                   VertexType;
       typedef tnlStaticVector< worldDimensions, typename MeshConfig::RealType >    PointType;
       typedef tnlMeshEntitySeed< MeshConfig, CellTopology >                        CellSeedType;
-      
+ 
       typedef tnlArray< PointType, tnlHost, GlobalIndexType >                      PointArrayType;
       typedef tnlArray< CellSeedType, tnlHost, GlobalIndexType >                   CellSeedArrayType;
       typedef tnlArray< GlobalIndexType, tnlHost, GlobalIndexType >                GlobalIdArrayType;
       typedef tnlConstSharedArray< GlobalIndexType, tnlHost, LocalIndexType >      IdArrayAccessorType;
       typedef tnlConstSharedArray< LocalIndexType, tnlHost, LocalIndexType >       IdPermutationArrayAccessorType;
-      
-      template< int Dimensions > using EntityTraits = 
+ 
+      template< int Dimensions > using EntityTraits =
          tnlMeshEntityTraits< MeshConfig, Dimensions >;
-      
+ 
       template< typename EntityTopology, int SubDimensions > using SubentityTraits =
          tnlMeshSubentityTraits< MeshConfig, EntityTopology, SubDimensions >;
-      
+ 
       template< typename EntityTopology, int SuperDimensions > using SuperentityTraits =
          tnlMeshSuperentityTraits< MeshConfig, EntityTopology, SuperDimensions >;
-      
-      
+ 
+ 
       typedef tnlDimensionsTag< meshDimensions >                                   DimensionsTag;
 
 };
 
-
-#endif /* TNLMESHTRAITS_H_ */
+} // namespace TNL
diff --git a/src/operators/CMakeLists.txt b/src/operators/CMakeLists.txt
index 87ce7309512ca0b3bbb1bad46a2655eb5b5e7dcf..3ab7e12a6678cd719ce4c1e33bf14bdf104ac72f 100755
--- a/src/operators/CMakeLists.txt
+++ b/src/operators/CMakeLists.txt
@@ -5,7 +5,6 @@ ADD_SUBDIRECTORY( operator-Q )
 ADD_SUBDIRECTORY( operator-curvature )
 
 SET( headers tnlDirichletBoundaryConditions.h
-             tnlDirichletBoundaryConditions_impl.h
              tnlExactFunctionInverseOperator.h
              tnlExactIdentityOperator.h
              tnlExactOperatorComposition.h
diff --git a/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h b/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h
index af39c588118eb976eec6425cd2c9d068d530c5e5..6fdb5f172da54a125751300c641949f63e0da7f8 100644
--- a/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h
+++ b/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator.h
@@ -1,5 +1,15 @@
-#ifndef TNLFINITEVOLUMENONLINEAROPERATOR_H
-#define	TNLFINITEVOLUMENONLINEAROPERATOR_H
+/***************************************************************************
+                          tnlTraverser.h  -  description
+                             -------------------
+    begin                : Feb 17, 2016
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
+
+namespace TNL {
 
 #include <core/vectors/tnlVector.h>
 #include <mesh/tnlGrid.h>
@@ -52,7 +62,7 @@ class tnlFiniteVolumeNonlinearOperator< tnlGrid< 1,MeshReal, Device, MeshIndex >
              typename Vector,
              typename Matrix >
    __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -106,7 +116,7 @@ class tnlFiniteVolumeNonlinearOperator< tnlGrid< 2, MeshReal, Device, MeshIndex
              typename Vector,
              typename Matrix >
    __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -158,7 +168,7 @@ class tnlFiniteVolumeNonlinearOperator< tnlGrid< 3, MeshReal, Device, MeshIndex
              typename Vector,
              typename Matrix >
    __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -172,8 +182,6 @@ class tnlFiniteVolumeNonlinearOperator< tnlGrid< 3, MeshReal, Device, MeshIndex
    OperatorQ operatorQ;
 };
 
+} //namespace TNL
 
 #include "tnlFiniteVolumeNonlinearOperator_impl.h"
-
-
-#endif	/* TNLFINITEVOLUMENONLINEAROPERATOR_H */
diff --git a/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator_impl.h b/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator_impl.h
index 9bd82a6965d7253712ac51446a31577a95f3df22..840c98c219f755de9899845ecae68c531a840c3a 100644
--- a/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator_impl.h
+++ b/src/operators/diffusion/nonlinear-diffusion-operators/tnlFiniteVolumeNonlinearOperator_impl.h
@@ -1,11 +1,19 @@
+/***************************************************************************
+                          tnlTraverser.h  -  description
+                             -------------------
+    begin                : Feb 17, 2016
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
 
-#ifndef TNLFINITEVOLUMENONLINEAROPERATOR__IMPL_H
-#define	TNLFINITEVOLUMENONLINEAROPERATOR__IMPL_H
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnlFiniteVolumeNonlinearOperator.h"
+#pragma once
 
+#include "tnlFiniteVolumeNonlinearOperator.h"
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -71,7 +79,7 @@ template< typename MeshEntity,
 __cuda_callable__
 void
 tnlFiniteVolumeNonlinearOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -155,7 +163,7 @@ template< typename MeshEntity,
 __cuda_callable__
 void
 tnlFiniteVolumeNonlinearOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -268,7 +276,7 @@ __cuda_callable__
 #endif
 void
 tnlFiniteVolumeNonlinearOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -306,4 +314,5 @@ updateLinearSystem( const RealType& time,
    matrixRow.setElement( 5, neighbourEntities.template getEntityIndex< 0,1,0 >(),  fCoef );
    matrixRow.setElement( 6, neighbourEntities.template getEntityIndex< 0,0,1 >(),  gCoef );
 }
-#endif	/* TNLFINITEVOLUMENONLINEAROPERATOR__IMPL_H */
+
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlExactLinearDiffusion.h b/src/operators/diffusion/tnlExactLinearDiffusion.h
index af6dbf4c922a05b6f83812466ceb5fcb1f93ab22..f50bd54b23aeca8c1fd31f35d4b95e525c57586a 100644
--- a/src/operators/diffusion/tnlExactLinearDiffusion.h
+++ b/src/operators/diffusion/tnlExactLinearDiffusion.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTLINEARDIFFUSION_H_
-#define TNLEXACTLINEARDIFFUSION_H_
+#pragma once
 
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int Dimensions >
 class tnlExactLinearDiffusion
 {};
@@ -30,9 +24,9 @@ class tnlExactLinearDiffusion< 1 > : public tnlDomain< 1, SpaceDomain >
    public:
 
       static const int Dimensions = 1;
-      
-      static tnlString getType();      
-   
+ 
+      static tnlString getType();
+ 
       template< typename Function >
       __cuda_callable__ inline
       typename Function::RealType operator()( const Function& function,
@@ -44,10 +38,10 @@ template<>
 class tnlExactLinearDiffusion< 2 > : public tnlDomain< 2, SpaceDomain >
 {
    public:
-      
+ 
       static const int Dimensions = 2;
-      
-      static tnlString getType();      
+ 
+      static tnlString getType();
 
       template< typename Function >
       __cuda_callable__ inline
@@ -60,9 +54,9 @@ template<>
 class tnlExactLinearDiffusion< 3 > : public tnlDomain< 3 >
 {
    public:
-      
+ 
       static const int Dimensions = 3;
-      
+ 
       static tnlString getType();
 
       template< typename Function >
@@ -72,6 +66,6 @@ class tnlExactLinearDiffusion< 3 > : public tnlDomain< 3 >
                                               const typename Function::RealType& time = 0.0 ) const;
 };
 
-#include <operators/diffusion/tnlExactLinearDiffusion_impl.h>
+} // namespace TNL
 
-#endif /* TNLEXACTLINEARDIFFUSION_H_ */
+#include <operators/diffusion/tnlExactLinearDiffusion_impl.h>
diff --git a/src/operators/diffusion/tnlExactLinearDiffusion_impl.h b/src/operators/diffusion/tnlExactLinearDiffusion_impl.h
index 1903e6029887b2900bddab1587ffce2e6e791ca8..d13f9b1b4de5f30615bfac2cf4235648111642f8 100644
--- a/src/operators/diffusion/tnlExactLinearDiffusion_impl.h
+++ b/src/operators/diffusion/tnlExactLinearDiffusion_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLEXACTLINEARDIFFUSION_IMPL_H_
-#define TNLEXACTLINEARDIFFUSION_IMPL_H_
+namespace TNL {
 
 tnlString
 tnlExactLinearDiffusion< 1 >::
@@ -76,4 +70,4 @@ operator()( const Function& function,
 
 }
 
-#endif /* TNLEXACTLINEARDIFFUSION_IMPL_H_ */
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlExactMeanCurvature.h b/src/operators/diffusion/tnlExactMeanCurvature.h
index 19506f8382db826d52fa016399c194431854379d..369647ab3005a65fa191e7705075730f39ef2520 100644
--- a/src/operators/diffusion/tnlExactMeanCurvature.h
+++ b/src/operators/diffusion/tnlExactMeanCurvature.h
@@ -6,58 +6,51 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-
-#ifndef TNLEXACTMEANCURVATURE_H
-#define	TNLEXACTMEANCURVATURE_H
+#pragma once
 
 #include<operators/diffusion/tnlExactNonlinearDiffusion.h>
 #include<operators/tnlExactFunctionInverseOperator.h>
 #include<operators/geometric/tnlExactGradientNorm.h>
 
+namespace TNL {
+
 template< int Dimensions,
           typename InnerOperator = tnlExactIdentityOperator< Dimensions > >
 class tnlExactMeanCurvature
 : public tnlDomain< Dimensions, SpaceDomain >
 {
    public:
-     
+ 
       typedef tnlExactGradientNorm< Dimensions > ExactGradientNorm;
       typedef tnlExactFunctionInverseOperator< Dimensions, ExactGradientNorm > FunctionInverse;
       typedef tnlExactNonlinearDiffusion< Dimensions, FunctionInverse > NonlinearDiffusion;
-      
+ 
       static tnlString getType()
       {
-         return tnlString( "tnlExactMeanCurvature< " ) + 
+         return tnlString( "tnlExactMeanCurvature< " ) +
                 tnlString( Dimensions) + ", " +
-                InnerOperator::getType() + " >";         
+                InnerOperator::getType() + " >";
       }
-      
+ 
       template< typename Real >
       void setRegularizationEpsilon( const Real& eps)
       {
          nonlinearDiffusion.getNonlinearity().getInnerOperator().setRegularizationEpsilon( eps );
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          return this->nonlinearDiffusion( function, v, time );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -71,7 +64,7 @@ class tnlExactMeanCurvature
             "Partial derivative must be non-negative integer." );
          static_assert( XDerivative + YDerivative + ZDerivative < 1, "Partial derivative of higher order then 1 are not implemented yet." );
          typedef typename Function::RealType RealType;
-         
+ 
          if( XDerivative == 1 )
          {
          }
@@ -80,20 +73,19 @@ class tnlExactMeanCurvature
          }
          if( ZDerivative == 1 )
          {
-         }         
+         }
       }
-      
-      
+ 
+ 
    protected:
-      
+ 
       ExactGradientNorm gradientNorm;
-      
+ 
       FunctionInverse functionInverse;
-      
+ 
       NonlinearDiffusion nonlinearDiffusion;
-      
+ 
 };
 
-
-#endif	/* TNLEXACTMEANCURVATURE_H */
+} // namespace TNL
 
diff --git a/src/operators/diffusion/tnlExactNonlinearDiffusion.h b/src/operators/diffusion/tnlExactNonlinearDiffusion.h
index fafc9656d465a9293ea18a0e0902b3d20184d101..f4c1347c5d0cdc4797d8ddc4a1e53cc0ce8de6e2 100644
--- a/src/operators/diffusion/tnlExactNonlinearDiffusion.h
+++ b/src/operators/diffusion/tnlExactNonlinearDiffusion.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTNONLINEARDIFFUSION_H_
-#define TNLEXACTNONLINEARDIFFUSION_H_
+#pragma once
 
 #include <functions/tnlDomain.h>
 #include <operators/tnlExactIdentityOperator.h>
 
 
-template<  int Dimensions, 
+namespace TNL {
+
+template<  int Dimensions,
            typename Nonlinearity,
            typename InnerOperator = tnlExactIdentityOperator< Dimensions > >
 class tnlExactNonlinearDiffusion
@@ -31,7 +25,7 @@ class tnlExactNonlinearDiffusion
 
 template< typename Nonlinearity,
           typename InnerOperator >
-class tnlExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator > 
+class tnlExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator >
    : public tnlDomain< 1, SpaceDomain >
 {
    public:
@@ -40,27 +34,27 @@ class tnlExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator >
       {
          return "tnlExactNonlinearDiffusion< 1, " + Nonlinearity::getType() + " >";
       };
-      
+ 
       Nonlinearity& getNonlinearity()
       {
          return this->nonlinearity;
       }
-      
+ 
       const Nonlinearity& getNonlinearity() const
       {
          return this->nonlinearity;
       }
-      
+ 
       InnerOperator& getInnerOperator()
       {
          return this->innerOperator;
       }
-      
+ 
       const InnerOperator& getInnerOperator() const
       {
          return this->innerOperator;
-      }      
-   
+      }
+ 
       template< typename Function >
       __cuda_callable__
       typename Function::RealType
@@ -68,16 +62,16 @@ class tnlExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator >
                   const typename Function::VertexType& v,
                   const typename Function::RealType& time = 0.0 ) const
       {
-         typedef typename Function::RealType RealType;         
+         typedef typename Function::RealType RealType;
          const RealType u_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
          const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
-         const RealType g = nonlinearity( function, v, time ); 
+         const RealType g = nonlinearity( function, v, time );
          const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         return u_xx + u_x * g_x / g;          
+         return u_xx * g + u_x * g_x;
       }
-   
+ 
       protected:
-         
+ 
          Nonlinearity nonlinearity;
 
          InnerOperator innerOperator;
@@ -89,31 +83,31 @@ class tnlExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator >
    : public tnlDomain< 2, SpaceDomain >
 {
    public:
-      
+ 
       static tnlString getType()
       {
          return "tnlExactNonlinearDiffusion< " + Nonlinearity::getType() + ", 2 >";
       };
-      
+ 
       Nonlinearity& getNonlinearity()
       {
          return this->nonlinearity;
       }
-      
+ 
       const Nonlinearity& getNonlinearity() const
       {
          return this->nonlinearity;
       }
-      
+ 
       InnerOperator& getInnerOperator()
       {
          return this->innerOperator;
       }
-      
+ 
       const InnerOperator& getInnerOperator() const
       {
          return this->innerOperator;
-      }      
+      }
 
       template< typename Function >
       __cuda_callable__
@@ -122,24 +116,24 @@ class tnlExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator >
                   const typename Function::VertexType& v,
                   const typename Function::RealType& time = 0.0 ) const
       {
-         typedef typename Function::RealType RealType;         
+         typedef typename Function::RealType RealType;
          const RealType u_x  = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
          const RealType u_y  = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
          const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
          const RealType u_yy = innerOperator.template getPartialDerivative< Function, 0, 2, 0 >( function, v, time );
-         const RealType g   = nonlinearity( function, v, time ); 
+         const RealType g   = nonlinearity( function, v, time );
          const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
          const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
 
-         return  u_xx + u_yy + ( g_x * u_x + g_y * u_y ) / g; 
+         return  ( u_xx + u_yy ) * g + g_x * u_x + g_y * u_y;
       }
 
       protected:
-         
+ 
          Nonlinearity nonlinearity;
-         
+ 
          InnerOperator innerOperator;
-      
+ 
 };
 
 template< typename Nonlinearity,
@@ -148,40 +142,40 @@ class tnlExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator >
    : public tnlDomain< 3, SpaceDomain >
 {
    public:
-      
+ 
       static tnlString getType()
       {
          return "tnlExactNonlinearDiffusion< " + Nonlinearity::getType() + ", 3 >";
       }
-      
+ 
       Nonlinearity& getNonlinearity()
       {
          return this->nonlinearity;
       }
-      
+ 
       const Nonlinearity& getNonlinearity() const
       {
          return this->nonlinearity;
       }
-      
+ 
       InnerOperator& getInnerOperator()
       {
          return this->innerOperator;
       }
-      
+ 
       const InnerOperator& getInnerOperator() const
       {
          return this->innerOperator;
-      }      
-      
+      }
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
       operator()( const Function& function,
                   const typename Function::VertexType& v,
                   const typename Function::RealType& time = 0.0 ) const
       {
-         typedef typename Function::RealType RealType;         
+         typedef typename Function::RealType RealType;
          const RealType u_x  = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
          const RealType u_y  = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
          const RealType u_z  = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
@@ -193,15 +187,14 @@ class tnlExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator >
          const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
          const RealType g_z = nonlinearity.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
 
-         return  u_xx + u_yy + u_zz + ( g_x * u_x + g_y * u_y + g_z * u_z ) / g; 
+         return ( u_xx + u_yy + u_zz ) * g + g_x * u_x + g_y * u_y + g_z * u_z;
       }
-      
+ 
       protected:
-         
+ 
          Nonlinearity nonlinearity;
-         
+ 
          InnerOperator innerOperator;
 };
 
-
-#endif /* TNLEXACTNONLINEARDIFFUSION_H_ */
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlLinearDiffusion.h b/src/operators/diffusion/tnlLinearDiffusion.h
index b4683676e673a985b0a233f5a3f016b9f8bf7f4e..18a1c8c483abb7e25630a8f34fb438483c8627ba 100644
--- a/src/operators/diffusion/tnlLinearDiffusion.h
+++ b/src/operators/diffusion/tnlLinearDiffusion.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLINEARDIFFUSION_H
-#define	TNLLINEARDIFFUSION_H
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <functions/tnlMeshFunction.h>
@@ -24,6 +16,8 @@
 #include <operators/tnlOperator.h>
 #include <operators/diffusion/tnlExactLinearDiffusion.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType >
@@ -42,25 +36,23 @@ class tnlLinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index
 : public tnlOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >,
                       MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public:    
-   
+   public:
+ 
       typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
-      typedef Index IndexType;      
+      typedef Index IndexType;
       typedef tnlExactLinearDiffusion< 1 > ExactOperatorType;
-      
+ 
       static const int Dimensions = MeshType::meshDimensions;
-      
+ 
       static constexpr int getMeshDimensions() { return Dimensions; }
-      
-      template< int EntityDimensions = Dimensions >
-      using MeshFunction = tnlMeshFunction< MeshType, EntityDimensions >;
-
+ 
       static tnlString getType();
 
-      template< typename PreimageFunction, typename MeshEntity >
+      template< typename PreimageFunction,
+                typename MeshEntity >
       __cuda_callable__
       inline Real operator()( const PreimageFunction& u,
                               const MeshEntity& entity,
@@ -72,19 +64,17 @@ class tnlLinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index
                                              const IndexType& index,
                                              const MeshEntity& entity ) const;
 
-      template< typename MeshEntity,
-                typename Vector,
-                typename MatrixRow >
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      inline void updateLinearSystem( const RealType& time,
-                                      const RealType& tau,
-                                      const MeshType& mesh,
-                                      const IndexType& index,
-                                      const MeshEntity& entity,
-                                      const MeshFunction< 1 >& u,
-                                      Vector& b,
-                                      MatrixRow& matrixRow ) const;
-
+      inline void setMatrixElements( const PreimageFunction& u,
+                                     const MeshEntity& entity,
+                                     const RealType& time,
+                                     const RealType& tau,
+                                     Matrix& matrix,
+                                     Vector& b ) const;
 };
 
 
@@ -97,23 +87,19 @@ class tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index
 : public tnlOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >,
                       MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
-      typedef Index IndexType;      
+      typedef Index IndexType;
       typedef tnlExactLinearDiffusion< 2 > ExactOperatorType;
-      
+ 
       static const int Dimensions = MeshType::meshDimensions;
-      
+ 
       static constexpr int getMeshDimensions() { return Dimensions; }
 
-      
-      template< int EntityDimensions = Dimensions >
-      using MeshFunction = tnlMeshFunction< MeshType, EntityDimensions >;      
-
       static tnlString getType();
 
       template< typename PreimageFunction, typename EntityType >
@@ -127,19 +113,18 @@ class tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index
       inline Index getLinearSystemRowLength( const MeshType& mesh,
                                              const IndexType& index,
                                              const EntityType& entity ) const;
-
-      template< typename Vector,
-                typename MatrixRow,
-                typename EntityType >
+ 
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      inline void updateLinearSystem( const RealType& time,
-                                      const RealType& tau,
-                                      const MeshType& mesh,
-                                      const IndexType& index,
-                                      const EntityType& entity,
-                                      const MeshFunction< 2 >& u,
-                                      Vector& b,
-                                      MatrixRow& matrixRow ) const;
+      inline void setMatrixElements( const PreimageFunction& u,
+                                     const MeshEntity& entity,
+                                     const RealType& time,
+                                     const RealType& tau,
+                                     Matrix& matrix,
+                                     Vector& b ) const;
 };
 
 
@@ -152,8 +137,8 @@ class tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index
 : public tnlOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >,
                       MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
@@ -162,16 +147,12 @@ class tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index
       typedef tnlExactLinearDiffusion< 3 > ExactOperatorType;
 
       static const int Dimensions = MeshType::meshDimensions;
-      
-      static constexpr int getMeshDimensions() { return Dimensions; }      
-
-      template< int EntityDimensions = Dimensions >
-      using MeshFunction = tnlMeshFunction< MeshType, EntityDimensions >;
+ 
+      static constexpr int getMeshDimensions() { return Dimensions; }
 
-      
       static tnlString getType();
 
-      template< typename PreimageFunction, 
+      template< typename PreimageFunction,
                 typename EntityType >
       __cuda_callable__
       inline Real operator()( const PreimageFunction& u,
@@ -184,23 +165,19 @@ class tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index
                                              const IndexType& index,
                                              const EntityType& entity ) const;
 
-      template< typename Vector,
-                typename MatrixRow,
-                typename EntityType >
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      inline void updateLinearSystem( const RealType& time,
-                                      const RealType& tau,
-                                      const MeshType& mesh,
-                                      const IndexType& index,
-                                      const EntityType& entity,
-                                      const MeshFunction< 3 >& u,
-                                      Vector& b,
-                                      MatrixRow& matrixRow ) const;
-
+      inline void setMatrixElements( const PreimageFunction& u,
+                                     const MeshEntity& entity,
+                                     const RealType& time,
+                                     const RealType& tau,
+                                     Matrix& matrix,
+                                     Vector& b ) const;
 };
 
+} //namespace TNL
 
 #include <operators/diffusion/tnlLinearDiffusion_impl.h>
-
-
-#endif	/* TNLLINEARDIFFUSION_H */
diff --git a/src/operators/diffusion/tnlLinearDiffusion_impl.h b/src/operators/diffusion/tnlLinearDiffusion_impl.h
index ef38d2e8b0f65119b6769fb778b9475df777ec4d..98ba2478bae64e6470d5275445865c05a510e377 100644
--- a/src/operators/diffusion/tnlLinearDiffusion_impl.h
+++ b/src/operators/diffusion/tnlLinearDiffusion_impl.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLINEARDIFFUSION_IMP_H
-#define	TNLLINEARDIFFUSION_IMP_H
+#pragma once
 
 #include <operators/diffusion/tnlLinearDiffusion.h>
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -65,7 +59,7 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-   template< typename MeshEntity >          
+   template< typename MeshEntity >
 __cuda_callable__
 inline
 Index
@@ -82,28 +76,30 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-   template< typename MeshEntity,
-             typename Vector, 
-             typename Matrix >
+   template< typename PreimageFunction,
+             typename MeshEntity,
+             typename Matrix,
+             typename Vector >
 __cuda_callable__
 inline
 void
 tnlLinearDiffusion< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction< 1 >& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+setMatrixElements( const PreimageFunction& u,
+                   const MeshEntity& entity,
+                   const RealType& time,
+                   const RealType& tau,
+                   Matrix& matrix,
+                   Vector& b ) const
 {
+   static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." );
+   static_assert( PreimageFunction::getEntitiesDimensions() == 1, "Wrong preimage function" );
    const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
+   const IndexType& index = entity.getIndex();
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-   const RealType lambdaX = tau * mesh.template getSpaceStepsProducts< -2 >();
+   const RealType lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >();
    matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1 >(),      - lambdaX );
    matrixRow.setElement( 1, index,                                              2.0 * lambdaX );
-   matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< 1 >(),       - lambdaX );   
+   matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< 1 >(),       - lambdaX );
 }
 
 template< typename MeshReal,
@@ -171,26 +167,28 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-   template< typename Vector,
+   template< typename PreimageFunction,
+             typename MeshEntity,
              typename Matrix,
-             typename EntityType >
+             typename Vector >
 __cuda_callable__
 inline
 void
 tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const EntityType& entity,
-                    const MeshFunction< 2 >& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+setMatrixElements( const PreimageFunction& u,
+                   const MeshEntity& entity,
+                   const RealType& time,
+                   const RealType& tau,
+                   Matrix& matrix,
+                   Vector& b ) const
 {
+   static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." );
+   static_assert( PreimageFunction::getEntitiesDimensions() == 2, "Wrong preimage function" );
+   const IndexType& index = entity.getIndex();
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-   const RealType lambdaX = tau * mesh.template getSpaceStepsProducts< -2, 0 >();
-   const RealType lambdaY = tau * mesh.template getSpaceStepsProducts< 0, -2 >();
-   const typename EntityType::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 typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
    matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1 >(), -lambdaY );
    matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< -1, 0 >(), -lambdaX );
    matrixRow.setElement( 2, index,                                                        2.0 * ( lambdaX + lambdaY ) );
@@ -249,7 +247,7 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-   template< typename EntityType >          
+   template< typename EntityType >
 __cuda_callable__
 inline
 Index
@@ -266,27 +264,29 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-   template< typename Vector,
+   template< typename PreimageFunction,
+             typename MeshEntity,
              typename Matrix,
-             typename EntityType >
+             typename Vector >
 __cuda_callable__
 inline
 void
 tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const EntityType& entity,
-                    const MeshFunction< 3 >& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+setMatrixElements( const PreimageFunction& u,
+                   const MeshEntity& entity,
+                   const RealType& time,
+                   const RealType& tau,
+                   Matrix& matrix,
+                   Vector& b ) const
 {
-   const typename EntityType::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
+   static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." );
+   static_assert( PreimageFunction::getEntitiesDimensions() == 3, "Wrong preimage function" );
+   const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
+   const IndexType& index = entity.getIndex();
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-   const RealType lambdaX = tau * mesh.template getSpaceStepsProducts< -2, 0, 0 >();
-   const RealType lambdaY = tau * mesh.template getSpaceStepsProducts< 0, -2, 0 >();
-   const RealType  lambdaZ = tau * mesh.template getSpaceStepsProducts< 0, 0, -2 >();
+   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 >();
    matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, 0, -1 >(), -lambdaZ );
    matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, -1, 0 >(), -lambdaY );
    matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< -1, 0, 0 >(), -lambdaX );
@@ -296,4 +296,4 @@ updateLinearSystem( const RealType& time,
    matrixRow.setElement( 6, neighbourEntities.template getEntityIndex< 0, 0, 1 >(),   -lambdaZ );
 }
 
-#endif	/* TNLLINEARDIFFUSION_IMP_H */
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlNonlinearDiffusion_impl.h b/src/operators/diffusion/tnlNonlinearDiffusion_impl.h
index 88f0bae7ea1b840b24c3f37e73f5a2ba4874a69d..c80cc92e0eafad1ba597188f76fb368ec8c7eb98 100644
--- a/src/operators/diffusion/tnlNonlinearDiffusion_impl.h
+++ b/src/operators/diffusion/tnlNonlinearDiffusion_impl.h
@@ -1,11 +1,11 @@
 
-#ifndef TNLNONLINEARDIFFUSION_IMPL_H
-#define	TNLNONLINEARDIFFUSION_IMPL_H
+#pragma once
 
 #include "tnlNonlinearDiffusion.h"
-
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -71,7 +71,7 @@ template< typename MeshEntity,
 __cuda_callable__
 void
 tnlNonlinearDiffusion< tnlGrid< 1, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -80,7 +80,7 @@ updateLinearSystem( const RealType& time,
                     Vector& b,
                     Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.updateLinearSystem( time, tau, mesh, index, entity, u, b, matrix );
+    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
 template< typename MeshReal,
@@ -148,7 +148,7 @@ template< typename MeshEntity,
 __cuda_callable__
 void
 tnlNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -157,7 +157,7 @@ updateLinearSystem( const RealType& time,
                     Vector& b,
                     Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.updateLinearSystem( time, tau, mesh, index, entity, u, b, matrix );
+    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
 template< typename MeshReal,
@@ -225,7 +225,7 @@ template< typename MeshEntity,
 __cuda_callable__
 void
 tnlNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -234,7 +234,7 @@ updateLinearSystem( const RealType& time,
                     Vector& b,
                     Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.updateLinearSystem( time, tau, mesh, index, entity, u, b, matrix );
+    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
-#endif	/* TNLNONLINEARDIFFUSION_IMPL_H */
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlOneSidedMeanCurvature.h b/src/operators/diffusion/tnlOneSidedMeanCurvature.h
index 87386d89d8fe0145235e6b6c9f09b9226f536bbb..597ff6c9b1ba953377d4a284a61c34cde07f81c9 100644
--- a/src/operators/diffusion/tnlOneSidedMeanCurvature.h
+++ b/src/operators/diffusion/tnlOneSidedMeanCurvature.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLONESIDEDTOTALVARIATIONMINIMIZATION_H
-#define	TNLONESIDEDTOTALVARIATIONMINIMIZATION_H
+#pragma once
 
 #include <operators/tnlOperator.h>
 #include <operators/tnlFunctionInverseOperator.h>
@@ -27,6 +19,7 @@
 #include <functions/tnlConstantFunction.h>
 #include <operators/diffusion/tnlExactMeanCurvature.h>
 
+namespace TNL {
 
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
@@ -36,7 +29,7 @@ class tnlOneSidedMeanCurvature
    : public tnlOperator< Mesh, MeshInteriorDomain, Mesh::getMeshDimensions(), Mesh::getMeshDimensions(), Real, Index >
 {
    public:
-            
+ 
       typedef Mesh MeshType;
       typedef Real RealType;
       typedef Index IndexType;
@@ -48,40 +41,40 @@ class tnlOneSidedMeanCurvature
       typedef tnlOperatorFunction< NonlinearityOperator, NonlinearityMeshFunction, NonlinearityBoundaryConditions, EvaluateNonlinearityOnFly > Nonlinearity;
       typedef tnlOneSidedNonlinearDiffusion< Mesh, Nonlinearity, RealType, IndexType > NonlinearDiffusion;
       typedef tnlExactMeanCurvature< Mesh::getMeshDimensions(), RealType > ExactOperatorType;
-      
+ 
       tnlOneSidedMeanCurvature( const MeshType& mesh )
       : nonlinearityOperator( gradientNorm ),
         nonlinearity( nonlinearityOperator, nonlinearityBoundaryConditions, mesh ),
         nonlinearDiffusion( nonlinearity ){}
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlOneSidedMeanCurvature< " ) +
             MeshType::getType() + ", " +
             ::getType< Real >() + ", " +
-            ::getType< Index >() + " >";         
+            ::getType< Index >() + " >";
       }
-      
+ 
       void setRegularizationEpsilon( const RealType& eps )
       {
          this->gradientNorm.setEps( eps );
       }
-      
+ 
       void setPreimageFunction( typename Nonlinearity::PreimageFunctionType& preimageFunction )
       {
          this->nonlinearity.setPreimageFunction( preimageFunction );
       }
-      
+ 
       bool refresh( const RealType& time = 0.0 )
       {
          return this->nonlinearity.refresh( time );
       }
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 )
       {
          return this->nonlinearity.deepRefresh( time );
-      }      
-      
+      }
+ 
       template< typename MeshFunction,
                 typename MeshEntity >
       __cuda_callable__
@@ -106,7 +99,7 @@ class tnlOneSidedMeanCurvature
                 typename Vector,
                 typename Matrix >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -115,21 +108,20 @@ class tnlOneSidedMeanCurvature
                                Vector& b,
                                Matrix& matrix ) const
       {
-         this->nonlinearDiffusion.updateLinearSystem( time, tau, mesh, index, entity, u, b, matrix );
-      }            
-      
-   protected:      
-      
+         this->nonlinearDiffusion.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
+      }
+ 
+   protected:
+ 
       NonlinearityBoundaryConditions nonlinearityBoundaryConditions;
-      
+ 
       GradientNorm gradientNorm;
 
       NonlinearityOperator nonlinearityOperator;
-      
+ 
       Nonlinearity nonlinearity;
-      
-      NonlinearDiffusion nonlinearDiffusion;            
+ 
+      NonlinearDiffusion nonlinearDiffusion;
 };
 
-#endif	/* TNLONESIDEDTOTALVARIATIONMINIMIZATION_H */
-
+} // namespace TNL
diff --git a/src/operators/diffusion/tnlOneSidedNonlinearDiffusion.h b/src/operators/diffusion/tnlOneSidedNonlinearDiffusion.h
index 1eb186f934d4d7b6f705a53ec2518d11700a9715..46f52422374f700dfc1517213a0efd9ac1611936 100644
--- a/src/operators/diffusion/tnlOneSidedNonlinearDiffusion.h
+++ b/src/operators/diffusion/tnlOneSidedNonlinearDiffusion.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
-#ifndef TNLONESIDEDNONLINEARDIFFUSION_H
-#define	TNLONESIDEDNONLINEARDIFFUSION_H
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <mesh/tnlGrid.h>
 #include <operators/diffusion/tnlExactNonlinearDiffusion.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Nonlinearity,
           typename Real = typename Mesh::RealType,
@@ -39,8 +33,8 @@ template< typename MeshReal,
           typename Index >
 class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
@@ -52,15 +46,15 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, N
 
       tnlOneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
       : nonlinearity( nonlinearity ){}
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlOneSidedNonlinearDiffusion< " ) +
             MeshType::getType() + ", " +
             Nonlinearity::getType() + "," +
             ::getType< Real >() + ", " +
-            ::getType< Index >() + " >";         
-      }     
+            ::getType< Index >() + " >";
+      }
 
       template< typename MeshFunction,
                 typename MeshEntity >
@@ -71,7 +65,7 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, N
       {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const typename MeshEntity::MeshType& mesh = entity.getMesh();
-         const RealType& hx_div = mesh.template getSpaceStepsProducts< -2 >();
+         const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2 >();
          const IndexType& center = entity.getIndex();
          const IndexType& east = neighbourEntities.template getEntityIndex<  1 >();
          const IndexType& west = neighbourEntities.template getEntityIndex< -1 >();
@@ -80,7 +74,7 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, N
          const RealType u_x_b = ( u_c - u[ west ] );
          return ( u_x_f * this->nonlinearity[ center ] -
                   u_x_b * this->nonlinearity[ west ] ) * hx_div;
-         
+ 
       }
 
       template< typename MeshEntity >
@@ -92,30 +86,28 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, N
          return 3;
       }
 
-      template< typename MeshEntity,
-                typename MeshFunction,
-                typename Vector,
-                typename Matrix >
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const
+      inline 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( index );
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const IndexType& center = entity.getIndex();
          const IndexType& east = neighbourEntities.template getEntityIndex<  1 >();
          const IndexType& west = neighbourEntities.template getEntityIndex< -1 >();
-         const RealType lambda_x = tau * mesh.template getSpaceStepsProducts< -2 >();
+         const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2 >();
          const RealType& nonlinearity_center = this->nonlinearity[ center ];
          const RealType& nonlinearity_west = this->nonlinearity[ west ];
          const RealType aCoef = -lambda_x * nonlinearity_west;
-         const RealType bCoef = lambda_x * ( nonlinearity_center + nonlinearity_west );              
+         const RealType bCoef = lambda_x * ( nonlinearity_center + nonlinearity_west );
          const RealType cCoef = -lambda_x * nonlinearity_center;
          matrixRow.setElement( 0, west,   aCoef );
          matrixRow.setElement( 1, center, bCoef );
@@ -123,7 +115,7 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, N
       }
 
    public:
-       
+ 
       const Nonlinearity& nonlinearity;
 };
 
@@ -136,27 +128,27 @@ template< typename MeshReal,
           typename Index >
 class tnlOneSidedNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
       typedef Index IndexType;
       typedef Nonlinearity NonlinearityType;
-      typedef tnlExactNonlinearDiffusion< MeshType::getMeshDimensions(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType;      
+      typedef tnlExactNonlinearDiffusion< MeshType::getMeshDimensions(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType;
 
       tnlOneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
-      : nonlinearity( nonlinearity ){}      
-      
+      : nonlinearity( nonlinearity ){}
+ 
       static tnlString getType()
       {
          return tnlString( "tnlOneSidedNonlinearDiffusion< " ) +
             MeshType::getType() + ", " +
             Nonlinearity::getType() + "," +
             ::getType< Real >() + ", " +
-            ::getType< Index >() + " >";         
-      }      
+            ::getType< Index >() + " >";
+      }
 
       template< typename MeshFunction,
                 typename MeshEntity >
@@ -167,19 +159,19 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >,
       {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const typename MeshEntity::MeshType& mesh = entity.getMesh();
-         const RealType& hx_div = mesh.template getSpaceStepsProducts< -2,  0 >();
-         const RealType& hy_div = mesh.template getSpaceStepsProducts<  0, -2 >();
+         const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2,  0 >();
+         const RealType& hy_div = 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 >();         
+         const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >();
          const RealType& u_c = u[ center ];
          const RealType u_x_f = ( u[ east ] - u_c );
          const RealType u_x_b = ( u_c - u[ west ] );
          const RealType u_y_f = ( u[ north ] - u_c );
          const RealType u_y_b = ( u_c - u[ south ] );
-         
+ 
          const RealType& nonlinearity_center = this->nonlinearity[ center ];
          return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div +
                 ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hy_div;
@@ -194,19 +186,17 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >,
          return 5;
       }
 
-      template< typename MeshEntity,
-                typename MeshFunction,
-                typename Vector,
-                typename Matrix >
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const
+      inline 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( index );
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
@@ -214,9 +204,9 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >,
          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 >();                  
-         const RealType lambda_x = tau * mesh.template getSpaceStepsProducts< -2,  0 >();
-         const RealType lambda_y = tau * mesh.template getSpaceStepsProducts<  0, -2 >();
+         const IndexType& south = neighbourEntities.template getEntityIndex<  0, -1 >();
+         const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0 >();
+         const RealType lambda_y = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2 >();
          const RealType& nonlinearity_center = this->nonlinearity[ center ];
          const RealType& nonlinearity_west = this->nonlinearity[ west ];
          const RealType& nonlinearity_south = this->nonlinearity[ south ];
@@ -230,11 +220,11 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >,
          matrixRow.setElement( 1, west,   bCoef );
          matrixRow.setElement( 2, center, cCoef );
          matrixRow.setElement( 3, east,   dCoef );
-         matrixRow.setElement( 4, north,  eCoef );         
+         matrixRow.setElement( 4, north,  eCoef );
       }
-   
+ 
    public:
-       
+ 
       const Nonlinearity& nonlinearity;
 };
 
@@ -247,8 +237,8 @@ template< typename MeshReal,
           typename Index >
 class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
@@ -259,14 +249,14 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >,
 
       tnlOneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
       : nonlinearity( nonlinearity ){}
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlOneSidedNonlinearDiffusion< " ) +
             MeshType::getType() + ", " +
             Nonlinearity::getType() + "," +
             ::getType< Real >() + ", " +
-            ::getType< Index >() + " >";         
+            ::getType< Index >() + " >";
       }
 
       template< typename MeshFunction,
@@ -278,30 +268,30 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >,
       {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const typename MeshEntity::MeshType& mesh = entity.getMesh();
-         const RealType& hx_div = mesh.template getSpaceStepsProducts< -2,  0,  0 >();
-         const RealType& hy_div = mesh.template getSpaceStepsProducts<  0, -2,  0 >();
-         const RealType& hz_div = mesh.template getSpaceStepsProducts<  0,  0, -2 >();
+         const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >();
+         const RealType& hy_div = entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >();
+         const RealType& hz_div = 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 >();         
-         
+         const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >();
+ 
          const RealType& u_c = u[ center ];
          const RealType u_x_f = ( u[ east ] - u_c );
          const RealType u_x_b = ( u_c - u[ west ] );
          const RealType u_y_f = ( u[ north ] - u_c );
          const RealType u_y_b = ( u_c - u[ south ] );
          const RealType u_z_f = ( u[ up ] - u_c );
-         const RealType u_z_b = ( u_c - u[ down ] );         
-         
+         const RealType u_z_b = ( u_c - u[ down ] );
+ 
          const RealType& nonlinearity_center = this->nonlinearity[ center ];
          return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div +
                 ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hx_div +
                 ( u_z_f * nonlinearity_center - u_z_b * this->nonlinearity[ down ] ) * hz_div;
-         
+ 
       }
 
       template< typename MeshEntity >
@@ -313,19 +303,17 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >,
          return 7;
       }
 
-      template< typename MeshEntity,
-                typename MeshFunction,
-                typename Vector,                
-                typename Matrix >
+      template< typename PreimageFunction,
+                typename MeshEntity,
+                typename Matrix,
+                typename Vector >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const
+      inline 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( index );
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
@@ -335,12 +323,12 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >,
          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 >();                  
-         
-         
-         const RealType lambda_x = tau * mesh.template getSpaceStepsProducts< -2,  0,  0 >();
-         const RealType lambda_y = tau * mesh.template getSpaceStepsProducts<  0, -2,  0 >();
-         const RealType lambda_z = tau * mesh.template getSpaceStepsProducts<  0,  0, -2 >();
+         const IndexType& down  = neighbourEntities.template getEntityIndex<  0,  0, -1 >();
+ 
+ 
+         const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2,  0,  0 >();
+         const RealType lambda_y = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >();
+         const RealType lambda_z = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >();
          const RealType& nonlinearity_center = this->nonlinearity[ center ];
          const RealType& nonlinearity_west   = this->nonlinearity[ west ];
          const RealType& nonlinearity_south  = this->nonlinearity[ south ];
@@ -362,10 +350,10 @@ class tnlOneSidedNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >,
          matrixRow.setElement( 5, north,  fCoef );
          matrixRow.setElement( 5, up,     gCoef );
       }
-     
+ 
    public:
-       
+ 
       const Nonlinearity& nonlinearity;
 };
 
-#endif	/* TNLONESIDEDNONLINEARDIFFUSION_H */
+} // namespace TNL
diff --git a/src/operators/euler/fvm/tnlLaxFridrichs.h b/src/operators/euler/fvm/tnlLaxFridrichs.h
index c361c8278397426fe726a9123f768c126bf20354..2d2d95133e9f0b55fc2ac2ece132ef83a2e755fb 100644
--- a/src/operators/euler/fvm/tnlLaxFridrichs.h
+++ b/src/operators/euler/fvm/tnlLaxFridrichs.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLAXFRIDRICHS_H_
-#define TNLLAXFRIDRICHS_H_
+#pragma once
 
 #include <core/vectors/tnlSharedVector.h>
 #include <mesh/tnlGrid.h>
 #include <mesh/tnlIdenticalGridGeometry.h>
 #include <operators/gradient/tnlCentralFDMGradient.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename PressureGradient = tnlCentralFDMGradient< Mesh > >
 class tnlLaxFridrichs
@@ -168,6 +162,6 @@ class tnlLaxFridrichs< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry
    tnlSharedVector< RealType, DeviceType, IndexType > rho, rho_u1, rho_u2, energy, p;
 };
 
-#include <implementation/operators/euler/fvm/tnlLaxFridrichs_impl.h>
+} // namespace TNL
 
-#endif
+#include <implementation/operators/euler/fvm/tnlLaxFridrichs_impl.h>
diff --git a/src/operators/euler/fvm/tnlLaxFridrichs_impl.h b/src/operators/euler/fvm/tnlLaxFridrichs_impl.h
index 92cb7b70781005ced0dda7f658be5979a6e01214..f406dccc6b29f0b7c9b1faba2605c44ab3463083 100644
--- a/src/operators/euler/fvm/tnlLaxFridrichs_impl.h
+++ b/src/operators/euler/fvm/tnlLaxFridrichs_impl.h
@@ -6,18 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLLAXFRIDRICHS_IMPL_H_
-#define TNLLAXFRIDRICHS_IMPL_H_
+#pragma once
 
+namespace TNL {
 
 template< typename Real,
           typename Device,
@@ -526,5 +519,4 @@ Real tnlLaxFridrichs< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry
    return r + ( ( r >= 0 ) - ( r < 0 ) ) * this->regularizeEps;
 }
 
-
-#endif
+} // namespace TNL
diff --git a/src/operators/fdm/tnlBackwardFiniteDifference.h b/src/operators/fdm/tnlBackwardFiniteDifference.h
index f936b19b9d32f5cacfdc88aabb72042ee1f8c797..d34a5a7288d51bf74c384a8b174cc7839f4741dd 100644
--- a/src/operators/fdm/tnlBackwardFiniteDifference.h
+++ b/src/operators/fdm/tnlBackwardFiniteDifference.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLBACKWARDFINITEDIFFERENCE_H
-#define	TNLBACKWARDFINITEDIFFERENCE_H
+#pragma once
 
 #include <operators/fdm/tnlFiniteDifferences.h>
 #include <operators/fdm/tnlExactDifference.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Mesh,
           int Xdifference = 0,
           int YDifference = 0,
@@ -29,7 +23,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::IndexType >
 class tnlBackwardFiniteDifference
-{    
+{
 };
 
 template< int Dimensions,
@@ -46,15 +40,15 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
                       MeshInteriorDomain, Dimensions, Dimensions, Real, Index >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType;
       typedef Real RealType;
       typedef MeshDevice DeviceType;
       typedef Index IndexType;
       typedef tnlExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType;
-      
+ 
       static constexpr int getMeshDimensions() { return Dimensions; }
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlBackwardFiniteDifference< " ) +
@@ -65,7 +59,7 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
             ::getType< RealType >() + ", " +
             ::getType< IndexType >() + " >";
       }
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       inline Real operator()( const MeshFunction& u,
@@ -90,5 +84,5 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
       };
 };
 
-#endif	/* TNLBACKWARDFINITEDIFFERENCE_H */
+} // namespace TNL
 
diff --git a/src/operators/fdm/tnlCentralFiniteDifference.h b/src/operators/fdm/tnlCentralFiniteDifference.h
index f68f6a5d1a80a36afed4d129a9a6eab6658982cb..c4616d211b535e6783b357f5048f230bc22af19e 100644
--- a/src/operators/fdm/tnlCentralFiniteDifference.h
+++ b/src/operators/fdm/tnlCentralFiniteDifference.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCENTRALFINITEDIFFERENCE_H
-#define	TNLCENTRALFINITEDIFFERENCE_H
+#pragma once
 
 #include <operators/fdm/tnlFiniteDifferences.h>
 #include <operators/fdm/tnlExactDifference.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Mesh,
           int Xdifference = 0,
           int YDifference = 0,
@@ -29,7 +23,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::IndexType >
 class tnlCentralFiniteDifference
-{    
+{
 };
 
 template< int Dimensions,
@@ -46,15 +40,15 @@ class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
                       MeshInteriorDomain, Dimensions, Dimensions, Real, Index >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType;
       typedef Real RealType;
       typedef MeshDevice DeviceType;
       typedef Index IndexType;
       typedef tnlExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType;
-            
+ 
       //static constexpr int getMeshDimensions() { return Dimensions; }
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlCentralFiniteDifference< " ) +
@@ -66,7 +60,7 @@ class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
             ::getType< IndexType >() + " >";
       }
 
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       inline Real operator()( const MeshFunction& u,
@@ -79,6 +73,5 @@ class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
       };
 };
 
-
-#endif	/* TNLCENTRALFINITEDIFFERENCE_H */
+} // namespace TNL
 
diff --git a/src/operators/fdm/tnlExactDifference.h b/src/operators/fdm/tnlExactDifference.h
index bf1b7f766f5c98116479b6ff0b4da1fa5c8c8c68..d3fd2af8119f1357a5a75d3eff3899e5acc98c33 100644
--- a/src/operators/fdm/tnlExactDifference.h
+++ b/src/operators/fdm/tnlExactDifference.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTDIFFERENCE_H
-#define	TNLEXACTDIFFERENCE_H
+#pragma once
+
+namespace TNL {
 
 template< int Dimensions,
           int XDerivative,
@@ -26,7 +20,7 @@ class tnlExactDifference
    : public tnlDomain< Dimensions, SpaceDomain >
 {
    public:
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlExactDifference< " ) +
@@ -35,10 +29,10 @@ class tnlExactDifference
             tnlString( YDerivative ) + ", " +
             tnlString( ZDerivative ) + " >";
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType operator()( 
+      typename Function::RealType operator()(
          const Function& function,
          const typename Function::VertexType& vertex,
          const typename Function::RealType& time = 0 ) const
@@ -47,11 +41,10 @@ class tnlExactDifference
             XDerivative,
             YDerivative,
             ZDerivative >(
-            vertex, 
+            vertex,
             time );
       }
 };
 
-
-#endif	/* TNLEXACTDIFFERENCE_H */
+} // namespace TNL
 
diff --git a/src/operators/fdm/tnlFiniteDifferences.h b/src/operators/fdm/tnlFiniteDifferences.h
index ed8b1a02395a0b8e1fd624e3ab27dd860dba6cb8..9ac0434d0c6792f0260712fcfd9ff58df8a2dede 100644
--- a/src/operators/fdm/tnlFiniteDifferences.h
+++ b/src/operators/fdm/tnlFiniteDifferences.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLFINITEDIFFERENCES_H
-#define	TNLFINITEDIFFERENCES_H
+namespace TNL {
 
 template< typename Mesh,
           typename Real,
@@ -28,12 +22,12 @@ template< typename Mesh,
           int YDirection,
           int ZDirection >
 class tnlFiniteDifferences
-{   
+{
 };
 
+} // namespace TNL
+
 #include <operators/fdm/tnlFiniteDifferences_1D.h>
 #include <operators/fdm/tnlFiniteDifferences_2D.h>
 #include <operators/fdm/tnlFiniteDifferences_3D.h>
 
-#endif	/* TNLFINITEDIFFERENCES_H */
-
diff --git a/src/operators/fdm/tnlFiniteDifferences_1D.h b/src/operators/fdm/tnlFiniteDifferences_1D.h
index 4f62e08b6c8f486fc0f0c72068d16c694b034e19..922b092066cdec409d20ed43a41abf1c170f3bf5 100644
--- a/src/operators/fdm/tnlFiniteDifferences_1D.h
+++ b/src/operators/fdm/tnlFiniteDifferences_1D.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLFINITEDIFFERENCES_1D_H
-#define	TNLFINITEDIFFERENCES_1D_H
+namespace TNL {
 
 /***
  * Default implementation for case when one differentiate with respect
@@ -33,22 +27,22 @@ template< typename MeshReal,
           int XDirection,
           int YDirection,
           int ZDirection >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    XDifference, YDifference, ZDifference,
    XDirection, YDirection, ZDirection >
-{   
+{
    static_assert( YDifference != 0 || ZDifference != 0,
       "You try to use default finite difference with 'wrong' template parameters. It means that required finite difference was not implmented yet." );
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
       {
          return 0.0;
-      }            
+      }
 };
 
 /****
@@ -59,23 +53,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 1 >()] - u_c ) * hxDiv;
-      }            
+      }
 };
 
 /****
@@ -86,23 +80,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< -1 >()] ) * hxDiv;
-      }            
+      }
 };
 
 /****
@@ -113,23 +107,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
          return ( u[ neighbourEntities.template getEntityIndex< 1 >() ] -
                   u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * ( 0.5 * hxDiv );
-      }            
+      }
 };
 
 /****
@@ -140,25 +134,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -166,25 +160,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< -2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -192,27 +186,26 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 1 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
-
-#endif	/* TNLFINITEDIFFERENCES_1D_H */
+} // namespace TNL
 
diff --git a/src/operators/fdm/tnlFiniteDifferences_2D.h b/src/operators/fdm/tnlFiniteDifferences_2D.h
index a4151b3b7aa7785a2aa741d5b6b6d60bbc800237..7afc81aaba0ad45dc04f4dae141d69f6721e3ed1 100644
--- a/src/operators/fdm/tnlFiniteDifferences_2D.h
+++ b/src/operators/fdm/tnlFiniteDifferences_2D.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFINITEDIFFERENCES_2D_H
-#define	TNLFINITEDIFFERENCES_2D_H
+#pragma once
+
+namespace TNL {
 
 /***
  * Default implementation for case when one differentiate with respect
@@ -33,22 +27,22 @@ template< typename MeshReal,
           int XDirection,
           int YDirection,
           int ZDirection >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    XDifference, YDifference, ZDifference,
    XDirection, YDirection, ZDirection >
-{   
+{
    static_assert( ZDifference != 0,
       "You try to use default finite difference with 'wrong' template parameters. It means that required finite difference was not implmented yet." );
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
       {
          return 0.0;
-      }            
+      }
 };
 
 /****
@@ -59,23 +53,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 1, 0 >()] - u_c ) * hxDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -83,23 +77,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0, 1, 0,
    0, 1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 1 >()] - u_c ) * hyDiv;
-      }            
+      }
 };
 
 /****
@@ -110,23 +104,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1,  0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -134,23 +128,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0,  1, 0,
    0, -1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv;
-      }            
+      }
 };
 
 /****
@@ -161,23 +155,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >();
          return ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] -
                   u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * ( 0.5 * hxDiv );
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -185,23 +179,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0, 1, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
          return ( u[ neighbourEntities.template getEntityIndex< 0,  1 >() ] -
                   u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * ( 0.5 * hyDiv );
-      }            
+      }
 };
 
 
@@ -213,25 +207,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2,0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 2, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -239,25 +233,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< -2, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -265,25 +259,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex<  1, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -291,25 +285,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0, 2, 0,
    0 ,1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -317,25 +311,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0,  2, 0,
    0, -1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, -2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 
@@ -344,26 +338,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index,
    0, 2, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hySquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0,  1 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * hySquareDiv;
-      }            
+      }
 };
 
-#endif	/* TNLFINITEDIFFERENCES_2D_H */
-
+} // namespace TNL
\ No newline at end of file
diff --git a/src/operators/fdm/tnlFiniteDifferences_3D.h b/src/operators/fdm/tnlFiniteDifferences_3D.h
index 8e7a0c6b57401b4783124299846f328c3c652b73..f3a7640c0dc6acfd430a3830f12a1ededae2a588 100644
--- a/src/operators/fdm/tnlFiniteDifferences_3D.h
+++ b/src/operators/fdm/tnlFiniteDifferences_3D.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLFINITEDIFFERENCES_3D_H
-#define	TNLFINITEDIFFERENCES_3D_H
+namespace TNL {
 
 /****
  * 1st order forward difference
@@ -26,23 +20,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >()] - u_c ) * hxDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -50,23 +44,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 1, 0,
    0, 1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >()] - u_c ) * hyDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -74,23 +68,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0, 1,
    0, 0, 1 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >()] - u_c ) * hzDiv;
-      }            
+      }
 };
 
 /****
@@ -101,23 +95,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -125,23 +119,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0,  1, 0,
    0, -1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__      
+      __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -149,23 +143,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0,  1,
    0, 0, -1 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv;
-      }            
+      }
 };
 
 /****
@@ -176,23 +170,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    1, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
          return ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] -
                   u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * ( 0.5 * hxDiv );
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -200,23 +194,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 1, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
          return ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] -
                   u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * ( 0.5 * hyDiv );
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -224,23 +218,23 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0, 1,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
          return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] -
                   u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * ( 0.5 * hzDiv );
-      }            
+      }
 };
 
 /****
@@ -251,25 +245,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 2, 0, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -277,25 +271,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    -1, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< -2, 0, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -303,25 +297,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    2, 0, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex<  1, 0, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -329,25 +323,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 2, 0,
    0, 1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 2, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -355,25 +349,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0,  2, 0,
    0, -1, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, -2, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -381,25 +375,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 2, 0,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hySquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0,  1, 0 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hySquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -407,25 +401,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0, 2,
    0, 0 ,1 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -433,25 +427,25 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0,  2,
    0, 0, -1 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 0, -2 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxSquareDiv;
-      }            
+      }
 };
 
 template< typename MeshReal,
@@ -459,27 +453,26 @@ template< typename MeshReal,
           typename MeshIndex,
           typename Real,
           typename Index >
-class tnlFiniteDifferences< 
+class tnlFiniteDifferences<
    tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index,
    0, 0, 2,
    0, 0, 0 >
-{   
+{
    public:
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       static Real getValue( const MeshFunction& u,
                             const MeshEntity& entity )
-      {         
+      {
          const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
          const Real& hzSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >();
          const Real& u_c = u[ entity.getIndex() ];
          return ( u[ neighbourEntities.template getEntityIndex< 0, 0,  1 >() ] -
                   2.0 * u_c +
                   u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hzSquareDiv;
-      }            
+      }
 };
 
-
-#endif	/* TNLFINITEDIFFERENCES_3D_H */
+} // namespace TNL
 
diff --git a/src/operators/fdm/tnlForwardFiniteDifference.h b/src/operators/fdm/tnlForwardFiniteDifference.h
index 27990f1f53a21e91e9c854e134028cbe0ff8e61d..c86dd29bc9ae3abf007b650d45249449b8fa69a7 100644
--- a/src/operators/fdm/tnlForwardFiniteDifference.h
+++ b/src/operators/fdm/tnlForwardFiniteDifference.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFORWARDFINITEDIFFERENCE_H
-#define	TNLFORWARDFINITEDIFFERENCE_H
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <operators/fdm/tnlFiniteDifferences.h>
 #include <operators/fdm/tnlExactDifference.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Mesh,
           int Xdifference = 0,
           int YDifference = 0,
@@ -30,7 +24,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::IndexType >
 class tnlForwardFiniteDifference
-{    
+{
 };
 
 template< int Dimensions,
@@ -47,15 +41,15 @@ class tnlForwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
                       MeshInteriorDomain, Dimensions, Dimensions, Real, Index >
 {
    public:
-      
+ 
       typedef tnlGrid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType;
       typedef Real RealType;
       typedef MeshDevice DeviceType;
       typedef Index IndexType;
       typedef tnlExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType;
-      
+ 
       static constexpr int getMeshDimensions() { return Dimensions; }
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlForwardFiniteDifference< " ) +
@@ -67,7 +61,7 @@ class tnlForwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
             ::getType< IndexType >() + " >";
       }
 
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       inline Real operator()( const MeshFunction& u,
@@ -94,5 +88,5 @@ class tnlForwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
       }
 };
 
-#endif	/* TNLFORWARDFINITEDIFFERENCE_H */
+} // namespace TNL
 
diff --git a/src/operators/geometric/tnlCoFVMGradientNorm.h b/src/operators/geometric/tnlCoFVMGradientNorm.h
index 1402747bca7f941fd092bcf50a10cbdcfc16e613..9c4861403726fce8680f5d00d3d708f4111e6b04 100644
--- a/src/operators/geometric/tnlCoFVMGradientNorm.h
+++ b/src/operators/geometric/tnlCoFVMGradientNorm.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLCOFVMGRADIENTNORM_H
-#define	TNLCOFVMGRADIENTNORM_H
+#pragma once
 
 #include <mesh/tnlGrid.h>
 #include <operators/geometric/tnlExactGradientNorm.h>
@@ -24,12 +16,14 @@
 #include <operators/tnlOperator.h>
 #include <operators/tnlOperatorComposition.h>
 
+namespace TNL {
+
 template< typename Mesh,
           int MeshEntityDimensions = Mesh::getMeshDimensions(),
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType >
 class tnlCoFVMGradientNorm
-{   
+{
 };
 
 template< int MeshDimensions,
@@ -39,12 +33,12 @@ template< int MeshDimensions,
           typename Real,
           typename Index >
 class tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions, Real, Index >
-: public tnlOperatorComposition< 
+: public tnlOperatorComposition<
    tnlMeshEntitiesInterpolants< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >,
                                 MeshDimensions - 1,
                                 MeshDimensions >,
    tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions - 1, Real, Index > >
-{  
+{
    public:
       typedef tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
@@ -55,13 +49,13 @@ class tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex
       typedef tnlMeshEntitiesInterpolants< MeshType, MeshDimensions - 1, MeshDimensions > OuterOperator;
       typedef tnlOperatorComposition< OuterOperator, InnerOperator > BaseType;
       typedef tnlExactGradientNorm< MeshDimensions, RealType > ExactOperatorType;
-         
+ 
       tnlCoFVMGradientNorm( const OuterOperator& outerOperator,
                             InnerOperator& innerOperator,
                             const MeshType& mesh )
       : BaseType( outerOperator, innerOperator, mesh )
       {}
-      
+ 
       static tnlString getType()
       {
          return tnlString( "tnlCoFVMGradientNorm< " ) +
@@ -70,12 +64,12 @@ class tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex
             ::getType< Real >() + ", " +
             ::getType< Index >() + " >";
       }
-      
+ 
       void setEps( const RealType& eps )
       {
          this->getInnerOperator().setEps( eps );
       }
-      
+ 
       static constexpr int getPreimageEntitiesDimensions() { return MeshDimensions; };
       static constexpr int getImageEntitiesDimensions() { return MeshDimensions; };
 
@@ -89,18 +83,18 @@ template< typename MeshReal,
 class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, 0, Real, Index >
    : public tnlOperator< tnlGrid< 1,MeshReal, Device, MeshIndex >, MeshInteriorDomain, 1, 0, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 1, RealType > ExactOperatorType;
-   
+ 
    constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); };
    constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; };
-   
+ 
    tnlCoFVMGradientNorm()
    : epsSquare( 0.0 ){}
 
@@ -118,25 +112,25 @@ class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, 0, Real, I
                     const MeshEntity& entity,
                     const Real& time = 0.0 ) const
    {
-      static_assert( MeshFunction::getDimensions() == 1, 
+      static_assert( MeshFunction::getDimensions() == 1,
          "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getDimensions() == 0,
          "The complementary finite volume gradient norm may be evaluated only on faces." );
       const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.template getNeighbourEntities< 1 >();
-      
-      const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();      
+ 
+      const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
       const RealType& u_x = ( u[ neighbourEntities.template getEntityIndex<  1 >() ] -
                               u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxDiv;
-      return sqrt( this->epsSquare + ( u_x * u_x ) );          
+      return sqrt( this->epsSquare + ( u_x * u_x ) );
    }
-                
+ 
    void setEps( const Real& eps )
    {
       this->epsSquare = eps*eps;
    }
-      
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
@@ -149,18 +143,18 @@ template< typename MeshReal,
 class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real, Index >
    : public tnlOperator< tnlGrid< 2,MeshReal, Device, MeshIndex >, MeshInteriorDomain, 2, 1, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 2, RealType > ExactOperatorType;
-   
+ 
    constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); };
    constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; };
-   
+ 
    tnlCoFVMGradientNorm()
    : epsSquare( 0.0 ){}
 
@@ -173,14 +167,14 @@ class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real,
          ::getType< Index >() + " >";
 
    }
-      
+ 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
    Real operator()( const MeshFunction& u,
                     const MeshEntity& entity,
                     const Real& time = 0.0 ) const
-   {      
-      static_assert( MeshFunction::getDimensions() == 2, 
+   {
+      static_assert( MeshFunction::getDimensions() == 2,
          "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getDimensions() == 1,
          "The complementary finite volume gradient norm may be evaluated only on faces." );
@@ -191,28 +185,28 @@ class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real,
       {
          const RealType u_x =
             ( u[ neighbourEntities.template getEntityIndex<  1, 0 >()] -
-              u[ neighbourEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv;         
+              u[ neighbourEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv;
          RealType u_y;
          if( entity.getCoordinates().y() > 0 )
          {
             if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-               u_y = 0.25 * 
-                  ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] + 
-                    u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] - 
+               u_y = 0.25 *
+                  ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
+                    u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] -
                     u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] -
                     u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv;
             else // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-               u_y = 0.5 * 
-                  ( u[ neighbourEntities.template getEntityIndex<  1,  0 >() ] + 
-                    u[ neighbourEntities.template getEntityIndex< -1,  0 >() ] - 
+               u_y = 0.5 *
+                  ( u[ neighbourEntities.template getEntityIndex<  1,  0 >() ] +
+                    u[ neighbourEntities.template getEntityIndex< -1,  0 >() ] -
                     u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] -
                     u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv;
          }
          else // if( entity.getCoordinates().y() > 0 )
          {
-            u_y = 0.5 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] - 
+            u_y = 0.5 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
+                 u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1,  0 >() ] ) * hyDiv;
          }
@@ -222,23 +216,23 @@ class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real,
       if( entity.getCoordinates().x() > 0 )
       {
          if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-            u_x = 0.25 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] - 
+            u_x = 0.25 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv;
          else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-            u_x = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  0,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  0, -1 >() ] - 
+            u_x = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  0,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  0, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv;
       }
       else // if( entity.getCoordinates().x() > 0 )
       {
-         u_x = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] - 
+         u_x = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1 >() ] ) * hxDiv;
       }
@@ -247,14 +241,14 @@ class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real,
            u[ neighbourEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv;
       return sqrt( this->epsSquare + u_x * u_x + u_y * u_y );
    }
-           
+ 
    void setEps( const Real& eps )
    {
       this->epsSquare = eps*eps;
-   }   
-   
+   }
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
@@ -267,27 +261,27 @@ template< typename MeshReal,
 class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real, Index >
    : public tnlOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >, MeshInteriorDomain, 3, 2, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 3, RealType > ExactOperatorType;
-   
+ 
    constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); };
    constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; };
-   
+ 
    tnlCoFVMGradientNorm()
-   : epsSquare( 0.0 ){}   
+   : epsSquare( 0.0 ){}
 
    static tnlString getType()
    {
       return tnlString( "tnlCoFVMGradientNorm< " ) +
          MeshType::getType() + ", 2, " +
          ::getType< Real >() + ", " +
-         ::getType< Index >() + " >";      
+         ::getType< Index >() + " >";
    }
 
    template< typename MeshFunction, typename MeshEntity >
@@ -296,7 +290,7 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
                     const MeshEntity& entity,
                     const Real& time = 0.0 ) const
    {
-      static_assert( MeshFunction::getDimensions() == 3, 
+      static_assert( MeshFunction::getDimensions() == 3,
          "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getDimensions() == 2,
          "The complementary finite volume gradient norm may be evaluated only on faces." );
@@ -308,23 +302,23 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
       {
          const RealType u_x =
             ( u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >()] -
-              u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >()] ) * hxDiv;         
+              u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >()] ) * hxDiv;
          RealType u_y;
          if( entity.getCoordinates().y() > 0 )
          {
             if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
             {
-               u_y = 0.25 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] - 
+               u_y = 0.25 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1, -1,  0 >() ] ) * hyDiv;
             }
             else // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
             {
-               u_y = 0.5 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] - 
+               u_y = 0.5 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1, -1,  0 >() ] ) * hyDiv;
 
@@ -332,9 +326,9 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
          }
          else // if( entity.getCoordinates().y() > 0 )
          {
-            u_y = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] + 
-              u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] - 
+            u_y = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] +
+              u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] ) * hyDiv;
 
@@ -344,26 +338,26 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
          {
             if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.25 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] - 
+               u_z = 0.25 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] +
+                 u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1,  0, -1 >() ] ) * hzDiv;
             }
             else //if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.5 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] - 
+               u_z = 0.5 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1,  0, -1 >() ] ) * hzDiv;
             }
          }
          else //if( entity.getCoordinates().z() > 0 )
          {
-            u_z = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] - 
+            u_z = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] ) * hzDiv;
          }
@@ -376,26 +370,26 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
          {
             if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
             {
-               u_x = 0.25 * 
-               ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] - 
+               u_x = 0.25 *
+               ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1, -1,  0 >() ] ) * hxDiv;
             }
             else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
             {
-               u_x = 0.5 * 
-               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] - 
+               u_x = 0.5 *
+               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1,  1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex< -1, -1,  0 >() ] ) * hxDiv;
             }
          }
          else // if( entity.getCoordinates().x() > 0 )
          {
-            u_x = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] - 
+            u_x = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  1,  0 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  1, -1,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] ) * hxDiv;
          }
@@ -407,26 +401,26 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
          {
             if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.25 * 
-               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] - 
+               u_z = 0.25 *
+               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] +
+                 u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  0, -1, -1 >() ] ) * hzDiv;
             }
             else // if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.5 * 
-               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] + 
-                 u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] - 
+               u_z = 0.5 *
+               ( u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] +
+                 u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] -
                  u[ neighbourEntities.template getEntityIndex<  0, -1, -1 >() ] ) * hzDiv;
             }
          }
          else // if( entity.getCoordinates().z() > 0 )
          {
-            u_z = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] - 
+            u_z = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] ) * hzDiv;
          }
@@ -437,17 +431,17 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
       {
          if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
          {
-            u_x = 0.25 * 
-            ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] - 
+            u_x = 0.25 *
+            ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0, -1 >() ] ) * hxDiv;
          }
          else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
          {
-            u_x = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] - 
+            u_x = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex< -1,  0, -1 >() ] ) * hxDiv;
 
@@ -455,56 +449,56 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real,
       }
       else // if( entity.getCoordinates().x() > 0 )
       {
-         u_x = 0.5 * 
-         ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] + 
-           u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] - 
+         u_x = 0.5 *
+         ( u[ neighbourEntities.template getEntityIndex<  1,  0,  1 >() ] +
+           u[ neighbourEntities.template getEntityIndex<  1,  0, -1 >() ] -
            u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] -
-           u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] ) * hxDiv;         
+           u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] ) * hxDiv;
       }
       RealType u_y;
       if( entity.getCoordinates().y() > 0 )
       {
          if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-         {      
-            u_y = 0.25 * 
-            ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] - 
+         {
+            u_y = 0.25 *
+            ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1, -1 >() ] ) * hyDiv;
          }
          else //if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
          {
-            u_y = 0.5 * 
-            ( u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] + 
-              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] - 
+            u_y = 0.5 *
+            ( u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] +
+              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1,  1 >() ] -
               u[ neighbourEntities.template getEntityIndex<  0, -1, -1 >() ] ) * hyDiv;
          }
       }
       else //if( entity.getCoordinates().y() > 0 )
       {
-         u_y = 0.5 * 
-         ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] + 
-           u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] - 
+         u_y = 0.5 *
+         ( u[ neighbourEntities.template getEntityIndex<  0,  1,  1 >() ] +
+           u[ neighbourEntities.template getEntityIndex<  0,  1, -1 >() ] -
            u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] -
-           u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] ) * hyDiv;         
+           u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] ) * hyDiv;
       }
       const RealType u_z =
          ( u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >()] -
            u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >()] ) * hzDiv;
       return sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z );
    }
-   
-        
+ 
+ 
    void setEps(const Real& eps)
    {
       this->epsSquare = eps*eps;
-   }   
-   
+   }
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
-#endif	/* TNLCOFVMGRADIENTNORM_H */
+} // namespace TNL
 
diff --git a/src/operators/geometric/tnlExactGradientNorm.h b/src/operators/geometric/tnlExactGradientNorm.h
index 1b03c3cf12670d7a3826be7f70adc62908939a31..efe4bf3c2425838a08ebeffc72b9c3c42a3ccb8a 100644
--- a/src/operators/geometric/tnlExactGradientNorm.h
+++ b/src/operators/geometric/tnlExactGradientNorm.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTGRADIENTTNORM_H
-#define	TNLEXACTGRADIENTTNORM_H
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <mesh/tnlGrid.h>
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< int Dimensions,
           typename Real = double >
 class tnlExactGradientNorm
@@ -41,7 +35,7 @@ class tnlExactGradientNorm< 1, Real >
       {
          return "tnlExactGradientNorm< 1 >";
       }
-      
+ 
       tnlExactGradientNorm()
       : epsilonSquare( 0.0 ){};
 
@@ -49,20 +43,20 @@ class tnlExactGradientNorm< 1, Real >
       {
          this->epsilonSquare = epsilon*epsilon;
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          typedef typename Function::RealType RealType;
          const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-         return sqrt( this->epsilonSquare + f_x * f_x );         
+         return sqrt( this->epsilonSquare + f_x * f_x );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -76,23 +70,23 @@ class tnlExactGradientNorm< 1, Real >
             "Partial derivative must be non-negative integer." );
          static_assert( XDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
          typedef typename Function::RealType RealType;
-         
+ 
          if( XDerivative == 1 )
          {
             const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time ); 
+            const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
             const RealType Q = sqrt( this->epsilonSquare + f_x * f_x );
-            return ( f_x * f_xx ) / Q;         
+            return ( f_x * f_xx ) / Q;
          }
          if( XDerivative == 0 )
-            return this->operator()( function, v, time );         
+            return this->operator()( function, v, time );
          if( YDerivative != 0 || ZDerivative != 0 )
-            return 0.0;         
+            return 0.0;
       }
-      
+ 
       protected:
-         
-         Real epsilonSquare;      
+ 
+         Real epsilonSquare;
 };
 
 
@@ -109,7 +103,7 @@ class tnlExactGradientNorm< 2, Real >
       {
          return "tnlExactGradientNorm< 2 >";
       }
-      
+ 
       tnlExactGradientNorm()
       : epsilonSquare( 0.0 ){};
 
@@ -117,12 +111,12 @@ class tnlExactGradientNorm< 2, Real >
       {
          this->epsilonSquare = epsilon*epsilon;
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          typedef typename Function::RealType RealType;
@@ -130,8 +124,8 @@ class tnlExactGradientNorm< 2, Real >
          const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
          return sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -145,32 +139,32 @@ class tnlExactGradientNorm< 2, Real >
             "Partial derivative must be non-negative integer." );
          static_assert( XDerivative < 2 && YDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
          typedef typename Function::RealType RealType;
-         
+ 
          if( XDerivative == 1 && YDerivative == 0 )
          {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );            
+            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
             const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
             const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
             const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
-            return ( f_x *  f_xx + f_y * f_xy ) / sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );            
+            return ( f_x *  f_xx + f_y * f_xy ) / sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
          }
          if( XDerivative == 0 && YDerivative == 1 )
          {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );            
+            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
             const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
             const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
             const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
-            return ( f_x *  f_xy + f_y * f_yy ) / sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );                        
-         }         
+            return ( f_x *  f_xy + f_y * f_yy ) / sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
+         }
          if( XDerivative == 0 && YDerivative == 0 )
-            return this->operator()( function, v, time );         
+            return this->operator()( function, v, time );
          if( ZDerivative > 0 )
-            return 0.0;         
+            return 0.0;
       }
-      
+ 
       protected:
-         
-         Real epsilonSquare;      
+ 
+         Real epsilonSquare;
 };
 
 template< typename Real >
@@ -183,7 +177,7 @@ class tnlExactGradientNorm< 3, Real >
       {
          return "tnlExactGradientNorm< 3 >";
       }
-      
+ 
       tnlExactGradientNorm()
       : epsilonSquare( 0.0 ){};
 
@@ -191,22 +185,22 @@ class tnlExactGradientNorm< 3, Real >
       {
          this->epsilonSquare = epsilon*epsilon;
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          typedef typename Function::RealType RealType;
          const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
          const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
          const RealType f_z = function.template getPartialDerivative< 0, 0, 1 >( v, time );
-         return sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );                           
+         return sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -224,44 +218,44 @@ class tnlExactGradientNorm< 3, Real >
          typedef typename Function::RealType RealType;
          if( XDerivative == 1 && YDerivative == 0 && ZDerivative == 0 )
          {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );            
+            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
             const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
             const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
             const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
             const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
             const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
             return ( f_x *  f_xx + f_y * f_xy + f_z * f_xz ) /
-               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );            
+               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
          }
          if( XDerivative == 0 && YDerivative == 1 && ZDerivative == 0 )
          {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );            
+            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
             const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
             const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
             const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
             const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
             const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
-            return ( f_x *  f_xy + f_y * f_yy + f_z * f_yz ) / 
-               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );                        
-         }         
+            return ( f_x *  f_xy + f_y * f_yy + f_z * f_yz ) /
+               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
+         }
          if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 1 )
          {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );            
+            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
             const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
             const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
             const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
             const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
             const RealType f_zz = function.template getPartialDerivative< 0, 0, 2 >( v, time );
-            return ( f_x *  f_xz + f_y * f_yz + f_z * f_zz ) / 
-               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );                                    
+            return ( f_x *  f_xz + f_y * f_yz + f_z * f_zz ) /
+               sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
          }
          if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 0 )
-            return this->operator()( function, v, time );                  
+            return this->operator()( function, v, time );
       }
-      
+ 
       protected:
-         
-         Real epsilonSquare;      
+ 
+         Real epsilonSquare;
 };
 
-#endif	/* TNLEXACTGRADIENTTNORM_H */
+} // namespace TNL
diff --git a/src/operators/geometric/tnlFDMGradientNorm.h b/src/operators/geometric/tnlFDMGradientNorm.h
index 08d8a0a4a8611ba696ba902a5be1b4e4d66c2763..43207e6c15eb94e46c00d1c6be0d5ddf09a8b170 100644
--- a/src/operators/geometric/tnlFDMGradientNorm.h
+++ b/src/operators/geometric/tnlFDMGradientNorm.h
@@ -6,26 +6,20 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFDMGRADIENTNORM_H
-#define	TNLFDMGRADIENTNORM_H
+#pragma once
 
 #include <operators/fdm/tnlForwardFiniteDifference.h>
 #include <operators/geometric/tnlExactGradientNorm.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Mesh,
           template< typename, int, int, int, typename, typename > class DifferenceOperatorTemplate = tnlForwardFiniteDifference,
           typename Real = typename Mesh::RealType,
-          typename Index = typename Mesh::IndexType > 
+          typename Index = typename Mesh::IndexType >
 class tnlFDMGradientNorm
 {
 };
@@ -40,18 +34,18 @@ class tnlFDMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, DifferenceOp
    : public tnlOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 1, RealType > ExactOperatorType;
-   
+ 
    template< typename MeshEntity = typename MeshType::Cell >
    using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
-   
+ 
    tnlFDMGradientNorm()
    : epsSquare( 0.0 ){}
 
@@ -71,16 +65,16 @@ class tnlFDMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, DifferenceOp
    {
       XDifferenceOperatorType< MeshEntity > XDifference;
       const RealType u_x = XDifference( u, entity );
-      return sqrt( this->epsSquare + u_x * u_x );          
+      return sqrt( this->epsSquare + u_x * u_x );
    }
-                
+ 
    void setEps( const Real& eps )
    {
       this->epsSquare = eps*eps;
    }
-      
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
@@ -95,15 +89,15 @@ class tnlFDMGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, DifferenceOp
    : public tnlOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
       typedef Index IndexType;
       typedef tnlExactGradientNorm< 2, RealType > ExactOperatorType;
-      
+ 
       template< typename MeshEntity >
       using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
       template< typename MeshEntity >
@@ -132,7 +126,7 @@ class tnlFDMGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, DifferenceOp
          YDifferenceOperatorType< MeshEntity > YDifference;
          const RealType u_x = XDifference( u, entity );
          const RealType u_y = YDifference( u, entity );
-         return sqrt( this->epsSquare + u_x * u_x + u_y * u_y );       
+         return sqrt( this->epsSquare + u_x * u_x + u_y * u_y );
       }
 
 
@@ -140,10 +134,10 @@ class tnlFDMGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, DifferenceOp
       void setEps( const Real& eps )
       {
          this->epsSquare = eps*eps;
-      }   
-   
+      }
+ 
    private:
-   
+ 
       RealType epsSquare;
 };
 
@@ -158,15 +152,15 @@ class tnlFDMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, DifferenceO
    : public tnlOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public: 
-   
+   public:
+ 
       typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
       typedef Index IndexType;
       typedef tnlExactGradientNorm< 3, RealType > ExactOperatorType;
-   
+ 
       template< typename MeshEntity >
       using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
       template< typename MeshEntity >
@@ -174,16 +168,16 @@ class tnlFDMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, DifferenceO
       template< typename MeshEntity >
       using ZDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 0, 1, Real, Index >;
 
-   
+ 
       tnlFDMGradientNorm()
-      : epsSquare( 0.0 ){}   
+      : epsSquare( 0.0 ){}
 
       static tnlString getType()
       {
          return tnlString( "tnlFDMGradientNorm< " ) +
             MeshType::getType() + ", " +
             ::getType< Real >() + ", " +
-            ::getType< Index >() + " >";      
+            ::getType< Index >() + " >";
       }
 
       template< typename MeshFunction, typename MeshEntity >
@@ -199,20 +193,19 @@ class tnlFDMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, DifferenceO
          const RealType u_x = XDifference( u, entity );
          const RealType u_y = YDifference( u, entity );
          const RealType u_z = ZDifference( u, entity );
-         return sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z );             
+         return sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z );
       }
 
 
       void setEps(const Real& eps)
       {
          this->epsSquare = eps*eps;
-      }   
-   
+      }
+ 
    private:
-   
+ 
       RealType epsSquare;
 };
 
-
-#endif	/* TNLFDMGRADIENTNORM_H */
+} // namespace TNL
 
diff --git a/src/operators/geometric/tnlTwoSidedGradientNorm.h b/src/operators/geometric/tnlTwoSidedGradientNorm.h
index 5b5157e2b4398dbd1e05eda3a9d7626a805f9e24..109433db9d8cf95741e4e4cdb3ffc7884718d647 100644
--- a/src/operators/geometric/tnlTwoSidedGradientNorm.h
+++ b/src/operators/geometric/tnlTwoSidedGradientNorm.h
@@ -6,26 +6,20 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLTWOSIDEDGRADIENTNORM_H
-#define	TNLTWOSIDEDGRADIENTNORM_H
+#pragma once
 
 #include <operators/fdm/tnlForwardFiniteDifference.h>
 #include <operators/fdm/tnlBackwardFiniteDifference.h>
 #include <operators/geometric/tnlExactGradientNorm.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
-          typename Index = typename Mesh::IndexType > 
+          typename Index = typename Mesh::IndexType >
 class tnlTwoSidedGradientNorm
 {
 };
@@ -39,15 +33,15 @@ class tnlTwoSidedGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, I
    : public tnlOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 1, RealType > ExactOperatorType;
-   
+ 
    tnlTwoSidedGradientNorm()
    : epsSquare( 0.0 ){}
 
@@ -69,16 +63,16 @@ class tnlTwoSidedGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, I
       tnlBackwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XBackwardDifference;
       const RealType u_x_f = XForwardDifference( u, entity );
       const RealType u_x_b = XBackwardDifference( u, entity );
-      return sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b ) );          
+      return sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b ) );
    }
-                
+ 
    void setEps( const Real& eps )
    {
       this->epsSquare = eps*eps;
    }
-      
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
@@ -92,15 +86,15 @@ class tnlTwoSidedGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, I
    : public tnlOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 2, RealType > ExactOperatorType;
-   
+ 
    tnlTwoSidedGradientNorm()
    : epsSquare( 0.0 ){}
 
@@ -113,13 +107,13 @@ class tnlTwoSidedGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, I
          ::getType< Index >() + " >";
 
    }
-      
+ 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
    Real operator()( const MeshFunction& u,
                     const MeshEntity& entity,
                     const Real& time = 0.0 ) const
-   {      
+   {
       tnlForwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XForwardDifference;
       tnlForwardFiniteDifference< typename MeshEntity::MeshType, 0, 1, 0, Real, Index > YForwardDifference;
       tnlBackwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XBackwardDifference;
@@ -128,20 +122,20 @@ class tnlTwoSidedGradientNorm< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, I
       const RealType u_x_b = XBackwardDifference( u, entity );
       const RealType u_y_f = YForwardDifference( u, entity );
       const RealType u_y_b = YBackwardDifference( u, entity );
-      
+ 
       return sqrt( this->epsSquare +
-         0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b + 
-                 u_y_f * u_y_f + u_y_b * u_y_b ) );          
+         0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
+                 u_y_f * u_y_f + u_y_b * u_y_b ) );
    }
-           
+ 
    void setEps( const Real& eps )
    {
       this->epsSquare = eps*eps;
-   }   
-   
-   
+   }
+ 
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
@@ -155,24 +149,24 @@ class tnlTwoSidedGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real,
    : public tnlOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >,
                          MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public: 
-   
+   public:
+ 
    typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef tnlExactGradientNorm< 3, RealType > ExactOperatorType;
-   
+ 
    tnlTwoSidedGradientNorm()
-   : epsSquare( 0.0 ){}   
+   : epsSquare( 0.0 ){}
 
    static tnlString getType()
    {
       return tnlString( "tnlTwoSidedGradientNorm< " ) +
          MeshType::getType() + ", " +
          ::getType< Real >() + ", " +
-         ::getType< Index >() + " >";      
+         ::getType< Index >() + " >";
    }
 
    template< typename MeshFunction, typename MeshEntity >
@@ -193,25 +187,24 @@ class tnlTwoSidedGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real,
       const RealType u_y_b = YBackwardDifference( u, entity );
       const RealType u_z_f = ZForwardDifference( u, entity );
       const RealType u_z_b = ZBackwardDifference( u, entity );
-      
+ 
       return sqrt( this->epsSquare +
          0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
                  u_y_f * u_y_f + u_y_b * u_y_b +
-                 u_z_f * u_z_f + u_z_b * u_z_b ) );          
-      
+                 u_z_f * u_z_f + u_z_b * u_z_b ) );
+ 
    }
-   
-        
+ 
+ 
    void setEps(const Real& eps)
    {
       this->epsSquare = eps*eps;
-   }   
-   
+   }
+ 
    private:
-   
+ 
    RealType epsSquare;
 };
 
-
-#endif	/* TNLTWOSIDEDGRADIENTNORM_H */
+} // namespace TNL
 
diff --git a/src/operators/interpolants/tnlMeshEntitiesInterpolants.h b/src/operators/interpolants/tnlMeshEntitiesInterpolants.h
index 2baac346cd71a534e0cdf255e9280c49eb0d8894..d1a5268d20db19fc85046eb5352e6eed051b5f46 100644
--- a/src/operators/interpolants/tnlMeshEntitiesInterpolants.h
+++ b/src/operators/interpolants/tnlMeshEntitiesInterpolants.h
@@ -6,30 +6,24 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMESHENTITIESINTERPOLANTS_H
-#define	TNLMESHENTITIESINTERPOLANTS_H
+#pragma once
 
 #include <type_traits>
 #include<functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename Mesh,
           int InEntityDimensions,
           int OutEntityDimenions >
 class tnlMeshEntitiesInterpolants
-{   
+{
 };
 
 /***
- * 1D grid mesh entity interpolation: 1 -> 0 
+ * 1D grid mesh entity interpolation: 1 -> 0
  */
 template< typename Real,
           typename Device,
@@ -38,7 +32,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 1, Real, Device, Index >, 1, 0 >
    : public tnlDomain< 1, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -52,16 +46,16 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 1, Real, Device, Index >, 1, 0 >
 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
             "The mesh entity belongs to other mesh type then the interpolants." );
-         
-         const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();      
-         
-         return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] + 
+ 
+         const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities();
+ 
+         return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] +
                         u[ neighbourEntities.template getEntityIndex<  1 >() ] );
       }
 };
 
 /***
- * 1D grid mesh entity interpolation: 0 -> 1 
+ * 1D grid mesh entity interpolation: 0 -> 1
  */
 template< typename Real,
           typename Device,
@@ -70,7 +64,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 1, Real, Device, Index >, 0, 1 >
    : public tnlDomain< 1, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -81,19 +75,19 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 1, Real, Device, Index >, 0, 1 >
       {
          static_assert( MeshFunction::getEntitiesDimensions() == 0,
             "Mesh function must be defined on vertices (or faces in case on 1D grid)." );
-         
+ 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.template getNeighbourEntities< 0 >();      
-         
-         return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] + 
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.template getNeighbourEntities< 0 >();
+ 
+         return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] +
                         u[ neighbourEntities.template getEntityIndex<  1 >() ] );
       }
 };
 
 /***
- * 2D grid mesh entity interpolation: 2 -> 1 
+ * 2D grid mesh entity interpolation: 2 -> 1
  */
 template< typename Real,
           typename Device,
@@ -102,9 +96,9 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 2, 1 >
    : public tnlDomain< 2, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > MeshType;
-      
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       Real operator()( const MeshFunction& u,
@@ -113,23 +107,23 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 2, 1 >
       {
          static_assert( MeshFunction::getEntityDimensions() == 2,
             "Mesh function must be defined on cells." );
-         
+ 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();      
-         
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
+ 
          if( entity.getOrientation().x() == 1.0 )
-            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + 
+            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] +
                            u[ neighbourEntities.template getEntityIndex<  1, 0 >() ] );
          else
-            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] + 
+            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] +
                            u[ neighbourEntities.template getEntityIndex< 0,  1 >() ] );
       }
 };
 
 /***
- * 2D grid mesh entity interpolation: 2 -> 0 
+ * 2D grid mesh entity interpolation: 2 -> 0
  */
 template< typename Real,
           typename Device,
@@ -138,7 +132,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 2, 0 >
    : public tnlDomain< 2, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -149,21 +143,21 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 2, 0 >
       {
          static_assert( MeshFunction::getEntityDimensions() == 2,
             "Mesh function must be defined on cells." );
-         
+ 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();      
-                  
-         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] + 
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();
+ 
+         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
-                         u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] + 
+                         u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] );
       }
 };
 
 /***
- * 2D grid mesh entity interpolation: 1 -> 2 
+ * 2D grid mesh entity interpolation: 1 -> 2
  */
 template< typename Real,
           typename Device,
@@ -172,7 +166,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 1, 2 >
    : public tnlDomain< 2, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -183,21 +177,21 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 1, 2 >
       {
          static_assert( MeshFunction::getEntitiesDimensions() == 1,
             "Mesh function must be defined on faces." );
-         
+ 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.template getNeighbourEntities< 1 >();      
-                  
-         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  0 >() ] + 
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.template getNeighbourEntities< 1 >();
+ 
+         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  0 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  1,  0 >() ] +
-                         u[ neighbourEntities.template getEntityIndex<  0,  1 >() ] + 
+                         u[ neighbourEntities.template getEntityIndex<  0,  1 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  0, -1 >() ] );
       }
 };
 
 /***
- * 2D grid mesh entity interpolation: 0 -> 2 
+ * 2D grid mesh entity interpolation: 0 -> 2
  */
 template< typename Real,
           typename Device,
@@ -206,7 +200,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 0, 2 >
    : public tnlDomain< 2, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -219,19 +213,19 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 2, Real, Device, Index >, 0, 2 >
             "Mesh function must be defined on vertices." );
 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.getNeighbourEntities();      
-                  
-         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] + 
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.getNeighbourEntities();
+ 
+         return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1,  1 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  1,  1 >() ] +
-                         u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] + 
+                         u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] +
                          u[ neighbourEntities.template getEntityIndex<  1, -1 >() ] );
       }
 };
 
 /***
- * 3D grid mesh entity interpolation: 3 -> 2 
+ * 3D grid mesh entity interpolation: 3 -> 2
  */
 template< typename Real,
           typename Device,
@@ -240,7 +234,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 3, Real, Device, Index >, 3, 2 >
    : public tnlDomain< 3, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -253,24 +247,24 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 3, Real, Device, Index >, 3, 2 >
             "Mesh function must be defined on cells." );
 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();      
-                  
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities();
+ 
          if( entity.getOrientation().x() == 1.0 )
-            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] + 
+            return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] +
                            u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] );
          if( entity.getOrientation().y() == 1.0 )
-            return 0.5 * ( u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] + 
+            return 0.5 * ( u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] +
                            u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] );
          else
-            return 0.5 * ( u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] + 
-                           u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] );            
+            return 0.5 * ( u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] +
+                           u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] );
       }
 };
 
 /***
- * 3D grid mesh entity interpolation: 2 -> 3 
+ * 3D grid mesh entity interpolation: 2 -> 3
  */
 template< typename Real,
           typename Device,
@@ -279,7 +273,7 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 3, Real, Device, Index >, 2, 3 >
    : public tnlDomain< 3, MeshInteriorDomain >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > MeshType;
 
       template< typename MeshFunction, typename MeshEntity >
@@ -292,18 +286,18 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 3, Real, Device, Index >, 2, 3 >
             "Mesh function must be defined on faces." );
 
          static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
-            "The mesh entity belongs to other mesh type then the interpolants." );         
-         
-         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.template getNeighbourEntities< 2 >();      
-                  
-         return 1.0 / 6.0 * ( u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] + 
+            "The mesh entity belongs to other mesh type then the interpolants." );
+ 
+         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.template getNeighbourEntities< 2 >();
+ 
+         return 1.0 / 6.0 * ( u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] +
                               u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] +
-                              u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] + 
+                              u[ neighbourEntities.template getEntityIndex<  0, -1,  0 >() ] +
                               u[ neighbourEntities.template getEntityIndex<  0,  1,  0 >() ] +
-                              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] + 
-                              u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] );            
+                              u[ neighbourEntities.template getEntityIndex<  0,  0, -1 >() ] +
+                              u[ neighbourEntities.template getEntityIndex<  0,  0,  1 >() ] );
       }
 };
 
-#endif	/* TNLMESHENTITIESINTERPOLANTS_H */
+} // namespace TNL
 
diff --git a/src/operators/operator-Q/tnlFiniteVolumeOperatorQ.h b/src/operators/operator-Q/tnlFiniteVolumeOperatorQ.h
index 59306c15b6811c6ca14708420929718aeca73747..2a425a428989fe6b2327bb076770021f975225e0 100644
--- a/src/operators/operator-Q/tnlFiniteVolumeOperatorQ.h
+++ b/src/operators/operator-Q/tnlFiniteVolumeOperatorQ.h
@@ -1,10 +1,21 @@
-#ifndef TNLFINITEVOLUMEOPERATORQ_H
-#define	TNLFINITEVOLUMEOPERATORQ_H
+/***************************************************************************
+                          tnlFiniteVolumeOperatorQ.h  -  description
+                             -------------------
+    begin                : Jan 25, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType,
@@ -337,7 +348,6 @@ class tnlFiniteVolumeOperatorQ< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real,
       RealType eps;
 };
 
-#include <operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h>
-
+} // namespace TNL
 
-#endif	/* TNLFINITEVOLUMEOPERATORQ_H */
+#include <operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h>
diff --git a/src/operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h b/src/operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
index e08da5fae295296cc5d8cbcec84c9e3b39454a01..a45128e2e7198ad5b22ac842c2eef3e6aed73844 100644
--- a/src/operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
+++ b/src/operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
@@ -1,10 +1,20 @@
+/***************************************************************************
+                          tnlFiniteVolumeOperatorQ_impl.h  -  description
+                             -------------------
+    begin                : Jan 25, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
 
-#ifndef TNLFINITEVOLUMEOPERATORQ_IMPL_H
-#define	TNLFINITEVOLUMEOPERATORQ_IMPL_H
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <operators/operator-Q/tnlFiniteVolumeOperatorQ.h>
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -614,4 +624,5 @@ operator()(
                this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 0, -1 ) );
     return 0.0;
 }
-#endif	/* TNLFINITEVOLUMEOPERATORQ_IMPL_H */
+
+} // namespace TNL
diff --git a/src/operators/operator-Q/tnlOneSideDiffOperatorQ.h b/src/operators/operator-Q/tnlOneSideDiffOperatorQ.h
index 491fab0c91ef0438cec795ad451e3a66298d21d2..59a909e8c32148e652586c94361fe3e770943763 100644
--- a/src/operators/operator-Q/tnlOneSideDiffOperatorQ.h
+++ b/src/operators/operator-Q/tnlOneSideDiffOperatorQ.h
@@ -1,10 +1,21 @@
-#ifndef TNLONESIDEDIFFOPERATORQ_H
-#define	TNLONESIDEDIFFOPERATORQ_H
+/***************************************************************************
+                          tnlOneSidedDiffOperatorQ.h  -  description
+                             -------------------
+    begin                : Jan 25, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType > 
@@ -123,7 +134,6 @@ class tnlOneSideDiffOperatorQ< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real,
    RealType eps, epsSquare;
 };
 
-#include <operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h>
-
+} // namespace TNL
 
-#endif	/* TNLONESIDEDIFFOPERATORQ_H */
+#include <operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h>
diff --git a/src/operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h b/src/operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
index 19cacbe34faaad2884d194248d84b30847f17975..4acc1ab78ffee46f4e90595e5382d7579883f0ff 100644
--- a/src/operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
+++ b/src/operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
@@ -1,10 +1,20 @@
+/***************************************************************************
+                          tnlOndeSidedDiffOperatorQ_impl.h  -  description
+                             -------------------
+    begin                : Jan 25, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
 
-#ifndef TNLONESIDEDIFFOPERATORQ_IMPL_H
-#define	TNLONESIDEDIFFOPERATORQ_IMPL_H
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -257,4 +267,5 @@ getValueStriped( const MeshFunction& u,
                         u_y_f * u_y_f + u_y_b * u_y_b + 
                         u_z_f * u_z_f + u_z_b * u_z_b ) );
 }   
-#endif	/* TNLONESIDEDIFFOPERATORQ_IMPL_H */
+
+} // namespace TNL
diff --git a/src/operators/operator-curvature/tnlExactOperatorCurvature.h b/src/operators/operator-curvature/tnlExactOperatorCurvature.h
index d0fee9c1b07da3e455318d872fbd56dee599d4aa..210c0da7574362f2a5d1c82e90aaf144bd13631d 100644
--- a/src/operators/operator-curvature/tnlExactOperatorCurvature.h
+++ b/src/operators/operator-curvature/tnlExactOperatorCurvature.h
@@ -1,11 +1,22 @@
-#ifndef TNLEXACTOPERATORCURVATURE_H
-#define	TNLEXACTOPERATORCURVATURE_H
+/***************************************************************************
+                          tnlExactOperatorCurvature.h  -  description
+                             -------------------
+    begin                : Jan 25, 2016
+    copyright            : (C) 2016 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <mesh/tnlGrid.h>
 #include <functions/tnlFunction.h>
 
+namespace TNL {
+
 template< typename ExactOperatorQ, int Dimensions >
 class tnlExactOperatorCurvature
 {};
@@ -87,7 +98,6 @@ class tnlFunctionType< tnlExactOperatorCurvature< ExactOperatorQ, Dimensions > >
       enum { Type = tnlSpaceDomain };
 };
 
-#include <operators/operator-curvature/tnlExactOperatorCurvature_impl.h>
-
+} // namespace TNL
 
-#endif	/* TNLEXACTOPERATORCURVATURE_H */
+#include <operators/operator-curvature/tnlExactOperatorCurvature_impl.h>
diff --git a/src/operators/operator-curvature/tnlExactOperatorCurvature_impl.h b/src/operators/operator-curvature/tnlExactOperatorCurvature_impl.h
index f09f59bd835afc9eddd78b5eb8d52e5702b3873d..cba4dd3420eeffe9daeed4032102d977d065d72e 100644
--- a/src/operators/operator-curvature/tnlExactOperatorCurvature_impl.h
+++ b/src/operators/operator-curvature/tnlExactOperatorCurvature_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTOPERATORCURVATURE_IMPL_H_
-#define TNLEXACTOPERATORCURVATURE_IMPL_H_
+#pragma once
 
 #include <operators/operator-curvature/tnlExactOperatorCurvature.h>
 
+namespace TNL {
+
 template< typename ExactOperatorQ >
 tnlString
 tnlExactOperatorCurvature< ExactOperatorQ, 1 >::
@@ -70,8 +64,8 @@ getValue( const Function& function,
         return 0.0;
    if (XDiffOrder == 0 && YDiffOrder == 0 )
         return ( function.template getValue< 2, 0, 0, Vertex >( v, time ) * function.template getValue< 0, 2, 0, Vertex >( v, time ) )
-               /ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - ( function.template getValue< 1, 0, 0, Vertex >( v, time ) * 
-               ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) + function.template getValue< 0, 1, 0, Vertex >( v, time ) * 
+               /ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - ( function.template getValue< 1, 0, 0, Vertex >( v, time ) *
+               ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) + function.template getValue< 0, 1, 0, Vertex >( v, time ) *
                ExactOperatorQ::template getValue< 0, 1, 0 >( function, v, time, eps ) )
                 / ( ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) * ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) );
    return 0;
@@ -85,4 +79,4 @@ getType()
    return "tnlExactOperatorCurvature< " + ExactOperatorQ::getType() + ",3 >";
 }
 
-#endif /* TNLEXACTOPERATORCURVATURE_IMPL_H_ */
+} //namespace TNL
diff --git a/src/operators/tnlDirichletBoundaryConditions.h b/src/operators/tnlDirichletBoundaryConditions.h
index 01f55a1e8e6861f2db5d0a8f6458acbd70ee284b..4faf390ffe00fa168541326a570d0fab0b64b575 100644
--- a/src/operators/tnlDirichletBoundaryConditions.h
+++ b/src/operators/tnlDirichletBoundaryConditions.h
@@ -6,20 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLDIRICHLETBOUNDARYCONDITIONS_H_
-#define TNLDIRICHLETBOUNDARYCONDITIONS_H_
+#pragma once
 
 #include <operators/tnlOperator.h>
 #include <functions/tnlConstantFunction.h>
+#include <functions/tnlFunctionAdapter.h>
+
+namespace TNL {
 
 template< typename Mesh,
           typename Function = tnlConstantFunction< Mesh::getMeshDimensions(), typename Mesh::RealType >,
@@ -36,58 +31,87 @@ class tnlDirichletBoundaryConditions
 {
    public:
 
-   typedef Mesh MeshType;
-   typedef Function FunctionType;
-   typedef Real RealType;
-   typedef typename MeshType::DeviceType DeviceType;
-   typedef Index IndexType;
-  
-   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
-   typedef typename MeshType::VertexType VertexType;
-   
-   static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
-
-   static void configSetup( tnlConfigDescription& config,
-                            const tnlString& prefix = "" );
-
-   bool setup( const tnlParameterContainer& parameters,
-               const tnlString& prefix = "" );
-
-   void setFunction( const Function& function );
-   
-   Function& getFunction();
-
-   const Function& getFunction() const;
-   
-   template< typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-   const RealType operator()( const MeshFunction& u,
-                              const EntityType& entity,                            
-                              const RealType& time = 0 ) const;
-   
-   template< typename EntityType >
-   __cuda_callable__
-   IndexType getLinearSystemRowLength( const MeshType& mesh,
-                                       const IndexType& index,
-                                       const EntityType& entity ) const;
-
-   template< typename MatrixRow,
-             typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const EntityType& entity,
-                               const MeshFunction& u,
-                               DofVectorType& b,
-                               MatrixRow& matrixRow ) const;
+      typedef Mesh MeshType;
+      typedef Function FunctionType;
+      typedef Real RealType;
+      typedef typename MeshType::DeviceType DeviceType;
+      typedef Index IndexType;
+
+      typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef typename MeshType::VertexType VertexType;
+
+      static constexpr int getMeshDimensions() { return MeshType::meshDimensions; }
+
+      static void configSetup( tnlConfigDescription& config,
+                               const tnlString& prefix = "" )
+      {
+         Function::configSetup( config, prefix );
+      }
+ 
+      bool setup( const tnlParameterContainer& parameters,
+                  const tnlString& prefix = "" )
+      {
+         return this->function.setup( 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
+      {
+         //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
+         return tnlFunctionAdapter< MeshType, Function >::template getValue( this->function, entity, time );
+      }
+
+      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 ] = tnlFunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+      }
+ 
 
    protected:
 
-   Function function;
-   
+      Function function;
+ 
    //static_assert( Device::DeviceType == Function::Device::DeviceType );
 };
 
@@ -99,6 +123,4 @@ ostream& operator << ( ostream& str, const tnlDirichletBoundaryConditions< Mesh,
    return str;
 }
 
-#include <operators/tnlDirichletBoundaryConditions_impl.h>
-
-#endif /* TNLDIRICHLETBOUNDARYCONDITIONS_H_ */
+} // namespace TNL
diff --git a/src/operators/tnlDirichletBoundaryConditions_impl.h b/src/operators/tnlDirichletBoundaryConditions_impl.h
deleted file mode 100644
index f78db6237a04fe3ac07afa66497c15237dc9a947..0000000000000000000000000000000000000000
--- a/src/operators/tnlDirichletBoundaryConditions_impl.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/***************************************************************************
-                          tnlDirichletBoundaryConditions_impl.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 TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H_
-#define TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H_
-
-#include <functions/tnlFunctionAdapter.h>
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-void
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-configSetup( tnlConfigDescription& config,
-             const tnlString& prefix )
-{
-   Function::configSetup( config, prefix );
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-bool
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-setup( const tnlParameterContainer& parameters,
-       const tnlString& prefix )
-{
-   return this->function.setup( parameters, prefix );
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-void
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-setFunction( const Function& function )
-{
-   this->function = function;
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-Function&
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-getFunction()
-{
-   return this->function;
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-const Function&
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-getFunction() const
-{
-   return *this->function;
-}
-
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-template< typename EntityType,
-          typename MeshFunction >
-__cuda_callable__
-const Real
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-operator()( const MeshFunction& u,
-            const EntityType& entity,            
-            const RealType& time ) const
-{
-   //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." );
-   return tnlFunctionAdapter< MeshType, Function >::template getValue( this->function, entity, time );
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-   template< typename EntityType >
-__cuda_callable__
-Index
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const EntityType& entity ) const
-{
-   return 1;
-}
-
-template< typename Mesh,
-          typename Function,
-          int MeshEntitiesDimensions,
-          typename Real,
-          typename Index >
-   template< typename Matrix,
-             typename EntityType,
-             typename MeshFunction >
-__cuda_callable__
-void
-tnlDirichletBoundaryConditions< Mesh, Function, MeshEntitiesDimensions, Real, Index >::
-updateLinearSystem( const RealType& time,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const EntityType& entity,
-                    const MeshFunction& u,
-                    DofVectorType& b,
-                    Matrix& matrix ) const
-{
-   typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-   matrixRow.setElement( 0, index, 1.0 );
-   b[ index ] = tnlFunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
-}
-
-#endif /* TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H_ */
diff --git a/src/operators/tnlExactFunctionInverseOperator.h b/src/operators/tnlExactFunctionInverseOperator.h
index 6b9084528c47e8ecb2ba0b136a402e30562ce631..8913538139f8422253791081b5efc5d1120273b3 100644
--- a/src/operators/tnlExactFunctionInverseOperator.h
+++ b/src/operators/tnlExactFunctionInverseOperator.h
@@ -6,58 +6,52 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTFUNCTIONINVERSEOPERATOR_H
-#define	TNLEXACTFUNCTIONINVERSEOPERATOR_H
+#pragma once
 
 #include <core/tnlString.h>
 #include <core/tnlCuda.h>
 #include <operators/tnlOperator.h>
 #include <operators/tnlExactIdentityOperator.h>
 
+namespace TNL {
+
 template< int Dimensions,
           typename InnerOperator= tnlExactIdentityOperator< Dimensions > >
 class tnlExactFunctionInverseOperator
    : public tnlDomain< Dimensions, SpaceDomain >
 {
    public:
-           
+ 
       static tnlString getType()
       {
-         return tnlString( "tnlExactFunctionInverseOperator< " ) + 
-                tnlString( Dimensions) + " >";         
+         return tnlString( "tnlExactFunctionInverseOperator< " ) +
+                tnlString( Dimensions) + " >";
       }
-                        
+ 
       InnerOperator& getInnerOperator()
       {
          return this->innerOperator;
       }
-      
+ 
       const InnerOperator& getInnerOperator() const
       {
          return this->innerOperator;
-      }      
+      }
 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          typedef typename Function::RealType RealType;
          return 1.0 / innerOperator( function, v, time );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -71,7 +65,7 @@ class tnlExactFunctionInverseOperator
             "Partial derivative must be non-negative integer." );
          static_assert( XDerivative + YDerivative + ZDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
          typedef typename Function::RealType RealType;
-         
+ 
          if( XDerivative == 1 )
          {
             const RealType f = innerOperator( function, v, time );
@@ -82,20 +76,20 @@ class tnlExactFunctionInverseOperator
          {
             const RealType f = innerOperator( function, v, time );
             const RealType f_y = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-            return -f_y / ( f * f );            
+            return -f_y / ( f * f );
          }
          if( ZDerivative == 1 )
          {
             const RealType f = innerOperator( function, v, time );
             const RealType f_z = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
-            return -f_z / ( f * f );            
-         }         
+            return -f_z / ( f * f );
+         }
       }
-      
+ 
    protected:
-      
-      InnerOperator innerOperator;           
+ 
+      InnerOperator innerOperator;
 };
 
-#endif	/* TNLEXACTFUNCTIONINVERSEOPERATOR_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlExactIdentityOperator.h b/src/operators/tnlExactIdentityOperator.h
index aab4488d8c9498597ed6f897d7036836e9d33dd7..288b5fe0d0b0f2100d931e3c27a97fb8d896eb50 100644
--- a/src/operators/tnlExactIdentityOperator.h
+++ b/src/operators/tnlExactIdentityOperator.h
@@ -6,45 +6,39 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLEXACTIDENTITYOPERATOR_H
-#define TNLEXACTIDENTITYOPERATOR_H
+#pragma once
 
 #include <core/tnlString.h>
 #include <core/tnlCuda.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< int Dimensions >
 class tnlExactIdentityOperator
    : public tnlDomain< Dimensions, SpaceDomain >
 {
    public:
-     
+ 
       static tnlString getType()
       {
-         return tnlString( "tnlExactIdentityOperator< " ) + 
-                tnlString( Dimensions) + " >";         
+         return tnlString( "tnlExactIdentityOperator< " ) +
+                tnlString( Dimensions) + " >";
       }
-      
+ 
       template< typename Function >
       __cuda_callable__
-      typename Function::RealType 
+      typename Function::RealType
          operator()( const Function& function,
-                     const typename Function::VertexType& v, 
+                     const typename Function::VertexType& v,
                      const typename Function::RealType& time = 0.0 ) const
       {
          return function( v, time );
       }
-      
-      template< typename Function, 
+ 
+      template< typename Function,
                 int XDerivative = 0,
                 int YDerivative = 0,
                 int ZDerivative = 0 >
@@ -56,12 +50,10 @@ class tnlExactIdentityOperator
       {
          static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
             "Partial derivative must be non-negative integer." );
-         
-         return function.template getPartialDerivative< XDerivative, YDerivative, ZDerivative >( v, time );         
+ 
+         return function.template getPartialDerivative< XDerivative, YDerivative, ZDerivative >( v, time );
       }
 };
 
-
-
-#endif /* TNLEXACTIDENTITYOPERATOR_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlExactOperatorComposition.h b/src/operators/tnlExactOperatorComposition.h
index 99d9240dcd78232ec1b605654a50fd28a4d3f971..3d234ca561cf726b912819fefe06992f2c8840f7 100644
--- a/src/operators/tnlExactOperatorComposition.h
+++ b/src/operators/tnlExactOperatorComposition.h
@@ -6,24 +6,18 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLEXACTOPERATORCOMPOSITION_H
-#define TNLEXACTOPERATORCOMPOSITION_H
+namespace TNL {
 
 template< typename OuterOperator,
           typename InnerOperator >
 class tnlExactOperatorComposition
 {
    public:
-      
+ 
       template< typename Function >
       __cuda_callable__ inline
       typename Function::RealType operator()( const Function& function,
@@ -32,13 +26,13 @@ class tnlExactOperatorComposition
       {
          return OuterOperator( innerOperator( function, v, time), v, time );
       }
-      
+ 
    protected:
-      
+ 
       InnerOperator innerOperator;
-      
+ 
       OuterOperator outerOperator;
 };
 
-#endif /* TNLEXACTOPERATORCOMPOSITION_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlFiniteDifferences.h b/src/operators/tnlFiniteDifferences.h
index 0685ffb5fddda2a6f7f73116da11dadfdaf66b72..3527d9febd5ddeef434165844d53c256633c2ccd 100644
--- a/src/operators/tnlFiniteDifferences.h
+++ b/src/operators/tnlFiniteDifferences.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFINITEDIFFERENCES_H_
-#define TNLFINITEDIFFERENCES_H_
+#pragma once
 
 #include <mesh/tnlGrid.h>
 
+namespace TNL {
+
 template< typename Grid >
 class tnlFiniteDifferences
 {
@@ -60,7 +54,7 @@ class tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const GridFunction& inFunction,
                                   GridFunction& outFunction );
-#endif   
+#endif
 
 #ifdef HAVE_NOT_CXX11
    template< typename GridFunction,
@@ -84,7 +78,7 @@ class tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const CellType& cell,
                                   const GridFunction& function );
-#endif   
+#endif
 
 };
 
@@ -123,7 +117,7 @@ class tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const GridFunction& inFunction,
                                   GridFunction& outFunction );
-#endif   
+#endif
 
 #ifdef HAVE_NOT_CXX11
    template< typename GridFunction,
@@ -147,7 +141,7 @@ class tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const CellType& cell,
                                   const GridFunction& function );
-#endif   
+#endif
 
 };
 
@@ -185,7 +179,7 @@ class tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const GridFunction& inFunction,
                                   GridFunction& outFunction );
-#endif   
+#endif
 
 #ifdef HAVE_NOT_CXX11
    template< typename GridFunction,
@@ -209,12 +203,10 @@ class tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >
    static RealType getDifference( const GridType& grid,
                                   const CellType& cell,
                                   const GridFunction& function );
-#endif   
+#endif
 
 };
 
-#include <operators/tnlFiniteDifferences_impl.h>
-
-
+} // namespace TNL
 
-#endif /* TNLFINITEDIFFERENCES_H_ */
+#include <operators/tnlFiniteDifferences_impl.h>
\ No newline at end of file
diff --git a/src/operators/tnlFiniteDifferences_impl.h b/src/operators/tnlFiniteDifferences_impl.h
index a2de1e58c9feadf4a88a46c29e374e2d398fd8f0..3201e9a395215fb7ec64771f3c822747ca5642fd 100644
--- a/src/operators/tnlFiniteDifferences_impl.h
+++ b/src/operators/tnlFiniteDifferences_impl.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFINITEDIFFERENCES_IMPL_H_
-#define TNLFINITEDIFFERENCES_IMPL_H_
+#pragma once
 
 #include <operators/tnlFiniteDifferences.h>
 
+namespace TNL {
+
 template< typename Real, typename Device, typename Index >
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -125,7 +119,7 @@ Real tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > >::getDifference( c
                                                                                const GridFunction& function )
 {
    if( ZDifferenceOrder > 0 )
-      return 0.0;   
+      return 0.0;
    auto neighbourEntities = cell.getNeighbourEntities();
    IndexType cellIndex = grid.getEntityIndex( cell );
    if( XDifferenceOrder == 1 )
@@ -206,7 +200,7 @@ Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >::getDifference( c
                function[ neighbourEntities.template getEntityIndex< -1, 0, 0 >( cellIndex ) ] ) / (  hx * hx );
    }
    if( YDifferenceOrder == 1 )
-   {      
+   {
       const RealType hy = grid.getSpaceSteps().y();
       return ( function[ neighbourEntities.template getEntityIndex< 0, YDifferenceDirection, 0 >( cellIndex ) ] -
                function[ cellIndex ] ) / ( YDifferenceDirection * hy );
@@ -235,9 +229,6 @@ Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >::getDifference( c
 
 }
 
+} // namespace TNL
 
-#include <operators/tnlFiniteDifferences_impl.h>
-
-
-
-#endif /* TNLFINITEDIFFERENCES_IMPL_H_ */
+#include <operators/tnlFiniteDifferences_impl.h>
\ No newline at end of file
diff --git a/src/operators/tnlFunctionInverseOperator.h b/src/operators/tnlFunctionInverseOperator.h
index bc109559ee2fca58092b5948f36d29a9ac274d5f..8e09d6931811f808f660d18f85152f9818d892ae 100644
--- a/src/operators/tnlFunctionInverseOperator.h
+++ b/src/operators/tnlFunctionInverseOperator.h
@@ -6,22 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLFUNCTIONINVERSEOPERATOR_H
-#define	TNLFUNCTIONINVERSEOPERATOR_H
+#pragma once
 
 #include <core/tnlString.h>
 #include <core/tnlCuda.h>
 #include <operators/tnlOperator.h>
 
+namespace TNL {
+
 template< typename Operator >
 class tnlFunctionInverseOperator
 : public tnlOperator< typename Operator::MeshType,
@@ -32,24 +26,24 @@ class tnlFunctionInverseOperator
                       typename Operator::IndexType >
 {
    public:
-      
+ 
       typedef Operator OperatorType;
       typedef typename OperatorType::RealType RealType;
       typedef typename OperatorType::IndexType IndexType;
       typedef tnlFunctionInverseOperator< Operator > ThisType;
       typedef ThisType ExactOperatorType;
-      
-      
+ 
+ 
       tnlFunctionInverseOperator( const OperatorType& operator_ )
       : operator_( operator_ ) {};
-      
+ 
       static tnlString getType()
       {
-         return tnlString( "tnlFunctionInverseOperator< " ) + Operator::getType() + " >";         
+         return tnlString( "tnlFunctionInverseOperator< " ) + Operator::getType() + " >";
       }
-      
+ 
       const OperatorType& getOperator() const { return this->operator_; }
-      
+ 
       template< typename MeshFunction,
                 typename MeshEntity >
       __cuda_callable__
@@ -60,12 +54,11 @@ class tnlFunctionInverseOperator
       {
          return 1.0 / operator_( u, entity, time );
       }
-      
+ 
    protected:
-      
+ 
       const OperatorType& operator_;
 };
 
-
-#endif	/* TNLINVERSEFUNCTIONOPERATOR_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlIdentityOperator.h b/src/operators/tnlIdentityOperator.h
index f175d036c35659ecb2ab642d1b17e76b22616098..e98ac38f906953b0a505ba11c791130c4c8b8679 100644
--- a/src/operators/tnlIdentityOperator.h
+++ b/src/operators/tnlIdentityOperator.h
@@ -6,33 +6,27 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLIDENTITYOPERATOR_H
-#define	TNLIDENTITYOPERATOR_H
+#pragma once
 
 #include<functions/tnlMeshFunction.h>
 
+namespace TNL {
+
 template< typename MeshFunction >
 class tnlIdentityOperator
    : public tnlDomain< MeshFunction::getDimensions(), MeshFunction::getDomainType() >
 {
    public:
-      
+ 
       typedef typename MeshFunction::MeshType MeshType;
       typedef typename MeshFunction::RealType RealType;
       typedef typename MeshFunction::IndexType IndexType;
-      
+ 
       tnlOperatorComposition( const MeshFunction& meshFunction )
       : meshFunction( meshFunction ) {};
-      
+ 
       template< typename MeshEntity >
       __cuda_callable__
       RealType operator()(
@@ -44,12 +38,12 @@ class tnlIdentityOperator
             "Mesh function and operator have both different number of dimensions." );
          return this->meshFunction( meshEntity, time );
       }
-      
-   
+ 
+ 
    protected:
-      
-      const MeshFunction& meshFunction;      
+ 
+      const MeshFunction& meshFunction;
 };
 
-#endif	/* TNLIDENTITYOPERATOR_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlNeumannBoundaryConditions.h b/src/operators/tnlNeumannBoundaryConditions.h
index 7f6e3e15364a1eaf92196e158fd48a8bdd189553..0194eba3a40232cb8e7255a90d9eab860bd545ba 100644
--- a/src/operators/tnlNeumannBoundaryConditions.h
+++ b/src/operators/tnlNeumannBoundaryConditions.h
@@ -1,6 +1,19 @@
+/***************************************************************************
+                          tnlIdentityOperator.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+
 #ifndef TNLNEUMANNBOUNDARYCONDITIONS_H
 #define	TNLNEUMANNBOUNDARYCONDITIONS_H
 
+#include <functions/tnlFunctionAdapter.h>
+
 template< typename Mesh,
           typename Function,
           typename Real = typename Mesh::RealType,
@@ -74,26 +87,60 @@ class tnlNeumannBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, F
    __cuda_callable__
    const RealType operator()( const MeshFunction& u,
                               const EntityType& entity,   
-                              const RealType& time = 0 ) const;
+                              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 >() ] - entity.getMesh().getSpaceSteps().x() * 
+            tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+      else
+         return u[ neighbourEntities.template getEntityIndex< -1 >() ] + entity.getMesh().getSpaceSteps().x() * 
+            tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );   
+
+   }
 
 
    template< typename EntityType >
    __cuda_callable__
    Index getLinearSystemRowLength( const MeshType& mesh,
                                    const IndexType& index,
-                                   const EntityType& entity ) const;
-
-   template< typename MatrixRow,
-             typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const EntityType& entity,
-                               const MeshFunction& u,
-                               DofVectorType& b,
-                               MatrixRow& matrixRow ) const;
+                                   const EntityType& entity ) const
+   {
+      return 2;
+   }
+
+      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
+      {
+         const auto& neighbourEntities = entity.getNeighbourEntities();
+         const IndexType& index = entity.getIndex();
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+         if( entity.getCoordinates().x() == 0 )
+         {
+            matrixRow.setElement( 0, index, 1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().x() * 
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         else
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1 >(), -1.0 );
+            matrixRow.setElement( 1, index, 1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }         
+      }
 };
 
 /****
@@ -116,43 +163,104 @@ class tnlNeumannBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, F
 {
    public:
 
-   typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
-
-   typedef Function FunctionType;
-   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
-   typedef tnlStaticVector< 2, RealType > VertexType;
-   typedef typename MeshType::CoordinatesType CoordinatesType;
-   typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
-   typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;
-   
+      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
 
-   template< typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-   const RealType operator()( const MeshFunction& u,
-                              const EntityType& entity,                            
-                              const RealType& time = 0 ) const;
-      
-   template< typename EntityType >
-   __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const EntityType& entity ) const;
-
-   template< typename MatrixRow,
-             typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const EntityType& entity,
-                               const MeshFunction& u,
-                               DofVectorType& b,
-                               MatrixRow& matrixRow ) const;
+      typedef Function FunctionType;
+      typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef tnlStaticVector< 2, RealType > VertexType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
+      typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;
+
+
+      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, 0 >() ] - entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == 0 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] + entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }         
+      }
+
+      template< typename EntityType >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const EntityType& entity ) const
+      {
+         return 2;
+      }
+
+      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
+      {
+         const auto& neighbourEntities = entity.getNeighbourEntities();
+         const IndexType& index = entity.getIndex();
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+         if( entity.getCoordinates().x() == 0 )
+         {
+            matrixRow.setElement( 0, index,                                                1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1, 0 >(), -1.0 );
+            matrixRow.setElement( 1, index,                                                 1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == 0 )
+         {
+            matrixRow.setElement( 0, index,                                                1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1 >(), -1.0 );
+            matrixRow.setElement( 1, index,                                                 1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }         
+      }
 };
 
 /****
@@ -174,43 +282,128 @@ class tnlNeumannBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, F
 {
    public:
 
-   typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
+      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
+      typedef Real RealType;
+      typedef Device DeviceType;
+      typedef Index IndexType;
 
-   typedef Function FunctionType;
-   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
-   typedef tnlStaticVector< 3, RealType > VertexType;
-   typedef typename MeshType::CoordinatesType CoordinatesType;
-   typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
-   typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;   
-
-   template< typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-   const RealType operator()( const MeshFunction& u,
-                              const EntityType& entity,
-                              const RealType& time = 0 ) const;
-   
-
-   template< typename EntityType >
-   __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const EntityType& entity ) const;
-
-   template< typename MatrixRow,
-             typename EntityType,
-             typename MeshFunction >
-   __cuda_callable__
-      void updateLinearSystem( const RealType& time,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const EntityType& entity,
-                               const MeshFunction& u,
-                               DofVectorType& b,
-                               MatrixRow& matrixRow ) const;
+      typedef Function FunctionType;
+      typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
+      typedef tnlStaticVector< 3, RealType > VertexType;
+      typedef typename MeshType::CoordinatesType CoordinatesType;
+      typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
+      typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;   
+
+      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, 0, 0 >() ] - entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] + entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == 0 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] + entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().z() == 0 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - entity.getMesh().getSpaceSteps().z() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 )
+         {
+            return u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] + entity.getMesh().getSpaceSteps().z() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }   
+      }
+
+
+      template< typename EntityType >
+      __cuda_callable__
+      Index getLinearSystemRowLength( const MeshType& mesh,
+                                      const IndexType& index,
+                                      const EntityType& entity ) const
+      {
+         return 2;
+      }
+
+      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
+      {
+         const auto& neighbourEntities = entity.getNeighbourEntities();
+         const IndexType& index = entity.getIndex();
+         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+         if( entity.getCoordinates().x() == 0 )
+         {
+            matrixRow.setElement( 0, index,                                                   1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0, 0 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 )
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1, 0, 0 >(), -1.0 );
+            matrixRow.setElement( 1, index,                                                    1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().x() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == 0 )
+         {
+            matrixRow.setElement( 0, index,                                                   1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1, 0 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().y() * 
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 )
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1, 0 >(), -1.0 );
+            matrixRow.setElement( 1, index,                                                    1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().y() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().z() == 0 )
+         {
+            matrixRow.setElement( 0, index,                                                   1.0 );
+            matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 0, 1 >(), -1.0 );
+            b[ index ] = - entity.getMesh().getSpaceSteps().z() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+         if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 )
+         {
+            matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, 0, -1 >(), -1.0 );
+            matrixRow.setElement( 1, index,                                                    1.0 );
+            b[ index ] = entity.getMesh().getSpaceSteps().z() *
+               tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         }
+      }
 };
 
 template< typename Mesh,
diff --git a/src/operators/tnlNeumannBoundaryConditions_impl.h b/src/operators/tnlNeumannBoundaryConditions_impl.h
index adb01b87ee245a2978f2a230a11db09081103261..449603e1cca45e03ec510a9e0f5c8119eabdb1d7 100644
--- a/src/operators/tnlNeumannBoundaryConditions_impl.h
+++ b/src/operators/tnlNeumannBoundaryConditions_impl.h
@@ -1,8 +1,19 @@
-#ifndef TNLNEUMANNBOUNDARYCONDITIONS_IMPL_H
-#define	TNLNEUMANNBOUNDARYCONDITIONS_IMPL_H
+/***************************************************************************
+                          tnlIdentityOperator.h  -  description
+                             -------------------
+    begin                : Nov 17, 2014
+    copyright            : (C) 2014 by Tomas Oberhuber
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
 #include <functions/tnlFunctionAdapter.h>
 
+namespace TNL {
+
 template< typename Function >
 void
 tnlNeumannBoundaryConditionsBase< Function >::
@@ -49,7 +60,7 @@ getFunction() const
 /****
  * 1D grid
  */
-
+/*
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -106,7 +117,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 tnlNeumannBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Function, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const MeshType& mesh,
                     const IndexType& index,
                     const EntityType& entity,
@@ -130,11 +141,12 @@ updateLinearSystem( const RealType& time,
       b[ index ] = mesh.getSpaceSteps().x() *
          tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
    }
-}
+}*/
 
 /****
  * 2D grid
  */
+/*
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -204,7 +216,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 tnlNeumannBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const MeshType& mesh,
                     const IndexType& index,
                     const EntityType& entity,
@@ -242,11 +254,12 @@ updateLinearSystem( const RealType& time,
       b[ index ] = mesh.getSpaceSteps().y() *
          tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
    }
-}
+}*/
 
 /****
  * 3D grid
  */
+/*
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
@@ -326,7 +339,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 tnlNeumannBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const MeshType& mesh,
                     const IndexType& index,
                     const EntityType& entity,                    
@@ -379,6 +392,7 @@ updateLinearSystem( const RealType& time,
          tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
    }
 }
+*/
 
-#endif	/* TNLNEUMANNBOUNDARYCONDITIONS_IMPL_H */
+} // namespace TNL
 
diff --git a/src/operators/tnlOperator.h b/src/operators/tnlOperator.h
index 112e6ff7747a337c03eb4aee9c2d041867f0c84f..76f5780871345f62e714ed1d1e4cfb320817ab4c 100644
--- a/src/operators/tnlOperator.h
+++ b/src/operators/tnlOperator.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
-
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLOPERATOR_H
-#define	TNLOPERATOR_H
+#pragma once
 
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename Mesh,
           tnlDomainType DomainType = MeshInteriorDomain,
           int PreimageEntitiesDimensions = Mesh::getMeshDimensions(),
@@ -30,7 +23,7 @@ template< typename Mesh,
 class tnlOperator : public tnlDomain< Mesh::getMeshDimensions(), DomainType >
 {
    public:
-      
+ 
       typedef Mesh MeshType;
       typedef typename MeshType::RealType MeshRealType;
       typedef typename MeshType::DeviceType DeviceType;
@@ -38,17 +31,18 @@ class tnlOperator : public tnlDomain< Mesh::getMeshDimensions(), DomainType >
       typedef Real RealType;
       typedef Index IndexType;
       typedef void ExactOperatorType;
-      
+ 
       constexpr static int getMeshDimensions() { return MeshType::getMeshDimensions(); }
       constexpr static int getPreimageEntitiesDimensions() { return PreimageEntitiesDimensions; }
       constexpr static int getImageEntitiesDimensions() { return ImageEntitiesDimensions; }
-      
+ 
       bool refresh( const RealType& time = 0.0 ) { return true; }
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 ) { return true; }
-    
-      template< typename MeshFunction > 
+ 
+      template< typename MeshFunction >
       void setPreimageFunction( const MeshFunction& f ){}
 };
-#endif	/* TNLOPERATOR_H */
+
+} // namespace TNL
 
diff --git a/src/operators/tnlOperatorComposition.h b/src/operators/tnlOperatorComposition.h
index e9f7558bae25610addd292c596d1a5f9af510378..9c415ed20cd96d4c87cc65aee5db7b790df1e50c 100644
--- a/src/operators/tnlOperatorComposition.h
+++ b/src/operators/tnlOperatorComposition.h
@@ -6,23 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLOPERATORCOMPOSITION_H
-#define	TNLOPERATORCOMPOSITION_H
+#pragma once
 
 #include<functions/tnlOperatorFunction.h>
 #include<functions/tnlMeshFunction.h>
 #include<operators/tnlOperator.h>
 #include<operators/tnlExactOperatorComposition.h>
 
+namespace TNL {
+
 /****
  * This object serves for composition of two operators F and G into an operator F( G( u ) ).
  * The function u must be set in the constructor or by a method setPreimageFunction.
@@ -40,12 +34,12 @@ class tnlOperatorComposition
                          InnerOperator::getPreimageEntitiesDimensions(),
                          OuterOperator::getImageEntitiesDimensions(),
                          typename InnerOperator::RealType,
-                         typename OuterOperator::IndexType >   
+                         typename OuterOperator::IndexType >
 {
       static_assert( is_same< typename OuterOperator::MeshType, typename InnerOperator::MeshType >::value,
          "Both operators have different mesh types." );
    public:
-      
+ 
       typedef typename InnerOperator::MeshType MeshType;
       typedef tnlMeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimensions() > PreimageFunctionType;
       typedef tnlMeshFunction< MeshType, InnerOperator::getImageEntitiesDimensions() > ImageFunctionType;
@@ -55,22 +49,22 @@ class tnlOperatorComposition
       typedef typename InnerOperator::IndexType IndexType;
       typedef tnlExactOperatorComposition< typename OuterOperator::ExactOperatorType,
                                            typename InnerOperator::ExactOperatorType > ExactOperatorType;
-      
+ 
       static constexpr int getPreimageEntitiesDimensions() { return InnerOperator::getImageEntitiesDimensions(); };
       static constexpr int getImageEntitiesDimensions() { return OuterOperator::getImageEntitiesDimensions(); };
-      
+ 
       tnlOperatorComposition( OuterOperator& outerOperator,
                               InnerOperator& innerOperator,
                               const InnerBoundaryConditions& innerBoundaryConditions,
                               const MeshType& mesh )
       : outerOperator( outerOperator ),
         innerOperatorFunction( innerOperator, innerBoundaryConditions, mesh ){};
-        
+ 
       void setPreimageFunction( const PreimageFunctionType& preimageFunction )
       {
          this->innerOperatorFunction.setPreimageFunction( preimageFunction );
       }
-        
+ 
       PreimageFunctionType& getPreimageFunction()
       {
          return this->innerOperatorFunction.getPreimageFunction();
@@ -79,26 +73,26 @@ class tnlOperatorComposition
       const PreimageFunctionType& getPreimageFunction() const
       {
          return this->innerOperatorFunction.getPreimageFunction();
-      }      
-      
+      }
+ 
       InnerOperator& getInnerOperator() { return this->innerOperatorFunction.getOperator(); }
-      
+ 
       const InnerOperator& getInnerOperator() const { return this->innerOperatorFunction.getOperator(); }
-      
+ 
       OuterOperator& getOuterOperator() { return this->outerOperator(); };
-      
+ 
       const OuterOperator& getOuterOperator() const { return this->outerOperator(); };
-      
+ 
       bool refresh( const RealType& time = 0.0 )
       {
          return this->innerOperatorFunction.refresh( time );
       }
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 )
       {
          return this->innerOperatorFunction.deepRefresh( time );
       }
-        
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       RealType operator()(
@@ -110,24 +104,24 @@ class tnlOperatorComposition
             "Mesh function and operator have both different number of dimensions." );
          //InnerOperatorFunction innerOperatorFunction( innerOperator, function );
          return outerOperator( innerOperatorFunction, meshEntity, time );
-      }      
-   
+      }
+ 
    protected:
-      
+ 
       OuterOperator& outerOperator;
-      
-      InnerOperatorFunction innerOperatorFunction;      
+ 
+      InnerOperatorFunction innerOperatorFunction;
 };
 
 template< typename OuterOperator,
           typename InnerOperator >
 class tnlOperatorComposition< OuterOperator, InnerOperator, void >
-   : public tnlDomain< InnerOperator::getDimensions(), InnerOperator::getDomainType() >   
+   : public tnlDomain< InnerOperator::getDimensions(), InnerOperator::getDomainType() >
 {
       static_assert( is_same< typename OuterOperator::MeshType, typename InnerOperator::MeshType >::value,
          "Both operators have different mesh types." );
    public:
-      
+ 
       typedef typename InnerOperator::MeshType MeshType;
       typedef tnlMeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimensions() > PreimageFunctionType;
       typedef tnlMeshFunction< MeshType, InnerOperator::getImageEntitiesDimensions() > ImageFunctionType;
@@ -135,18 +129,18 @@ class tnlOperatorComposition< OuterOperator, InnerOperator, void >
       typedef tnlOperatorFunction< InnerOperator, ImageFunctionType > OuterOperatorFunction;
       typedef typename InnerOperator::RealType RealType;
       typedef typename InnerOperator::IndexType IndexType;
-      
+ 
       tnlOperatorComposition( const OuterOperator& outerOperator,
                               InnerOperator& innerOperator,
                               const MeshType& mesh )
       : outerOperator( outerOperator ),
         innerOperatorFunction( innerOperator, mesh ){};
-        
+ 
       void setPreimageFunction( PreimageFunctionType& preimageFunction )
       {
          this->innerOperatorFunction.setPreimageFunction( preimageFunction );
-      }        
-        
+      }
+ 
       PreimageFunctionType& getPreimageFunction()
       {
          return this->innerOperatorFunction.getPreimageFunction();
@@ -155,8 +149,8 @@ class tnlOperatorComposition< OuterOperator, InnerOperator, void >
       const PreimageFunctionType& getPreimageFunction() const
       {
          return this->innerOperatorFunction.getPreimageFunction();
-      }      
-      
+      }
+ 
       bool refresh( const RealType& time = 0.0 )
       {
          return this->innerOperatorFunction.refresh( time );
@@ -166,14 +160,14 @@ class tnlOperatorComposition< OuterOperator, InnerOperator, void >
          f.write( "innerFunction", "gnuplot" );
          return true;*/
       }
-      
+ 
       bool deepRefresh( const RealType& time = 0.0 )
       {
          return this->innerOperatorFunction.deepRefresh( time );
          /*this->innerOperatorFunction.write( "innerFunction", "gnuplot" );
           return true;*/
       }
-        
+ 
       template< typename MeshFunction, typename MeshEntity >
       __cuda_callable__
       RealType operator()(
@@ -185,15 +179,14 @@ class tnlOperatorComposition< OuterOperator, InnerOperator, void >
             "Mesh function and operator have both different number of dimensions." );
          //InnerOperatorFunction innerOperatorFunction( innerOperator, function );
          return outerOperator( innerOperatorFunction, meshEntity, time );
-      }      
-   
+      }
+ 
    protected:
-      
+ 
       const OuterOperator& outerOperator;
-      
-      InnerOperatorFunction innerOperatorFunction;      
+ 
+      InnerOperatorFunction innerOperatorFunction;
 };
 
-
-#endif	/* TNLOPERATORCOMPOSITION_H */
+} // namespace TNL
 
diff --git a/src/problems/tnlHeatEquationEocProblem.h b/src/problems/tnlHeatEquationEocProblem.h
index 199404347430d996f2ad9e54d0b45f8368e0bdab..af5ed348b67b9889e343d29bde35ad1012357ceb 100644
--- a/src/problems/tnlHeatEquationEocProblem.h
+++ b/src/problems/tnlHeatEquationEocProblem.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
@@ -22,11 +15,11 @@
  */
 
 
-#ifndef TNLHEATEQUATIONEOCPROBLEM_H_
-#define TNLHEATEQUATIONEOCPROBLEM_H_
+#pragma once
 
 #include <problems/tnlHeatEquationProblem.h>
 
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -42,6 +35,6 @@ class tnlHeatEquationEocProblem : public tnlHeatEquationProblem< Mesh, BoundaryC
       bool setup( const tnlParameterContainer& parameters );
 };
 
-#include <problems/tnlHeatEquationEocProblem_impl.h>
+} //namespace TNL
 
-#endif /* TNLHEATEQUATIONEOCPROBLEM_H_ */
+#include <problems/tnlHeatEquationEocProblem_impl.h>
diff --git a/src/problems/tnlHeatEquationEocProblem_impl.h b/src/problems/tnlHeatEquationEocProblem_impl.h
index fe60dbe774a45c2d2ef148e2e6888f54f6ae5f47..d2dff0096b77cbe977767af24aba1ce503ec3e2e 100644
--- a/src/problems/tnlHeatEquationEocProblem_impl.h
+++ b/src/problems/tnlHeatEquationEocProblem_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
@@ -22,11 +15,11 @@
  */
 
 
-#ifndef TNLHEATEQUATIONEOCPROBLEM_IMPL_H_
-#define TNLHEATEQUATIONEOCPROBLEM_IMPL_H_
+#pragma once
 
 #include "tnlHeatEquationProblem.h"
 
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -53,4 +46,4 @@ setup( const tnlParameterContainer& parameters )
    return true;
 }
 
-#endif /* TNLHEATEQUATIONEOCPROBLEM_IMPL_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlHeatEquationEocRhs.h b/src/problems/tnlHeatEquationEocRhs.h
index 803d97f051e4c430bc9333841d8dbfc04f6452d5..9258624bd44c922fd1b42ab70eac4255f8b1e66d 100644
--- a/src/problems/tnlHeatEquationEocRhs.h
+++ b/src/problems/tnlHeatEquationEocRhs.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
@@ -21,11 +14,12 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-#ifndef TNLHEATEQUATIONEOCRHS_H_
-#define TNLHEATEQUATIONEOCRHS_H_
+#pragma once
 
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename ExactOperator,
           typename TestFunction >
 class tnlHeatEquationEocRhs
@@ -60,4 +54,4 @@ class tnlHeatEquationEocRhs
       TestFunction testFunction;
 };
 
-#endif /* TNLHEATEQUATIONEOCRHS_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlHeatEquationProblem.h b/src/problems/tnlHeatEquationProblem.h
index 704f25ca27fc749d388cb2d50495d576e64b0d57..78fe20d5e7b57fc4f646c3521cb1ef0d93813e09 100644
--- a/src/problems/tnlHeatEquationProblem.h
+++ b/src/problems/tnlHeatEquationProblem.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
@@ -21,14 +14,15 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-
-#ifndef TNLHEATEQUATIONPROBLEM_H_
-#define TNLHEATEQUATIONPROBLEM_H_
+#pragma once
 
 #include <problems/tnlPDEProblem.h>
 #include <operators/diffusion/tnlLinearDiffusion.h>
 #include <matrices/tnlEllpackMatrix.h>
 #include <functions/tnlMeshFunction.h>
+#include <core/tnlTimer.h>
+
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -59,6 +53,9 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
 
       void writeProlog( tnlLogger& logger,
                         const tnlParameterContainer& parameters ) const;
+ 
+      bool writeEpilog( tnlLogger& logger );
+
 
       bool setup( const tnlParameterContainer& parameters );
 
@@ -93,23 +90,25 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
       void assemblyLinearSystem( const RealType& time,
                                  const RealType& tau,
                                  const MeshType& mesh,
-                                 const DofVectorType& dofs,                                 
+                                 const DofVectorType& dofs,
                                  Matrix& matrix,
                                  DofVectorType& rightHandSide,
 				 MeshDependentDataType& meshDependentData );
 
 
       protected:
-         
+ 
          MeshFunctionType u;
-      
+ 
          DifferentialOperator differentialOperator;
 
          BoundaryCondition boundaryCondition;
 
          RightHandSide rightHandSide;
+ 
+         tnlTimer gpuTransferTimer;
 };
 
-#include <problems/tnlHeatEquationProblem_impl.h>
+} // namespace TNL
 
-#endif /* TNLHEATEQUATIONPROBLEM_H_ */
+#include <problems/tnlHeatEquationProblem_impl.h>
diff --git a/src/problems/tnlHeatEquationProblem_impl.h b/src/problems/tnlHeatEquationProblem_impl.h
index ce68ff2b4cf1b40846cff2931af31f4aa38fbdc5..afb5772ffa14ab3341fa6d7be40392c2c31d56c0 100644
--- a/src/problems/tnlHeatEquationProblem_impl.h
+++ b/src/problems/tnlHeatEquationProblem_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 /***
  * Authors:
@@ -21,8 +14,7 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-#ifndef TNLHEATEQUATIONPROBLEM_IMPL_H_
-#define TNLHEATEQUATIONPROBLEM_IMPL_H_
+#pragma once
 
 #include <core/mfilename.h>
 #include <matrices/tnlMatrixSetter.h>
@@ -35,6 +27,7 @@
 
 #include "tnlHeatEquationProblem.h"
 
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -68,6 +61,19 @@ writeProlog( tnlLogger& logger, const tnlParameterContainer& parameters ) const
 {
 }
 
+template< typename Mesh,
+          typename BoundaryCondition,
+          typename RightHandSide,
+          typename DifferentialOperator >
+bool
+tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
+writeEpilog( tnlLogger& logger )
+{
+   logger.writeParameter< const char* >( "GPU transfer time:", "" );
+   this->gpuTransferTimer.writeLog( logger, 1 );
+   return true;
+}
+
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
@@ -76,6 +82,7 @@ bool
 tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
 setup( const tnlParameterContainer& parameters )
 {
+   this->gpuTransferTimer.reset();
    if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
        ! this->rightHandSide.setup( parameters, "right-hand-side-" ) )
       return false;
@@ -134,7 +141,7 @@ template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator >
-   template< typename Matrix >          
+   template< typename Matrix >
 bool
 tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
 setupLinearSystem( const MeshType& mesh,
@@ -202,12 +209,13 @@ getExplicitRHS( const RealType& time,
     *
     * You may use supporting vectors again if you need.
     */
-   
+ 
    //cout << "u = " << u << endl;
    this->bindDofs( mesh, uDofs );
    MeshFunctionType fu( mesh, fuDofs );
    tnlExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
-   explicitUpdater.template update< typename Mesh::Cell >( 
+   explicitUpdater.setGPUTransferTimer( this->gpuTransferTimer );
+   explicitUpdater.template update< typename Mesh::Cell >(
       time,
       mesh,
       this->differentialOperator,
@@ -220,7 +228,7 @@ getExplicitRHS( const RealType& time,
       this->boundaryCondition,
       time + tau,
       this->u );
-   
+ 
    //fu.write( "fu.txt", "gnuplot" );
    //this->u.write( "u.txt", "gnuplot");
    //getchar();
@@ -235,13 +243,13 @@ template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator >
-    template< typename Matrix >          
+    template< typename Matrix >
 void
 tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
 assemblyLinearSystem( const RealType& time,
                       const RealType& tau,
                       const MeshType& mesh,
-                      const DofVectorType& dofs,                      
+                      const DofVectorType& dofs,
                       Matrix& matrix,
                       DofVectorType& b,
 		                MeshDependentDataType& meshDependentData )
@@ -291,4 +299,4 @@ assemblyLinearSystem( const RealType& time,
    abort();*/
 }
 
-#endif /* TNLHEATEQUATIONPROBLEM_IMPL_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlMeanCurvatureFlowEocProblem.h b/src/problems/tnlMeanCurvatureFlowEocProblem.h
index 948b7c95a2e17847b503b8fc708096dad84a9d30..838e6c16dc558887170597124ed2da0de4e615b4 100644
--- a/src/problems/tnlMeanCurvatureFlowEocProblem.h
+++ b/src/problems/tnlMeanCurvatureFlowEocProblem.h
@@ -6,29 +6,23 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMEANCURVATUREFLOWEOCPROBLEM_H_
-#define TNLMEANCURVATUREFLOWEOCPROBLEM_H_
+#pragma once
 
 #include <problems/tnlMeanCurvatureFlowProblem.h>
 #include <operators/operator-Q/tnlOneSideDiffOperatorQ.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator = tnlNonlinearDiffusion< Mesh,
                                                           tnlOneSideDiffNonlinearOperator< Mesh, tnlOneSideDiffOperatorQ<Mesh, typename BoundaryCondition::RealType,
-                                                          typename BoundaryCondition::IndexType >, typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType >, 
+                                                          typename BoundaryCondition::IndexType >, typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType >,
                                                           typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType > >
-class tnlMeanCurvatureFlowEocProblem : public tnlMeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator > 
+class tnlMeanCurvatureFlowEocProblem : public tnlMeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >
 {
    public:
 
@@ -37,6 +31,6 @@ class tnlMeanCurvatureFlowEocProblem : public tnlMeanCurvatureFlowProblem< Mesh,
       bool setup( const tnlParameterContainer& parameters );
 };
 
-#include <problems/tnlMeanCurvatureFlowEocProblem_impl.h>
+} // namespace TNL
 
-#endif /* TNLMEANCURVATUREFLOWEOCPROBLEM_H_ */
+#include <problems/tnlMeanCurvatureFlowEocProblem_impl.h>
diff --git a/src/problems/tnlMeanCurvatureFlowEocProblem_impl.h b/src/problems/tnlMeanCurvatureFlowEocProblem_impl.h
index 50c4ddcd7dfbd4554cba0da08262b41b67e06087..07d84c0fe4bc45254bf7845e5f28397e868a791b 100644
--- a/src/problems/tnlMeanCurvatureFlowEocProblem_impl.h
+++ b/src/problems/tnlMeanCurvatureFlowEocProblem_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
+
+#pragma once
 
-#ifndef TNLMEANCURVATUREFLOWEOCPROBLEM_IMPL_H_
-#define TNLMEANCURVATUREFLOWEOCPROBLEM_IMPL_H_
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -38,11 +32,11 @@ tnlMeanCurvatureFlowEocProblem< Mesh, BoundaryCondition, RightHandSide, Differen
 setup( const tnlParameterContainer& parameters )
 {
    if( ! this->boundaryCondition.setup( parameters ) ||
-       ! this->rightHandSide.setup( parameters ) || 
+       ! this->rightHandSide.setup( parameters ) ||
        ! this->differentialOperator.nonlinearDiffusionOperator.operatorQ.setEps(parameters.getParameter< double >("eps")) )
       return false;
-   
+ 
    return true;
 }
 
-#endif /* TNLMEANCURVATUREFLOWEOCPROBLEM_IMPL_H_ */
+} // namespace TNL
\ No newline at end of file
diff --git a/src/problems/tnlMeanCurvatureFlowEocRhs.h b/src/problems/tnlMeanCurvatureFlowEocRhs.h
index 49a29d47b1436c52da12b6a7b1cd27be956a48c4..63a98cf0baee02ed36c0d715897bd1251ccec8da 100644
--- a/src/problems/tnlMeanCurvatureFlowEocRhs.h
+++ b/src/problems/tnlMeanCurvatureFlowEocRhs.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMEANCURVATUREFLOWEOCRHS_H_
-#define TNLMEANCURVATUREFLOWEOCRHS_H_
+#pragma once
 
 #include <functions/tnlDomain.h>
 
+namespace TNL {
+
 template< typename ExactOperator,
           typename TestFunction,
           int Dimensions >
@@ -51,11 +45,10 @@ class tnlMeanCurvatureFlowEocRhs : public tnlDomain< Dimensions, SpaceDomain >
       };
 
    protected:
-      
+ 
       ExactOperator exactOperator;
 
       TestFunction testFunction;
 };
 
-
-#endif /* TNLMEANCURVATUREFLOWEOCRHS_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlMeanCurvatureFlowProblem.h b/src/problems/tnlMeanCurvatureFlowProblem.h
index e317449789a97e3ddb2d8dc5746ec18f8658eaf3..061ab2437749dc6e1f9999aceb4e88682fae63ba 100644
--- a/src/problems/tnlMeanCurvatureFlowProblem.h
+++ b/src/problems/tnlMeanCurvatureFlowProblem.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMEANCURVATUREFLOWPROBLEM_H_
-#define TNLMEANCURVATUREFLOWPROBLEM_H_
+#pragma once
 
 #include <operators/diffusion/tnlOneSidedMeanCurvature.h>
 #include <problems/tnlPDEProblem.h>
@@ -24,10 +16,12 @@
 #include <matrices/tnlCSRMatrix.h>
 #include <functions/tnlMeshFunction.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
-          typename DifferentialOperator = 
+          typename DifferentialOperator =
             tnlOneSidedMeanCurvature< Mesh,
                                       typename Mesh::RealType,
                                       typename Mesh::IndexType,
@@ -67,7 +61,7 @@ class tnlMeanCurvatureFlowProblem : public tnlPDEProblem< Mesh,
       template< typename Matrix >
       bool setupLinearSystem( const MeshType& mesh,
                               Matrix& matrix );
-      
+ 
       bool makeSnapshot( const RealType& time,
                          const IndexType& step,
                          const MeshType& mesh,
@@ -103,10 +97,11 @@ class tnlMeanCurvatureFlowProblem : public tnlPDEProblem< Mesh,
       DifferentialOperator differentialOperator;
 
       BoundaryCondition boundaryCondition;
-   
+ 
       RightHandSide rightHandSide;
 };
 
-#include "tnlMeanCurvatureFlowProblem_impl.h"
 
-#endif /* TNLMEANCURVATUREFLOWPROBLEM_H_ */
+} // namespace TNL
+
+#include "tnlMeanCurvatureFlowProblem_impl.h"
diff --git a/src/problems/tnlMeanCurvatureFlowProblem_impl.h b/src/problems/tnlMeanCurvatureFlowProblem_impl.h
index f1e7bd91a37ae82ca51479bbbaccee09180f7842..732bb8563c662720c4df50666a3d116de809e5d6 100644
--- a/src/problems/tnlMeanCurvatureFlowProblem_impl.h
+++ b/src/problems/tnlMeanCurvatureFlowProblem_impl.h
@@ -6,17 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLMEANCURVATUREFLOWPROBLEM_IMPL_H_
-#define TNLMEANCURVATUREFLOWPROBLEM_IMPL_H_
+#pragma once
 
 #include <core/mfilename.h>
 #include <matrices/tnlMatrixSetter.h>
@@ -29,6 +21,7 @@
 
 #include "tnlMeanCurvatureFlowProblem.h"
 
+namespace TNL {
 
 template< typename Mesh,
           typename BoundaryCondition,
@@ -131,7 +124,7 @@ template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator >
-template< typename Matrix >          
+template< typename Matrix >
 bool
 tnlMeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
 setupLinearSystem( const MeshType& mesh,
@@ -147,7 +140,7 @@ setupLinearSystem( const MeshType& mesh,
       mesh,
       differentialOperator,
       boundaryCondition,
-      rowLengths 
+      rowLengths
    );
    matrix.setDimensions( dofs, dofs );
    if( ! matrix.setCompressedRowsLengths( rowLengths ) )
@@ -201,7 +194,7 @@ getExplicitRHS( const RealType& time,
     */
 
 //   this->differentialOperator.computeFirstGradient(mesh,time,u);
-   
+ 
    //cout << "u = " << u << endl;
    //this->bindDofs( mesh, u );
    MeshFunctionType u( mesh, inDofs );
@@ -216,7 +209,7 @@ getExplicitRHS( const RealType& time,
       this->rightHandSide,
       u,
       fu );
-   
+ 
    tnlBoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter;
    boundaryConditionsSetter.template apply< typename Mesh::Cell >(
       this->boundaryCondition,
@@ -234,7 +227,7 @@ template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator >
-template< typename Matrix >          
+template< typename Matrix >
 void
 tnlMeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
 assemblyLinearSystem( const RealType& time,
@@ -246,12 +239,12 @@ assemblyLinearSystem( const RealType& time,
                       MeshDependentDataType& meshDependentData )
 {
    MeshFunctionType u( mesh, dofsU );
-   tnlLinearSystemAssembler< Mesh, 
-			     MeshFunctionType, 
-			     DifferentialOperator, 
-			     BoundaryCondition, 
-			     RightHandSide, 
-			     tnlBackwardTimeDiscretisation, 
+   tnlLinearSystemAssembler< Mesh,
+			     MeshFunctionType,
+			     DifferentialOperator,
+			     BoundaryCondition,
+			     RightHandSide,
+			     tnlBackwardTimeDiscretisation,
 			     MatrixType,
 			     DofVectorType > systemAssembler;
    systemAssembler.template assembly< typename Mesh::Cell >(
@@ -271,4 +264,4 @@ assemblyLinearSystem( const RealType& time,
    //abort();*/
 }
 
-#endif /* TNLMEANCURVATUREFLOWPROBLEM_IMPL_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlPDEProblem.h b/src/problems/tnlPDEProblem.h
index 7be3d7f0a161a2c0a7295961c73c4d94bad6bb16..53e284b92fafa2c65e067461f8e13c5d5d9a939a 100644
--- a/src/problems/tnlPDEProblem.h
+++ b/src/problems/tnlPDEProblem.h
@@ -6,21 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPDEPROBLEM_H_
-#define TNLPDEPROBLEM_H_
+#pragma once
 
 #include <problems/tnlProblem.h>
 #include <matrices/tnlCSRMatrix.h>
 
+namespace TNL {
+
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Device = typename Mesh::DeviceType,
@@ -50,6 +44,9 @@ class tnlPDEProblem : public tnlProblem< Real, Device, Index >
 
       void writeProlog( tnlLogger& logger,
                         const tnlParameterContainer& parameters ) const;
+ 
+      bool writeEpilog( tnlLogger& logger ) const;
+
 
       bool setMeshDependentData( const MeshType& mesh,
                                  MeshDependentDataType& meshDependentData );
@@ -62,6 +59,11 @@ class tnlPDEProblem : public tnlProblem< Real, Device, Index >
                        const MeshType& mesh,
                        DofVectorType& dofs,
                        MeshDependentDataType& meshDependentData );
+ 
+      void setExplicitBoundaryConditions( const RealType& time,
+                                          const MeshType& mesh,
+                                          DofVectorType& dofs,
+                                          MeshDependentDataType& meshDependentData );
 
       bool postIterate( const RealType& time,
                         const RealType& tau,
@@ -74,6 +76,6 @@ class tnlPDEProblem : public tnlProblem< Real, Device, Index >
 
 };
 
-#include <problems/tnlPDEProblem_impl.h>
+} //namespace TNL
 
-#endif /* TNLPDEPROBLEM_H_ */
+#include <problems/tnlPDEProblem_impl.h>
diff --git a/src/problems/tnlPDEProblem_impl.h b/src/problems/tnlPDEProblem_impl.h
index 9954e2b1f4294c348fd4f197f7e3dfb6e08f273d..80e717ee7e4cbc51d54e72decb56004f45a58f63 100644
--- a/src/problems/tnlPDEProblem_impl.h
+++ b/src/problems/tnlPDEProblem_impl.h
@@ -6,17 +6,11 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPDEPROBLEM_IMPL_H_
-#define TNLPDEPROBLEM_IMPL_H_
+#pragma once
+
+namespace TNL {
 
 template< typename Mesh,
           typename Real,
@@ -54,6 +48,18 @@ writeProlog( tnlLogger& logger, const tnlParameterContainer& parameters ) const
 {
 }
 
+template< typename Mesh,
+          typename Real,
+          typename Device,
+          typename Index >
+bool
+tnlPDEProblem< Mesh, Real, Device, Index >::
+writeEpilog( tnlLogger& logger ) const
+{
+   return true;
+}
+
+
 template< typename Mesh,
           typename Real,
           typename Device,
@@ -95,6 +101,20 @@ preIterate( const RealType& time,
    return true;
 }
 
+template< typename Mesh,
+          typename Real,
+          typename Device,
+          typename Index >
+void
+tnlPDEProblem< Mesh, Real, Device, Index >::
+setExplicitBoundaryConditions( const RealType& time,
+                               const MeshType& mesh,
+                               DofVectorType& dofs,
+                               MeshDependentDataType& meshDependentData )
+{
+}
+
+
 template< typename Mesh,
           typename Real,
           typename Device,
@@ -122,5 +142,4 @@ getSolverMonitor()
    return 0;
 }
 
-
-#endif /* TNLPDEPROBLEM_IMPL_H_ */
+} // namespace TNL
diff --git a/src/problems/tnlProblem.h b/src/problems/tnlProblem.h
index b8c4af466584f3a315c697be174efb77465be447..d592ea7b1246cbc9bd8300204459045d211ce471 100644
--- a/src/problems/tnlProblem.h
+++ b/src/problems/tnlProblem.h
@@ -6,20 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef TNLPROBLEM_H_
-#define TNLPROBLEM_H_
+#pragma once
 
 #include <matrices/tnlSlicedEllpackMatrix.h>
 
+namespace TNL {
+
 template< typename Real,
           typename Device,
           typename Index >
@@ -32,5 +26,4 @@ class tnlProblem
       typedef Index IndexType;
 };
 
-
-#endif /* TNLPROBLEM_H_ */
+} //namespace TNL
diff --git a/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h b/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h
index 64dde9accce0ac0113208db46ba375869c9d081d..9b3fe479d78abc8402cfc03d602d69d2b70c2775 100644
--- a/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h
+++ b/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlNavierStokesSolver_H_
 #define tnlNavierStokesSolver_H_
diff --git a/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h b/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h
index ee42d6b199160c5b1474e03ff1a9e48882ead691..f94ede1733fb605cf6d46d6cc51dfa5d4d15319b 100644
--- a/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h
+++ b/src/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlNavierStokesSolver_IMPL_H_
 #define tnlNavierStokesSolver_IMPL_H_
@@ -323,7 +316,7 @@ void tnlNavierStokesSolver< AdvectionScheme,
       const IndexType size = dofs_rho.getSize();
 
       #ifdef HAVE_OPENMP
-      #pragma omp parallel for, if( tnlOmp::isEnabled() )
+      #pragma omp parallel for, if( tnlHost::isOMPEnabled() )
       #endif
       for( IndexType c = 0; c < size; c++ )
          {
@@ -447,7 +440,7 @@ void tnlNavierStokesSolver< AdvectionScheme,
    writePhysicalVariables( time, -4 );
 
 #ifdef HAVE_OPENMP
-  #pragma omp parallel for, if( tnlOmp::isEnabled() )
+  #pragma omp parallel for, if( tnlHost::isOMPEnabled() )
   #endif
   for( IndexType j = 0; j < ySize; j ++ )
      for( IndexType i = 0; i < xSize; i ++ )
diff --git a/src/solvers/linear/CMakeLists.txt b/src/solvers/linear/CMakeLists.txt
index 181dc98f872a1de919ba95d851d268199ca2e4aa..2b8ed6ad23884c6b881aa82594e3912e2da6dd59 100755
--- a/src/solvers/linear/CMakeLists.txt
+++ b/src/solvers/linear/CMakeLists.txt
@@ -3,6 +3,8 @@ ADD_SUBDIRECTORY( stationary )
 
 SET( headers tnlLinearResidueGetter.h
              tnlLinearResidueGetter_impl.h 
+             tnlUmfpackWrapper.h
+             tnlUmfpackWrapper_impl.h
    )
 
 SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/solvers/linear )
@@ -20,4 +22,4 @@ if( BUILD_CUDA)
 endif()
 
    
-INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear )
\ No newline at end of file
+INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear )
diff --git a/src/solvers/linear/krylov/tnlBICGStabSolver.h b/src/solvers/linear/krylov/tnlBICGStabSolver.h
index e3695d0a2e47a5e2dc50c40963c4110f5e8be394..d1b776251c01550ff32fc8ad0bbbe72ee75f0ed2 100644
--- a/src/solvers/linear/krylov/tnlBICGStabSolver.h
+++ b/src/solvers/linear/krylov/tnlBICGStabSolver.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlBICGStabSolverH
 #define tnlBICGStabSolverH
 
 #include <math.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
diff --git a/src/solvers/linear/krylov/tnlBICGStabSolver_impl.h b/src/solvers/linear/krylov/tnlBICGStabSolver_impl.h
index d38b0519c35549c379a645091cc2396dedea0ebd..eb3f29d7aa8ccab98d557d6dcf9e2637df2b086a 100644
--- a/src/solvers/linear/krylov/tnlBICGStabSolver_impl.h
+++ b/src/solvers/linear/krylov/tnlBICGStabSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlBICGStabSolver_implH
 #define tnlBICGStabSolver_implH
@@ -165,7 +158,7 @@ bool tnlBICGStabSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vect
        * x_{j+1} = x_j + alpha_j * p_j + omega_j * s_j
        */
       x.addVectors( p, alpha, s, omega );
-      
+ 
       /****
        * r_{j+1} = s_j - omega_j * A * s_j
        */
diff --git a/src/solvers/linear/krylov/tnlCGSolver.h b/src/solvers/linear/krylov/tnlCGSolver.h
index ce30288d75554aaef7829d72536243c44e9059cc..e053d4697205eef5d74c9b98faa7b524d9dd6eaa 100644
--- a/src/solvers/linear/krylov/tnlCGSolver.h
+++ b/src/solvers/linear/krylov/tnlCGSolver.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlCGSolverH
 #define tnlCGSolverH
 
 #include <math.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
@@ -44,7 +37,7 @@ class tnlCGSolver : public tnlObject,
 
 
    tnlCGSolver();
-   
+ 
    tnlString getType() const;
 
    static void configSetup( tnlConfigDescription& config,
diff --git a/src/solvers/linear/krylov/tnlCGSolver_impl.h b/src/solvers/linear/krylov/tnlCGSolver_impl.h
index e6ad7b74312d3246347fb10a01f59b4e78c6d9e4..4e42606dc4ac33334df3b88f4d6e28792b603165 100644
--- a/src/solvers/linear/krylov/tnlCGSolver_impl.h
+++ b/src/solvers/linear/krylov/tnlCGSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlCGSolver_implH
 #define tnlCGSolver_implH
@@ -104,12 +97,12 @@ solve( const Vector& b, Vector& x )
        */
       if( s2 == 0.0 ) alpha = 0.0;
       else alpha = s1 / s2;
-      
+ 
       /****
        * 2. x_{j+1} = x_j + \alpha_j p_j
        */
       x.addVector( p, alpha );
-      
+ 
       /****
        * 3. r_{j+1} = r_j - \alpha_j A * p_j
        */
@@ -137,7 +130,7 @@ solve( const Vector& b, Vector& x )
        * 6. r_{j+1} = new_r
        */
       new_r.swap( r );
-      
+ 
       if( this->getIterations() % 10 == 0 )
          this->setResidue( ResidueGetter :: getResidue( *matrix, b, x, bNorm ) );
    }
diff --git a/src/solvers/linear/krylov/tnlGMRESSolver.h b/src/solvers/linear/krylov/tnlGMRESSolver.h
index 8852c6ad9612a1c8f4154e0da1197d23f88de8b1..fa63a4849a04429566d8afe3fe00854a01c3346e 100644
--- a/src/solvers/linear/krylov/tnlGMRESSolver.h
+++ b/src/solvers/linear/krylov/tnlGMRESSolver.h
@@ -6,21 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlGMRESSolverH
 #define tnlGMRESSolverH
 
 
 #include <math.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
diff --git a/src/solvers/linear/krylov/tnlGMRESSolver_impl.cpp b/src/solvers/linear/krylov/tnlGMRESSolver_impl.cpp
index 9e2099cc8d30deaf2dbd59e9174614228fed43e3..1b12a40a6110353b56f56e9595e07d011a94796a 100644
--- a/src/solvers/linear/krylov/tnlGMRESSolver_impl.cpp
+++ b/src/solvers/linear/krylov/tnlGMRESSolver_impl.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <solvers/linear/krylov/tnlGMRESSolver.h>
 #include <matrices/tnlCSRMatrix.h>
diff --git a/src/solvers/linear/krylov/tnlGMRESSolver_impl.h b/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
index 87cc0a8a63b34fbbf3d2ad6fad051f78b044229c..c2c0a80c33b62f489688e9ef1c519e887128e65c 100644
--- a/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
+++ b/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLGMRESSOLVER_IMPL_H_
 #define TNLGMRESSOLVER_IMPL_H_
@@ -47,7 +40,7 @@ configSetup( tnlConfigDescription& config,
              const tnlString& prefix )
 {
    //tnlIterativeSolver< RealType, IndexType >::configSetup( config, prefix );
-   config.addEntry< int >( prefix + "gmres-restarting", "Number of iterations after which the GMRES restarts.", 10 );   
+   config.addEntry< int >( prefix + "gmres-restarting", "Number of iterations after which the GMRES restarts.", 10 );
 }
 
 template< typename Matrix,
@@ -104,7 +97,7 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
    }
 
    IndexType _size = size;
-   
+ 
    //RealType *w = _w. getData();
    RealType *s = _s. getData();
    RealType *cs = _cs. getData();
@@ -133,13 +126,13 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
    }
    else
    {
-      matrix -> vectorProduct( x, _r );      
+      matrix -> vectorProduct( x, _r );
       normb = b. lpNorm( ( RealType ) 2.0 );
       _r. addVector( b, ( RealType ) 1.0, -1.0 );
       beta = _r. lpNorm( ( RealType ) 2.0 );
       //cout << "x = " << x << endl;
    }
-   
+ 
     //cout << "norm b = " << normb << endl;
     //cout << " beta = " << beta << endl;
 
@@ -150,7 +143,7 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
    this->setResidue( beta / normb );
 
    tnlSharedVector< RealType, DeviceType, IndexType > vi, vk;
-   while( this->nextIteration() )
+   while( this->checkNextIteration() )
    {
       const IndexType m = restarting;
       for( IndexType i = 0; i < m + 1; i ++ )
@@ -188,7 +181,7 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
          }
          else
              matrix->vectorProduct( vi, w );
-         
+ 
          //cout << " i = " << i << " vi = " << vi << endl;
 
          for( IndexType k = 0; k <= i; k++ )
@@ -201,7 +194,7 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
                 * H_{k,i} = ( w, v_k )
                 */
                RealType H_k_i = w. scalarProduct( vk );
-               H[ k + i * ( m + 1 ) ] += H_k_i;           
+               H[ k + i * ( m + 1 ) ] += H_k_i;
 
                /****
                 * w = w - H_{k,i} v_k
@@ -218,15 +211,15 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
          H[ i + 1 + i * ( m + 1 ) ] = normw;
 
          //cout << "normw = " << normw << endl;
-         
+ 
          /***
           * v_{i+1} = w / |w|
           */
          vi. bind( &( _v. getData()[ ( i + 1 ) * size ] ), size );
          vi. addVector( w, ( RealType ) 1.0 / normw );
-         
+ 
          //cout << "vi = " << vi << endl;
-         
+ 
          /****
           * Applying the Givens rotations
           */
@@ -250,11 +243,7 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
                              sn[ i ] );
 
          this->setResidue( fabs( s[ i + 1 ] ) / normb );
-         // The nextIteration() method should not be called here, because it increments
-         // the iteration counter. The condition below is slightly different than in
-         // nextIteration(), because it first increments and then compares.
-         if( this->getIterations() >= this->getMinIterations() && this->getResidue() < this->getConvergenceResidue() )
-         {
+         if( ! this->checkNextIteration() ) {
             update( i, m, _H, _s, _v, x );
             this->refreshSolverMonitor( true );
             return this->checkConvergence();
@@ -325,7 +314,7 @@ void tnlGMRESSolver< Matrix, Preconditioner > :: update( IndexType k,
       //cout << " y = " << y << endl;
       y[ i ] /= H[ i + i * ( m + 1 ) ];
       for( j = i - 1; j >= 0; j--)
-         y[ j ] -= H[ j + i * ( m + 1 ) ] * y[ i ];      
+         y[ j ] -= H[ j + i * ( m + 1 ) ] * y[ i ];
    }
 
    tnlSharedVector< RealType, DeviceType, IndexType > vi;
diff --git a/src/solvers/linear/krylov/tnlTFQMRSolver.h b/src/solvers/linear/krylov/tnlTFQMRSolver.h
index ab25f3e349e752bdac403a2323fada4fe34aa30e..eb85056cf030990ca5bf0e02fa85e8e6e1e3997f 100644
--- a/src/solvers/linear/krylov/tnlTFQMRSolver.h
+++ b/src/solvers/linear/krylov/tnlTFQMRSolver.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlTFQMRSolverH
 #define tnlTFQMRSolverH
 
 #include <math.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/vectors/tnlVector.h>
 #include <core/vectors/tnlSharedVector.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
@@ -75,7 +68,9 @@ class tnlTFQMRSolver : public tnlObject,
 
    bool setSize( IndexType size );
 
-   tnlVector< RealType, Device, IndexType >  d, r, w, u, v, r_ast, Au;
+   tnlVector< RealType, Device, IndexType >  d, r, w, u, v, r_ast, Au, M_tmp;
+
+   IndexType size;
 
    const MatrixType* matrix;
    const PreconditionerType* preconditioner;
diff --git a/src/solvers/linear/krylov/tnlTFQMRSolver_impl.h b/src/solvers/linear/krylov/tnlTFQMRSolver_impl.h
index e2f7d210d3ea93e4b257305f8079adc1c1b079a9..7d3f129d52e0ee13d6dca3d1b953c2fc2047e0c9 100644
--- a/src/solvers/linear/krylov/tnlTFQMRSolver_impl.h
+++ b/src/solvers/linear/krylov/tnlTFQMRSolver_impl.h
@@ -6,29 +6,17 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlTFQMRSolver_implH
 #define tnlTFQMRSolver_implH
 
-template< typename RealType,
-          typename Vector >
-RealType computeTFQMRNewP( Vector& p,
-                           const Vector&r,
-                           const RealType& beta,
-                           const RealType& omega,
-                           const Vector& Ap );
-
 template< typename Matrix,
           typename Preconditioner >
 tnlTFQMRSolver< Matrix, Preconditioner > :: tnlTFQMRSolver()
+: size( 0 ),
+  matrix( 0 ),
+  preconditioner( 0 )
 {
 }
 
@@ -83,15 +71,29 @@ bool tnlTFQMRSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
    dbgFunctionName( "tnlTFQMRSolver", "Solve" );
    if( ! this->setSize( matrix -> getRows() ) ) return false;
 
-   RealType tau, theta, eta, rho, alpha, w_norm;
-   RealType b_norm = b. lpNorm( 2.0 );
-   if( b_norm == 0.0 )
-       b_norm = 1.0;
+   RealType tau, theta, eta, rho, alpha, b_norm, w_norm;
+
+   if( preconditioner ) {
+      preconditioner -> solve( b, M_tmp );
+      b_norm = M_tmp. lpNorm( ( RealType ) 2.0 );
 
-   this->matrix -> vectorProduct( x, r );
-   r. addVector( b, 1.0, -1.0 );
+      matrix -> vectorProduct( x, M_tmp );
+      M_tmp.addVector( b, 1.0, -1.0 );
+      preconditioner -> solve( M_tmp, r );
+   }
+   else {
+      b_norm = b. lpNorm( 2.0 );
+      matrix -> vectorProduct( x, r );
+      r.addVector( b, 1.0, -1.0 );
+   }
    w = u = r;
-   matrix -> vectorProduct( u, Au );
+   if( preconditioner ) {
+      matrix -> vectorProduct( u, M_tmp );
+      preconditioner -> solve( M_tmp, Au );
+   }
+   else {
+      matrix -> vectorProduct( u, Au );
+   }
    v = Au;
    d. setValue( 0.0 );
    tau = r. lpNorm( 2.0 );
@@ -101,6 +103,9 @@ bool tnlTFQMRSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
    // only to avoid compiler warning; alpha is initialized inside the loop
    alpha = 0.0;
 
+   if( b_norm == 0.0 )
+       b_norm = 1.0;
+
    this->resetIterations();
    this->setResidue( tau / b_norm );
 
@@ -114,7 +119,13 @@ bool tnlTFQMRSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
       else {
          // not necessary in odd iter since the previous iteration
          // already computed v_{m+1} = A*u_{m+1}
-         matrix -> vectorProduct( u, Au );
+         if( preconditioner ) {
+            matrix -> vectorProduct( u, M_tmp );
+            preconditioner -> solve( M_tmp, Au );
+         }
+         else {
+            matrix -> vectorProduct( u, Au );
+         }
       }
       w.addVector( Au, -alpha );
       d.addVector( u, 1.0, theta * theta * eta / alpha );
@@ -137,13 +148,19 @@ bool tnlTFQMRSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
 
          u.addVector( w, 1.0, beta );
          v.addVector( Au, beta, beta * beta );
-         matrix -> vectorProduct( u, Au );
+         if( preconditioner ) {
+            matrix -> vectorProduct( u, M_tmp );
+            preconditioner -> solve( M_tmp, Au );
+         }
+         else {
+            matrix -> vectorProduct( u, Au );
+         }
          v.addVector( Au, 1.0 );
       }
       else {
          u.addVector( v, -alpha );
       }
-      
+ 
       this->refreshSolverMonitor();
    }
 
@@ -165,13 +182,17 @@ template< typename Matrix,
           typename Preconditioner >
 bool tnlTFQMRSolver< Matrix, Preconditioner > :: setSize( IndexType size )
 {
+   if( this->size == size )
+      return true;
+   this->size = size;
    if( ! d. setSize( size ) ||
        ! r. setSize( size ) ||
        ! w. setSize( size ) ||
        ! u. setSize( size ) ||
        ! v. setSize( size ) ||
        ! r_ast. setSize( size ) ||
-       ! Au. setSize( size ) )
+       ! Au. setSize( size ) ||
+       ! M_tmp. setSize( size ) )
    {
       cerr << "I am not able to allocate all supporting vectors for the TFQMR solver." << endl;
       return false;
diff --git a/src/solvers/linear/stationary/tnlSORSolver.h b/src/solvers/linear/stationary/tnlSORSolver.h
index fc15f4793da46706f5216e2d4b7a5b746fe67045..834467cf7665fa778ebbc55c677991563762696c 100644
--- a/src/solvers/linear/stationary/tnlSORSolver.h
+++ b/src/solvers/linear/stationary/tnlSORSolver.h
@@ -6,20 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlSORSolverH
 #define tnlSORSolverH
 
 #include <math.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
 #include <solvers/tnlIterativeSolver.h>
 #include <solvers/linear/tnlLinearResidueGetter.h>
@@ -68,7 +61,7 @@ class tnlSORSolver : public tnlObject,
    template< typename Vector,
              typename ResidueGetter = tnlLinearResidueGetter< Matrix, Vector > >
    bool solve( const Vector& b, Vector& x );
-#endif   
+#endif
 
    ~tnlSORSolver();
 
diff --git a/src/solvers/linear/stationary/tnlSORSolver_impl.cpp b/src/solvers/linear/stationary/tnlSORSolver_impl.cpp
index 88e21d0cd024eec631319ef893a6816177a00790..5dc501896f65fa5bd5f4adfacc9e9e474c30e370 100644
--- a/src/solvers/linear/stationary/tnlSORSolver_impl.cpp
+++ b/src/solvers/linear/stationary/tnlSORSolver_impl.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <solvers/linear/stationary/tnlSORSolver.h>
 #include <matrices/tnlCSRMatrix.h>
diff --git a/src/solvers/linear/stationary/tnlSORSolver_impl.h b/src/solvers/linear/stationary/tnlSORSolver_impl.h
index ca8df5aa0134f2984ef2dbf06c631ef739a54ddb..188a52a60f4999ff1beaf981c4016235e60758ba 100644
--- a/src/solvers/linear/stationary/tnlSORSolver_impl.h
+++ b/src/solvers/linear/stationary/tnlSORSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSORSOLVER_IMPL_H_
 #define TNLSORSOLVER_IMPL_H_
@@ -56,7 +49,7 @@ setup( const tnlParameterContainer& parameters,
    {
       cerr << "Warning: The SOR method parameter omega is out of interval (0,2). The value is " << this->omega << " the method will not converge." << endl;
    }
-   return true;   
+   return true;
 }
 
 
diff --git a/src/solvers/linear/tnlLinearResidueGetter.h b/src/solvers/linear/tnlLinearResidueGetter.h
index 9aa56b612b978c948ee17c3f9aea84e136a1d737..7a4a7fa8845092309e995b92cbea6ad320b9ba19 100644
--- a/src/solvers/linear/tnlLinearResidueGetter.h
+++ b/src/solvers/linear/tnlLinearResidueGetter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLINEARRESIDUEGETTER_H_
 #define TNLLINEARRESIDUEGETTER_H_
diff --git a/src/solvers/linear/tnlLinearResidueGetter_impl.h b/src/solvers/linear/tnlLinearResidueGetter_impl.h
index b41c99a027512a618e8be49c2b546615fb0b5078..6ae6462ab1d8a7429d624f4cd7f5a6f3c40a0fc5 100644
--- a/src/solvers/linear/tnlLinearResidueGetter_impl.h
+++ b/src/solvers/linear/tnlLinearResidueGetter_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLINEARRESIDUEGETTER_IMPL_H_
 #define TNLLINEARRESIDUEGETTER_IMPL_H_
diff --git a/src/solvers/linear/tnlUmfpackWrapper.h b/src/solvers/linear/tnlUmfpackWrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..c40597540adf615654a79b6cdcba980b3dc0b49a
--- /dev/null
+++ b/src/solvers/linear/tnlUmfpackWrapper.h
@@ -0,0 +1,122 @@
+#pragma once
+
+#ifdef HAVE_UMFPACK
+
+#include <umfpack.h>
+
+#include <tnlObject.h>
+#include <config/tnlConfigDescription.h>
+#include <matrices/tnlCSRMatrix.h>
+#include <solvers/preconditioners/tnlDummyPreconditioner.h>
+#include <solvers/tnlIterativeSolver.h>
+#include <solvers/linear/tnlLinearResidueGetter.h>
+
+
+template< typename Matrix >
+struct is_csr_matrix
+{
+    static const bool value = false;
+};
+
+template< typename Real, typename Device, typename Index >
+struct is_csr_matrix< tnlCSRMatrix< Real, Device, Index > >
+{
+    static const bool value = true;
+};
+
+
+template< typename Matrix,
+          typename Preconditioner = tnlDummyPreconditioner< typename Matrix :: RealType,
+                                                            typename Matrix :: DeviceType,
+                                                            typename Matrix :: IndexType> >
+class tnlUmfpackWrapper
+    : public tnlObject,
+      // just to ensure the same interface as other linear solvers
+      public tnlIterativeSolver< typename Matrix::RealType,
+                                 typename Matrix::IndexType >
+{
+public:
+    typedef typename Matrix :: RealType RealType;
+    typedef typename Matrix :: IndexType IndexType;
+    typedef typename Matrix :: DeviceType DeviceType;
+    typedef Matrix MatrixType;
+    typedef Preconditioner PreconditionerType;
+
+    tnlUmfpackWrapper()
+    {
+        if( ! is_csr_matrix< Matrix >::value )
+            cerr << "The tnlUmfpackWrapper solver is available only for CSR matrices." << endl;
+        if( std::is_same< typename Matrix::DeviceType, tnlCuda >::value )
+            cerr << "The tnlUmfpackWrapper solver is not available on CUDA." << endl;
+        if( ! std::is_same< RealType, double >::value )
+            cerr << "The tnlUmfpackWrapper solver is available only for double precision." << endl;
+        if( ! std::is_same< IndexType, int >::value )
+            cerr << "The tnlUmfpackWrapper solver is available only for 'int' index type." << endl;
+    }
+
+    static void configSetup( tnlConfigDescription& config,
+                             const tnlString& prefix = "" )
+    {};
+
+    bool setup( const tnlParameterContainer& parameters,
+               const tnlString& prefix = "" )
+    {
+        return false;
+    };
+
+    void setMatrix( const MatrixType& matrix )
+    {};
+
+    void setPreconditioner( const Preconditioner& preconditioner )
+    {};
+
+    template< typename Vector,
+              typename ResidueGetter = tnlLinearResidueGetter< MatrixType, Vector > >
+    bool solve( const Vector& b, Vector& x )
+    {
+        return false;
+    };
+
+};
+
+
+template< typename Preconditioner >
+class tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >
+    : public tnlObject,
+      // just to ensure the same interface as other linear solvers
+      public tnlIterativeSolver< double, int >
+{
+public:
+    typedef double RealType;
+    typedef int IndexType;
+    typedef tnlHost DeviceType;
+    typedef tnlCSRMatrix< double, tnlHost, int > MatrixType;
+    typedef Preconditioner PreconditionerType;
+
+    tnlUmfpackWrapper();
+
+    tnlString getType() const;
+
+    static void configSetup( tnlConfigDescription& config,
+                             const tnlString& prefix = "" );
+
+    bool setup( const tnlParameterContainer& parameters,
+               const tnlString& prefix = "" );
+
+    void setMatrix( const MatrixType& matrix );
+
+    void setPreconditioner( const Preconditioner& preconditioner );
+
+    template< typename Vector,
+              typename ResidueGetter = tnlLinearResidueGetter< MatrixType, Vector > >
+    bool solve( const Vector& b, Vector& x );
+
+protected:
+   const MatrixType* matrix;
+
+   const PreconditionerType* preconditioner;
+};
+
+#include "tnlUmfpackWrapper_impl.h"
+
+#endif
diff --git a/src/solvers/linear/tnlUmfpackWrapper_impl.h b/src/solvers/linear/tnlUmfpackWrapper_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2c60037b869d7deeb39739f0d5614acaeaceaa0
--- /dev/null
+++ b/src/solvers/linear/tnlUmfpackWrapper_impl.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#ifdef HAVE_UMFPACK
+
+#include "tnlUmfpackWrapper.h"
+
+template< typename Preconditioner >
+tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+tnlUmfpackWrapper()
+{}
+
+template< typename Preconditioner >
+void
+tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+configSetup( tnlConfigDescription& config,
+             const tnlString& prefix )
+{
+}
+
+template< typename Preconditioner >
+bool
+tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+setup( const tnlParameterContainer& parameters,
+       const tnlString& prefix )
+{
+    return true;    
+}
+
+template< typename Preconditioner >
+void tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+setMatrix( const MatrixType& matrix )
+{
+    this -> matrix = &matrix;
+}
+
+template< typename Preconditioner >
+void tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+setPreconditioner( const Preconditioner& preconditioner )
+{
+    this -> preconditioner = &preconditioner;
+}
+
+
+template< typename Preconditioner >
+    template< typename Vector, typename ResidueGetter >
+bool tnlUmfpackWrapper< tnlCSRMatrix< double, tnlHost, int >, Preconditioner >::
+solve( const Vector& b,
+       Vector& x )
+{
+    tnlAssert( matrix->getRows() == matrix->getColumns(), );
+    tnlAssert( matrix->getColumns() == x.getSize() && matrix->getColumns() == b.getSize(), );
+
+    const IndexType size = matrix -> getRows();
+
+    this->resetIterations();
+    this->setResidue( this -> getConvergenceResidue() + 1.0 );
+
+    RealType bNorm = b. lpNorm( ( RealType ) 2.0 );
+
+    // UMFPACK objects
+    void* Symbolic = nullptr;
+    void* Numeric = nullptr;
+
+    int status = UMFPACK_OK;
+    double Control[ UMFPACK_CONTROL ];
+    double Info[ UMFPACK_INFO ];
+
+    // umfpack expects Compressed Sparse Column format, we have Compressed Sparse Row
+    // so we need to solve  A^T * x = rhs
+    int system_type = UMFPACK_Aat;
+
+    // symbolic reordering of the sparse matrix
+    status = umfpack_di_symbolic( size, size,
+                                  matrix->rowPointers.getData(),
+                                  matrix->columnIndexes.getData(),
+                                  matrix->values.getData(),
+                                  &Symbolic, Control, Info );
+    if( status != UMFPACK_OK ) {
+        cerr << "error: symbolic reordering failed" << endl;
+        goto finished;
+    }
+
+    // numeric factorization
+    status = umfpack_di_numeric( matrix->rowPointers.getData(),
+                                 matrix->columnIndexes.getData(),
+                                 matrix->values.getData(),
+                                 Symbolic, &Numeric, Control, Info );
+    if( status != UMFPACK_OK ) {
+        cerr << "error: numeric factorization failed" << endl;
+        goto finished;
+    }
+
+    // solve with specified right-hand-side
+    status = umfpack_di_solve( system_type,
+                               matrix->rowPointers.getData(),
+                               matrix->columnIndexes.getData(),
+                               matrix->values.getData(),
+                               x.getData(),
+                               b.getData(),
+                               Numeric, Control, Info );
+    if( status != UMFPACK_OK ) {
+        cerr << "error: umfpack_di_solve failed" << endl;
+        goto finished;
+    }
+
+finished:
+    if( status != UMFPACK_OK ) {
+        // increase print level for reports
+        Control[ UMFPACK_PRL ] = 2;
+        umfpack_di_report_status( Control, status );
+//        umfpack_di_report_control( Control );
+//        umfpack_di_report_info( Control, Info );
+    }
+
+    if( Symbolic )
+        umfpack_di_free_symbolic( &Symbolic );
+    if( Numeric )
+        umfpack_di_free_numeric( &Numeric );
+
+    this->setResidue( ResidueGetter::getResidue( *matrix, x, b, bNorm ) );
+    this->refreshSolverMonitor( true );
+    return status == UMFPACK_OK;
+};
+
+#endif
diff --git a/src/solvers/ode/tnlEulerSolver.h b/src/solvers/ode/tnlEulerSolver.h
index 428bf19d550c5cb7b932c234ab1f7b9c7360b38b..09c62fb1516af2e3e785a63df2cfcd99b30b9115 100644
--- a/src/solvers/ode/tnlEulerSolver.h
+++ b/src/solvers/ode/tnlEulerSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlEulerSolverH
 #define tnlEulerSolverH
@@ -22,6 +15,7 @@
 #include <config/tnlConfigDescription.h>
 #include <solvers/ode/tnlExplicitSolver.h>
 #include <config/tnlParameterContainer.h>
+#include <core/tnlTimer.h>
 
 template< typename Problem >
 class tnlEulerSolver : public tnlExplicitSolver< Problem >
@@ -56,12 +50,12 @@ class tnlEulerSolver : public tnlExplicitSolver< Problem >
                              RealType tau,
                              RealType& currentResidue );
 
-   
+ 
    DofVectorType k1;
 
    RealType cflCondition;
-   
-   tnlTimerRT timer, updateTimer;
+ 
+   //tnlTimer timer, updateTimer;
 };
 
 #include <solvers/ode/tnlEulerSolver_impl.h>
diff --git a/src/solvers/ode/tnlEulerSolver_impl.h b/src/solvers/ode/tnlEulerSolver_impl.h
index b682fcefe96a77eb1de9d5479a30615cdeba68db..e963c1a2ef6e0876989fb90c160609810928feb5 100644
--- a/src/solvers/ode/tnlEulerSolver_impl.h
+++ b/src/solvers/ode/tnlEulerSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlEulerSolver_implH
 #define tnlEulerSolver_implH
@@ -32,8 +25,8 @@ template< typename Problem >
 tnlEulerSolver< Problem > :: tnlEulerSolver()
 : cflCondition( 0.0 )
 {
-   timer.reset();
-   updateTimer.reset();
+   //timer.reset();
+   //updateTimer.reset();
 };
 
 template< typename Problem >
@@ -80,7 +73,7 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
    /****
     * First setup the supporting meshes k1...k5 and k_tmp.
     */
-   timer.start();
+   //timer.start();
    if( ! k1. setLike( u ) )
    {
       cerr << "I do not have enough memory to allocate a supporting grid for the Euler explicit solver." << endl;
@@ -109,9 +102,9 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
       /****
        * Compute the RHS
        */
-      timer.stop();
+      //timer.stop();
       this->problem->getExplicitRHS( time, currentTau, u, k1 );
-      timer.start();
+      //timer.start();
 
       RealType lastResidue = this->getResidue();
       RealType maxResidue( 0.0 );
@@ -125,9 +118,9 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
          }
       }
       RealType newResidue( 0.0 );
-      updateTimer.start();
+      //updateTimer.start();
       computeNewTimeLevel( u, currentTau, newResidue );
-      updateTimer.stop();
+      //updateTimer.stop();
       this->setResidue( newResidue );
 
       /****
@@ -156,8 +149,8 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
           ( this->getConvergenceResidue() != 0.0 && this->getResidue() < this->getConvergenceResidue() ) )
       {
          this->refreshSolverMonitor();
-         std::cerr << std::endl << "RHS Timer = " << timer.getTime() << std::endl;
-         std::cerr << std::endl << "Update Timer = " << updateTimer.getTime() << std::endl;
+         //std::cerr << std::endl << "RHS Timer = " << timer.getRealTime() << std::endl;
+         //std::cerr << std::endl << "Update Timer = " << updateTimer.getRealTime() << std::endl;
          return true;
       }
 
@@ -166,7 +159,7 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u )
          currentTau /= 0.95;
          currentTau = Min( currentTau, this->getMaxTau() );
       }
-   }   
+   }
 };
 
 template< typename Problem >
@@ -175,15 +168,15 @@ void tnlEulerSolver< Problem > :: computeNewTimeLevel( DofVectorType& u,
                                                        RealType& currentResidue )
 {
    RealType localResidue = RealType( 0.0 );
-   IndexType size = k1. getSize();
+   const IndexType size = k1. getSize();
    RealType* _u = u. getData();
    RealType* _k1 = k1. getData();
 
    if( std::is_same< DeviceType, tnlHost >::value )
    {
-#ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:localResidue) firstprivate( _u, _k1, tau ) if( tnlOmp::isEnabled() )
-#endif
+//#ifdef HAVE_OPENMP
+//#pragma omp parallel for reduction(+:localResidue) firstprivate( _u, _k1, tau ) if( tnlHost::isOMPEnabled() )
+//#endif
       for( IndexType i = 0; i < size; i ++ )
       {
          const RealType add = tau * _k1[ i ];
@@ -244,7 +237,7 @@ __global__ void updateUEuler( const Index size,
 
    computeBlockResidue( du,
                         cudaBlockResidue,
-                        n );   
+                        n );
 }
 #endif
 
diff --git a/src/solvers/ode/tnlExplicitSolver.h b/src/solvers/ode/tnlExplicitSolver.h
index c3c6328e7d49a33a0829e64b142698f49e1a341f..4d82fe7dfea29e93a96fabb00e6b0ea29613e72d 100644
--- a/src/solvers/ode/tnlExplicitSolver.h
+++ b/src/solvers/ode/tnlExplicitSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlExplicitSolverH
 #define tnlExplicitSolverH
@@ -22,7 +15,7 @@
 #include <core/tnlTimerCPU.h>
 #include <core/tnlTimerRT.h>
 #include <core/tnlFlopsCounter.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <solvers/ode/tnlODESolverMonitor.h>
 #include <solvers/tnlIterativeSolver.h>
 #include <config/tnlConfigDescription.h>
@@ -33,7 +26,7 @@ class tnlExplicitSolver : public tnlIterativeSolver< typename Problem::RealType,
                                                      typename Problem::IndexType >
 {
    public:
-   
+ 
    typedef Problem ProblemType;
    typedef typename Problem :: DofVectorType DofVectorType;
    typedef typename Problem :: RealType RealType;
@@ -53,13 +46,13 @@ class tnlExplicitSolver : public tnlIterativeSolver< typename Problem::RealType,
    void setTime( const RealType& t );
 
    const RealType& getTime() const;
-   
+ 
    void setStopTime( const RealType& stopTime );
 
    RealType getStopTime() const;
 
    void setTau( const RealType& tau );
-   
+ 
    const RealType& getTau() const;
 
    void setMaxTau( const RealType& maxTau );
@@ -67,13 +60,13 @@ class tnlExplicitSolver : public tnlIterativeSolver< typename Problem::RealType,
    const RealType& getMaxTau() const;
 
    void setMPIComm( MPI_Comm comm );
-  
+ 
    void setVerbose( IndexType v );
 
    void setTimerCPU( tnlTimerCPU* timer );
 
    void setTimerRT( tnlTimerRT* timer );
-   
+ 
    virtual bool solve( DofVectorType& u ) = 0;
 
    void setTestingMode( bool testingMode );
@@ -85,7 +78,7 @@ class tnlExplicitSolver : public tnlIterativeSolver< typename Problem::RealType,
    void refreshSolverMonitor();
 
 protected:
-    
+ 
    /****
     * Current time of the parabolic problem.
     */
@@ -108,7 +101,7 @@ protected:
    IndexType verbosity;
 
    tnlTimerCPU* cpu_timer;
-   
+ 
    tnlTimerRT* rt_timer;
 
    bool testingMode;
diff --git a/src/solvers/ode/tnlExplicitSolver_impl.h b/src/solvers/ode/tnlExplicitSolver_impl.h
index 7fbe958e13e5d7bd12ebb6ed88dcfd72dc7e9165..1eb4920740c41f2c1c8a303b3a1cb5f64de915df 100644
--- a/src/solvers/ode/tnlExplicitSolver_impl.h
+++ b/src/solvers/ode/tnlExplicitSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLEXPLICITSOLVER_IMPL_H_
 #define TNLEXPLICITSOLVER_IMPL_H_
diff --git a/src/solvers/ode/tnlMersonSolver.h b/src/solvers/ode/tnlMersonSolver.h
index 673ee904dd371f253cc1df5a9790c7bdf7d35938..2cd0829f4207edf51e7cb4bd3c0748124dbfc9bc 100644
--- a/src/solvers/ode/tnlMersonSolver.h
+++ b/src/solvers/ode/tnlMersonSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMersonSolverH
 #define tnlMersonSolverH
@@ -48,7 +41,7 @@ class tnlMersonSolver : public tnlExplicitSolver< Problem >
    bool solve( DofVectorType& u );
 
    protected:
-   
+ 
    //! Compute the Runge-Kutta coefficients
    /****
     * The parameter u is not constant because one often
diff --git a/src/solvers/ode/tnlMersonSolver_impl.h b/src/solvers/ode/tnlMersonSolver_impl.h
index 4c0fdad7e245af80f89f2206e5d5b3776df4cbc8..f0866b14f47d81d319f6500cdd4d33141e23d6d0 100644
--- a/src/solvers/ode/tnlMersonSolver_impl.h
+++ b/src/solvers/ode/tnlMersonSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlMersonSolver_implH
 #define tnlMersonSolver_implH
@@ -192,7 +185,7 @@ bool tnlMersonSolver< Problem > :: solve( DofVectorType& u )
          RealType newResidue( 0.0 );
          computeNewTimeLevel( u, currentTau, newResidue );
          this->setResidue( newResidue );
-         
+ 
          /****
           * When time is close to stopTime the new residue
           * may be inaccurate significantly.
@@ -274,28 +267,28 @@ void tnlMersonSolver< Problem > :: computeKFunctions( DofVectorType& u,
       this->problem->getExplicitRHS( time, tau, u, k1 );
 
    #ifdef HAVE_OPENMP
-   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, tau, tau_3 ) if( tnlOmp::isEnabled() )
+   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, tau, tau_3 ) if( tnlHost::isOMPEnabled() )
    #endif
       for( IndexType i = 0; i < size; i ++ )
          _kAux[ i ] = _u[ i ] + tau * ( 1.0 / 3.0 * _k1[ i ] );
       this->problem->getExplicitRHS( time + tau_3, tau, kAux, k2 );
 
    #ifdef HAVE_OPENMP
-   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k2, tau, tau_3 ) if( tnlOmp::isEnabled() )
+   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k2, tau, tau_3 ) if( tnlHost::isOMPEnabled() )
    #endif
       for( IndexType i = 0; i < size; i ++ )
          _kAux[ i ] = _u[ i ] + tau * 1.0 / 6.0 * ( _k1[ i ] + _k2[ i ] );
       this->problem->getExplicitRHS( time + tau_3, tau, kAux, k3 );
 
    #ifdef HAVE_OPENMP
-   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k3, tau, tau_3 ) if( tnlOmp::isEnabled() )
+   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k3, tau, tau_3 ) if( tnlHost::isOMPEnabled() )
    #endif
       for( IndexType i = 0; i < size; i ++ )
          _kAux[ i ] = _u[ i ] + tau * ( 0.125 * _k1[ i ] + 0.375 * _k3[ i ] );
       this->problem->getExplicitRHS( time + 0.5 * tau, tau, kAux, k4 );
 
    #ifdef HAVE_OPENMP
-   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k3, _k4, tau, tau_3 ) if( tnlOmp::isEnabled() )
+   #pragma omp parallel for firstprivate( size, _kAux, _u, _k1, _k3, _k4, tau, tau_3 ) if( tnlHost::isOMPEnabled() )
    #endif
       for( IndexType i = 0; i < size; i ++ )
          _kAux[ i ] = _u[ i ] + tau * ( 0.5 * _k1[ i ] - 1.5 * _k3[ i ] + 2.0 * _k4[ i ] );
@@ -454,7 +447,7 @@ void tnlMersonSolver< Problem > :: computeNewTimeLevel( DofVectorType& u,
    if( DeviceType :: getDevice() == tnlHostDevice )
    {
 #ifdef HAVE_OPENMP
-#pragma omp parallel for reduction(+:localResidue) firstprivate( size, _u, _k1, _k4, _k5, tau ) if( tnlOmp::isEnabled() )
+#pragma omp parallel for reduction(+:localResidue) firstprivate( size, _u, _k1, _k4, _k5, tau ) if( tnlHost::isOMPEnabled() )
 #endif
       for( IndexType i = 0; i < size; i ++ )
       {
diff --git a/src/solvers/ode/tnlODESolverMonitor.h b/src/solvers/ode/tnlODESolverMonitor.h
index f9f38271a1a4ef826eeb79fd6a7183cd402ad4c3..5c81b820aa337055752746e0b251fdcca58a2e3c 100644
--- a/src/solvers/ode/tnlODESolverMonitor.h
+++ b/src/solvers/ode/tnlODESolverMonitor.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLODESOLVERMONITOR_H_
 #define TNLODESOLVERMONITOR_H_
diff --git a/src/solvers/ode/tnlODESolverMonitor_impl.h b/src/solvers/ode/tnlODESolverMonitor_impl.h
index 44ff3d69d2b5a76a5bef95abc13720f66ffd7911..4e415520f37a9c1707e0af1f0b8d0e1337a3fb33 100644
--- a/src/solvers/ode/tnlODESolverMonitor_impl.h
+++ b/src/solvers/ode/tnlODESolverMonitor_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLODESOLVERMONITOR_IMPL_H_
 #define TNLODESOLVERMONITOR_IMPL_H_
diff --git a/src/solvers/pde/tnlBackwardTimeDiscretisation.h b/src/solvers/pde/tnlBackwardTimeDiscretisation.h
index 4c0f11218e1ce22db648d17946f0692ccfef36ff..b3e5d78b279a83ba52400a7fc076f1e22e99abe3 100644
--- a/src/solvers/pde/tnlBackwardTimeDiscretisation.h
+++ b/src/solvers/pde/tnlBackwardTimeDiscretisation.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLBACKWARDTIMEDISCRETISATION_H
@@ -23,8 +16,8 @@
 
 class tnlBackwardTimeDiscretisation
 {
-    public:        
-        
+    public:
+ 
         template< typename RealType,
                   typename IndexType,
                   typename MatrixType >
diff --git a/src/solvers/pde/tnlBoundaryConditionsSetter.h b/src/solvers/pde/tnlBoundaryConditionsSetter.h
index 2cb76bddbbd749e4b577e900def6429ac3c82f8f..5cbfd74c17667278ce90d02af1453f88df85931a 100644
--- a/src/solvers/pde/tnlBoundaryConditionsSetter.h
+++ b/src/solvers/pde/tnlBoundaryConditionsSetter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLBOUNDARYCONDITIONSSETTER_H
@@ -35,7 +28,7 @@ class tnlBoundaryConditionsSetterTraverserUserData
 
       DofVector *u;
 
-      tnlBoundaryConditionsSetterTraverserUserData( 
+      tnlBoundaryConditionsSetterTraverserUserData(
          const Real& time,
          const BoundaryConditions& boundaryConditions,
          DofVector& u )
@@ -55,7 +48,7 @@ class tnlBoundaryConditionsSetter
       typedef typename MeshFunction::RealType RealType;
       typedef typename MeshFunction::DeviceType DeviceType;
       typedef typename MeshFunction::IndexType IndexType;
-      typedef tnlBoundaryConditionsSetterTraverserUserData< 
+      typedef tnlBoundaryConditionsSetterTraverserUserData<
          RealType,
          MeshFunction,
          BoundaryConditions > TraverserUserData;
@@ -63,12 +56,12 @@ class tnlBoundaryConditionsSetter
       template< typename EntityType = typename MeshType::Cell >
       static void apply( const BoundaryConditions& boundaryConditions,
                          const RealType& time,
-                         MeshFunction& u );      
-     
+                         MeshFunction& u );
+ 
       class TraverserBoundaryEntitiesProcessor
       {
          public:
-            
+ 
             template< typename GridEntity >
             __cuda_callable__
             static inline void processEntity( const MeshType& mesh,
diff --git a/src/solvers/pde/tnlBoundaryConditionsSetter_impl.h b/src/solvers/pde/tnlBoundaryConditionsSetter_impl.h
index 8dd600d393da2e09dcea07062e13cd764780dd88..4d05aad74f780865e14ef50b7092a91ff6d57d40 100644
--- a/src/solvers/pde/tnlBoundaryConditionsSetter_impl.h
+++ b/src/solvers/pde/tnlBoundaryConditionsSetter_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLBOUNDARYCONDITIONSSETTER_IMPL_H
 #define	TNLBOUNDARYCONDITIONSSETTER_IMPL_H
diff --git a/src/solvers/pde/tnlExplicitTimeStepper.h b/src/solvers/pde/tnlExplicitTimeStepper.h
index 0f35a1495d9c89687542d4d6ede27e7beb4369e4..4835ab0fb61efcddf6d6dc2cba5aa0597a2dc0c1 100644
--- a/src/solvers/pde/tnlExplicitTimeStepper.h
+++ b/src/solvers/pde/tnlExplicitTimeStepper.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLEXPLICITTIMESTEPPER_H_
 #define TNLEXPLICITTIMESTEPPER_H_
@@ -21,7 +14,7 @@
 #include <solvers/ode/tnlODESolverMonitor.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
-#include <core/tnlTimerRT.h>
+#include <core/tnlTimer.h>
 #include <core/tnlLogger.h>
 
 
@@ -70,7 +63,7 @@ class tnlExplicitTimeStepper
                         const RealType& tau,
                         DofVectorType& _u,
                         DofVectorType& _fu );
-   
+ 
    bool writeEpilog( tnlLogger& logger );
 
    protected:
@@ -84,9 +77,9 @@ class tnlExplicitTimeStepper
    RealType timeStep;
 
    MeshDependentDataType* meshDependentData;
-   
-   tnlTimerRT explicitUpdaterTimer, mainTimer;
-   
+ 
+   tnlTimer preIterateTimer, explicitUpdaterTimer, mainTimer, postIterateTimer;
+ 
    long long int allIterations;
 };
 
diff --git a/src/solvers/pde/tnlExplicitTimeStepper_impl.h b/src/solvers/pde/tnlExplicitTimeStepper_impl.h
index e026ef174f85a1d4be7181fd7f6d45af3502463f..738e67f2725cf2303101b2396b96ab0e9b151c03 100644
--- a/src/solvers/pde/tnlExplicitTimeStepper_impl.h
+++ b/src/solvers/pde/tnlExplicitTimeStepper_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLEXPLICITTIMESTEPPER_IMPL_H_
 #define TNLEXPLICITTIMESTEPPER_IMPL_H_
@@ -59,6 +52,8 @@ init( const MeshType& mesh )
 {
    this->explicitUpdaterTimer.reset();
    this->mainTimer.reset();
+   this->preIterateTimer.reset();
+   this->postIterateTimer.reset();
    return true;
 }
 
@@ -126,6 +121,7 @@ solve( const RealType& time,
    this->meshDependentData = &meshDependentData;
    if( ! this->odeSolver->solve( dofVector ) )
       return false;
+   this->problem->setExplicitBoundaryConditions( stopTime, *( this->mesh ), dofVector, *( this->meshDependentData ) );
    mainTimer.stop();
    this->allIterations += this->odeSolver->getIterations();
    return true;
@@ -140,6 +136,7 @@ getExplicitRHS( const RealType& time,
                 DofVectorType& u,
                 DofVectorType& fu )
 {
+   this->preIterateTimer.start();
    if( ! this->problem->preIterate( time,
                                     tau,
                                     *( this->mesh),
@@ -150,9 +147,12 @@ getExplicitRHS( const RealType& time,
       return;
       //return false; // TODO: throw exception
    }
+   this->preIterateTimer.stop();
    this->explicitUpdaterTimer.start();
+   this->problem->setExplicitBoundaryConditions( time, *( this->mesh ), u, *( this->meshDependentData ) );
    this->problem->getExplicitRHS( time, tau, *( this->mesh ), u, fu, *( this->meshDependentData ) );
    this->explicitUpdaterTimer.stop();
+   this->postIterateTimer.start();
    if( ! this->problem->postIterate( time,
                                      tau,
                                      *( this->mesh ),
@@ -163,6 +163,7 @@ getExplicitRHS( const RealType& time,
       return;
       //return false; // TODO: throw exception
    }
+   this->postIterateTimer.stop();
 }
 
 template< typename Problem,
@@ -171,9 +172,15 @@ bool
 tnlExplicitTimeStepper< Problem, OdeSolver >::
 writeEpilog( tnlLogger& logger )
 {
-   logger.writeParameter< long long int >( "Ierations count:", this->allIterations );
-   logger.writeParameter< double >( "Explicit update computation time:", this->explicitUpdaterTimer.getTime() );
-   logger.writeParameter< double >( "Explicit time stepper time:", this->mainTimer.getTime() );
+   logger.writeParameter< long long int >( "Iterations count:", this->allIterations );
+   logger.writeParameter< const char* >( "Pre-iterate time:", "" );
+   this->preIterateTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Explicit update computation:", "" );
+   this->explicitUpdaterTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Explicit time stepper time:", "" );
+   this->mainTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Post-iterate time:", "" );
+   this->postIterateTimer.writeLog( logger, 1 );
    return true;
 }
 
diff --git a/src/solvers/pde/tnlExplicitUpdater.h b/src/solvers/pde/tnlExplicitUpdater.h
index 6956c8b29e9a200d054677f7ec31e737c78fe66b..8c99a37e4f6bed5a0bb3374067b1d14140df9984 100644
--- a/src/solvers/pde/tnlExplicitUpdater.h
+++ b/src/solvers/pde/tnlExplicitUpdater.h
@@ -6,19 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLEXPLICITUPDATER_H_
 #define TNLEXPLICITUPDATER_H_
 
 #include <functions/tnlFunctionAdapter.h>
+#include <core/tnlTimer.h>
 
 template< typename Real,
           typename MeshFunction,
@@ -51,7 +45,8 @@ class tnlExplicitUpdaterTraverserUserData
         rightHandSide( &rightHandSide ),
         u( &u ),
         fu( &fu )
-      {};
+      {
+      };
 };
 
 
@@ -72,6 +67,14 @@ class tnlExplicitUpdater
                                                    DifferentialOperator,
                                                    BoundaryConditions,
                                                    RightHandSide > TraverserUserData;
+ 
+      tnlExplicitUpdater()
+      : gpuTransferTimer( 0 ){}
+ 
+      void setGPUTransferTimer( tnlTimer& timer )
+      {
+         this->gpuTransferTimer = &timer;
+      }
 
       template< typename EntityType >
       void update( const RealType& time,
@@ -80,12 +83,12 @@ class tnlExplicitUpdater
                    const BoundaryConditions& boundaryConditions,
                    const RightHandSide& rightHandSide,
                    MeshFunction& u,
-                   MeshFunction& fu ) const;      
-      
+                   MeshFunction& fu ) const;
+ 
       class TraverserBoundaryEntitiesProcessor
       {
          public:
-            
+ 
             template< typename GridEntity >
             __cuda_callable__
             static inline void processEntity( const MeshType& mesh,
@@ -105,27 +108,31 @@ class tnlExplicitUpdater
          public:
 
             typedef typename MeshType::VertexType VertexType;
-         
+ 
             template< typename EntityType >
             __cuda_callable__
             static inline void processEntity( const MeshType& mesh,
                                               TraverserUserData& userData,
                                               const EntityType& entity )
             {
-               ( *userData.fu)( entity ) = 
+               ( *userData.fu)( entity ) =
                   userData.differentialOperator->operator()(
                      *userData.u,
                      entity,
                      *userData.time );
 
                typedef tnlFunctionAdapter< MeshType, RightHandSide > FunctionAdapter;
-               ( * userData.fu )( entity ) += 
+               ( * userData.fu )( entity ) +=
                   FunctionAdapter::getValue(
                      *userData.rightHandSide,
                      entity,
                      *userData.time );
             }
       };
+ 
+   protected:
+ 
+      tnlTimer* gpuTransferTimer;
 };
 
 #include <solvers/pde/tnlExplicitUpdater_impl.h>
diff --git a/src/solvers/pde/tnlExplicitUpdater_impl.h b/src/solvers/pde/tnlExplicitUpdater_impl.h
index 16a2c0346402907c21701d280609deddd27a3cad..1a17046d70c761a6e51049ffe2a65362e27e180d 100644
--- a/src/solvers/pde/tnlExplicitUpdater_impl.h
+++ b/src/solvers/pde/tnlExplicitUpdater_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLEXPLICITUPDATER_IMPL_H_
 #define TNLEXPLICITUPDATER_IMPL_H_
@@ -23,6 +16,8 @@
 #include <mesh/grids/tnlTraverser_Grid2D.h>
 #include <mesh/grids/tnlTraverser_Grid3D.h>
 
+#include "tnlExplicitUpdater.h"
+
 template< typename Mesh,
           typename MeshFunction,
           typename DifferentialOperator,
@@ -33,13 +28,13 @@ void
 tnlExplicitUpdater< Mesh, MeshFunction, DifferentialOperator, BoundaryConditions, RightHandSide >::
 update( const RealType& time,
         const Mesh& mesh,
-        const DifferentialOperator& differentialOperator,        
+        const DifferentialOperator& differentialOperator,
         const BoundaryConditions& boundaryConditions,
         const RightHandSide& rightHandSide,
         MeshFunction& u,
         MeshFunction& fu ) const
 {
-   static_assert( std::is_same< MeshFunction, 
+   static_assert( std::is_same< MeshFunction,
                                 tnlVector< typename MeshFunction::RealType,
                                            typename MeshFunction::DeviceType,
                                            typename MeshFunction::IndexType > >::value != true,
@@ -60,12 +55,17 @@ update( const RealType& time,
    }
    if( std::is_same< DeviceType, tnlCuda >::value )
    {
+      if( this->gpuTransferTimer )
+         this->gpuTransferTimer->start();
       RealType* kernelTime = tnlCuda::passToDevice( time );
       DifferentialOperator* kernelDifferentialOperator = tnlCuda::passToDevice( differentialOperator );
       BoundaryConditions* kernelBoundaryConditions = tnlCuda::passToDevice( boundaryConditions );
       RightHandSide* kernelRightHandSide = tnlCuda::passToDevice( rightHandSide );
       MeshFunction* kernelU = tnlCuda::passToDevice( u );
       MeshFunction* kernelFu = tnlCuda::passToDevice( fu );
+     if( this->gpuTransferTimer )
+         this->gpuTransferTimer->stop();
+
       TraverserUserData userData( *kernelTime, *kernelDifferentialOperator, *kernelBoundaryConditions, *kernelRightHandSide, *kernelU, *kernelFu );
       checkCudaDevice;
       tnlTraverser< MeshType, EntityType > meshTraverser;
@@ -78,6 +78,9 @@ update( const RealType& time,
                                                     ( mesh,
                                                       userData );
 
+      if( this->gpuTransferTimer )
+         this->gpuTransferTimer->start();
+ 
       checkCudaDevice;
       tnlCuda::freeFromDevice( kernelTime );
       tnlCuda::freeFromDevice( kernelDifferentialOperator );
@@ -86,6 +89,10 @@ update( const RealType& time,
       tnlCuda::freeFromDevice( kernelU );
       tnlCuda::freeFromDevice( kernelFu );
       checkCudaDevice;
+ 
+      if( this->gpuTransferTimer )
+         this->gpuTransferTimer->stop();
+
    }
 }
 
diff --git a/src/solvers/pde/tnlLinearSystemAssembler.h b/src/solvers/pde/tnlLinearSystemAssembler.h
index 14753fb7877ae1f1126b541345099a1da28a916f..897658d9391d79f529fe0c95361090a648cfb503 100644
--- a/src/solvers/pde/tnlLinearSystemAssembler.h
+++ b/src/solvers/pde/tnlLinearSystemAssembler.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLINEARSYSTEMASSEMBLER_H_
 #define TNLLINEARSYSTEMASSEMBLER_H_
@@ -44,9 +37,9 @@ class tnlLinearSystemAssemblerTraverserUserData
       const BoundaryConditions* boundaryConditions;
 
       const RightHandSide* rightHandSide;
-      
+ 
       const MeshFunction *u;
-      
+ 
       DofVector *b;
 
       Matrix *matrix;
@@ -91,13 +84,13 @@ class tnlLinearSystemAssembler
    typedef typename MeshFunction::IndexType IndexType;
    typedef Matrix MatrixType;
    typedef tnlLinearSystemAssemblerTraverserUserData< RealType,
-                                                      MeshFunction,                                                      
+                                                      MeshFunction,
                                                       DifferentialOperator,
                                                       BoundaryConditions,
                                                       RightHandSide,
                                                       MatrixType,
                                                       DofVector > TraverserUserData;
-      
+ 
    template< typename EntityType >
    void assembly( const RealType& time,
                   const RealType& tau,
@@ -109,26 +102,25 @@ class tnlLinearSystemAssembler
                   MatrixType& matrix,
                   DofVector& b ) const;
 
-   
+ 
       class TraverserBoundaryEntitiesProcessor
    {
       public:
-         
-         template< typename EntityType >         
+ 
+         template< typename EntityType >
          __cuda_callable__
          static void processEntity( const MeshType& mesh,
                                     TraverserUserData& userData,
                                     const EntityType& entity )
          {
-             ( *userData.b )[ entity.getIndex() ] = 0.0;           
-             userData.boundaryConditions->updateLinearSystem
-               ( *userData.time + *userData.tau,
-                 mesh,
-                 entity.getIndex(),
+             ( *userData.b )[ entity.getIndex() ] = 0.0;
+             userData.boundaryConditions->setMatrixElements
+               ( *userData.u,
                  entity,
-                 *userData.u,
-                 *userData.b,
-                 *userData.matrix );
+                 *userData.time + *userData.tau,
+                 *userData.tau,
+                 *userData.matrix,
+                 *userData.b );
          }
    };
 
@@ -142,17 +134,15 @@ class tnlLinearSystemAssembler
                                     TraverserUserData& userData,
                                     const EntityType& entity )
          {
-            ( *userData.b )[ entity.getIndex() ] = 0.0;            
-            userData.differentialOperator->updateLinearSystem
-               ( *userData.time,
-                 *userData.tau,
-                 mesh,
-                 entity.getIndex(),
+            ( *userData.b )[ entity.getIndex() ] = 0.0;
+            userData.differentialOperator->setMatrixElements
+               ( *userData.u,
                  entity,
-                 *userData.u,
-                 *userData.b,
-                 *userData.matrix );
-            
+                 *userData.time + *userData.tau,
+                 *userData.tau,
+                 *userData.matrix,
+                 *userData.b );
+ 
             typedef tnlFunctionAdapter< MeshType, RightHandSide > RhsFunctionAdapter;
             typedef tnlFunctionAdapter< MeshType, MeshFunction > MeshFunctionAdapter;
             const RealType& rhs = RhsFunctionAdapter::getValue
diff --git a/src/solvers/pde/tnlLinearSystemAssembler_impl.h b/src/solvers/pde/tnlLinearSystemAssembler_impl.h
index 80ef87f45a594c950a9eab87b9468cfa2cd807c9..167ced7332e7e099e7d5905e2275c199bda90da5 100644
--- a/src/solvers/pde/tnlLinearSystemAssembler_impl.h
+++ b/src/solvers/pde/tnlLinearSystemAssembler_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLINEARSYSTEMASSEMBLER_IMPL_H_
 #define TNLLINEARSYSTEMASSEMBLER_IMPL_H_
@@ -44,7 +37,7 @@ assembly( const RealType& time,
           MatrixType& matrix,
           DofVector& b ) const
 {
-      static_assert( std::is_same< MeshFunction, 
+      static_assert( std::is_same< MeshFunction,
                                 tnlVector< typename MeshFunction::RealType,
                                            typename MeshFunction::DeviceType,
                                            typename MeshFunction::IndexType > >::value != true,
diff --git a/src/solvers/pde/tnlNoTimeDiscretisation.h b/src/solvers/pde/tnlNoTimeDiscretisation.h
index ff90e1b9b29369f93b2dfceb4e1f912ce8e8533b..213187db4880360717af751018c2da7d9d6d4dc7 100644
--- a/src/solvers/pde/tnlNoTimeDiscretisation.h
+++ b/src/solvers/pde/tnlNoTimeDiscretisation.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLNOTIMEDISCRETISATION_H
 #define	TNLNOTIMEDISCRETISATION_H
@@ -23,7 +16,7 @@
 class tnlNoTimeDiscretisation
 {
     public:
-        
+ 
         template< typename RealType,
                   typename IndexType,
                   typename MatrixType >
diff --git a/src/solvers/pde/tnlPDESolver.h b/src/solvers/pde/tnlPDESolver.h
index 87c1f18e5b36a0814455703c9d689a54004f043b..8d9ef4edd9f0bf1b6e0b893c0e3031f767b93fff 100644
--- a/src/solvers/pde/tnlPDESolver.h
+++ b/src/solvers/pde/tnlPDESolver.h
@@ -6,22 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDESOLVER_H_
 #define TNLPDESOLVER_H_
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
-#include <solvers/tnlSolverMonitor.h>
 #include <core/tnlLogger.h>
 
 template< typename Problem,
@@ -73,13 +65,9 @@ class tnlPDESolver : public tnlObject
 
       const RealType& getSnapshotPeriod() const;
 
-      void setIoRtTimer( tnlTimerRT& ioRtTimer);
-
-      void setComputeRtTimer( tnlTimerRT& computeRtTimer );
+      void setIoTimer( tnlTimer& ioTimer);
 
-      void setIoCpuTimer( tnlTimerCPU& ioCpuTimer );
-
-      void setComputeCpuTimer( tnlTimerCPU& computeCpuTimer );
+      void setComputeTimer( tnlTimer& computeTimer );
 
       bool solve();
 
@@ -99,10 +87,7 @@ class tnlPDESolver : public tnlObject
 
       ProblemType* problem;
 
-      tnlTimerRT *ioRtTimer, *computeRtTimer;
-
-      tnlTimerCPU *ioCpuTimer, *computeCpuTimer;
-
+      tnlTimer *ioTimer, *computeTimer;
 };
 
 #include <solvers/pde/tnlPDESolver_impl.h>
diff --git a/src/solvers/pde/tnlPDESolver_impl.h b/src/solvers/pde/tnlPDESolver_impl.h
index f7df40fc84992153b341a38e9f2aad515b2c0484..24f568d5517b86c61aeb92466a799ebee809327b 100644
--- a/src/solvers/pde/tnlPDESolver_impl.h
+++ b/src/solvers/pde/tnlPDESolver_impl.h
@@ -6,18 +6,14 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDESOLVER_IMPL_H_
 #define TNLPDESOLVER_IMPL_H_
 
+#include "tnlPDESolver.h"
+
+
 template< typename Problem,
           typename TimeStepper >
 tnlPDESolver< Problem, TimeStepper >::
@@ -29,10 +25,8 @@ tnlPDESolver()
   timeStep( 1.0 ),
   timeStepOrder( 0.0 ),
   problem( 0 ),
-  ioRtTimer( 0 ),
-  computeRtTimer( 0 ),
-  ioCpuTimer( 0 ),
-  computeCpuTimer( 0 )
+  ioTimer( 0 ),
+  computeTimer( 0 )
 {
 }
 
@@ -86,13 +80,13 @@ setup( const tnlParameterContainer& parameters,
    cout << " [ OK ]" << endl;
    this->dofs.setValue( 0.0 );
    this->problem->bindDofs( this->mesh, this->dofs );
-   
+ 
    /****
     * Set mesh dependent data
     */
    this->problem->setMeshDependentData( this->mesh, this->meshDependentData );
    this->problem->bindMeshDependentData( this->mesh, this->meshDependentData );
-   
+ 
    /***
     * Set-up the initial condition
     */
@@ -253,7 +247,7 @@ setTimeStep( const RealType& timeStep )
    this->timeStep = timeStep;
    return true;
 }
-   
+ 
 template< typename Problem,
           typename TimeStepper >
 const typename TimeStepper::RealType&
@@ -288,27 +282,15 @@ getTimeStepOrder() const
 }
 
 template< typename Problem, typename TimeStepper >
-void tnlPDESolver< Problem, TimeStepper > :: setIoRtTimer( tnlTimerRT& ioRtTimer )
-{
-   this->ioRtTimer = &ioRtTimer;
-}
-
-template< typename Problem, typename TimeStepper >
-void tnlPDESolver< Problem, TimeStepper > :: setComputeRtTimer( tnlTimerRT& computeRtTimer )
+void tnlPDESolver< Problem, TimeStepper > :: setIoTimer( tnlTimer& ioTimer )
 {
-   this->computeRtTimer = &computeRtTimer;
+   this->ioTimer = &ioTimer;
 }
 
 template< typename Problem, typename TimeStepper >
-void tnlPDESolver< Problem, TimeStepper > :: setIoCpuTimer( tnlTimerCPU& ioCpuTimer )
+void tnlPDESolver< Problem, TimeStepper > :: setComputeTimer( tnlTimer& computeTimer )
 {
-   this->ioCpuTimer = &ioCpuTimer;
-}
-
-template< typename Problem, typename TimeStepper >
-void tnlPDESolver< Problem, TimeStepper > :: setComputeCpuTimer( tnlTimerCPU& computeCpuTimer )
-{
-   this->computeCpuTimer = & computeCpuTimer;
+   this->computeTimer = &computeTimer;
 }
 
 template< typename Problem, typename TimeStepper >
@@ -330,23 +312,17 @@ solve()
    IndexType step( 0 );
    IndexType allSteps = ceil( ( this->finalTime - this->initialTime ) / this->snapshotPeriod );
 
-   this->ioRtTimer->reset();
-   this->ioCpuTimer->reset();
-   this->computeRtTimer->reset();
-   this->computeCpuTimer->reset();
-   
-   this->ioRtTimer->start();
-   this->ioCpuTimer->start();
+   this->ioTimer->reset();
+   this->computeTimer->reset();
+ 
+   this->ioTimer->start();
    if( ! this->problem->makeSnapshot( t, step, mesh, this->dofs, this->meshDependentData ) )
    {
       cerr << "Making the snapshot failed." << endl;
       return false;
    }
-
-   this->ioRtTimer->stop();
-   this->ioCpuTimer->stop();
-   this->computeRtTimer->start();
-   this->computeCpuTimer->start();
+   this->ioTimer->stop();
+   this->computeTimer->start();
 
    /****
     * Initialize the time stepper
@@ -363,22 +339,17 @@ solve()
       step ++;
       t += tau;
 
-      this->ioRtTimer->start();
-      this->ioCpuTimer->start();
-      this->computeRtTimer->stop();
-      this->computeCpuTimer->stop();
-
+      this->ioTimer->start();
+      this->computeTimer->stop();
       if( ! this->problem->makeSnapshot( t, step, mesh, this->dofs, this->meshDependentData ) )
       {
          cerr << "Making the snapshot failed." << endl;
          return false;
       }
-
-      this->ioRtTimer->stop();
-      this->ioCpuTimer->stop();
-      this->computeRtTimer->start();
-      this->computeCpuTimer->start();
+      this->ioTimer->stop();
+      this->computeTimer->start();
    }
+   this->computeTimer->stop();
    return true;
 }
 
@@ -387,7 +358,8 @@ bool
 tnlPDESolver< Problem, TimeStepper >::
 writeEpilog( tnlLogger& logger ) const
 {
-   return this->timeStepper->writeEpilog( logger );
+   return ( this->timeStepper->writeEpilog( logger ) &&
+      this->problem->writeEpilog( logger ) );
 }
 
 #endif /* TNLPDESOLVER_IMPL_H_ */
diff --git a/src/solvers/pde/tnlSemiImplicitTimeStepper.h b/src/solvers/pde/tnlSemiImplicitTimeStepper.h
index 1d66681f2956dfcf70c1e1957457a1e98f920679..c90757a07ca5cf366bd670b141d5b1a1c333a49e 100644
--- a/src/solvers/pde/tnlSemiImplicitTimeStepper.h
+++ b/src/solvers/pde/tnlSemiImplicitTimeStepper.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSEMIIMPLICITTIMESTEPPER_H_
 #define TNLSEMIIMPLICITTIMESTEPPER_H_
@@ -65,7 +58,7 @@ class tnlSemiImplicitTimeStepper
                const MeshType& mesh,
                DofVectorType& dofVector,
                MeshDependentDataType& meshDependentData );
-   
+ 
    bool writeEpilog( tnlLogger& logger );
 
    protected:
@@ -80,10 +73,10 @@ class tnlSemiImplicitTimeStepper
 
    RealType timeStep;
 
-   tnlTimerRT preIterateTimer, linearSystemAssemblerTimer, linearSystemSolverTimer, postIterateTimer;
-   
+   tnlTimer preIterateTimer, linearSystemAssemblerTimer, preconditionerUpdateTimer, linearSystemSolverTimer, postIterateTimer;
+ 
    bool verbose;
-   
+ 
    long long int allIterations;
 };
 
diff --git a/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h b/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h
index 53507c0f73bc74844172a4173f92f8ad1eb8e051..85f8ff17d643d329c3a37b68aff6b7ff3e64c948 100644
--- a/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h
+++ b/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSEMIIMPLICITTIMESTEPPER_IMPL_H_
 #define TNLSEMIIMPLICITTIMESTEPPER_IMPL_H_
@@ -76,8 +69,13 @@ init( const MeshType& mesh )
    }
    if( ! this->rightHandSide.setSize( this->matrix.getRows() ) )
       return false;
+
+   this->preIterateTimer.reset();
    this->linearSystemAssemblerTimer.reset();
+   this->preconditionerUpdateTimer.reset();
    this->linearSystemSolverTimer.reset();
+   this->postIterateTimer.reset();
+
    this->allIterations = 0;
    return true;
 }
@@ -181,8 +179,9 @@ solve( const RealType& time,
       if( verbose )
          cout << "                                                                  Solving the linear system for time " << t + currentTau << "             \r" << flush;
 
-      // TODO: add timer
+      this->preconditionerUpdateTimer.start();
       preconditioner.update( this->matrix );
+      this->preconditionerUpdateTimer.stop();
 
       this->linearSystemSolverTimer.start();
       if( ! this->linearSystemSolver->template solve< DofVectorType, tnlLinearResidueGetter< MatrixType, DofVectorType > >( this->rightHandSide, dofVector ) )
@@ -219,11 +218,17 @@ bool
 tnlSemiImplicitTimeStepper< Problem, LinearSystemSolver >::
 writeEpilog( tnlLogger& logger )
 {
-   logger.writeParameter< long long int >( "Ierations count:", this->allIterations );
-   logger.writeParameter< double >( "Pre-iterate time:", this->preIterateTimer.getTime() );
-   logger.writeParameter< double >( "Linear system assembler time:", this->linearSystemAssemblerTimer.getTime() );
-   logger.writeParameter< double >( "Linear system solver time:", this->linearSystemSolverTimer.getTime() );
-   logger.writeParameter< double >( "Post-iterate time:", this->postIterateTimer.getTime() );   
+   logger.writeParameter< long long int >( "Iterations count:", this->allIterations );
+   logger.writeParameter< const char* >( "Pre-iterate time:", "" );
+   this->preIterateTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Linear system assembler time:", "" );
+   this->linearSystemAssemblerTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Preconditioner update time:", "" );
+   this->preconditionerUpdateTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Linear system solver time:", "" );
+   this->linearSystemSolverTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Post-iterate time:", "" );
+   this->postIterateTimer.writeLog( logger, 1 );
    return true;
 }
 
diff --git a/src/solvers/preconditioners/tnlDiagonalPreconditioner.h b/src/solvers/preconditioners/tnlDiagonalPreconditioner.h
index d4af93a98b03f724e75f3c4fe15443eef558269f..99f9434f33ba56e2f43dae18a36fd26b52e5f316 100644
--- a/src/solvers/preconditioners/tnlDiagonalPreconditioner.h
+++ b/src/solvers/preconditioners/tnlDiagonalPreconditioner.h
@@ -1,7 +1,7 @@
 #ifndef TNLDIAGONALPRECONDITIONER_H_
 #define TNLDIAGONALPRECONDITIONER_H_
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/vectors/tnlVector.h>
 
 template< typename Real, typename Device, typename Index >
diff --git a/src/solvers/preconditioners/tnlDummyPreconditioner.h b/src/solvers/preconditioners/tnlDummyPreconditioner.h
index ef5424e9171652a95a58b3983f3c2469fcee63e8..76e88a23b5780f031921db3b401414497ad6d3e9 100644
--- a/src/solvers/preconditioners/tnlDummyPreconditioner.h
+++ b/src/solvers/preconditioners/tnlDummyPreconditioner.h
@@ -6,19 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLDUMMYPRECONDITIONER_H_
 #define TNLDUMMYPRECONDITIONER_H_
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 
 template< typename Real, typename Device, typename Index >
 class tnlDummyPreconditioner
diff --git a/src/solvers/tnlBuildConfigTags.h b/src/solvers/tnlBuildConfigTags.h
index 447f7aecfb82325e4a90daf47e2a3717d6f2a5cb..df5f7404dc6e7b6bbd401da6b9526c8a6e5527b6 100644
--- a/src/solvers/tnlBuildConfigTags.h
+++ b/src/solvers/tnlBuildConfigTags.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLBUILDCONFIGTAGS_H_
 #define TNLBUILDCONFIGTAGS_H_
@@ -26,6 +19,7 @@
 #include <solvers/linear/krylov/tnlBICGStabSolver.h>
 #include <solvers/linear/krylov/tnlGMRESSolver.h>
 #include <solvers/linear/krylov/tnlTFQMRSolver.h>
+#include <solvers/linear/tnlUmfpackWrapper.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
 
 class tnlDefaultBuildConfigTag{};
@@ -57,7 +51,7 @@ template< typename ConfigTag > struct tnlConfigTagMeshResolve{ enum { enabled =
 /****
  * 1, 2, and 3 dimensions are enabled by default
  */
-template< typename ConfigTag, int Dimensions > struct tnlConfigTagDimensions{ enum { enabled = ( Dimensions > 0 && Dimensions <=3 ) }; };
+template< typename ConfigTag, int Dimensions > struct tnlConfigTagDimensions{ enum { enabled = ( Dimensions > 0 && Dimensions <= 3 ) }; };
 
 /****
  * Up to the exceptions enlisted below, all mesh types are disabled by default.
@@ -151,6 +145,17 @@ public:
     using Template = tnlTFQMRSolver< Matrix, Preconditioner >;
 };
 
+#ifdef HAVE_UMFPACK
+class  tnlSemiImplicitUmfpackSolverTag
+{
+public:
+    template< typename Matrix, typename Preconditioner = tnlDummyPreconditioner< typename Matrix::RealType,
+                                                                                 typename Matrix::DeviceType,
+                                                                                 typename Matrix::IndexType > >
+    using Template = tnlUmfpackWrapper< Matrix, Preconditioner >;
+};
+#endif
+
 template< typename ConfigTag, typename SemiImplicitSolver > struct tnlConfigTagSemiImplicitSolver{ enum { enabled = true }; };
 
 #endif /* TNLBUILDCONFIGTAGS_H_ */
diff --git a/src/solvers/tnlDummyProblem.h b/src/solvers/tnlDummyProblem.h
index 0d5f226d379a5d6224b15ad1939a8d4ffebf6702..4abeebc5e9786cb09648cbeee02ed7525beb676c 100644
--- a/src/solvers/tnlDummyProblem.h
+++ b/src/solvers/tnlDummyProblem.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLDUMMYPROBLEM_H_
 #define TNLDUMMYPROBLEM_H_
diff --git a/src/solvers/tnlFastBuildConfigTag.h b/src/solvers/tnlFastBuildConfigTag.h
index 597a4fa3cacd32abec0cfb9e3c547a20e98a80dc..54e70f421d59ed639bf2f729d9adc7ada2b376a7 100644
--- a/src/solvers/tnlFastBuildConfigTag.h
+++ b/src/solvers/tnlFastBuildConfigTag.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLFASTBUILDCONFIGTAG_H_
 #define TNLFASTBUILDCONFIGTAG_H_
diff --git a/src/solvers/tnlIterativeSolver.h b/src/solvers/tnlIterativeSolver.h
index 8c05287d8d31cbbfffcfd186d550484da9618466..0523a30c05a4f8a166deffbe5c7adfce25b32c96 100644
--- a/src/solvers/tnlIterativeSolver.h
+++ b/src/solvers/tnlIterativeSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLITERATIVESOLVER_H_
 #define TNLITERATIVESOLVER_H_
@@ -65,6 +58,8 @@ class tnlIterativeSolver
 
    bool nextIteration();
 
+   bool checkNextIteration();
+
    bool checkConvergence();
 
    void refreshSolverMonitor( bool force = false );
diff --git a/src/solvers/tnlIterativeSolverMonitor.h b/src/solvers/tnlIterativeSolverMonitor.h
index 5cca8ed68ac8bcc9afe365b8837ff92ecdd94537..0d185a41fdcd22b648e4c91c86ec8fb03ab4a70f 100644
--- a/src/solvers/tnlIterativeSolverMonitor.h
+++ b/src/solvers/tnlIterativeSolverMonitor.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLITERATIVESOLVERMONITOR_H_
 #define TNLITERATIVESOLVERMONITOR_H_
@@ -41,7 +34,7 @@ class tnlIterativeSolverMonitor : public tnlSolverMonitor< Real, Index >
    const RealType& getResidue() const;
 
    void setVerbose( const Index& verbose );
-   
+ 
    void setRefreshRate( const IndexType& refreshRate );
 
    virtual void refresh( bool force = false );
diff --git a/src/solvers/tnlIterativeSolverMonitor_impl.h b/src/solvers/tnlIterativeSolverMonitor_impl.h
index 998706a7e86fefb0d384beb074b7e92322f797c7..e980a2b2601d8d7d47da9adf96a670ca35f92abc 100644
--- a/src/solvers/tnlIterativeSolverMonitor_impl.h
+++ b/src/solvers/tnlIterativeSolverMonitor_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLITERATIVESOLVERMONITOR_IMPL_H_
 #define TNLITERATIVESOLVERMONITOR_IMPL_H_
diff --git a/src/solvers/tnlIterativeSolver_impl.cpp b/src/solvers/tnlIterativeSolver_impl.cpp
index 1790169332340a7239a601a4e25d6abfdecff2ca..070cd48026d92edcd80fa50780fdf09f29a985db 100644
--- a/src/solvers/tnlIterativeSolver_impl.cpp
+++ b/src/solvers/tnlIterativeSolver_impl.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <solvers/tnlIterativeSolver.h>
 
diff --git a/src/solvers/tnlIterativeSolver_impl.h b/src/solvers/tnlIterativeSolver_impl.h
index 5841ec5b3cda1417c9e341032a26697ee0c10140..7dc03f728034aeebd0441fdaf65fa2f0ca16bda4 100644
--- a/src/solvers/tnlIterativeSolver_impl.h
+++ b/src/solvers/tnlIterativeSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLITERATIVESOLVER_IMPL_H_
 #define TNLITERATIVESOLVER_IMPL_H_
@@ -38,7 +31,7 @@ template< typename Real, typename Index >
 void tnlIterativeSolver< Real, Index> :: configSetup( tnlConfigDescription& config,
                                                       const tnlString& prefix )
 {
-   config.addEntry< int >   ( prefix + "max-iterations", "Maximal number of iterations the solver may perform.", 100000 );
+   config.addEntry< int >   ( prefix + "max-iterations", "Maximal number of iterations the solver may perform.", 100000000000 );
    config.addEntry< int >   ( prefix + "min-iterations", "Minimal number of iterations the solver must perform.", 0 );
    config.addEntry< double >( prefix + "convergence-residue", "Convergence occurs when the residue drops bellow this limit.", 1.0e-6 );
    config.addEntry< double >( prefix + "divergence-residue", "Divergence occurs when the residue exceeds given limit.", DBL_MAX );
@@ -89,10 +82,18 @@ void tnlIterativeSolver< Real, Index> :: resetIterations()
 
 template< typename Real, typename Index >
 bool tnlIterativeSolver< Real, Index> :: nextIteration()
+{
+   // this->checkNextIteration() must be called before the iteration counter is incremented
+   bool result = this->checkNextIteration();
+   this->currentIteration++;
+   return result;
+}
+
+template< typename Real, typename Index >
+bool tnlIterativeSolver< Real, Index> :: checkNextIteration()
 {
    // TODO: fix
    //tnlAssert( solverMonitor, );
-   this->currentIteration++;
    if( this->solverMonitor )
    {
       solverMonitor->setIterations( this->currentIteration );
@@ -101,10 +102,10 @@ bool tnlIterativeSolver< Real, Index> :: nextIteration()
          solverMonitor->refresh();
    }
 
-   if( std::isnan( this->getResidue() ) || 
+   if( std::isnan( this->getResidue() ) ||
        this->getIterations() > this->getMaxIterations()  ||
-       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->getMinIterations() ) ||
-       ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() > this->minIterations ) ) 
+       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) ||
+       ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) )
       return false;
    return true;
 }
diff --git a/src/solvers/tnlMeshTypeResolver.h b/src/solvers/tnlMeshTypeResolver.h
index d18f7040918fb4c8095d595a3281247d11afa7ce..e922f2f3e16bde37ee6d1bc0ffd22f309dfbbbbc 100644
--- a/src/solvers/tnlMeshTypeResolver.h
+++ b/src/solvers/tnlMeshTypeResolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMESHTYPERESOLVER_H_
 #define TNLMESHTYPERESOLVER_H_
diff --git a/src/solvers/tnlMeshTypeResolver_impl.h b/src/solvers/tnlMeshTypeResolver_impl.h
index 7450070cf7affecb53993df7fd8b90a1c18421fc..66041bc4fd3b11ad40f77a3032103d1c71411015 100644
--- a/src/solvers/tnlMeshTypeResolver_impl.h
+++ b/src/solvers/tnlMeshTypeResolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMESHTYPERESOLVER_IMPL_H_
 #define TNLMESHTYPERESOLVER_IMPL_H_
diff --git a/src/solvers/tnlSolver.h b/src/solvers/tnlSolver.h
index 9e4040d87a48621acbe7750bb4f2164063c73c11..370586529f771c67712c23d4297bf5ab3367ab9d 100644
--- a/src/solvers/tnlSolver.h
+++ b/src/solvers/tnlSolver.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVER_H_
 #define TNLSOLVER_H_
diff --git a/src/solvers/tnlSolverConfig.h b/src/solvers/tnlSolverConfig.h
index 446bb65632cb402d9836fe9e607fc1fb7887145d..3add9a423600f11e3a27386526006d11aaf4e4a4 100644
--- a/src/solvers/tnlSolverConfig.h
+++ b/src/solvers/tnlSolverConfig.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERCONFIG_H_
 #define TNLSOLVERCONFIG_H_
diff --git a/src/solvers/tnlSolverConfig_impl.h b/src/solvers/tnlSolverConfig_impl.h
index 01d005335aac5b531af61f05bb0768317688d382..8c368d054908eca2ab0962f3cf907e7d3f6811b6 100644
--- a/src/solvers/tnlSolverConfig_impl.h
+++ b/src/solvers/tnlSolverConfig_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERCONFIG_IMPL_H_
 #define TNLSOLVERCONFIG_IMPL_H_
@@ -100,7 +93,7 @@ bool tnlSolverConfig< ConfigTag, ProblemConfig >::configSetup( tnlConfigDescript
    }
    config.addRequiredEntry< tnlString >( "discrete-solver", "The solver of the discretised problem:" );
    if( tnlConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled )
-   {      
+   {
       if( tnlConfigTagExplicitSolver< ConfigTag, tnlExplicitEulerSolverTag >::enabled )
          config.addEntryEnum( "euler" );
       if( tnlConfigTagExplicitSolver< ConfigTag, tnlExplicitMersonSolverTag >::enabled )
@@ -118,6 +111,10 @@ bool tnlSolverConfig< ConfigTag, ProblemConfig >::configSetup( tnlConfigDescript
          config.addEntryEnum( "tfqmr" );
       if( tnlConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitSORSolverTag >::enabled )
          config.addEntryEnum( "sor" );
+#ifdef HAVE_UMFPACK
+      if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitUmfpackSolverTag >::enabled )
+         config.addEntryEnum( "umfpack" );
+#endif
    }
    config.addEntry< tnlString >( "preconditioner", "The preconditioner for the discrete solver:", "none" );
    config.addEntryEnum( "none" );
@@ -140,7 +137,7 @@ bool tnlSolverConfig< ConfigTag, ProblemConfig >::configSetup( tnlConfigDescript
    }
    if( tnlConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled )
    {
-      config.addDelimiter( " === Semi-implicit solvers parameters === " );      
+      config.addDelimiter( " === Semi-implicit solvers parameters === " );
       typedef tnlCSRMatrix< double, tnlHost, int > MatrixType;
       if( tnlConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitCGSolverTag >::enabled )
          tnlCGSolver< MatrixType >::configSetup( config );
@@ -156,7 +153,7 @@ bool tnlSolverConfig< ConfigTag, ProblemConfig >::configSetup( tnlConfigDescript
 
    config.addDelimiter( " === Logs and messages ===" );
    config.addEntry< int >( "verbose", "Set the verbose mode. The higher number the more messages are generated.", 1 );
-   config.addEntry< tnlString >( "log-file", "Log file for the computation." );
+   config.addEntry< tnlString >( "log-file", "Log file for the computation.", "log.txt" );
    config.addEntry< int >( "log-width", "Number of columns of the log table.", 80 );
    return true;
 
diff --git a/src/solvers/tnlSolverInitiator.h b/src/solvers/tnlSolverInitiator.h
index 5cad3ee8150864a21a8b27d5bcd6f394de168514..270c7b568bdc35c37139e577ec8dec6708ba5a68 100644
--- a/src/solvers/tnlSolverInitiator.h
+++ b/src/solvers/tnlSolverInitiator.h
@@ -6,19 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERINITIATOR_H_
 #define TNLSOLVERINITIATOR_H_
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <config/tnlParameterContainer.h>
 #include <solvers/tnlBuildConfigTags.h>
 
diff --git a/src/solvers/tnlSolverInitiator_impl.h b/src/solvers/tnlSolverInitiator_impl.h
index 0876bd27527879a2a9cf4faaa071fc5f5bfa90df..9135058f6bad44a869abc7dafcf424c01776d761 100644
--- a/src/solvers/tnlSolverInitiator_impl.h
+++ b/src/solvers/tnlSolverInitiator_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <config/tnlParameterContainer.h>
 #include <solvers/tnlMeshTypeResolver.h>
diff --git a/src/solvers/tnlSolverMonitor.h b/src/solvers/tnlSolverMonitor.h
index b6263a27b03e39ce1c2afa5a0fc23fd681bf5d35..22079e4a863104dd70cc18404d19e5fa97c69dc5 100644
--- a/src/solvers/tnlSolverMonitor.h
+++ b/src/solvers/tnlSolverMonitor.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERMONITOR_H_
 #define TNLSOLVERMONITOR_H_
@@ -26,7 +19,7 @@ class tnlSolverMonitor
    virtual void refresh( bool force = false ) = 0;
 
    ~tnlSolverMonitor() {};
-      
+ 
 };
 
 
diff --git a/src/solvers/tnlSolverStarter.h b/src/solvers/tnlSolverStarter.h
index 7b9bc2d8f3757487ac9f479ac274ab18ddef4ddd..93ec8beecd382c87c3a5665c557db94f1f922a07 100644
--- a/src/solvers/tnlSolverStarter.h
+++ b/src/solvers/tnlSolverStarter.h
@@ -6,21 +6,13 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERSTARTER_H_
 #define TNLSOLVERSTARTER_H_
 
 #include <config/tnlParameterContainer.h>
-#include <core/tnlTimerRT.h>
-#include <core/tnlTimerCPU.h>
+#include <core/tnlTimer.h>
 #include <ostream>
 
 template< typename MeshConfig >
@@ -45,9 +37,7 @@ class tnlSolverStarter
 
    int logWidth;
 
-   tnlTimerRT ioRtTimer, computeRtTimer, totalRtTimer;
-
-   tnlTimerCPU ioCpuTimer, computeCpuTimer, totalCpuTimer;
+   tnlTimer ioTimer, computeTimer, totalTimer;
 };
 
 #include <solvers/tnlSolverStarter_impl.h>
diff --git a/src/solvers/tnlSolverStarter_impl.h b/src/solvers/tnlSolverStarter_impl.h
index 3f9e5fcc0201adb7d994497a48a9868897ac2f94..04c11e5f97122b4aa7c352f692bb44a67a4f5fa8 100644
--- a/src/solvers/tnlSolverStarter_impl.h
+++ b/src/solvers/tnlSolverStarter_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERSTARTER_IMPL_H_
 #define TNLSOLVERSTARTER_IMPL_H_
@@ -21,7 +14,6 @@
 #include <tnlConfig.h>
 #include <core/tnlLogger.h>
 #include <core/tnlString.h>
-#include <core/tnlOmp.h>
 #include <core/tnlCuda.h>
 #include <solvers/ode/tnlMersonSolver.h>
 #include <solvers/ode/tnlEulerSolver.h>
@@ -30,6 +22,7 @@
 #include <solvers/linear/krylov/tnlBICGStabSolver.h>
 #include <solvers/linear/krylov/tnlGMRESSolver.h>
 #include <solvers/linear/krylov/tnlTFQMRSolver.h>
+#include <solvers/linear/tnlUmfpackWrapper.h>
 #include <solvers/preconditioners/tnlDummyPreconditioner.h>
 #include <solvers/preconditioners/tnlDiagonalPreconditioner.h>
 #include <solvers/pde/tnlExplicitTimeStepper.h>
@@ -92,7 +85,7 @@ bool tnlSolverStarter< ConfigTag > :: run( const tnlParameterContainer& paramete
    /****
     * Create and set-up the problem
     */
-   if( ! tnlOmp::setup( parameters ) ||
+   if( ! tnlHost::setup( parameters ) ||
        ! tnlCuda::setup( parameters ) )
       return false;
    Problem problem;
@@ -198,6 +191,7 @@ class tnlSolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDisc
                        const tnlParameterContainer& parameters )
       {
          const tnlString& discreteSolver = parameters. getParameter< tnlString>( "discrete-solver" );
+#ifndef HAVE_UMFPACK
          if( discreteSolver != "sor" &&
              discreteSolver != "cg" &&
              discreteSolver != "bicgstab" &&
@@ -207,6 +201,18 @@ class tnlSolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDisc
             cerr << "Unknown semi-implicit discrete solver " << discreteSolver << ". It can be only: sor, cg, bicgstab, gmres or tfqmr." << endl;
             return false;
          }
+#else
+         if( discreteSolver != "sor" &&
+             discreteSolver != "cg" &&
+             discreteSolver != "bicgstab" &&
+             discreteSolver != "gmres" &&
+             discreteSolver != "tfqmr" &&
+             discreteSolver != "umfpack" )
+         {
+            cerr << "Unknown semi-implicit discrete solver " << discreteSolver << ". It can be only: sor, cg, bicgstab, gmres, tfqmr or umfpack." << endl;
+            return false;
+         }
+#endif
 
          if( discreteSolver == "sor" )
             return tnlSolverStarterPreconditionerSetter< Problem, tnlSemiImplicitSORSolverTag, ConfigTag >::run( problem, parameters );
@@ -218,6 +224,10 @@ class tnlSolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDisc
             return tnlSolverStarterPreconditionerSetter< Problem, tnlSemiImplicitGMRESSolverTag, ConfigTag >::run( problem, parameters );
          if( discreteSolver == "tfqmr" )
             return tnlSolverStarterPreconditionerSetter< Problem, tnlSemiImplicitTFQMRSolverTag, ConfigTag >::run( problem, parameters );
+#ifdef HAVE_UMFPACK
+         if( discreteSolver == "umfpack" )
+            return tnlSolverStarterPreconditionerSetter< Problem, tnlSemiImplicitUmfpackSolverTag, ConfigTag >::run( problem, parameters );
+#endif
          return false;
       }
 };
@@ -352,11 +362,14 @@ class tnlSolverStarterExplicitTimeStepperSetter
          typedef typename Problem::IndexType IndexType;
          typedef tnlODESolverMonitor< RealType, IndexType > SolverMonitorType;
 
+         const int verbose = parameters.getParameter< int >( "verbose" );
+
          ExplicitSolver explicitSolver;
          explicitSolver.setup( parameters );
-         int verbose = parameters.getParameter< int >( "verbose" );
          explicitSolver.setVerbose( verbose );
+
          SolverMonitorType odeSolverMonitor;
+         odeSolverMonitor.setVerbose( verbose );
          if( ! problem.getSolverMonitor() )
             explicitSolver.setSolverMonitor( odeSolverMonitor );
          else
@@ -395,10 +408,13 @@ class tnlSolverStarterSemiImplicitTimeStepperSetter
          typedef typename Problem::IndexType IndexType;
          typedef tnlIterativeSolverMonitor< RealType, IndexType > SolverMonitorType;
 
+         const int verbose = parameters.getParameter< int >( "verbose" );
+
          LinearSystemSolverType linearSystemSolver;
          linearSystemSolver.setup( parameters );
 
          SolverMonitorType solverMonitor;
+         solverMonitor.setVerbose( verbose );
          if( ! problem.getSolverMonitor() )
             linearSystemSolver.setSolverMonitor( solverMonitor );
          else
@@ -490,11 +506,9 @@ bool tnlSolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
                                                     const tnlParameterContainer& parameters,
                                                     TimeStepper& timeStepper )
 {
-   this->totalCpuTimer.reset();
-   this->totalRtTimer.reset();
-   this->totalCpuTimer.start();
-   this->totalRtTimer.start();
-   
+   this->totalTimer.reset();
+   this->totalTimer.start();
+ 
 
    /****
     * Set-up the PDE solver
@@ -537,16 +551,10 @@ bool tnlSolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
    /****
     * Set-up timers
     */
-   this->computeRtTimer.reset();
-   this->computeCpuTimer.reset();
-   this->ioRtTimer.reset();
-   this->ioRtTimer.stop();
-   this->ioCpuTimer.reset();
-   this->ioCpuTimer.stop();
-   solver.setComputeRtTimer( this->computeRtTimer );
-   solver.setComputeCpuTimer( this->computeCpuTimer );
-   solver.setIoRtTimer( this->ioRtTimer );
-   solver.setIoCpuTimer( this->ioCpuTimer );
+   this->computeTimer.reset();
+   this->ioTimer.reset();
+   solver.setComputeTimer( this->computeTimer );
+   solver.setIoTimer( this->ioTimer );
 
    /****
     * Start the solver
@@ -574,10 +582,8 @@ bool tnlSolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
    /****
     * Stop timers
     */
-   this->computeRtTimer.stop();
-   this->computeCpuTimer.stop();
-   this->totalCpuTimer.stop();
-   this->totalRtTimer.stop();
+   this->computeTimer.stop();
+   this->totalTimer.stop();
 
    /****
     * Write an epilog
@@ -611,14 +617,14 @@ bool tnlSolverStarter< ConfigTag > :: writeEpilog( ostream& str, const Solver& s
    logger.writeCurrentTime( "Finished at:" );
    if( ! solver.writeEpilog( logger ) )
       return false;
-   logger.writeParameter< double >( "IO Real Time:", this->ioRtTimer.getTime() );
-   logger.writeParameter< double >( "IO CPU Time:", this->ioCpuTimer.getTime() );
-   logger.writeParameter< double >( "Compute Real Time:", this->computeRtTimer.getTime() );
-   logger.writeParameter< double >( "Compute CPU Time:", this->computeCpuTimer.getTime() );
-   logger.writeParameter< double >( "Total Real Time:", this->totalRtTimer.getTime() );
-   logger.writeParameter< double >( "Total CPU Time:", this->totalCpuTimer.getTime() );
+   logger.writeParameter< const char* >( "Compute time:", "" );
+   this->computeTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "I/O time:", "" );
+   this->ioTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Total time:", "" );
+   this->totalTimer.writeLog( logger, 1 );
    char buf[ 256 ];
-   sprintf( buf, "%f %%", 100 * ( ( double ) this->totalCpuTimer.getTime() ) / this->totalRtTimer.getTime() );
+   sprintf( buf, "%f %%", 100 * ( ( double ) this->totalTimer.getCPUTime() ) / this->totalTimer.getRealTime() );
    logger.writeParameter< char* >( "CPU usage:", buf );
    logger.writeSeparator();
    return true;
diff --git a/src/solvers/tnlSolver_impl.h b/src/solvers/tnlSolver_impl.h
index 4c89c6cc94952c94dd305cee20d56c4ebd628de7..6abccde1617ee5321fe24da1dfdb0119d89bbbef 100644
--- a/src/solvers/tnlSolver_impl.h
+++ b/src/solvers/tnlSolver_impl.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVER_IMPL_H_
 #define TNLSOLVER_IMPL_H_
@@ -21,7 +14,6 @@
 #include <solvers/tnlSolverInitiator.h>
 #include <solvers/tnlSolverStarter.h>
 #include <solvers/tnlSolverConfig.h>
-#include <core/tnlOmp.h>
 #include <core/tnlCuda.h>
 
 template< template< typename Real, typename Device, typename Index, typename MeshType, typename MeshConfig, typename SolverStarter > class ProblemSetter,
@@ -36,7 +28,7 @@ run( int argc, char* argv[] )
    ProblemConfig< MeshConfig >::configSetup( configDescription );
    tnlSolverConfig< MeshConfig, ProblemConfig< MeshConfig> >::configSetup( configDescription );
    configDescription.addDelimiter( "Parallelization setup:" );
-   tnlOmp::configSetup( configDescription );
+   tnlHost::configSetup( configDescription );
    tnlCuda::configSetup( configDescription );
 
    if( ! parseCommandLine( argc, argv, configDescription, parameters ) )
diff --git a/src/core/tnlObject.cpp b/src/tnlObject.cpp
similarity index 88%
rename from src/core/tnlObject.cpp
rename to src/tnlObject.cpp
index e86cc0e532026e8d21047abe65a99632e840b0a7..589c94d7bad720e790c9ac06756f4b981951ff77 100644
--- a/src/core/tnlObject.cpp
+++ b/src/tnlObject.cpp
@@ -6,16 +6,9 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <debug/tnlDebug.h>
 #include <core/tnlAssert.h>
 #include <core/tnlFile.h>
@@ -51,9 +44,9 @@ bool tnlObject :: save( tnlFile& file ) const
 {
 #ifdef HAVE_NOT_CXX11
    if( ! file. write< const char, tnlHost, int >( magic_number, strlen( magic_number ) ) )
-#else      
+#else
    if( ! file. write( magic_number, strlen( magic_number ) ) )
-#endif      
+#endif
       return false;
    if( ! this->getSerializationTypeVirtual().save( file ) ) return false;
    return true;
@@ -138,9 +131,9 @@ bool getObjectType( tnlFile& file, tnlString& type )
    char mn[ 10 ];
 #ifdef HAVE_NOT_CXX11
    if( ! file. read< char, tnlHost, int >( mn, strlen( magic_number ) ) )
-#else      
+#else
    if( ! file. read( mn, strlen( magic_number ) ) )
-#endif      
+#endif
    {
       cerr << "Unable to read file " << file. getFileName() << " ... " << endl;
       return false;
diff --git a/src/core/tnlObject.h b/src/tnlObject.h
similarity index 80%
rename from src/core/tnlObject.h
rename to src/tnlObject.h
index 349db04e23f88804f03593086a60866dad22ed13..4bdc9bc86a6b04bc27afe8a8874c60d28f39319c 100644
--- a/src/core/tnlObject.h
+++ b/src/tnlObject.h
@@ -6,21 +6,16 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#ifndef tnlObjectH
-#define tnlObjectH
+#pragma once
 
 #include <core/tnlCuda.h>
 #include <core/tnlString.h>
 
+
+namespace TNL {
+
 class tnlFile;
 template< class T > class tnlList;
 
@@ -65,14 +60,14 @@ class tnlObject
 
    //! Method for restoring the object from a file
    virtual bool load( tnlFile& file );
-   
+ 
    //! Method for restoring the object from a file
    virtual bool boundLoad( tnlFile& file );
 
    bool save( const tnlString& fileName ) const;
 
    bool load( const tnlString& fileName );
-   
+ 
    bool boundLoad( const tnlString& fileName );
 
    //! Destructor
@@ -90,4 +85,4 @@ bool getObjectType( const tnlString& file_name, tnlString& type );
 bool parseObjectType( const tnlString& objectType,
                       tnlList< tnlString >& parsedObjectType );
 
-#endif
+} // namespace TNL
\ No newline at end of file
diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt
index 1968db4cbd315558c63e3de4f90a378f4de1d3fa..a44d068a33c2d2a1503f0580d7ac63627c973e1a 100755
--- a/tests/benchmarks/CMakeLists.txt
+++ b/tests/benchmarks/CMakeLists.txt
@@ -3,7 +3,7 @@ ADD_SUBDIRECTORY( heat-equation-benchmark )
 
 IF( BUILD_CUDA )
     CUDA_ADD_EXECUTABLE( tnl-cuda-benchmarks${debugExt} tnl-cuda-benchmarks.cu )
-    if( WITH_CUBLAS STREQUAL "yes" )
+    if( HAVE_CUBLAS STREQUAL "yes" )
         CUDA_ADD_CUBLAS_TO_TARGET( tnl-cuda-benchmarks${debugExt} )
     endif()
     TARGET_LINK_LIBRARIES( tnl-cuda-benchmarks${debugExt} tnl${debugExt}-${tnlVersion} ${CUSPARSE_LIBRARY} )                        
diff --git a/tests/benchmarks/array-operations.h b/tests/benchmarks/array-operations.h
index 939e9c4d8894c0836b3a201380d672feecf1256e..11f5bd9ff4c56a63dd1b13d3cbe962137f13096b 100644
--- a/tests/benchmarks/array-operations.h
+++ b/tests/benchmarks/array-operations.h
@@ -24,12 +24,16 @@ benchmarkArrayOperations( Benchmark & benchmark,
 
     HostArray hostArray, hostArray2;
     CudaArray deviceArray, deviceArray2;
-    hostArray.setSize( size );
-    if( ! deviceArray.setSize( size ) )
-        return false;
-    hostArray2.setLike( hostArray );
-    if( ! deviceArray2.setLike( deviceArray ) )
+    if( ! hostArray.setSize( size ) ||
+        ! hostArray2.setSize( size ) ||
+        ! deviceArray.setSize( size ) ||
+        ! deviceArray2.setSize( size ) )
+    {
+        const char* msg = "error: allocation of arrays failed";
+        cerr << msg << endl;
+        benchmark.addErrorMessage( msg );
         return false;
+    }
 
     Real resultHost, resultDevice;
 
@@ -86,6 +90,52 @@ benchmarkArrayOperations( Benchmark & benchmark,
     benchmark.time( reset1,
                     "CPU->GPU", copyAssignHostCuda,
                     "GPU->CPU", copyAssignCudaHost );
+
+
+    auto setValueHost = [&]() {
+        hostArray.setValue( 3.0 );
+    };
+    auto setValueCuda = [&]() {
+        deviceArray.setValue( 3.0 );
+    };
+    benchmark.setOperation( "setValue", datasetSize );
+    benchmark.time( reset1,
+                    "CPU", setValueHost,
+                    "GPU", setValueCuda );
+
+
+    auto setSizeHost = [&]() {
+        hostArray.setSize( size );
+    };
+    auto setSizeCuda = [&]() {
+        deviceArray.setSize( size );
+    };
+    auto resetSize1 = [&]() {
+        hostArray.reset();
+        deviceArray.reset();
+    };
+    benchmark.setOperation( "allocation (setSize)", datasetSize );
+    benchmark.time( resetSize1,
+                    "CPU", setSizeHost,
+                    "GPU", setSizeCuda );
+
+
+    auto resetSizeHost = [&]() {
+        hostArray.reset();
+    };
+    auto resetSizeCuda = [&]() {
+        deviceArray.reset();
+    };
+    auto setSize1 = [&]() {
+        hostArray.setSize( size );
+        deviceArray.setSize( size );
+    };
+    benchmark.setOperation( "deallocation (reset)", datasetSize );
+    benchmark.time( setSize1,
+                    "CPU", resetSizeHost,
+                    "GPU", resetSizeCuda );
+
+    return true;
 }
 
 } // namespace benchmarks
diff --git a/tests/benchmarks/benchmarks.h b/tests/benchmarks/benchmarks.h
index 0d3a219d554f5e429f732b0747a60f2429b7801f..97fa5a4f1c44e09d5f1bbbdc1265aeddf11ebf7a 100644
--- a/tests/benchmarks/benchmarks.h
+++ b/tests/benchmarks/benchmarks.h
@@ -174,11 +174,52 @@ public:
         }
     }
 
+    void
+    writeErrorMessage( const char* msg,
+                       const int & colspan = 1 )
+    {
+        // initial indent string
+        header_indent = "!";
+        log << endl;
+        for( auto & it : metadataColumns ) {
+            log << header_indent << " " << it.first << endl;
+        }
+
+        // make sure there is a header column for the message
+        if( horizontalGroups.size() == 0 )
+            horizontalGroups.push_back( {"", 1} );
+
+        // dump stacked spanning columns
+        while( horizontalGroups.back().second <= 0 ) {
+            horizontalGroups.pop_back();
+            header_indent.pop_back();
+        }
+        for( int i = 0; i < horizontalGroups.size(); i++ ) {
+            if( horizontalGroups[ i ].second > 0 ) {
+                log << header_indent << " " << horizontalGroups[ i ].first << endl;
+                header_indent += "!";
+            }
+        }
+        if( horizontalGroups.size() > 0 ) {
+            horizontalGroups.back().second -= colspan;
+            header_indent.pop_back();
+        }
+
+        // only when changed (the header has been already adjusted)
+        // print each element on separate line
+        for( auto & it : metadataColumns ) {
+            log << it.second << endl;
+        }
+        log << msg << endl;
+    }
+
     void
     closeTable()
     {
+        log << endl;
         header_indent = body_indent = "";
         header_changed = true;
+        horizontalGroups.clear();
     }
 
     bool save( std::ostream & logFile )
@@ -186,7 +227,7 @@ public:
         closeTable();
         logFile << log.str();
         if( logFile.good() ) {
-            log.str() ="";
+            log.str() = "";
             return true;
         }
         return false;
@@ -361,6 +402,17 @@ public:
         return this->baseTime;
     }
 
+    // Adds an error message to the log. Should be called in places where the
+    // "time" method could not be called (e.g. due to failed allocation).
+    void
+    addErrorMessage( const char* msg,
+                     const int & numberOfComputations = 1 )
+    {
+        // each computation has 3 subcolumns
+        const int colspan = 3 * numberOfComputations;
+        writeErrorMessage( msg, colspan );
+    }
+
     using Logging::save;
 
 protected:
diff --git a/tests/benchmarks/cublasWrappers.h b/tests/benchmarks/cublasWrappers.h
index 6369c0f12f34f9deb6ca2094f4255f9ab9142ed9..a7520a34d5d13ced796d8b2366b0382887f09a49 100644
--- a/tests/benchmarks/cublasWrappers.h
+++ b/tests/benchmarks/cublasWrappers.h
@@ -5,6 +5,70 @@
 
 #include <cublas_v2.h>
 
+inline cublasStatus_t
+cublasIgamax( cublasHandle_t handle, int n,
+              const float           *x, int incx, int *result )
+{
+    return cublasIsamax( handle, n, x, incx, result );
+}
+
+inline cublasStatus_t
+cublasIgamax( cublasHandle_t handle, int n,
+              const double          *x, int incx, int *result )
+{
+    return cublasIdamax( handle, n, x, incx, result );
+}
+
+
+inline cublasStatus_t
+cublasIgamin( cublasHandle_t handle, int n,
+              const float           *x, int incx, int *result )
+{
+    return cublasIsamin( handle, n, x, incx, result );
+}
+
+inline cublasStatus_t
+cublasIgamin( cublasHandle_t handle, int n,
+              const double          *x, int incx, int *result )
+{
+    return cublasIdamin( handle, n, x, incx, result );
+}
+
+
+inline cublasStatus_t
+cublasGasum( cublasHandle_t handle, int n,
+             const float           *x, int incx, float  *result )
+{
+    return cublasSasum( handle, n, x, incx, result );
+}
+
+inline cublasStatus_t
+cublasGasum( cublasHandle_t handle, int n,
+             const double          *x, int incx, double *result )
+{
+    return cublasDasum( handle, n, x, incx, result );
+}
+
+
+inline cublasStatus_t
+cublasGaxpy( cublasHandle_t handle, int n,
+             const float           *alpha,
+             const float           *x, int incx,
+             float                 *y, int incy )
+{
+    return cublasSaxpy( handle, n, alpha, x, incx, y, incy );
+}
+
+inline cublasStatus_t
+cublasGaxpy( cublasHandle_t handle, int n,
+             const double          *alpha,
+             const double          *x, int incx,
+             double                *y, int incy )
+{
+    return cublasDaxpy( handle, n, alpha, x, incx, y, incy );
+}
+
+
 inline cublasStatus_t
 cublasGdot( cublasHandle_t handle, int n,
             const float        *x, int incx,
@@ -23,5 +87,37 @@ cublasGdot( cublasHandle_t handle, int n,
     return cublasDdot( handle, n, x, incx, y, incy, result );
 }
 
+
+inline cublasStatus_t
+cublasGnrm2( cublasHandle_t handle, int n,
+             const float           *x, int incx, float  *result )
+{
+    return cublasSnrm2( handle, n, x, incx, result );
+}
+
+inline cublasStatus_t
+cublasGnrm2( cublasHandle_t handle, int n,
+             const double          *x, int incx, double *result )
+{
+    return cublasDnrm2( handle, n, x, incx, result );
+}
+
+
+inline cublasStatus_t
+cublasGscal( cublasHandle_t handle, int n,
+             const float           *alpha,
+             float           *x, int incx )
+{
+    return cublasSscal( handle, n, alpha, x, incx );
+}
+
+inline cublasStatus_t
+cublasGscal( cublasHandle_t handle, int n,
+             const double          *alpha,
+             double          *x, int incx )
+{
+    return cublasDscal( handle, n, alpha, x, incx );
+}
+
 #endif
 #endif
diff --git a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h
index 49d4b71f29f75ce806aae5d7bfdabfb1073776e8..76269b7139f3c58d82721652f911297803a3ba26 100644
--- a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h
+++ b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h
@@ -43,7 +43,7 @@ class BenchmarkLaplace< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
 
       template< typename MeshEntity, typename Vector, typename MatrixRow >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -85,7 +85,7 @@ class BenchmarkLaplace< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
 
       template< typename MeshEntity, typename Vector, typename MatrixRow >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
@@ -127,7 +127,7 @@ class BenchmarkLaplace< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
 
       template< typename MeshEntity, typename Vector, typename MatrixRow >
       __cuda_callable__
-      void updateLinearSystem( const RealType& time,
+      void setMatrixElements( const RealType& time,
                                const RealType& tau,
                                const MeshType& mesh,
                                const IndexType& index,
diff --git a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h
index 862eddc7878509a6dfde868bd31aacc0698db38f..6cec357de6f5a0a5cd5c6ae93668be721d48c559 100644
--- a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h
+++ b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h
@@ -80,7 +80,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 BenchmarkLaplace< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -188,7 +188,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 BenchmarkLaplace< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
@@ -305,7 +305,7 @@ template< typename MeshReal,
 __cuda_callable__
 void
 BenchmarkLaplace< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-updateLinearSystem( const RealType& time,
+setMatrixElements( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     const IndexType& index,
diff --git a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h
index b1300dfeca4d6d3390c485e92315f68e45672729..ba9ce459a1855d616f91fe4937a6d230662d7374 100644
--- a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h
+++ b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h
@@ -23,7 +23,7 @@ template< typename Mesh, typename Real >class HeatEquationBenchmarkRhs
          typedef typename MeshEntity::MeshType::VertexType VertexType;
          VertexType v = entity.getCenter();
          return 0.0;
-      };
+      }
 };
 
 #endif /* HeatEquationBenchmarkRHS_H_ */
diff --git a/tests/benchmarks/share/tnl-log-to-html.py b/tests/benchmarks/share/tnl-log-to-html.py
index 256a66ea00a99d9de3e5dc8b38f16b0f77e7e4fb..38adaad4002dc50f7039e006058cb692c6523ade 100644
--- a/tests/benchmarks/share/tnl-log-to-html.py
+++ b/tests/benchmarks/share/tnl-log-to-html.py
@@ -3,6 +3,19 @@
 import sys
 import collections
 
+def getSortKey(value):
+    # try to convert to number if possible
+    try:
+        return int(value)
+    except ValueError:
+        try:
+            return float(value)
+        except ValueError:
+            if value:
+                return value
+            # None or empty string
+            return 0
+
 class columnFormating:
 
     def __init__( self, data ):
@@ -253,7 +266,7 @@ class logToHtmlConvertor:
         elements = [line.strip() for line in body]
 
         if len(elements) != len(leafColumns):
-            raise Exception("Error in the table format: header has {} leaf columns, but the corresponding row has {} elements.".format(len(leafColumns), len(row)))
+            raise Exception("Error in the table format: header has {} leaf columns, but the corresponding row has {} elements.".format(len(leafColumns), len(elements)))
 
         row = collections.OrderedDict()
         for element, column in zip(elements, leafColumns):
@@ -305,7 +318,7 @@ class logToHtmlConvertor:
         # TODO: check this
         # sort again (just in case, previous sorting might compare values from
         # different columns)
-        self.tableRows.sort(key=lambda row: list(row.values()))
+        self.tableRows.sort(key=lambda row: [getSortKey(value) for value in row.values()])
 
     def countSubcolumns( self ):
         for path, col in self.tableColumns.items():
diff --git a/tests/benchmarks/spmv.h b/tests/benchmarks/spmv.h
new file mode 100644
index 0000000000000000000000000000000000000000..00b968f5cdfdf492926047160e202accf12305fb
--- /dev/null
+++ b/tests/benchmarks/spmv.h
@@ -0,0 +1,184 @@
+#pragma once
+
+#include "benchmarks.h"
+
+#include <core/tnlList.h>
+#include <matrices/tnlCSRMatrix.h>
+#include <matrices/tnlEllpackMatrix.h>
+#include <matrices/tnlSlicedEllpackMatrix.h>
+#include <matrices/tnlChunkedEllpackMatrix.h>
+
+namespace tnl
+{
+namespace benchmarks
+{
+
+// silly alias to match the number of template parameters with other formats
+template< typename Real, typename Device, typename Index >
+using SlicedEllpackMatrix = tnlSlicedEllpackMatrix< Real, Device, Index >;
+
+template< typename Matrix >
+int setHostTestMatrix( Matrix& matrix,
+                       const int elementsPerRow )
+{
+    const int size = matrix.getRows();
+    int elements( 0 );
+    for( int row = 0; row < size; row++ ) {
+        int col = row - elementsPerRow / 2;
+        for( int element = 0; element < elementsPerRow; element++ ) {
+            if( col + element >= 0 &&
+                col + element < size )
+            {
+                matrix.setElement( row, col + element, element + 1 );
+                elements++;
+            }
+        }
+    }
+    return elements;
+}
+
+#ifdef HAVE_CUDA
+template< typename Matrix >
+__global__ void setCudaTestMatrixKernel( Matrix* matrix,
+                                         const int elementsPerRow,
+                                         const int gridIdx )
+{
+    const int rowIdx = ( gridIdx * tnlCuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
+    if( rowIdx >= matrix->getRows() )
+        return;
+    int col = rowIdx - elementsPerRow / 2;
+    for( int element = 0; element < elementsPerRow; element++ ) {
+        if( col + element >= 0 &&
+            col + element < matrix->getColumns() )
+           matrix->setElementFast( rowIdx, col + element, element + 1 );
+    }
+}
+#endif
+
+template< typename Matrix >
+void setCudaTestMatrix( Matrix& matrix,
+                        const int elementsPerRow )
+{
+#ifdef HAVE_CUDA
+    typedef typename Matrix::IndexType IndexType;
+    typedef typename Matrix::RealType RealType;
+    Matrix* kernel_matrix = tnlCuda::passToDevice( matrix );
+    dim3 cudaBlockSize( 256 ), cudaGridSize( tnlCuda::getMaxGridSize() );
+    const IndexType cudaBlocks = roundUpDivision( matrix.getRows(), cudaBlockSize.x );
+    const IndexType cudaGrids = roundUpDivision( cudaBlocks, tnlCuda::getMaxGridSize() );
+    for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) {
+        if( gridIdx == cudaGrids - 1 )
+            cudaGridSize.x = cudaBlocks % tnlCuda::getMaxGridSize();
+        setCudaTestMatrixKernel< Matrix >
+            <<< cudaGridSize, cudaBlockSize >>>
+            ( kernel_matrix, elementsPerRow, gridIdx );
+        checkCudaDevice;
+    }
+    tnlCuda::freeFromDevice( kernel_matrix );
+#endif
+}
+
+
+// TODO: rename as benchmark_SpMV_synthetic and move to spmv-synthetic.h
+template< typename Real,
+          template< typename, typename, typename > class Matrix,
+          template< typename, typename, typename > class Vector = tnlVector >
+bool
+benchmarkSpMV( Benchmark & benchmark,
+               const int & loops,
+               const int & size,
+               const int elementsPerRow = 5 )
+{
+    typedef Matrix< Real, tnlHost, int > HostMatrix;
+    typedef Matrix< Real, tnlCuda, int > DeviceMatrix;
+    typedef tnlVector< Real, tnlHost, int > HostVector;
+    typedef tnlVector< Real, tnlCuda, int > CudaVector;
+
+    HostMatrix hostMatrix;
+    DeviceMatrix deviceMatrix;
+    tnlVector< int, tnlHost, int > hostRowLengths;
+    tnlVector< int, tnlCuda, int > deviceRowLengths;
+    HostVector hostVector, hostVector2;
+    CudaVector deviceVector, deviceVector2;
+
+    // create benchmark group
+    tnlList< tnlString > parsedType;
+    parseObjectType( HostMatrix::getType(), parsedType );
+    benchmark.createHorizontalGroup( parsedType[ 0 ], 2 );
+
+    if( ! hostRowLengths.setSize( size ) ||
+        ! deviceRowLengths.setSize( size ) ||
+        ! hostMatrix.setDimensions( size, size ) ||
+        ! deviceMatrix.setDimensions( size, size ) ||
+        ! hostVector.setSize( size ) ||
+        ! hostVector2.setSize( size ) ||
+        ! deviceVector.setSize( size ) ||
+        ! deviceVector2.setSize( size ) )
+    {
+        const char* msg = "error: allocation of vectors failed";
+        cerr << msg << endl;
+        benchmark.addErrorMessage( msg, 2 );
+        return false;
+    }
+
+    hostRowLengths.setValue( elementsPerRow );
+    deviceRowLengths.setValue( elementsPerRow );
+
+    if( ! hostMatrix.setCompressedRowsLengths( hostRowLengths ) ) {
+        const char* msg = "error: allocation of host matrix failed";
+        cerr << msg << endl;
+        benchmark.addErrorMessage( msg, 2 );
+        return false;
+    }
+    if( ! deviceMatrix.setCompressedRowsLengths( deviceRowLengths ) ) {
+        const char* msg = "error: allocation of device matrix failed";
+        cerr << msg << endl;
+        benchmark.addErrorMessage( msg, 2 );
+        return false;
+    }
+
+    const int elements = setHostTestMatrix< HostMatrix >( hostMatrix, elementsPerRow );
+    setCudaTestMatrix< DeviceMatrix >( deviceMatrix, elementsPerRow );
+    const double datasetSize = ( double ) loops * elements * ( 2 * sizeof( Real ) + sizeof( int ) ) / oneGB;
+
+    // reset function
+    auto reset = [&]() {
+        hostVector.setValue( 1.0 );
+        deviceVector.setValue( 1.0 );
+        hostVector2.setValue( 0.0 );
+        deviceVector2.setValue( 0.0 );
+    };
+
+    // compute functions
+    auto spmvHost = [&]() {
+        hostMatrix.vectorProduct( hostVector, hostVector2 );
+    };
+    auto spmvCuda = [&]() {
+        deviceMatrix.vectorProduct( deviceVector, deviceVector2 );
+    };
+
+    benchmark.setOperation( datasetSize );
+    benchmark.time( reset,
+                    "CPU", spmvHost,
+                    "GPU", spmvCuda );
+
+    return true;
+}
+
+template< typename Real = double,
+          typename Index = int >
+bool
+benchmarkSpmvSynthetic( Benchmark & benchmark,
+                        const int & loops,
+                        const int & size,
+                        const int & elementsPerRow )
+{
+    // TODO: benchmark all formats from tnl-benchmark-spmv (different parameters of the base formats)
+    benchmarkSpMV< Real, tnlCSRMatrix >( benchmark, loops, size, elementsPerRow );
+    benchmarkSpMV< Real, tnlEllpackMatrix >( benchmark, loops, size, elementsPerRow );
+    benchmarkSpMV< Real, SlicedEllpackMatrix >( benchmark, loops, size, elementsPerRow );
+    benchmarkSpMV< Real, tnlChunkedEllpackMatrix >( benchmark, loops, size, elementsPerRow );
+}
+
+} // namespace benchmarks
+} // namespace tnl
diff --git a/tests/benchmarks/tnl-benchmark-linear-solvers.cpp b/tests/benchmarks/tnl-benchmark-linear-solvers.cpp
index 6e050dccd0c42656d756b6dc1083f700779a6950..917636d6bfe0830f58ecfbf93992216b1a0b8177 100644
--- a/tests/benchmarks/tnl-benchmark-linear-solvers.cpp
+++ b/tests/benchmarks/tnl-benchmark-linear-solvers.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-benchmark-linear-solvers.h"
diff --git a/tests/benchmarks/tnl-benchmark-linear-solvers.cu b/tests/benchmarks/tnl-benchmark-linear-solvers.cu
index 317bbc9aa6c18ab9b6fa98e1b8ba7a60e7d32b47..2a117204e76a9881d55de83a13f31fcd40e154ae 100644
--- a/tests/benchmarks/tnl-benchmark-linear-solvers.cu
+++ b/tests/benchmarks/tnl-benchmark-linear-solvers.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnl-benchmark-linear-solvers.h"
\ No newline at end of file
+#include "tnl-benchmark-linear-solvers.h"
diff --git a/tests/benchmarks/tnl-benchmark-linear-solvers.h b/tests/benchmarks/tnl-benchmark-linear-solvers.h
index 9ec5b34d02b6258a6b2a39a976e62d2f35be32ea..fd2c20a752768815f3bc028ab3e9cc7f321ca30a 100644
--- a/tests/benchmarks/tnl-benchmark-linear-solvers.h
+++ b/tests/benchmarks/tnl-benchmark-linear-solvers.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_BENCHMARK_LINEAR_SOLVERS_H_
 #define TNL_BENCHMARK_LINEAR_SOLVERS_H_
@@ -49,14 +42,11 @@ void configSetup( tnlConfigDescription& config )
 {
    config.addDelimiter                            ( "General settings:" );
    config.addRequiredEntry< tnlString >( "test" , "Test to be performed." );
-      config.addEntryEnum< tnlString >( "tridiagonal" );
-      config.addEntryEnum< tnlString >( "multidiagonal" );
-      config.addEntryEnum< tnlString >( "multidiagonal-with-long-rows" );
       config.addEntryEnum< tnlString >( "mtx" );
       config.addEntryEnum< tnlString >( "tnl" );
    config.addRequiredEntry< tnlString >( "input-file" , "Input binary file name." );
    config.addEntry< tnlString >( "log-file", "Log file name.", "tnl-benchmark-linear-solvers.log");
-   config.addEntry< tnlString >( "precison", "Precision of the arithmetics.", "double" );
+   config.addEntry< tnlString >( "precision", "Precision of the arithmetics.", "double" );
    config.addEntry< tnlString >( "matrix-format", "Matrix format.", "csr" );
       config.addEntryEnum< tnlString >( "dense" );
       config.addEntryEnum< tnlString >( "tridiagonal" );
@@ -217,7 +207,7 @@ int main( int argc, char* argv[] )
    tnlConfigDescription conf_desc;
 
    configSetup( conf_desc );
-   
+ 
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
    {
       conf_desc.printUsage( argv[ 0 ] );
diff --git a/tests/benchmarks/tnl-benchmark-simple-heat-equation.cpp b/tests/benchmarks/tnl-benchmark-simple-heat-equation.cpp
index 2ec7b727e49d55f8ce27bacce25d4a7195a1048a..d8113b58727715352ee34948c932a03c64ab6a22 100644
--- a/tests/benchmarks/tnl-benchmark-simple-heat-equation.cpp
+++ b/tests/benchmarks/tnl-benchmark-simple-heat-equation.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-benchmark-simple-heat-equation.h"
 
diff --git a/tests/benchmarks/tnl-benchmark-simple-heat-equation.cu b/tests/benchmarks/tnl-benchmark-simple-heat-equation.cu
index 95cc136c6ba4b6420a24e349077d94a27d6412b8..d083f1af2f3764b66a50724521435e49af38845c 100644
--- a/tests/benchmarks/tnl-benchmark-simple-heat-equation.cu
+++ b/tests/benchmarks/tnl-benchmark-simple-heat-equation.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnl-benchmark-simple-heat-equation.h"
\ No newline at end of file
+#include "tnl-benchmark-simple-heat-equation.h"
diff --git a/tests/benchmarks/tnl-benchmark-simple-heat-equation.h b/tests/benchmarks/tnl-benchmark-simple-heat-equation.h
index 2d20cddce6144d668a933c471f8893d751e2394d..0ab653dbb8061404b60a8fcab6517851a8af7f82 100644
--- a/tests/benchmarks/tnl-benchmark-simple-heat-equation.h
+++ b/tests/benchmarks/tnl-benchmark-simple-heat-equation.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_BENCHMARK_SIMPLE_HEAT_EQUATION_H
 #define	TNL_BENCHMARK_SIMPLE_HEAT_EQUATION_H
@@ -22,6 +15,7 @@
 #include <stdio.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
+#include <core/tnlTimer.h>
 #include <core/tnlTimerRT.h>
 #include <core/tnlCuda.h>
 
@@ -194,17 +188,17 @@ __global__ void boundaryConditionsKernel( const Real* u, Real* aux,
    if( i == 0 && j < gridYSize )
       aux[ j * gridXSize ] = 0.0; //u[ j * gridXSize + 1 ];
    if( i == gridXSize - 1 && j < gridYSize )
-      aux[ j * gridXSize + gridXSize - 2 ] = 0.0; //u[ j * gridXSize + gridXSize - 1 ];      
+      aux[ j * gridXSize + gridXSize - 2 ] = 0.0; //u[ j * gridXSize + gridXSize - 1 ];
    if( j == 0 && i < gridXSize )
       aux[ j * gridXSize ] = 0.0; //u[ j * gridXSize + 1 ];
    if( j == gridYSize -1  && i < gridXSize )
-      aux[ j * gridXSize + gridXSize - 2 ] = 0.0; //u[ j * gridXSize + gridXSize - 1 ];      
-    
+      aux[ j * gridXSize + gridXSize - 2 ] = 0.0; //u[ j * gridXSize + gridXSize - 1 ];
+ 
 }
 
 
 template< typename Real, typename Index >
-__global__ void heatEquationKernel( const Real* u, 
+__global__ void heatEquationKernel( const Real* u,
                                     Real* aux,
                                     const Real tau,
                                     const Real hx_inv,
@@ -231,10 +225,10 @@ __global__ void updateKernel( Real* u,
 {
    const Index blockOffset = blockIdx.x * blockDim.x;
    Index idx = blockOffset + threadIdx.x;
-   
+ 
    if( idx < dofs )
       u[ idx ] += aux[ idx ];
-   
+ 
    __syncthreads();
 
    const Index rest = dofs - blockOffset;
@@ -283,10 +277,10 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
    const Index dofsCount = gridXSize * gridYSize;
    dim3 cudaUpdateBlocks( dofsCount / 256 + ( dofsCount % 256 != 0 ) );
    dim3 cudaUpdateBlockSize( 256 );
-   
+ 
    /****
     * Initiation
-    */   
+    */
    Real* u = new Real[ dofsCount ];
    Real* aux = new Real[ dofsCount ];
    Real* max_du = new Real[ cudaUpdateBlocks.x ];
@@ -295,7 +289,7 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
       cerr << "I am not able to allocate grid function for grid size " << gridXSize << "x" << gridYSize << "." << endl;
       return false;
    }
-   
+ 
    const Real hx = domainXSize / ( Real ) gridXSize;
    const Real hy = domainYSize / ( Real ) gridYSize;
    const Real hx_inv = 1.0 / ( hx * hx );
@@ -306,7 +300,7 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
       if( verbose )
          cout << "Setting tau to " << tau << "." << endl;
    }
-   
+ 
    /****
     * Initial condition
     */
@@ -315,12 +309,12 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
    for( Index j = 0; j < gridYSize; j++ )
       for( Index i = 0; i < gridXSize; i++ )
       {
-         const Real x = i * hx - domainXSize / 2.0;      
-         const Real y = j * hy - domainYSize / 2.0;      
+         const Real x = i * hx - domainXSize / 2.0;
+         const Real y = j * hy - domainYSize / 2.0;
          u[ j * gridXSize + i ] = exp( - sigma * ( x * x + y * y ) );
       }
    writeFunction( "initial", u, gridXSize, gridYSize, hx, hy );
-   
+ 
    /****
     * Allocate data on the CUDA device
     */
@@ -335,7 +329,7 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
       cerr << "Allocation failed. " << cudaErr << endl;
       return false;
    }
-   
+ 
    /****
     * Explicit Euler solver
     */
@@ -347,16 +341,16 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
    cout << "Setting block size to " << cudaBlockSize.x << "," << cudaBlockSize.y << "," << cudaBlockSize.z << endl;
 
    if( verbose )
-      cout << "Starting the solver main loop..." << endl;   
+      cout << "Starting the solver main loop..." << endl;
    tnlTimerRT timer;
    timer.reset();
    timer.start();
-   Real time( 0.0 );   
+   Real time( 0.0 );
    Index iteration( 0 );
    while( time < finalTime )
    {
       const Real timeLeft = finalTime - time;
-      const Real currentTau = tau < timeLeft ? tau : timeLeft;      
+      const Real currentTau = tau < timeLeft ? tau : timeLeft;
 
       /****
        * Neumann boundary conditions
@@ -368,7 +362,7 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
          cerr << "Setting of boundary conditions failed. " << cudaErr << endl;
          return false;
       }
-                    
+ 
       /****
        * Laplace operator
        */
@@ -380,10 +374,10 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
          cerr << "Laplace operator failed." << endl;
          return false;
       }
-            
+ 
       /****
        * Update
-       */            
+       */
       //cout << "Update ... " << endl;
       updateKernel<<< cudaUpdateBlocks, cudaUpdateBlockSize >>>( cuda_u, cuda_aux, cuda_max_du, dofsCount );
       if( cudaGetLastError() != cudaSuccess )
@@ -404,19 +398,19 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
          const Real a = fabs( max_du[ i ] );
          absMax = a > absMax ? a : absMax;
       }
-            
+ 
       time += currentTau;
       iteration++;
       if( verbose && iteration % 1000 == 0 )
          cout << "Iteration: " << iteration << "\t Time:" << time << "    \r" << flush;
    }
    timer.stop();
-   if( verbose )      
+   if( verbose )
       cout << endl << "Finished..." << endl;
    cout << "Computation time is " << timer.getTime() << " sec. i.e. " << timer.getTime() / ( double ) iteration << "sec. per iteration." << endl;
    cudaMemcpy( u, cuda_u, dofsCount * sizeof( Real ), cudaMemcpyDeviceToHost );
    writeFunction( "final", u, gridXSize, gridYSize, hx, hy );
-   
+ 
    /***
     * Freeing allocated memory
     */
@@ -443,12 +437,12 @@ bool solveHeatEquationHost( const tnlParameterContainer& parameters )
    Real tau = parameters.getParameter< double >( "time-step" );
    const Real finalTime = parameters.getParameter< double >( "final-time" );
    const bool verbose = parameters.getParameter< bool >( "verbose" );
-   
+ 
    /****
     * Initiation
-    */   
-   Real* u = new Real[ gridXSize * gridYSize ];
-   Real* aux = new Real[ gridXSize * gridYSize ];
+    */
+   Real* __restrict__ u = new Real[ gridXSize * gridYSize ];
+   Real* __restrict__ aux = new Real[ gridXSize * gridYSize ];
    if( ! u || ! aux )
    {
       cerr << "I am not able to allocate grid function for grid size " << gridXSize << "x" << gridYSize << "." << endl;
@@ -465,7 +459,7 @@ bool solveHeatEquationHost( const tnlParameterContainer& parameters )
       if( verbose )
          cout << "Setting tau to " << tau << "." << endl;
    }
-   
+ 
    /****
     * Initial condition
     */
@@ -474,21 +468,19 @@ bool solveHeatEquationHost( const tnlParameterContainer& parameters )
    for( Index j = 0; j < gridYSize; j++ )
       for( Index i = 0; i < gridXSize; i++ )
       {
-         const Real x = i * hx - domainXSize / 2.0;      
-         const Real y = j * hy - domainYSize / 2.0;      
+         const Real x = i * hx - domainXSize / 2.0;
+         const Real y = j * hy - domainYSize / 2.0;
          u[ j * gridXSize + i ] = exp( - sigma * ( x * x + y * y ) );
       }
-   
+ 
    /****
     * Explicit Euler solver
     */
    if( verbose )
       cout << "Starting the solver main loop..." << endl;
-   tnlTimerRT timer, computationTimer;
-   computationTimer.reset();
-   timer.reset();
+   tnlTimer timer, computationTimer, updateTimer;
    timer.start();
-   Real time( 0.0 );   
+   Real time( 0.0 );
    Index iteration( 0 );
    while( time < finalTime )
    {
@@ -509,7 +501,7 @@ bool solveHeatEquationHost( const tnlParameterContainer& parameters )
          aux[ i ] = 0.0; //u[ gridXSize + i ];
          aux[ ( gridYSize - 1 ) * gridXSize + i ] = 0.0; //u[ ( gridYSize - 2 ) * gridXSize + i ];
       }
-      
+ 
       /*for( Index j = 1; j < gridYSize - 1; j++ )
          for( Index i = 1; i < gridXSize - 1; i++ )
          {
@@ -530,29 +522,37 @@ bool solveHeatEquationHost( const tnlParameterContainer& parameters )
                                      ( u[ c - gridXSize ] - 2.0 * u[ c ] + u[ c + gridXSize ] ) * hy_inv );
          }
       computationTimer.stop();
-      
+ 
+      updateTimer.start();
       Real absMax( 0.0 ), residue( 0.0 );
       for( Index i = 0; i < dofsCount; i++ )
       {
          const Real add = currentTau * aux[ i ];
          u[ i ] += add;
          residue += fabs( add );
-         /*const Real a = fabs( aux[ i ] );         
+         /*const Real a = fabs( aux[ i ] );
          absMax = a > absMax ? a : absMax;*/
       }
-
-      
+      updateTimer.stop();
+ 
       time += currentTau;
       iteration++;
       if( verbose && iteration % 10000 == 0 )
          cout << "Iteration: " << iteration << "\t \t Time:" << time << "    \r" << flush;
    }
    timer.stop();
-   if( verbose )      
+   if( verbose )
       cout << endl << "Finished..." << endl;
-   cout << "Explicit update computation time is " << computationTimer.getTime() << " sec. i.e. " << computationTimer.getTime() / ( double ) iteration << "sec. per iteration." << endl;
-   cout << "Explicit time stepper time is " << timer.getTime() << " sec. i.e. " << timer.getTime() / ( double ) iteration << "sec. per iteration." << endl;
-   
+   tnlLogger logger( 72, std::cout );
+   logger.writeSeparator();
+   logger.writeParameter< const char* >( "Compute time:", "" );
+   timer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Explicit update computation:", "" );
+   computationTimer.writeLog( logger, 1 );
+   logger.writeParameter< const char* >( "Euler solver update:", "" );
+   updateTimer.writeLog( logger, 1 );
+   logger.writeSeparator();
+ 
    /***
     * Freeing allocated memory
     */
@@ -568,9 +568,9 @@ int main( int argc, char* argv[] )
    tnlConfigDescription config;
    config.addEntry< tnlString >( "device", "Device the computation will run on.", "host" );
       config.addEntryEnum< tnlString >( "host" );
-#ifdef HAVE_CUDA      
+#ifdef HAVE_CUDA
       config.addEntryEnum< tnlString >( "cuda" );
-#endif      
+#endif
    config.addEntry< int >( "grid-x-size", "Grid size along x-axis.", 100 );
    config.addEntry< int >( "grid-y-size", "Grid size along y-axis.", 100 );
    config.addEntry< double >( "domain-x-size", "Domain size along x-axis.", 2.0 );
@@ -579,11 +579,11 @@ int main( int argc, char* argv[] )
    config.addEntry< double >( "time-step", "Time step. By default it is proportional to one over space step square.", 0.0 );
    config.addEntry< double >( "final-time", "Final time of the simulation.", 1.0 );
    config.addEntry< bool >( "verbose", "Verbose mode.", true );
-   
+ 
    tnlParameterContainer parameters;
    if( ! parseCommandLine( argc, argv, config, parameters ) )
       return EXIT_FAILURE;
-   
+ 
    tnlString device = parameters.getParameter< tnlString >( "device" );
    if( device == "host" &&
        ! solveHeatEquationHost< double, int >( parameters  ) )
@@ -591,9 +591,9 @@ int main( int argc, char* argv[] )
 #ifdef HAVE_CUDA
    if( device == "cuda" &&
        ! solveHeatEquationCuda< double, int >( parameters  ) )
-      return EXIT_FAILURE;   
-#endif      
-   return EXIT_SUCCESS;   
+      return EXIT_FAILURE;
+#endif
+   return EXIT_SUCCESS;
 }
 
 
diff --git a/tests/benchmarks/tnl-benchmark-spmv.cpp b/tests/benchmarks/tnl-benchmark-spmv.cpp
index 9d5b4b1983ef4d9bd568ee4d42e4a871b00f6aef..fadbcca0ce9d04b01103d4f24b0df03c169fc1c7 100644
--- a/tests/benchmarks/tnl-benchmark-spmv.cpp
+++ b/tests/benchmarks/tnl-benchmark-spmv.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #include "tnl-benchmark-spmv.h"
diff --git a/tests/benchmarks/tnl-benchmark-spmv.cu b/tests/benchmarks/tnl-benchmark-spmv.cu
index b32395f7d6da40fcdb83371d3e458ed5cc3d082e..fed383d86776e521dd31f299e3ba8baa9b0afdae 100644
--- a/tests/benchmarks/tnl-benchmark-spmv.cu
+++ b/tests/benchmarks/tnl-benchmark-spmv.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
-#include "tnl-benchmark-spmv.h"
\ No newline at end of file
+#include "tnl-benchmark-spmv.h"
diff --git a/tests/benchmarks/tnl-benchmark-spmv.h b/tests/benchmarks/tnl-benchmark-spmv.h
index 2f360605a64acfa4789ab6bfe1a05cd3722c9350..31bc52a01873526d2f5f7cd0bf2db9fda7b73a44 100644
--- a/tests/benchmarks/tnl-benchmark-spmv.h
+++ b/tests/benchmarks/tnl-benchmark-spmv.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_BENCHMARK_SPMV_H_
 #define TNL_BENCHMARK_SPMV_H_
@@ -41,16 +34,12 @@ void setupConfig( tnlConfigDescription& config )
 {
    config.addDelimiter                            ( "General settings:" );
    config.addRequiredEntry< tnlString >( "test" , "Test to be performed." );
-      config.addEntryEnum< tnlString >( "tridiagonal" );
-      config.addEntryEnum< tnlString >( "multidiagonal" );
-      config.addEntryEnum< tnlString >( "multidiagonal-with-long-rows" );
       config.addEntryEnum< tnlString >( "mtx" );
       config.addEntryEnum< tnlString >( "tnl" );
    config.addRequiredEntry< tnlString >( "input-file" , "Input file name." );
-   config.addEntry< tnlString >( "log-file", "Log file name.", "tnl-benchmark-linear-solvers.log");
-   config.addEntry< tnlString >( "pdf-file", "PDf file name for the matrix pattern.", "tnl-benchmark.log");
+   config.addEntry< tnlString >( "log-file", "Log file name.", "tnl-benchmark-spmv.log");
    config.addEntry< tnlString >( "precision", "Precision of the arithmetics.", "double" );
-   config.addEntry< double >( "stop-time" ,"Seconds to iterate the SpMV operation.", 1.0 );
+   config.addEntry< double >( "stop-time", "Seconds to iterate the SpMV operation.", 1.0 );
    config.addEntry< int >( "verbose", "Verbose mode.", 1 );
 }
 
@@ -675,7 +664,7 @@ int main( int argc, char* argv[] )
    tnlConfigDescription conf_desc;
 
    setupConfig( conf_desc );
-   
+ 
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
    {
       conf_desc.printUsage( argv[ 0 ] );
diff --git a/tests/benchmarks/tnl-cuda-benchmarks.cu b/tests/benchmarks/tnl-cuda-benchmarks.cu
index e21eb98636b46afdf62abb576c6fdec4c36e3821..b92e8d52a59f5ad62714464917b8dbdb19624d7e 100644
--- a/tests/benchmarks/tnl-cuda-benchmarks.cu
+++ b/tests/benchmarks/tnl-cuda-benchmarks.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "tnl-cuda-benchmarks.h"
\ No newline at end of file
+#include "tnl-cuda-benchmarks.h"
diff --git a/tests/benchmarks/tnl-cuda-benchmarks.h b/tests/benchmarks/tnl-cuda-benchmarks.h
index e868cf2b257b29b446e1560f363480cd8ad330a0..ee2e2aac28edc6365ae1f33b2e1a9d2fc9ff9880 100644
--- a/tests/benchmarks/tnl-cuda-benchmarks.h
+++ b/tests/benchmarks/tnl-cuda-benchmarks.h
@@ -6,25 +6,19 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCUDABENCHMARKS_H_
 #define TNLCUDBENCHMARKS_H_
 
-#include <core/tnlList.h>
-#include <matrices/tnlSlicedEllpackMatrix.h>
-#include <matrices/tnlEllpackMatrix.h>
-#include <matrices/tnlCSRMatrix.h>
+#include <core/tnlSystemInfo.h>
+#include <core/tnlCudaDeviceInfo.h>
+#include <config/tnlConfigDescription.h>
+#include <config/tnlParameterContainer.h>
 
 #include "array-operations.h"
 #include "vector-operations.h"
+#include "spmv.h"
 
 using namespace tnl::benchmarks;
 
@@ -32,223 +26,155 @@ using namespace tnl::benchmarks;
 // TODO: should benchmarks check the result of the computation?
 
 
-// silly alias to match the number of template parameters with other formats
-template< typename Real, typename Device, typename Index >
-using SlicedEllpackMatrix = tnlSlicedEllpackMatrix< Real, Device, Index >;
-
-template< typename Matrix >
-int setHostTestMatrix( Matrix& matrix,
-                       const int elementsPerRow )
-{
-   const int size = matrix.getRows();
-   int elements( 0 );
-   for( int row = 0; row < size; row++ )
-   {
-      int col = row - elementsPerRow / 2;
-      for( int element = 0; element < elementsPerRow; element++ )
-      {
-         if( col + element >= 0 &&
-             col + element < size )
-         {
-            matrix.setElement( row, col + element, element + 1 );
-            elements++;
-         }
-      }      
-   }
-   return elements;
-}
-
-template< typename Matrix >
-__global__ void setCudaTestMatrixKernel( Matrix* matrix,
-                                         const int elementsPerRow,
-                                         const int gridIdx )
-{
-   const int rowIdx = ( gridIdx * tnlCuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   if( rowIdx >= matrix->getRows() )
-      return;
-   int col = rowIdx - elementsPerRow / 2;   
-   for( int element = 0; element < elementsPerRow; element++ )
-   {
-      if( col + element >= 0 &&
-          col + element < matrix->getColumns() )
-         matrix->setElementFast( rowIdx, col + element, element + 1 );
-   }      
-}
-
-template< typename Matrix >
-void setCudaTestMatrix( Matrix& matrix,
-                        const int elementsPerRow )
+template< typename Real >
+void
+runCudaBenchmarks( Benchmark & benchmark,
+                   Benchmark::MetadataMap metadata,
+                   const unsigned & minSize,
+                   const unsigned & maxSize,
+                   const double & sizeStepFactor,
+                   const unsigned & loops,
+                   const unsigned & elementsPerRow )
 {
-   typedef typename Matrix::IndexType IndexType;
-   typedef typename Matrix::RealType RealType;
-   Matrix* kernel_matrix = tnlCuda::passToDevice( matrix );
-   dim3 cudaBlockSize( 256 ), cudaGridSize( tnlCuda::getMaxGridSize() );
-   const IndexType cudaBlocks = roundUpDivision( matrix.getRows(), cudaBlockSize.x );
-   const IndexType cudaGrids = roundUpDivision( cudaBlocks, tnlCuda::getMaxGridSize() );
-   for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ )
-   {
-      if( gridIdx == cudaGrids - 1 )
-         cudaGridSize.x = cudaBlocks % tnlCuda::getMaxGridSize();
-      setCudaTestMatrixKernel< Matrix >
-       <<< cudaGridSize, cudaBlockSize >>>
-       ( kernel_matrix, elementsPerRow, gridIdx );
-      checkCudaDevice;
-   }
-   tnlCuda::freeFromDevice( kernel_matrix );
+    const tnlString precision = getType< Real >();
+    metadata["precision"] = precision;
+
+    // Array operations
+    benchmark.newBenchmark( tnlString("Array operations (") + precision + ")",
+                            metadata );
+    for( unsigned size = minSize; size <= maxSize; size *= 2 ) {
+        benchmark.setMetadataColumns( Benchmark::MetadataColumns({
+           {"size", size},
+        } ));
+        benchmarkArrayOperations< Real >( benchmark, loops, size );
+    }
+
+    // Vector operations
+    benchmark.newBenchmark( tnlString("Vector operations (") + precision + ")",
+                            metadata );
+    for( unsigned size = minSize; size <= maxSize; size *= sizeStepFactor ) {
+        benchmark.setMetadataColumns( Benchmark::MetadataColumns({
+           {"size", size},
+        } ));
+        benchmarkVectorOperations< Real >( benchmark, loops, size );
+    }
+
+    // Sparse matrix-vector multiplication
+    benchmark.newBenchmark( tnlString("Sparse matrix-vector multiplication (") + precision + ")",
+                            metadata );
+    for( unsigned size = minSize; size <= maxSize; size *= 2 ) {
+        benchmark.setMetadataColumns( Benchmark::MetadataColumns({
+            {"rows", size},
+            {"columns", size},
+            {"elements per row", elementsPerRow},
+        } ));
+        benchmarkSpmvSynthetic< Real >( benchmark, loops, size, elementsPerRow );
+    }
 }
 
-
-template< typename Real,
-          template< typename, typename, typename > class Matrix,
-          template< typename, typename, typename > class Vector = tnlVector >
-bool
-benchmarkSpMV( Benchmark & benchmark,
-               const int & loops,
-               const int & size,
-               const int elementsPerRow = 5 )
+void
+setupConfig( tnlConfigDescription & config )
 {
-   typedef Matrix< Real, tnlHost, int > HostMatrix;
-   typedef Matrix< Real, tnlCuda, int > DeviceMatrix;
-   typedef tnlVector< Real, tnlHost, int > HostVector;
-   typedef tnlVector< Real, tnlCuda, int > CudaVector;
-
-   HostMatrix hostMatrix;
-   DeviceMatrix deviceMatrix;
-   tnlVector< int, tnlHost, int > hostRowLengths;
-   tnlVector< int, tnlCuda, int > deviceRowLengths;
-   HostVector hostVector, hostVector2;
-   CudaVector deviceVector, deviceVector2;
-
-   if( ! hostRowLengths.setSize( size ) ||
-       ! deviceRowLengths.setSize( size ) ||
-       ! hostMatrix.setDimensions( size, size ) ||
-       ! deviceMatrix.setDimensions( size, size ) ||
-       ! hostVector.setSize( size ) ||
-       ! hostVector2.setSize( size ) ||
-       ! deviceVector.setSize( size ) ||
-       ! deviceVector2.setSize( size ) )
-   {
-      cerr << "Unable to allocate all matrices and vectors for the SpMV benchmark." << endl;
-      return false;
-   }
-
-   hostRowLengths.setValue( elementsPerRow );
-   deviceRowLengths.setValue( elementsPerRow );
-
-   if( ! hostMatrix.setCompressedRowsLengths( hostRowLengths ) )
-   {
-      cerr << "Unable to allocate host matrix elements." << endl;
-      return false;
-   }
-   if( ! deviceMatrix.setCompressedRowsLengths( deviceRowLengths ) )
-   {
-      cerr << "Unable to allocate device matrix elements." << endl;
-      return false;
-   }
-
-   tnlList< tnlString > parsedType;
-   parseObjectType( HostMatrix::getType(), parsedType );
-   benchmark.createHorizontalGroup( parsedType[ 0 ], 2 );
-
-   const int elements = setHostTestMatrix< HostMatrix >( hostMatrix, elementsPerRow );
-   setCudaTestMatrix< DeviceMatrix >( deviceMatrix, elementsPerRow );
-   const double datasetSize = loops * elements * ( 2 * sizeof( Real ) + sizeof( int ) ) / oneGB;
-
-   // reset function
-   auto reset = [&]() {
-      hostVector.setValue( 1.0 );
-      deviceVector.setValue( 1.0 );
-      hostVector2.setValue( 0.0 );
-      deviceVector2.setValue( 0.0 );
-   };
-
-   // compute functions
-   auto spmvHost = [&]() {
-      hostMatrix.vectorProduct( hostVector, hostVector2 );
-   };
-   auto spmvCuda = [&]() {
-      deviceMatrix.vectorProduct( deviceVector, deviceVector2 );
-   };
-
-   benchmark.setOperation( datasetSize );
-   benchmark.time( reset,
-                   "CPU", spmvHost,
-                   "GPU", spmvCuda );
-
-   return true;
+    config.addDelimiter( "Benchmark settings:" );
+    config.addEntry< tnlString >( "log-file", "Log file name.", "tnl-cuda-benchmarks.log");
+    config.addEntry< tnlString >( "output-mode", "Mode for opening the log file.", "overwrite" );
+    config.addEntryEnum( "append" );
+    config.addEntryEnum( "overwrite" );
+    config.addEntry< tnlString >( "precision", "Precision of the arithmetics.", "double" );
+    config.addEntryEnum( "float" );
+    config.addEntryEnum( "double" );
+    config.addEntryEnum( "all" );
+    config.addEntry< int >( "min-size", "Minimum size of arrays/vectors used in the benchmark.", 100000 );
+    config.addEntry< int >( "max-size", "Minimum size of arrays/vectors used in the benchmark.", 10000000 );
+    config.addEntry< int >( "size-step-factor", "Factor determining the size of arrays/vectors used in the benchmark. First size is min-size and each following size is stepFactor*previousSize, up to max-size.", 2 );
+    config.addEntry< int >( "loops", "Number of iterations for every computation.", 10 );
+    config.addEntry< int >( "elements-per-row", "Number of elements per row of the sparse matrix used in the matrix-vector multiplication benchmark.", 5 );
+    config.addEntry< int >( "verbose", "Verbose mode.", 1 );
 }
 
-int main( int argc, char* argv[] )
+int
+main( int argc, char* argv[] )
 {
 #ifdef HAVE_CUDA
-   
-   typedef double Real;
-   tnlString precision = getType< Real >();
-   
-   /****
-    * The first argument of this program is the size od data set to be reduced.
-    * If no argument is given we use hardcoded default value.
-    */
-   int size = 1 << 22;
-   if( argc > 1 )
-      size = atoi( argv[ 1 ] );
-   int loops = 10;
-   if( argc > 2 )
-      loops = atoi( argv[ 2 ] );
-   int elementsPerRow = 5;
-   if( argc > 3 )
-      elementsPerRow = atoi( argv[ 3 ] );
-
-   ofstream logFile( "tnl-cuda-benchmarks.log" );
-   Benchmark benchmark( loops, true );
-//   ostream & logFile = cout;
-//   Benchmark benchmark( loops, false );
-   
-   // TODO: add hostname, CPU info, GPU info, date, ...
-   Benchmark::MetadataMap metadata {
-      {"precision", precision},
-   };
-   // TODO: loop over sizes
-   
-
-   // Array operations
-   benchmark.newBenchmark( tnlString("Array operations (") + precision + ")",
-                           metadata );
-   benchmark.setMetadataColumns( Benchmark::MetadataColumns({
-      {"size", size},
-   } ));
-   benchmarkArrayOperations< Real >( benchmark, loops, size );
-   
-   // Vector operations
-   benchmark.newBenchmark( tnlString("Vector operations (") + precision + ")",
-                           metadata );
-   benchmark.setMetadataColumns( Benchmark::MetadataColumns({
-      {"size", size},
-   } ));
-   benchmarkVectorOperations< Real >( benchmark, loops, size );
-
-
-   // SpMV
-   benchmark.newBenchmark( tnlString("SpMV (") + precision + ")",
-                           metadata );
-   benchmark.setMetadataColumns( Benchmark::MetadataColumns({
-      {"rows", size},
-      {"columns", size},
-      {"elements per row", elementsPerRow},
-   } ));
-
-   benchmarkSpMV< Real, tnlEllpackMatrix >( benchmark, loops, size, elementsPerRow );
-   benchmarkSpMV< Real, SlicedEllpackMatrix >( benchmark, loops, size, elementsPerRow );
-   benchmarkSpMV< Real, tnlCSRMatrix >( benchmark, loops, size, elementsPerRow );
-
-
-   if( ! benchmark.save( logFile ) )
-       return EXIT_FAILURE;
-   
-   return EXIT_SUCCESS;
+    tnlParameterContainer parameters;
+    tnlConfigDescription conf_desc;
+
+    setupConfig( conf_desc );
+
+    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) ) {
+        conf_desc.printUsage( argv[ 0 ] );
+        return 1;
+    }
+
+    const tnlString & logFileName = parameters.getParameter< tnlString >( "log-file" );
+    const tnlString & outputMode = parameters.getParameter< tnlString >( "output-mode" );
+    const tnlString & precision = parameters.getParameter< tnlString >( "precision" );
+    const unsigned minSize = parameters.getParameter< unsigned >( "min-size" );
+    const unsigned maxSize = parameters.getParameter< unsigned >( "max-size" );
+    const unsigned sizeStepFactor = parameters.getParameter< unsigned >( "size-step-factor" );
+    const unsigned loops = parameters.getParameter< unsigned >( "loops" );
+    const unsigned elementsPerRow = parameters.getParameter< unsigned >( "elements-per-row" );
+    const unsigned verbose = parameters.getParameter< unsigned >( "verbose" );
+
+    if( sizeStepFactor <= 1 ) {
+        cerr << "The value of --size-step-factor must be greater than 1." << endl;
+        return EXIT_FAILURE;
+    }
+
+    // open log file
+    auto mode = ios::out;
+    if( outputMode == "append" )
+        mode |= ios::app;
+    ofstream logFile( logFileName.getString(), mode );
+
+    // init benchmark and common metadata
+    Benchmark benchmark( loops, verbose );
+
+    // prepare global metadata
+    tnlSystemInfo systemInfo;
+    const int cpu_id = 0;
+    tnlCacheSizes cacheSizes = systemInfo.getCPUCacheSizes( cpu_id );
+    tnlString cacheInfo = tnlString( cacheSizes.L1data ) + ", "
+                        + tnlString( cacheSizes.L1instruction ) + ", "
+                        + tnlString( cacheSizes.L2 ) + ", "
+                        + tnlString( cacheSizes.L3 );
+    const int activeGPU = tnlCudaDeviceInfo::getActiveDevice();
+    const tnlString deviceArch = tnlString( tnlCudaDeviceInfo::getArchitectureMajor( activeGPU ) ) + "." +
+                                 tnlString( tnlCudaDeviceInfo::getArchitectureMinor( activeGPU ) );
+    Benchmark::MetadataMap metadata {
+        { "host name", systemInfo.getHostname() },
+        { "architecture", systemInfo.getArchitecture() },
+        { "system", systemInfo.getSystemName() },
+        { "system release", systemInfo.getSystemRelease() },
+        { "start time", systemInfo.getCurrentTime() },
+        { "CPU model name", systemInfo.getCPUModelName( cpu_id ) },
+        { "CPU cores", systemInfo.getNumberOfCores( cpu_id ) },
+        { "CPU threads per core", systemInfo.getNumberOfThreads( cpu_id ) / systemInfo.getNumberOfCores( cpu_id ) },
+        { "CPU max frequency (MHz)", systemInfo.getCPUMaxFrequency( cpu_id ) / 1e3 },
+        { "CPU cache sizes (L1d, L1i, L2, L3) (kiB)", cacheInfo },
+        { "GPU name", tnlCudaDeviceInfo::getDeviceName( activeGPU ) },
+        { "GPU architecture", deviceArch },
+        { "GPU CUDA cores", tnlCudaDeviceInfo::getCudaCores( activeGPU ) },
+        { "GPU clock rate (MHz)", (double) tnlCudaDeviceInfo::getClockRate( activeGPU ) / 1e3 },
+        { "GPU global memory (GB)", (double) tnlCudaDeviceInfo::getGlobalMemory( activeGPU ) / 1e9 },
+        { "GPU memory clock rate (MHz)", (double) tnlCudaDeviceInfo::getMemoryClockRate( activeGPU ) / 1e3 },
+        { "GPU memory ECC enabled", tnlCudaDeviceInfo::getECCEnabled( activeGPU ) },
+    };
+
+    if( precision == "all" || precision == "float" )
+        runCudaBenchmarks< float >( benchmark, metadata, minSize, maxSize, sizeStepFactor, loops, elementsPerRow );
+    if( precision == "all" || precision == "double" )
+        runCudaBenchmarks< double >( benchmark, metadata, minSize, maxSize, sizeStepFactor, loops, elementsPerRow );
+
+    if( ! benchmark.save( logFile ) ) {
+        cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< tnlString >( "log-file" ) << "'." << endl;
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
 #else
-   tnlCudaSupportMissingMessage;
-   return EXIT_FAILURE;
+    tnlCudaSupportMissingMessage;
+    return EXIT_FAILURE;
 #endif
 }
 
diff --git a/tests/benchmarks/tnlCusparseCSRMatrix.h b/tests/benchmarks/tnlCusparseCSRMatrix.h
index 81d0bc4f63fc37a2d1f8b7ee84ee0b732c3f909e..50d20a049babf9db3cbb4d46ca53a07357a1864c 100644
--- a/tests/benchmarks/tnlCusparseCSRMatrix.h
+++ b/tests/benchmarks/tnlCusparseCSRMatrix.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <core/tnlAssert.h>
 #include <core/tnlCuda.h>
@@ -46,7 +39,7 @@ class tnlCusparseCSRMatrixBase
          this->cusparseHandle = cusparseHandle;
          cusparseCreateMatDescr( & this->matrixDescriptor );
       };
-#endif      
+#endif
 
       int getRows() const
       {
@@ -70,7 +63,7 @@ class tnlCusparseCSRMatrixBase
                           OutVector& outVector ) const
       {
          tnlAssert( matrix, );
-#ifdef HAVE_CUDA         
+#ifdef HAVE_CUDA
          cusparseDcsrmv( *( this->cusparseHandle ),
                          CUSPARSE_OPERATION_NON_TRANSPOSE,
                          this->matrix->getRows(),
@@ -84,7 +77,7 @@ class tnlCusparseCSRMatrixBase
                          inVector.getData(),
                          1.0,
                          outVector.getData() );
-#endif      
+#endif
       }
 
    protected:
@@ -109,7 +102,7 @@ class tnlCusparseCSRMatrix< double > : public tnlCusparseCSRMatrixBase< double >
                           OutVector& outVector ) const
       {
          tnlAssert( matrix, );
-#ifdef HAVE_CUDA         
+#ifdef HAVE_CUDA
          /*cusparseDcsrmv( *( this->cusparseHandle ),
                          CUSPARSE_OPERATION_NON_TRANSPOSE,
                          this->matrix->getRows(),
@@ -122,7 +115,7 @@ class tnlCusparseCSRMatrix< double > : public tnlCusparseCSRMatrixBase< double >
                          inVector.getData(),
                          1.0,
                          outVector.getData() );*/
-#endif         
+#endif
       }
 };
 
@@ -137,12 +130,12 @@ class tnlCusparseCSRMatrix< float > : public tnlCusparseCSRMatrixBase< float >
                           OutVector& outVector ) const
       {
          tnlAssert( matrix, );
-#ifdef HAVE_CUDA         
+#ifdef HAVE_CUDA
          /*cusparseScsrmv( *( this->cusparseHandle ),
                          CUSPARSE_OPERATION_NON_TRANSPOSE,
                          this->matrix->getRows(),
                          this->matrix->getColumns(),
-                         this->matrix->values.getSize(),                         
+                         this->matrix->values.getSize(),
                          this->matrixDescriptor,
                          this->matrix->values.getData(),
                          this->matrix->rowPointers.getData(),
@@ -150,7 +143,7 @@ class tnlCusparseCSRMatrix< float > : public tnlCusparseCSRMatrixBase< float >
                          inVector.getData(),
                          0,
                          outVector.getData() );*/
-#endif         
+#endif
       }
 };
 
diff --git a/tests/benchmarks/vector-operations.h b/tests/benchmarks/vector-operations.h
index 3876235c09163b7b79171d0ed8e465006de27e33..3b1b6a614a990fb7d059502e4980c2f552d9ad5b 100644
--- a/tests/benchmarks/vector-operations.h
+++ b/tests/benchmarks/vector-operations.h
@@ -28,12 +28,16 @@ benchmarkVectorOperations( Benchmark & benchmark,
 
     HostVector hostVector, hostVector2;
     CudaVector deviceVector, deviceVector2;
-    hostVector.setSize( size );
-    if( ! deviceVector.setSize( size ) )
-        return false;
-    hostVector2.setLike( hostVector );
-    if( ! deviceVector2.setLike( deviceVector ) )
+    if( ! hostVector.setSize( size ) ||
+        ! hostVector2.setSize( size ) ||
+        ! deviceVector.setSize( size ) ||
+        ! deviceVector2.setSize( size ) )
+    {
+        const char* msg = "error: allocation of vectors failed";
+        cerr << msg << endl;
+        benchmark.addErrorMessage( msg );
         return false;
+    }
 
     Real resultHost, resultDevice;
 
@@ -71,10 +75,21 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto multiplyCuda = [&]() {
         deviceVector *= 0.5;
     };
+#ifdef HAVE_CUBLAS
+    auto multiplyCublas = [&]() {
+        const Real alpha = 0.5;
+        cublasGscal( cublasHandle, size,
+                     &alpha,
+                     deviceVector.getData(), 1 );
+    };
+#endif
     benchmark.setOperation( "scalar multiplication", 2 * datasetSize );
     benchmark.time( reset1,
                     "CPU", multiplyHost,
                     "GPU", multiplyCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", multiplyCublas );
+#endif
 
 
     auto addVectorHost = [&]() {
@@ -83,10 +98,22 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto addVectorCuda = [&]() {
         deviceVector.addVector( deviceVector2 );
     };
+#ifdef HAVE_CUBLAS
+    auto addVectorCublas = [&]() {
+        const Real alpha = 1.0;
+        cublasGaxpy( cublasHandle, size,
+                     &alpha,
+                     deviceVector2.getData(), 1,
+                     deviceVector.getData(), 1 );
+    };
+#endif
     benchmark.setOperation( "vector addition", 3 * datasetSize );
     benchmark.time( reset1,
                     "CPU", addVectorHost,
                     "GPU", addVectorCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", addVectorCublas );
+#endif
 
 
     auto maxHost = [&]() {
@@ -119,10 +146,22 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto absMaxCuda = [&]() {
         resultDevice = deviceVector.absMax();
     };
+#ifdef HAVE_CUBLAS
+    auto absMaxCublas = [&]() {
+        int index = 0;
+        cublasIgamax( cublasHandle, size,
+                      deviceVector.getData(), 1,
+                      &index );
+        resultDevice = deviceVector.getElement( index );
+    };
+#endif
     benchmark.setOperation( "absMax", datasetSize );
     benchmark.time( reset1,
                     "CPU", absMaxHost,
                     "GPU", absMaxCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", absMaxCublas );
+#endif
 
 
     auto absMinHost = [&]() {
@@ -131,10 +170,22 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto absMinCuda = [&]() {
         resultDevice = deviceVector.absMin();
     };
+#ifdef HAVE_CUBLAS
+    auto absMinCublas = [&]() {
+        int index = 0;
+        cublasIgamin( cublasHandle, size,
+                      deviceVector.getData(), 1,
+                      &index );
+        resultDevice = deviceVector.getElement( index );
+    };
+#endif
     benchmark.setOperation( "absMin", datasetSize );
     benchmark.time( reset1,
                     "CPU", absMinHost,
                     "GPU", absMinCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", absMinCublas );
+#endif
 
 
     auto sumHost = [&]() {
@@ -155,10 +206,20 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto l1normCuda = [&]() {
         resultDevice = deviceVector.lpNorm( 1.0 );
     };
+#ifdef HAVE_CUBLAS
+    auto l1normCublas = [&]() {
+        cublasGasum( cublasHandle, size,
+                     deviceVector.getData(), 1,
+                     &resultDevice );
+    };
+#endif
     benchmark.setOperation( "l1 norm", datasetSize );
     benchmark.time( reset1,
                     "CPU", l1normHost,
                     "GPU", l1normCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", l1normCublas );
+#endif
 
 
     auto l2normHost = [&]() {
@@ -167,10 +228,20 @@ benchmarkVectorOperations( Benchmark & benchmark,
     auto l2normCuda = [&]() {
         resultDevice = deviceVector.lpNorm( 2.0 );
     };
+#ifdef HAVE_CUBLAS
+    auto l2normCublas = [&]() {
+        cublasGnrm2( cublasHandle, size,
+                     deviceVector.getData(), 1,
+                     &resultDevice );
+    };
+#endif
     benchmark.setOperation( "l2 norm", datasetSize );
     benchmark.time( reset1,
                     "CPU", l2normHost,
                     "GPU", l2normCuda );
+#ifdef HAVE_CUBLAS
+    benchmark.time( reset1, "cuBLAS", l2normCublas );
+#endif
 
 
     auto l3normHost = [&]() {
@@ -202,11 +273,10 @@ benchmarkVectorOperations( Benchmark & benchmark,
     benchmark.setOperation( "scalar product", 2 * datasetSize );
     benchmark.time( reset1,
                     "CPU", scalarProductHost,
-                    "GPU", scalarProductCuda
+                    "GPU", scalarProductCuda );
 #ifdef HAVE_CUBLAS
-                  , "cuBLAS", scalarProductCublas
+    benchmark.time( reset1, "cuBLAS", scalarProductCublas );
 #endif
-                  );
 
     /*
     cout << "Benchmarking prefix-sum:" << endl;
diff --git a/tests/long-time-unit-tests/matrix-formats-test.cpp b/tests/long-time-unit-tests/matrix-formats-test.cpp
index c2e708c75b6e0cfc77be6e4e7ffa280122691bca..486abff7389420a63d8221c17f562291ee9bb5a4 100644
--- a/tests/long-time-unit-tests/matrix-formats-test.cpp
+++ b/tests/long-time-unit-tests/matrix-formats-test.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "matrix-formats-test.h"
 
diff --git a/tests/long-time-unit-tests/matrix-formats-test.cu b/tests/long-time-unit-tests/matrix-formats-test.cu
index ea8e69e2ed478934a623a27df666633dd4ecf3be..827a59703a725da63ab4e9efbf61752c57453dfe 100644
--- a/tests/long-time-unit-tests/matrix-formats-test.cu
+++ b/tests/long-time-unit-tests/matrix-formats-test.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include "matrix-formats-test.h"
\ No newline at end of file
+#include "matrix-formats-test.h"
diff --git a/tests/long-time-unit-tests/matrix-formats-test.h b/tests/long-time-unit-tests/matrix-formats-test.h
index b845ec2234f426301eeb0b854be6f05b5b36e22f..4816f5f1748fc3d2f58e733050e8a32c026b5e10 100644
--- a/tests/long-time-unit-tests/matrix-formats-test.h
+++ b/tests/long-time-unit-tests/matrix-formats-test.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef MATRIX_FORMATS_TEST_H_
 #define MATRIX_FORMATS_TEST_H_
@@ -43,7 +36,7 @@ void setupConfig( tnlConfigDescription& config )
        config.addEntryEnum< tnlString >( "csr" );
    config.addEntry< bool >( "hard-test", "Comparison against the dense matrix.", false );
    config.addEntry< bool >( "multiplication-test", "Matrix-vector multiplication test.", false );
-   config.addEntry< bool >( "verbose", "Verbose mode." );  
+   config.addEntry< bool >( "verbose", "Verbose mode." );
 }
 
 
@@ -133,7 +126,7 @@ int main( int argc, char* argv[] )
    tnlConfigDescription conf_desc;
 
    setupConfig( conf_desc );
-   
+ 
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
    {
       conf_desc.printUsage( argv[ 0 ] );
diff --git a/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp b/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp
index 089a523fafc4aad90abcb37b4c322aa7375e80de..15de8846f5d742ec4be98b0f0f0a93a7fde6b044 100644
--- a/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp
+++ b/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlArrayOperationsTester.h"
 #include "../../tnlUnitTestStarter.h"
diff --git a/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cu b/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cu
index aec760defcf0d01c831de77865bfc4f16e3d9456..3da0650b6880197c1f893c497d47afc956d36274 100644
--- a/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cu
+++ b/tests/unit-tests/core/arrays/tnlArrayOperationsTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlArrayOperationsTester.h"
 #include "../../tnlUnitTestStarter.h"
diff --git a/tests/unit-tests/core/arrays/tnlArrayOperationsTester.h b/tests/unit-tests/core/arrays/tnlArrayOperationsTester.h
index 1391ead101bcbf620ce44537c18c125c79937387..23c760bb5f21323141efdcd0690a4c2944eec565 100644
--- a/tests/unit-tests/core/arrays/tnlArrayOperationsTester.h
+++ b/tests/unit-tests/core/arrays/tnlArrayOperationsTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLARRAYOPERATIONSTESTER_H_
 #define TNLARRAYOPERATIONSTESTER_H_
diff --git a/tests/unit-tests/core/arrays/tnlArrayTest.cpp b/tests/unit-tests/core/arrays/tnlArrayTest.cpp
index a5baec3e66158f4c2b4512345ab8de6e259a74a0..68f6d1581000ec02133c83461f657c3679529674 100644
--- a/tests/unit-tests/core/arrays/tnlArrayTest.cpp
+++ b/tests/unit-tests/core/arrays/tnlArrayTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/arrays/tnlArrayTest.cu b/tests/unit-tests/core/arrays/tnlArrayTest.cu
index c72897386d75f97651c2d41abe4d8f51addcc319..583d739247ca7e06e97840d64edfde110e842eb9 100644
--- a/tests/unit-tests/core/arrays/tnlArrayTest.cu
+++ b/tests/unit-tests/core/arrays/tnlArrayTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -41,4 +34,4 @@ int main( int argc, char* argv[] )
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/core/arrays/tnlArrayTester.h b/tests/unit-tests/core/arrays/tnlArrayTester.h
index 9c4afab61874d77e9ae15d3287a8128e532d9982..f073c30df853ee3cc1c8bcf08770727882eaf27c 100644
--- a/tests/unit-tests/core/arrays/tnlArrayTester.h
+++ b/tests/unit-tests/core/arrays/tnlArrayTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLARRAYTESTER_H_
 #define TNLARRAYTESTER_H_
@@ -94,7 +87,7 @@ class tnlArrayTester : public CppUnit :: TestCase
       CPPUNIT_ASSERT( u.getSize() == 10 );
       CPPUNIT_ASSERT( v.getSize() == 10 );
    }
-   
+ 
    void testBind()
    {
       Array u( 10 ), v;
@@ -107,14 +100,14 @@ class tnlArrayTester : public CppUnit :: TestCase
       u.reset();
       CPPUNIT_ASSERT( u.getSize() == 0 );
       CPPUNIT_ASSERT( v.getElement( 0 ) == 50 );
-      
+ 
       ElementType data[ 10 ] = { 1, 2, 3, 4, 5, 6, 7, 8, 10 };
       u.bind( data, 10 );
       CPPUNIT_ASSERT( u.getElement( 1 ) == 2 );
       v.bind( u );
       CPPUNIT_ASSERT( v.getElement( 1 ) == 2 );
       u.reset();
-      v.setElement( 1, 3 );      
+      v.setElement( 1, 3 );
       v.reset();
       CPPUNIT_ASSERT( data[ 1 ] == 3 );
    }
diff --git a/tests/unit-tests/core/arrays/tnlMultiArrayTest.cpp b/tests/unit-tests/core/arrays/tnlMultiArrayTest.cpp
index b313aa017e28ba580145bad7d0c5d957088646df..f0049d43339d850ed3a209a246bf746d0e4bca76 100644
--- a/tests/unit-tests/core/arrays/tnlMultiArrayTest.cpp
+++ b/tests/unit-tests/core/arrays/tnlMultiArrayTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/arrays/tnlMultiArrayTest.cu b/tests/unit-tests/core/arrays/tnlMultiArrayTest.cu
index 27eb22566d9e545b2bd367fbcf3c36226f44bbe9..9594876c0e48bb4ec294b5db6a9a1014f9d99564 100644
--- a/tests/unit-tests/core/arrays/tnlMultiArrayTest.cu
+++ b/tests/unit-tests/core/arrays/tnlMultiArrayTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlCuda.h>
@@ -45,15 +38,15 @@ int main( int argc, char* argv[] )
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, long int, tnlCuda, long int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, float, tnlCuda, long int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, double, tnlCuda, long int > >() ||
-       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, char, tnlCuda, int > >() ||  
-       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, int, tnlCuda, int > >() || 
-       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlCuda, int > >() || 
+       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, char, tnlCuda, int > >() ||
+       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, int, tnlCuda, int > >() ||
+       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlCuda, int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, float, tnlCuda, int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, double, tnlCuda, int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, char, tnlCuda, long int > >() ||
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, int, tnlCuda, long int > >() ||
-       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlCuda, long int > >() || 
-       //! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, float, tnlCuda, long int > >()  
+       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlCuda, long int > >() ||
+       //! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, float, tnlCuda, long int > >()
        ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, double, tnlCuda, long int > >()
        )
      return EXIT_FAILURE;
diff --git a/tests/unit-tests/core/arrays/tnlMultiArrayTester.h b/tests/unit-tests/core/arrays/tnlMultiArrayTester.h
index be799d741dd9b96f4ebd7129e3f7df4db8005d64..e74805ffa1a9011c05ea83d7f76fefb0d0747cfd 100644
--- a/tests/unit-tests/core/arrays/tnlMultiArrayTester.h
+++ b/tests/unit-tests/core/arrays/tnlMultiArrayTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMULTIARRAYTESTER_H_
 #define TNLMULTIARRAYTESTER_H_
@@ -116,19 +109,19 @@ class tnlMultiArrayTester : public CppUnit :: TestCase
    {
       u.setElement( i, i, i, v );
    }
-   
+ 
    IndexType getDiagonalElement( tnlMultiArray< 1, ElementType, Device, IndexType >& u,
                                  const IndexType& i )
    {
       return u.getElement( i );
    }
-   
+ 
    IndexType getDiagonalElement( tnlMultiArray< 2, ElementType, Device, IndexType >& u,
                                  const IndexType& i )
    {
       return u.getElement( i, i );
    }
-   
+ 
    IndexType getDiagonalElement( tnlMultiArray< 3, ElementType, Device, IndexType >& u,
                                  const IndexType& i )
    {
diff --git a/tests/unit-tests/core/arrays/tnlSharedArrayTester.h b/tests/unit-tests/core/arrays/tnlSharedArrayTester.h
index 20153f05fc2a3b4361130e90d419189a6235eaea..04512f085771101b16924c7c204d87a1bd176a2d 100644
--- a/tests/unit-tests/core/arrays/tnlSharedArrayTester.h
+++ b/tests/unit-tests/core/arrays/tnlSharedArrayTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSHAREDARRAYTESTER_H_
 #define TNLSHAREDARRAYTESTER_H_
diff --git a/tests/unit-tests/core/arrays/tnlStaticArrayTest.cpp b/tests/unit-tests/core/arrays/tnlStaticArrayTest.cpp
index aa9f08f0548e2b1f6c589e35051ed6d999fbc2af..117e7a952044287ec7f607fe1322a88d6a503a90 100644
--- a/tests/unit-tests/core/arrays/tnlStaticArrayTest.cpp
+++ b/tests/unit-tests/core/arrays/tnlStaticArrayTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/arrays/tnlStaticArrayTest.cu b/tests/unit-tests/core/arrays/tnlStaticArrayTest.cu
index 76cfe1d756c12dc7832914f2f7e6362146987065..2dd52f5d67ece6a9838b8e5e435da1974707ad01 100644
--- a/tests/unit-tests/core/arrays/tnlStaticArrayTest.cu
+++ b/tests/unit-tests/core/arrays/tnlStaticArrayTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -35,4 +28,4 @@ int main( int argc, char* argv[] )
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/core/arrays/tnlStaticArrayTester.h b/tests/unit-tests/core/arrays/tnlStaticArrayTester.h
index 9a6d4d8a014188b7eed006f73675bd8b1c7ed55b..a253d6e6e08f1a14e70d4d8761f53cf6d71569c8 100644
--- a/tests/unit-tests/core/arrays/tnlStaticArrayTester.h
+++ b/tests/unit-tests/core/arrays/tnlStaticArrayTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSTATICARRAYTESTER_H_
 #define TNLSTATICARRAYTESTER_H_
@@ -112,7 +105,7 @@ class tnlStaticArrayTester : public CppUnit :: TestCase
       CPPUNIT_ASSERT( u.y() == 1 );
       CPPUNIT_ASSERT( u.z() == 2 );
    }
-   
+ 
    template< int _Size, typename Element >
    void checkCoordinates( const tnlStaticArray< _Size, Element >& u )
    {
diff --git a/tests/unit-tests/core/cuda/reduction-test.cu b/tests/unit-tests/core/cuda/reduction-test.cu
index 14c08c03e0993deceb19acdd26e4b06837d693e5..4132e9ddebe4894e974457fe8fb82aff8227d896 100644
--- a/tests/unit-tests/core/cuda/reduction-test.cu
+++ b/tests/unit-tests/core/cuda/reduction-test.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlCudaReductionTester.h"
 #include "../../tnlUnitTestStarter.h"
diff --git a/tests/unit-tests/core/cuda/tnlCudaReductionTester.h b/tests/unit-tests/core/cuda/tnlCudaReductionTester.h
index e384a20e48c023befae13186d9b415cc81bfb7ee..2c89ec3b5aa054eaf81c1f9ea2175f9ded98604e 100644
--- a/tests/unit-tests/core/cuda/tnlCudaReductionTester.h
+++ b/tests/unit-tests/core/cuda/tnlCudaReductionTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 #ifndef TNLCUDAREDUCTIONTESTER_H_
@@ -170,7 +163,7 @@ class tnlCudaReductionTester : public CppUnit :: TestCase
 
       setConstantSequence( longSequence, ( RealType ) -1, hostData, deviceData );
       tnlParallelReductionSum< RealType, int > sumOperation;
-      CPPUNIT_ASSERT( 
+      CPPUNIT_ASSERT(
          ( reductionOnCudaDevice( sumOperation, longSequence, deviceData, ( RealType* ) 0, result ) ) );
       CPPUNIT_ASSERT( result == -longSequence );
 
diff --git a/tests/unit-tests/core/cuda/tnlCudaTest.cu b/tests/unit-tests/core/cuda/tnlCudaTest.cu
index 9c446baf943a1c945c1530bb9e0e0d54f9776c32..cd63b0621627c02823007e1b286f6c3fff332f9a 100644
--- a/tests/unit-tests/core/cuda/tnlCudaTest.cu
+++ b/tests/unit-tests/core/cuda/tnlCudaTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include "tnlCudaTester.h"
 #include "../../tnlUnitTestStarter.h"
@@ -24,4 +17,4 @@ int main( int argc, char* argv[] )
       return EXIT_FAILURE;
    return EXIT_SUCCESS;
 }
- 
\ No newline at end of file
+ 
diff --git a/tests/unit-tests/core/cuda/tnlCudaTester.h b/tests/unit-tests/core/cuda/tnlCudaTester.h
index 19bca5bcf0b7ec62c7fa12d50810021dead30ff5..213bf04f3eb1e71ce271d6b338b4f91d7f2bf1a7 100644
--- a/tests/unit-tests/core/cuda/tnlCudaTester.h
+++ b/tests/unit-tests/core/cuda/tnlCudaTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCUDATESTER_H_
 #define TNLCUDATESTER_H_
diff --git a/tests/unit-tests/core/multimaps/tnlEllpackIndexMultimapTest.cpp b/tests/unit-tests/core/multimaps/tnlEllpackIndexMultimapTest.cpp
index b28bc7b83bab55a143bc0d1ec04c123bd4652f13..3802bac58d967659c9ec576b77c2f5fc97eed16b 100644
--- a/tests/unit-tests/core/multimaps/tnlEllpackIndexMultimapTest.cpp
+++ b/tests/unit-tests/core/multimaps/tnlEllpackIndexMultimapTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -27,7 +20,7 @@ int main( int argc, char* argv[] )
 {
 #ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter :: run< tnlIndexMultimapTester< tnlEllpackIndexMultimap< int, tnlHost > > >() ||
-       ! tnlUnitTestStarter :: run< tnlIndexMultimapTester< tnlEllpackIndexMultimap< long int, tnlHost > > >() 
+       ! tnlUnitTestStarter :: run< tnlIndexMultimapTester< tnlEllpackIndexMultimap< long int, tnlHost > > >()
        )
      return EXIT_FAILURE;
    return EXIT_SUCCESS;
diff --git a/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h b/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h
index 3dcb6626237b22d65886dd4cb1b64bf7044897d9..c005ccb9405cbed83df6f26da8c8a17e47a09c42 100644
--- a/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h
+++ b/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLINDEXMULTIMAPTESTER_H_
 #define TNLINDEXMULTIMAPTESTER_H_
@@ -95,9 +88,9 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase
       typedef tnlIndexMultimapTester< IndexMultimapType, IndexMultimapSetup >              TesterType;
       typedef tnlIndexMultimapTesterSetter< IndexMultimapType, IndexMultimapSetup > IndexMultimapSetter;
       typedef typename CppUnit::TestCaller< TesterType >                 TestCallerType;
-      
+ 
       typedef typename IndexMultimapType::ValuesAllocationVectorType  ValuesAllocationVectorType;
-      typedef typename IndexMultimapType::ValuesAccessorType                  ValuesAccessorType; 
+      typedef typename IndexMultimapType::ValuesAccessorType                  ValuesAccessorType;
 
       tnlIndexMultimapTester(){};
 
@@ -169,7 +162,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase
          IndexMultimapType n;
          IndexMultimapSetter::setup( n );
          n.setRanges( 10, 10 );
-         
+ 
          ValuesAllocationVectorType portsAllocationVector;
          portsAllocationVector.setSize( n.getKeysRange() );
          portsAllocationVector.setValue( 7 );
diff --git a/tests/unit-tests/core/tnl-cuda-kernels.h b/tests/unit-tests/core/tnl-cuda-kernels.h
index bb8da3d4d503778012886b7fb7e92aab8235de51..d71f699d215291086b440e65ae15666c9fbf0970 100644
--- a/tests/unit-tests/core/tnl-cuda-kernels.h
+++ b/tests/unit-tests/core/tnl-cuda-kernels.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCUDAKERNELS_H_
 #define TNLCUDAKERNELS_H_
diff --git a/tests/unit-tests/core/tnlCUDAKernelsTester.h b/tests/unit-tests/core/tnlCUDAKernelsTester.h
index 10e3a6f5e43b26f5c7debfe95ba5860a704ed20a..9307d2181ce92c62f80ddbbdf43ad42fc69c89af 100644
--- a/tests/unit-tests/core/tnlCUDAKernelsTester.h
+++ b/tests/unit-tests/core/tnlCUDAKernelsTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCUDAKERNELSTESTER_H_
 #define TNLCUDAKERNELSTESTER_H_
diff --git a/tests/unit-tests/core/tnlCommunicatorTester.h b/tests/unit-tests/core/tnlCommunicatorTester.h
index eff6ceba9f3dcf398097bcdddf2413361377493b..b309bf6089a3d9ff93fc74d9a345c2919e8a8949 100644
--- a/tests/unit-tests/core/tnlCommunicatorTester.h
+++ b/tests/unit-tests/core/tnlCommunicatorTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCOMMUNICATORTESTER_H_
 #define TNLCOMMUNICATORTESTER_H_
diff --git a/tests/unit-tests/core/tnlFileTester.h b/tests/unit-tests/core/tnlFileTester.h
index 9f4833e2d49d2d970814197ff32356ce5274be99..9af11cf8128cc675d0ba0e642c8ff1324df70231 100644
--- a/tests/unit-tests/core/tnlFileTester.h
+++ b/tests/unit-tests/core/tnlFileTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <cppunit/TestSuite.h>
 #include <cppunit/TestResult.h>
@@ -56,17 +49,17 @@ class tnlFileTester : public CppUnit :: TestCase
          return;
       }
       int intData( 5 );
-#ifdef HAVE_NOT_CXX11      
+#ifdef HAVE_NOT_CXX11
       file. write< int, tnlHost >( &intData );
-#else      
+#else
       file. write( &intData );
-#endif      
+#endif
       double doubleData[ 3 ] = { 1.0, 2.0, 3.0 };
 #ifdef HAVE_NOT_CXX11
       file. write< double, tnlHost >( doubleData, 3 );
 #else
       file. write( doubleData, 3 );
-#endif      
+#endif
       if( ! file. close() )
       {
          cerr << "Unable to close the file test-file.tnl" << endl;
@@ -83,10 +76,10 @@ class tnlFileTester : public CppUnit :: TestCase
 #ifdef HAVE_NOT_CXX11
       file. read< int, tnlHost >( &newIntData );
       file. read< double, tnlHost >( newDoubleData, 3 );
-#else            
+#else
       file. read( &newIntData, 1 );
       file. read( newDoubleData, 3 );
-#endif      
+#endif
 
       CPPUNIT_ASSERT( newIntData == intData );
       for( int i = 0; i < 3; i ++ )
diff --git a/tests/unit-tests/core/tnlGridOldTester.h b/tests/unit-tests/core/tnlGridOldTester.h
index 806fdcd73e4752c80ec514b1423ea03d3a724054..d7ee7445df9f0378b0d7a69ac8037f32d26d9057 100644
--- a/tests/unit-tests/core/tnlGridOldTester.h
+++ b/tests/unit-tests/core/tnlGridOldTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef tnlGridOldTESTER_H_
 #define tnlGridOldTESTER_H_
diff --git a/tests/unit-tests/core/tnlListTest.cpp b/tests/unit-tests/core/tnlListTest.cpp
index 90d30f38f75587c6a28a1ec911be94de67510c86..ca9bc4ae39a722d190a7ba753783a6093c990320 100644
--- a/tests/unit-tests/core/tnlListTest.cpp
+++ b/tests/unit-tests/core/tnlListTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <cstdlib>
diff --git a/tests/unit-tests/core/tnlListTester.h b/tests/unit-tests/core/tnlListTester.h
index 96588b8a7c58edd9b7576906fc7d5fc56133c1ea..0a543dc4044658d4e12bf2d252c9b1795e7d277a 100644
--- a/tests/unit-tests/core/tnlListTester.h
+++ b/tests/unit-tests/core/tnlListTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLISTTESTER_H_
 #define TNLLISTTESTER_H_
diff --git a/tests/unit-tests/core/tnlObjectTest.cpp b/tests/unit-tests/core/tnlObjectTest.cpp
index fa16d357f650d263ec591830555ecfdce5f6f510..bfdde389b31e139c38e509aaef95276d264f5ba7 100644
--- a/tests/unit-tests/core/tnlObjectTest.cpp
+++ b/tests/unit-tests/core/tnlObjectTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/tnlObjectTester.h b/tests/unit-tests/core/tnlObjectTester.h
index dd3812b09d7547688c182f6a677134c43b64cb82..1899f843206d36b1398596669bd065e1e6012518 100644
--- a/tests/unit-tests/core/tnlObjectTester.h
+++ b/tests/unit-tests/core/tnlObjectTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLOBJECTTESTER_H_
 #define TNLOBJECTTESTER_H_
@@ -24,7 +17,7 @@
 #include <cppunit/TestCaller.h>
 #include <cppunit/TestCase.h>
 #include <cppunit/Message.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <core/tnlFile.h>
 
 class tnlObjectTester : public CppUnit :: TestCase
diff --git a/tests/unit-tests/core/tnlRealTester.h b/tests/unit-tests/core/tnlRealTester.h
index b758166be60067bd0bb8f592565500c6589ddaa6..f5c4bc615da04483e66479a0983da3032853a97a 100644
--- a/tests/unit-tests/core/tnlRealTester.h
+++ b/tests/unit-tests/core/tnlRealTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLREALTESTER_H_
 #define TNLREALTESTER_H_
diff --git a/tests/unit-tests/core/tnlSharedMemoryTester.h b/tests/unit-tests/core/tnlSharedMemoryTester.h
index 97d6d1a36fe7f9486e92788abf7fc5a8c6213dfe..ed02d245e0993f445ade1717243c6edabdf590e0 100644
--- a/tests/unit-tests/core/tnlSharedMemoryTester.h
+++ b/tests/unit-tests/core/tnlSharedMemoryTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSHAREDMEMORYTESTER_H_
 #define TNLSHAREDMEMORYTESTER_H_
diff --git a/tests/unit-tests/core/tnlStringTest.cpp b/tests/unit-tests/core/tnlStringTest.cpp
index a6770e6ac363da26a6bd81ea9b548943fb4eeba8..2e610606cca0ddc071e2418d7a5cb19ab16ef91f 100644
--- a/tests/unit-tests/core/tnlStringTest.cpp
+++ b/tests/unit-tests/core/tnlStringTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/tnlStringTester.h b/tests/unit-tests/core/tnlStringTester.h
index f1acc6a624cfc2b02b3750c82954eb02dc381b23..d59e9452187200cdd83cee23cddd2c8dc03ad9b7 100644
--- a/tests/unit-tests/core/tnlStringTester.h
+++ b/tests/unit-tests/core/tnlStringTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSTRINGTESTER_H_
 #define TNLSTRINGTESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlSharedVectorTester.h b/tests/unit-tests/core/vectors/tnlSharedVectorTester.h
index 87024082367ddcc18637d7315d00783883120f2a..5c8834cfb8e9958ef924233da51159d38701ed61 100644
--- a/tests/unit-tests/core/vectors/tnlSharedVectorTester.h
+++ b/tests/unit-tests/core/vectors/tnlSharedVectorTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSHAREDVECTORTESTER_H_
 #define TNLSHAREDVECTORTESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlStaticVector.cu b/tests/unit-tests/core/vectors/tnlStaticVector.cu
index b4c10d4509c70f6e311a65f90eb6a9c3a1adb2a4..7f2c962f3eeb3d20416fe8371274817e132f2e89 100644
--- a/tests/unit-tests/core/vectors/tnlStaticVector.cu
+++ b/tests/unit-tests/core/vectors/tnlStaticVector.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -35,4 +28,4 @@ int main( int argc, char* argv[] )
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/core/vectors/tnlStaticVectorTest.cpp b/tests/unit-tests/core/vectors/tnlStaticVectorTest.cpp
index cfeb8f92dcf98b72720dce1f0982e0485f9dfb67..76319a08edcb94151d094682f576f5eceb8aa7ea 100644
--- a/tests/unit-tests/core/vectors/tnlStaticVectorTest.cpp
+++ b/tests/unit-tests/core/vectors/tnlStaticVectorTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/vectors/tnlStaticVectorTester.h b/tests/unit-tests/core/vectors/tnlStaticVectorTester.h
index fde7012bbb408210c48afadf3f3b1a38721485e2..847f1bf2c302d958be56f1950d2337e67447a87a 100644
--- a/tests/unit-tests/core/vectors/tnlStaticVectorTester.h
+++ b/tests/unit-tests/core/vectors/tnlStaticVectorTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSTATICVECTORTESTER_H_
 #define TNLSTATICVECTORTESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlVectorCUDATester.h b/tests/unit-tests/core/vectors/tnlVectorCUDATester.h
index a11136d39237d866830b06e4302c1b61fa2b7331..dd72326aaf2130a56c93ce8cc7d8ca9685daabe1 100644
--- a/tests/unit-tests/core/vectors/tnlVectorCUDATester.h
+++ b/tests/unit-tests/core/vectors/tnlVectorCUDATester.h
@@ -6,14 +6,7 @@
  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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLONGVECTORCUDATESTER_H_
 #define TNLLONGVECTORCUDATESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlVectorHostTester.h b/tests/unit-tests/core/vectors/tnlVectorHostTester.h
index 8d73408736ee48d7c5f4f116efc09da845659fe1..1e09c28f4ace06054ac4870fb09ec1cac41ea508 100644
--- a/tests/unit-tests/core/vectors/tnlVectorHostTester.h
+++ b/tests/unit-tests/core/vectors/tnlVectorHostTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLONGVECTORHOSTTESTER_H_
 #define TNLLONGVECTORHOSTTESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cpp b/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cpp
index 08580d1c455ca63d08274c09cde90c47ef406383..3d6cdfdc55a55165e9643f2c043e14c431bc9f2d 100644
--- a/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cpp
+++ b/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlVectorOperationsTester.h"
 #include "../../tnlUnitTestStarter.h"
diff --git a/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cu b/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cu
index a4040aa7cc1fa277478989b9c5a0d02236020d55..602c40df0a5eeb81eed268121953e5c9be518114 100644
--- a/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cu
+++ b/tests/unit-tests/core/vectors/tnlVectorOperationsTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
  
 #include "tnlVectorOperationsTester.h"
 #include "../../tnlUnitTestStarter.h"
diff --git a/tests/unit-tests/core/vectors/tnlVectorOperationsTester.h b/tests/unit-tests/core/vectors/tnlVectorOperationsTester.h
index f452b8b10b875d98b65aa62822a72b05c33f401c..e8b6f6391d737e394fb4a3ee83f5ebc8c833e763 100644
--- a/tests/unit-tests/core/vectors/tnlVectorOperationsTester.h
+++ b/tests/unit-tests/core/vectors/tnlVectorOperationsTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLVECTOROPERATIONSTESTER_H_
 #define TNLVECTOROPERATIONSTESTER_H_
diff --git a/tests/unit-tests/core/vectors/tnlVectorTest.cpp b/tests/unit-tests/core/vectors/tnlVectorTest.cpp
index 7d04dbd9131b2b5af3085c351b6606d992acd52b..ed369b6d03beaa6e91f33e70ed350eaaa5b8695d 100644
--- a/tests/unit-tests/core/vectors/tnlVectorTest.cpp
+++ b/tests/unit-tests/core/vectors/tnlVectorTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/vectors/tnlVectorTest.cu b/tests/unit-tests/core/vectors/tnlVectorTest.cu
index ac8ac01ef0e9317e5f136c6b5b9cc820c9e50966..c4a0f37b64ee479c48764c8aa2b4ae7f6473910e 100644
--- a/tests/unit-tests/core/vectors/tnlVectorTest.cu
+++ b/tests/unit-tests/core/vectors/tnlVectorTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/core/vectors/tnlVectorTester.h b/tests/unit-tests/core/vectors/tnlVectorTester.h
index d1fd777f201c200bd5f2cbd79a120cd8eebffea7..c4caf7d4074f926be4cd0eaa2d6453418943b656 100644
--- a/tests/unit-tests/core/vectors/tnlVectorTester.h
+++ b/tests/unit-tests/core/vectors/tnlVectorTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLVECTORHOSTTESTER_H_
 #define TNLVECTORHOSTTESTER_H_
diff --git a/tests/unit-tests/diff/tnlMPIMeshTester.h b/tests/unit-tests/diff/tnlMPIMeshTester.h
index f8651d73d446f83ae6af5ec596b98e60f598c838..9ec7ef7491a145b063de0e4ff71dd629c99a1d99 100644
--- a/tests/unit-tests/diff/tnlMPIMeshTester.h
+++ b/tests/unit-tests/diff/tnlMPIMeshTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMPIMESHTESTER_H_
 #define TNLMPIMESHTESTER_H_
diff --git a/tests/unit-tests/diff/tnlMersonSolverCUDATester.cu.h b/tests/unit-tests/diff/tnlMersonSolverCUDATester.cu.h
index dab468ce705da57a05069e09ecb0d1dbe74e262d..f5e72db96625dd73b29b8ba6f4e5c21e47524aa0 100644
--- a/tests/unit-tests/diff/tnlMersonSolverCUDATester.cu.h
+++ b/tests/unit-tests/diff/tnlMersonSolverCUDATester.cu.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 
 
diff --git a/tests/unit-tests/functions/tnlOperatorFunctionTest.cpp b/tests/unit-tests/functions/tnlOperatorFunctionTest.cpp
index 850396cd0b5e51e029a041d0f9671e828c836432..f8ed5bb4ed7a71517208d453e8cefa17f854d953 100644
--- a/tests/unit-tests/functions/tnlOperatorFunctionTest.cpp
+++ b/tests/unit-tests/functions/tnlOperatorFunctionTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlOperatorFunctionTest.h"
 
diff --git a/tests/unit-tests/functions/tnlOperatorFunctionTest.h b/tests/unit-tests/functions/tnlOperatorFunctionTest.h
index ea98605deab17b60e74396cce7368cd1078f04ce..f71379698e58a18f723eb2f6ba7f3a51fc33138a 100644
--- a/tests/unit-tests/functions/tnlOperatorFunctionTest.h
+++ b/tests/unit-tests/functions/tnlOperatorFunctionTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLOPERATORFUNCTIONTEST_H
 #define	TNLOPERATORFUNCTIONTEST_H
@@ -48,7 +41,7 @@ class tnlOperatorFunctionTest
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef typename MeshType::VertexType VertexType;
    typedef tnlExpBumpFunction< MeshType::getMeshDimensions(), RealType > TestFunctionType;
-   typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions() > MeshFunctionType;   
+   typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions() > MeshFunctionType;
 
    tnlOperatorFunctionTest(){};
 
@@ -64,7 +57,7 @@ class tnlOperatorFunctionTest
       suiteOfTests -> addTest( new TestCallerType( "testWithBoundaryConditions", &TesterType::testWithBoundaryConditions ) );
       return suiteOfTests;
    }
-   
+ 
    void testWithNoBoundaryConditions()
    {
       MeshType mesh;
@@ -84,15 +77,15 @@ class tnlOperatorFunctionTest
       {
          auto entity = mesh.template getEntity< typename MeshType::Cell >( i );
          entity.refresh();
-         
+ 
          if( ! entity.isBoundaryEntity() )
          {
             //cerr << entity.getIndex() << " " << operator_( f1, entity ) << " " << operatorFunction( entity ) << endl;
             CPPUNIT_ASSERT( operator_( f1, entity ) == operatorFunction( entity ) );
          }
-      }            
+      }
    }
-   
+ 
    void testWithBoundaryConditions()
    {
       MeshType mesh;
@@ -102,11 +95,11 @@ class tnlOperatorFunctionTest
       mesh.setDomain( VertexType( -1.0 ), VertexType( 2.0 ) );
       TestFunctionType testFunction;
       testFunction.setAmplitude( 1.0 );
-      testFunction.setSigma( 1.0 );      
+      testFunction.setSigma( 1.0 );
       MeshFunctionType f1( mesh );
       f1 = testFunction;
       OperatorType operator_;
-      BoundaryConditionsType boundaryConditions;      
+      BoundaryConditionsType boundaryConditions;
       OperatorFunctionType operatorFunction( operator_, boundaryConditions, f1 );
       operatorFunction.refresh();
       //cerr << f1.getData() << endl;
@@ -121,11 +114,11 @@ class tnlOperatorFunctionTest
             //cerr << entity.getIndex() << " " << operator_( f1, entity ) << " " << operatorFunction( entity ) << endl;
             CPPUNIT_ASSERT( operator_( f1, entity ) == operatorFunction( entity ) );
          }
-      }            
-   }   
+      }
+   }
 };
 #endif
-   
+ 
 template< typename MeshType >
 bool runTest()
 {
@@ -139,7 +132,7 @@ bool runTest()
    return true;
 #else
    return false;
-#endif        
+#endif
 }
 
 int main( int argc, char* argv[] )
diff --git a/tests/unit-tests/matrices/tnlAdaptiveRgCSRMatrixTester.h b/tests/unit-tests/matrices/tnlAdaptiveRgCSRMatrixTester.h
index c12c8309244bb78779ccc8ef905916e9182a4ad3..264e4b32785ba30d308a8bba91c3ebf9e4702d59 100644
--- a/tests/unit-tests/matrices/tnlAdaptiveRgCSRMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlAdaptiveRgCSRMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLAdaptiveRgCSRMATRIXTESTER_H_
 #define TNLAdaptiveRgCSRMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlCSRMatrixTest.cpp b/tests/unit-tests/matrices/tnlCSRMatrixTest.cpp
index 2e6498c3d45f4aa34c1ba4cac721bf89e3b410a1..be75526ad8919dfe40431e9aea36054818f34e1f 100644
--- a/tests/unit-tests/matrices/tnlCSRMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlCSRMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlCSRMatrixTest.cu b/tests/unit-tests/matrices/tnlCSRMatrixTest.cu
index 70db14d21a93bf2b252bda49237ea916ff80f4a8..516f661e329c4d8997ff1c07352be86efda92b0c 100644
--- a/tests/unit-tests/matrices/tnlCSRMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlCSRMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cpp b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cpp
index 698f6cee723e081530609c98f7852cf3f361234a..4a9190e55155fcbefb3e4ffcfd2d1e1fa834db0d 100644
--- a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cu b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cu
index 068d46e08617c75131265a8c39cfff94f0794a85..1ecdc372d12f8f66afbcb6e8b89897492f033a1a 100644
--- a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlCuda.h>
diff --git a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTestSetup.h b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTestSetup.h
index 8a10210b698427910fbeae920168533a60610527..25064f2a1e1ef707c7141666744b6209b3c834d8 100644
--- a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTestSetup.h
+++ b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTestSetup.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCHUNKEDELLPACKMATRIXTESTSETUP_H_
 #define TNLCHUNKEDELLPACKMATRIXTESTSETUP_H_
@@ -39,7 +32,7 @@ class tnlSparseMatrixTesterMatrixSetter< tnlChunkedEllpackMatrix< Real, Device,
    public:
 
    typedef tnlChunkedEllpackMatrix< Real, Device, Index > Matrix;
-   
+ 
    static bool setup( Matrix& matrix )
    {
       matrix.setNumberOfChunksInSlice( TestSetup::sliceSize );
diff --git a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h
index 5f281816eb863183594d98bd3cd2bd4da6750f97..b439c2ac41768c012caf28a8bdaa4058cb1c888b 100644
--- a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLCHUNKEDELLPACKMATRIXTESTER_H_
 #define TNLCHUNKEDELLPACKMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlDenseMatrixTest.cpp b/tests/unit-tests/matrices/tnlDenseMatrixTest.cpp
index 0b21b38508b768a4876c3c806ca0fdfce7e2d8fd..4fefc01103029e77e9187024868440c99dbf4e37 100644
--- a/tests/unit-tests/matrices/tnlDenseMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlDenseMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlDenseMatrixTest.cu b/tests/unit-tests/matrices/tnlDenseMatrixTest.cu
index e83b11e36f5590f3a63103d19ca2d3a49b6c8625..6fc86af04746f6ebdd16d9af5fe057abc7764399 100644
--- a/tests/unit-tests/matrices/tnlDenseMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlDenseMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlDenseMatrixTester.h b/tests/unit-tests/matrices/tnlDenseMatrixTester.h
index a4ea8c6cc6e4cf271284c8144a9ea133483c7240..ac3ec7e0408fcdd85e9d9ed26afda70096183803 100644
--- a/tests/unit-tests/matrices/tnlDenseMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlDenseMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLDENSEMATRIXTESTER_H_
 #define TNLDENSEMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlEllpackMatrixTest.cpp b/tests/unit-tests/matrices/tnlEllpackMatrixTest.cpp
index 8e336c9d5b3828b70fb2c658b0cb9ce488b048d5..b9792fdd7f0da8e3e34c01ad06b266598a828fee 100644
--- a/tests/unit-tests/matrices/tnlEllpackMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlEllpackMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlEllpackMatrixTest.cu b/tests/unit-tests/matrices/tnlEllpackMatrixTest.cu
index b7b12a02a42bde1985c2fb91b1f9dd1da2d52771..cd0dcf77d42d384745ff53427d2741c794c4b2b6 100644
--- a/tests/unit-tests/matrices/tnlEllpackMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlEllpackMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlCuda.h>
@@ -34,4 +27,4 @@ int main( int argc, char* argv[] )
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/matrices/tnlEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlEllpackMatrixTester.h
index 442da3df4d21417c4fde872774d970b81e04eee8..3ea8fdbbaee46f0a1ec9124c61f959a7bacc1adc 100644
--- a/tests/unit-tests/matrices/tnlEllpackMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlEllpackMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLELLPACKMATRIXTESTER_H_
 #define TNLELLPACKMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlMatrixTester.h b/tests/unit-tests/matrices/tnlMatrixTester.h
index 14033b95fd1012e471ef0f9823f68b4e44063915..c0ce352286bd59505da3c8910f6064ec03efade7 100644
--- a/tests/unit-tests/matrices/tnlMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMATRIXTESTER_H_
 #define TNLMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cpp b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cpp
index b496500902612661d4f001d467340631e5d66da1..b7237f40e59a666fc8714692decf54a1e412ae56 100644
--- a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cu b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cu
index 0aa4557ec95e08e5f0f3871a27d32144743d605e..3c782a436ce4e142735a69cbc1e49d79c9c29092 100644
--- a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTester.h b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTester.h
index 23d0115683d9c890beae825d549e4f244c5c6c30..0ea883227f68d1ddd027353df22fe12947b3a745 100644
--- a/tests/unit-tests/matrices/tnlMultidiagonalMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlMultidiagonalMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMULTIDIAGONALMATRIXTESTER_H_
 #define TNLMULTIDIAGONALMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlRgCSRMatrixTester.h b/tests/unit-tests/matrices/tnlRgCSRMatrixTester.h
index 52c7260ee7b05939194cc48d9b1755937a7f2ab9..a61d50c7dfd722cb6716b5400e1d44f120a31274 100644
--- a/tests/unit-tests/matrices/tnlRgCSRMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlRgCSRMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLRgCSRMATRIXTESTER_H_
 #define TNLRgCSRMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cpp b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cpp
index a464003672b215b22a2b376ce5b965aa39ef0282..3bfbee0e3b28ecf17713d2c50f4793011903430f 100644
--- a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cu b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cu
index 78e8cda939e7797f279a1bf466368571f64bee62..1d641a582e4d5c39d3888e1709d88cd0700248a6 100644
--- a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlCuda.h>
@@ -29,11 +22,11 @@ int main( int argc, char* argv[] )
   if( ! tnlUnitTestStarter::run< tnlSparseMatrixTester< tnlSlicedEllpackMatrix< float, tnlCuda, int, 32 > > >() ||
       ! tnlUnitTestStarter::run< tnlSparseMatrixTester< tnlSlicedEllpackMatrix< double, tnlCuda, int, 32 > > >() ||
       ! tnlUnitTestStarter::run< tnlSparseMatrixTester< tnlSlicedEllpackMatrix< float, tnlCuda, int, 4 > > >() ||
-      ! tnlUnitTestStarter::run< tnlSparseMatrixTester< tnlSlicedEllpackMatrix< double, tnlCuda, int, 4 > > >() 
+      ! tnlUnitTestStarter::run< tnlSparseMatrixTester< tnlSlicedEllpackMatrix< double, tnlCuda, int, 4 > > >()
        )
      return EXIT_FAILURE;
    return EXIT_SUCCESS;
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h
index 452c8387cdff03feaeea8191562df6c458d775e1..bff401d5d9653588b3bf21f2b50ec5fe66961a32 100644
--- a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSLICEDELLPACKMATRIXTESTER_H_
 #define TNLSLICEDELLPACKMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlSparseMatrixTester.h b/tests/unit-tests/matrices/tnlSparseMatrixTester.h
index 8bb3706fca93240b10f2d2def3f04174f9f96b97..442f21b8ad7718530bd40254ec6665cca8335626 100644
--- a/tests/unit-tests/matrices/tnlSparseMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlSparseMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSPARSEMATRIXTESTER_H_
 #define TNLSPARSEMATRIXTESTER_H_
diff --git a/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cpp b/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cpp
index ca83ebd5e0b659314bb8ed61810049faa42bad65..b0fc050edf59b10494ae4553506d34631333b2ad 100644
--- a/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cpp
+++ b/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cu b/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cu
index 119ffe0d5985595c8649a910da72b22053a011e4..ac0f9643459bc943a183376a3ad105c27d9d24d6 100644
--- a/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cu
+++ b/tests/unit-tests/matrices/tnlTridiagonalMatrixTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -35,4 +28,4 @@ int main( int argc, char* argv[] )
 #else
    return EXIT_FAILURE;
 #endif
-}
\ No newline at end of file
+}
diff --git a/tests/unit-tests/matrices/tnlTridiagonalMatrixTester.h b/tests/unit-tests/matrices/tnlTridiagonalMatrixTester.h
index 4e4124af64397544cd9926af410c29e8f58dbeec..4fd12dd70287eb3edc4a129e6164bbab863bb100 100644
--- a/tests/unit-tests/matrices/tnlTridiagonalMatrixTester.h
+++ b/tests/unit-tests/matrices/tnlTridiagonalMatrixTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLTRIDIAGONALMATRIXTESTER_H_
 #define TNLTRIDIAGONALMATRIXTESTER_H_
diff --git a/tests/unit-tests/mesh/tnlGrid1DTester.h b/tests/unit-tests/mesh/tnlGrid1DTester.h
index 78fe8df08368e98451c6f90772857850673ea96d..55451e0dff163d0eefae9db8e23774ce78bc4cfd 100644
--- a/tests/unit-tests/mesh/tnlGrid1DTester.h
+++ b/tests/unit-tests/mesh/tnlGrid1DTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TESTS_UNIT_TESTS_MESH_TNLGRID1DTESTER_H_
 #define TESTS_UNIT_TESTS_MESH_TNLGRID1DTESTER_H_
@@ -58,7 +51,7 @@ class tnlGridTester< 1, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType xSize( 13 );
       GridType grid;
       grid.setDimensions( xSize );
-      
+ 
       typename GridType::Cell cell( grid );
       for( cell.getCoordinates().x() = 0;
            cell.getCoordinates().x() < xSize;
@@ -76,7 +69,7 @@ class tnlGridTester< 1, RealType, Device, IndexType >: public CppUnit :: TestCas
       GridType grid;
       grid.setDimensions( xSize );
 
-      typename GridType::Vertex vertex( grid );      
+      typename GridType::Vertex vertex( grid );
       for( vertex.getCoordinates().x() = 0;
            vertex.getCoordinates().x() < xSize;
            vertex.getCoordinates().x()++ )
diff --git a/tests/unit-tests/mesh/tnlGrid2DTester.h b/tests/unit-tests/mesh/tnlGrid2DTester.h
index da9bcfc652455084d2652962374967f09c189db1..7611fd0d9a1367962e3232921f511cdb157b707f 100644
--- a/tests/unit-tests/mesh/tnlGrid2DTester.h
+++ b/tests/unit-tests/mesh/tnlGrid2DTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TESTS_UNIT_TESTS_MESH_TNLGRID2DTESTER_H_
 #define TESTS_UNIT_TESTS_MESH_TNLGRID2DTESTER_H_
@@ -85,14 +78,14 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
    {
       const IndexType xSize( 13 );
       const IndexType ySize( 17 );
-      GridType grid;      
+      GridType grid;
       grid.setDimensions( xSize, ySize );
 
       typedef typename GridType::template MeshEntity< 1 > FaceType;
       typedef typename FaceType::EntityOrientationType OrientationType;
       typedef typename FaceType::EntityBasisType BasisType;
       FaceType face( grid );
-      
+ 
       face.setOrientation( OrientationType( 1, 0 ) );
       for( face.getCoordinates().y() = 0;
            face.getCoordinates().y() < ySize;
@@ -120,7 +113,7 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
          {
             const IndexType faceIndex = grid.template getEntityIndex( face );
             CPPUNIT_ASSERT( faceIndex >= 0 );
-            CPPUNIT_ASSERT( faceIndex < grid.template getEntitiesCount< typename GridType::Face >() );            
+            CPPUNIT_ASSERT( faceIndex < grid.template getEntitiesCount< typename GridType::Face >() );
             CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Face >( faceIndex ).getCoordinates() == face.getCoordinates() );
             CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Face >( faceIndex ).getOrientation() == OrientationType( 0, 1 ) );
             // TODO: fix this - gives undefined reference - I do not know why
@@ -134,12 +127,12 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType xSize( 13 );
       const IndexType ySize( 17 );
       GridType grid;
-      
+ 
       typedef typename GridType::template MeshEntity< 0 > VertexType;
       typedef typename VertexType::EntityBasisType BasisType;
       VertexType vertex( grid );
-      
-      CoordinatesType& vertexCoordinates = vertex.getCoordinates();      
+ 
+      CoordinatesType& vertexCoordinates = vertex.getCoordinates();
       grid.setDimensions( xSize, ySize );
       for( vertex.getCoordinates().y() = 0;
            vertex.getCoordinates().y() < ySize + 1;
@@ -161,9 +154,9 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType ySize( 17 );
       GridType grid;
       grid.setDimensions( xSize, ySize );
-      
+ 
       typedef typename GridType::CoordinatesType CoordinatesType;
-      typedef typename GridType::Cell CellType;      
+      typedef typename GridType::Cell CellType;
       CellType cell( grid );
 
       for( cell.getCoordinates().y() = 0;
@@ -196,7 +189,7 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
                auto neighbourEntities = cell.getNeighbourEntities();
                CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, -1 >() ) );
             }
-            if( cell.getCoordinates().y() < ySize - 1 )               
+            if( cell.getCoordinates().y() < ySize - 1 )
             {
                const CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, 1 ) );
                const IndexType auxCellIndex = grid.getEntityIndex( auxCell );
@@ -212,10 +205,10 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType ySize( 17 );
       GridType grid;
       grid.setDimensions( xSize, ySize );
-      
+ 
       typedef typename GridType::CoordinatesType CoordinatesType;
-      typedef typename GridType::Cell CellType;      
-      typedef typename GridType::Face FaceType;      
+      typedef typename GridType::Cell CellType;
+      typedef typename GridType::Face FaceType;
       typedef typename FaceType::EntityOrientationType EntityOrientationType;
       typedef typename FaceType::EntityBasisType EntityBasisType;
       CellType cell( grid );
@@ -226,12 +219,12 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
          for( cell.getCoordinates().x() = 0;
               cell.getCoordinates().x() < xSize;
               cell.getCoordinates().x()++ )
-         {            
+         {
             //const IndexType cellIndex = grid.getEntityIndex( cell );
             cell.refresh(); //setIndex( cellIndex );
             auto neighbourEntities = cell.template getNeighbourEntities< GridType::Face::entityDimensions >();
 
-            FaceType face1( grid, 
+            FaceType face1( grid,
                             cell.getCoordinates(),
                             EntityOrientationType( -1, 0 ),
                             EntityBasisType( 0, 1 ) );
@@ -251,7 +244,7 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
                             EntityBasisType( 1, 0 ) );
             IndexType face3Index = grid.template getEntityIndex( face3 );
             CPPUNIT_ASSERT( ( face3Index == neighbourEntities.template getEntityIndex< 0, -1 >() ) );
-            
+ 
             FaceType face4( grid,
                             cell.getCoordinates() + CoordinatesType( 0, 1 ),
                             EntityOrientationType( 0, 1 ),
@@ -267,10 +260,10 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType ySize( 17 );
       GridType grid;
       grid.setDimensions( xSize, ySize );
-      
+ 
       typedef typename GridType::CoordinatesType CoordinatesType;
-      typedef typename GridType::Cell CellType;      
-      typedef typename GridType::Face FaceType;      
+      typedef typename GridType::Cell CellType;
+      typedef typename GridType::Face FaceType;
       typedef typename FaceType::EntityOrientationType EntityOrientationType;
       FaceType face( grid );
 
@@ -298,7 +291,7 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
                if( face.getCoordinates().x() < xSize )
                {
                   CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, 0 ) );
-                  IndexType cellIndex = grid.getEntityIndex( cell );                  
+                  IndexType cellIndex = grid.getEntityIndex( cell );
                   CPPUNIT_ASSERT( ( cellIndex == neighbourCells.template getEntityIndex< 1, 0 >() ) );
                }
             }
@@ -308,7 +301,7 @@ class tnlGridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCas
                //const IndexType faceIndex = grid.getEntityIndex( face );
                face.refresh();//setIndex( faceIndex );
                auto neighbourCells = face.template getNeighbourEntities< GridType::Cell::entityDimensions >();
-               
+ 
                if( face.getCoordinates().y() > 0 )
                {
                   CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, -1 ) );
diff --git a/tests/unit-tests/mesh/tnlGrid3DTester.h b/tests/unit-tests/mesh/tnlGrid3DTester.h
index 6f76eb78ea4d43ff91520b91b23134be23e1ddbe..6ef30d8cd160006b7c07649231b2a70642549663 100644
--- a/tests/unit-tests/mesh/tnlGrid3DTester.h
+++ b/tests/unit-tests/mesh/tnlGrid3DTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TESTS_UNIT_TESTS_MESH_TNLGRID3DTESTER_H_
 #define TESTS_UNIT_TESTS_MESH_TNLGRID3DTESTER_H_
@@ -95,12 +88,12 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-            
+ 
       typedef typename GridType::template MeshEntity< 2 > FaceType;
       typedef typename FaceType::EntityOrientationType OrientationType;
       typedef typename FaceType::EntityBasisType BasisType;
       FaceType face( grid );
-      
+ 
       face.setOrientation( OrientationType( 1, 0, 0 ) );
       for( face.getCoordinates().z() = 0;
             face.getCoordinates().z() < zSize;
@@ -171,12 +164,12 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-      
+ 
       typedef typename GridType::template MeshEntity< 1 > EdgeType;
       typedef typename EdgeType::EntityOrientationType OrientationType;
       typedef typename EdgeType::EntityBasisType BasisType;
       EdgeType edge( grid );
-      
+ 
       edge.setBasis( OrientationType( 1, 0, 0 ) );
       for( edge.getCoordinates().z() = 0;
            edge.getCoordinates().z() < zSize + 1;
@@ -196,7 +189,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                // TODO: fix this - gives undefined reference - I do not know why
                //CPPUNIT_ASSERT( grid.template getEntity< 1 >( faceIndex ).getBasis() == BasisType( 0, 1 ) );
             }
-      
+ 
       edge.setBasis( OrientationType( 0, 1, 0 ) );
       for( edge.getCoordinates().z() = 0;
            edge.getCoordinates().z() < zSize + 1;
@@ -235,7 +228,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                //CPPUNIT_ASSERT( grid.template getEntity< 1 >( edgeIndex ).getOrientation() == OrientationType( 1, 0, 0 ) );
                // TODO: fix this - gives undefined reference - I do not know why
                //CPPUNIT_ASSERT( grid.template getEntity< 1 >( faceIndex ).getBasis() == BasisType( 0, 1 ) );
-            }      
+            }
    }
 
    void vertexIndexingTest()
@@ -245,12 +238,12 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-      
+ 
       typedef typename GridType::template MeshEntity< 0 > VertexType;
       typedef typename VertexType::EntityOrientationType OrientationType;
       typedef typename VertexType::EntityBasisType BasisType;
       VertexType vertex( grid );
-      
+ 
       for( vertex.getCoordinates().z() = 0;
            vertex.getCoordinates().z() < zSize + 1;
            vertex.getCoordinates().z()++ )
@@ -278,7 +271,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-      
+ 
       typedef typename GridType::Cell CellType;
       CellType cell( grid );
       for( cell.getCoordinates().z() = 0;
@@ -344,7 +337,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-     
+ 
       typedef typename GridType::Cell CellType;
       typedef typename GridType::Face FaceType;
       typedef typename FaceType::EntityOrientationType EntityOrientationType;
@@ -363,7 +356,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                //const IndexType cellIndex = grid.getEntityIndex( cell );
                cell.refresh();//setIndex( cellIndex );
                auto neighbourEntities = cell.template getNeighbourEntities< GridType::Face::entityDimensions >();
-               
+ 
 
                face.setCoordinates( cell.getCoordinates() );
                face.setOrientation( EntityOrientationType( 1, 0, 0 ) );
@@ -410,7 +403,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
       const IndexType zSize( 19 );
       GridType grid;
       grid.setDimensions( xSize, ySize, zSize );
-      
+ 
       typedef typename GridType::Cell CellType;
       typedef typename GridType::Face FaceType;
       typedef typename FaceType::EntityOrientationType EntityOrientationType;
@@ -444,7 +437,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                   }
                   if( face.getCoordinates().x() < xSize )
                   {
-                     CellType cell( grid, face.getCoordinates() );                     
+                     CellType cell( grid, face.getCoordinates() );
                      IndexType cellIndex = grid.getEntityIndex( cell );
                      CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 1, 0, 0 >() ) );
                   }
@@ -455,7 +448,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                   //const IndexType faceIndex = grid.getEntityIndex( face );
                   face.refresh();//setIndex( faceIndex );
                   auto neighbourEntities = face.template getNeighbourEntities< GridType::Cell::entityDimensions >();
-                  
+ 
                   if( face.getCoordinates().y() > 0 )
                   {
                      CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, -1, 0 ) );
@@ -475,7 +468,7 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas
                   //const IndexType faceIndex = grid.getEntityIndex( face );
                   face.refresh();//setIndex( faceIndex );
                   auto neighbourEntities = face.template getNeighbourEntities< GridType::Cell::entityDimensions >();
-                  
+ 
                   if( face.getCoordinates().z() > 0 )
                   {
                      CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, 0, -1 ) );
diff --git a/tests/unit-tests/mesh/tnlGridTest.cpp b/tests/unit-tests/mesh/tnlGridTest.cpp
index b73459dac41d191d574150f8fb396984b913e9b7..c0eb85812d825f21293d9243de27a6f77be4a048 100644
--- a/tests/unit-tests/mesh/tnlGridTest.cpp
+++ b/tests/unit-tests/mesh/tnlGridTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/mesh/tnlGridTester.h b/tests/unit-tests/mesh/tnlGridTester.h
index e24962eaf9762948e3576be6386df540a1b42afe..f21702ebe11bc19cfc7f577985748d3d132fbcb5 100644
--- a/tests/unit-tests/mesh/tnlGridTester.h
+++ b/tests/unit-tests/mesh/tnlGridTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 #ifndef TNLGRIDTESTER_H_
 #define TNLGRIDTESTER_H_
 
diff --git a/tests/unit-tests/mesh/tnlMeshEntityTest.cpp b/tests/unit-tests/mesh/tnlMeshEntityTest.cpp
index cdcb5dabbd3e4d537874fe01f1b26adf15c52643..fb983c155e8b5d98d1431ddc6d6f168b3b9cf560 100644
--- a/tests/unit-tests/mesh/tnlMeshEntityTest.cpp
+++ b/tests/unit-tests/mesh/tnlMeshEntityTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/mesh/tnlMeshEntityTester.h b/tests/unit-tests/mesh/tnlMeshEntityTester.h
index 8a3928c27405b80bd30fc665f838e078e79eecbd..96541e45d9d10b4a5883d613bf028d5b1dbdf0df 100644
--- a/tests/unit-tests/mesh/tnlMeshEntityTester.h
+++ b/tests/unit-tests/mesh/tnlMeshEntityTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMESHENTITYTESTER_H_
 #define TNLMESHENTITYTESTER_H_
@@ -30,7 +23,7 @@
 #include <mesh/topologies/tnlMeshEdgeTopology.h>
 #include <mesh/topologies/tnlMeshTriangleTopology.h>
 #include <mesh/topologies/tnlMeshTetrahedronTopology.h>
-    
+ 
 //typedef tnlMeshConfigBase< tnlMeshTriangleTopology, 2, double, int, int, void > TestTriangleEntityTopology;
 typedef tnlMeshConfigBase< tnlMeshEdgeTopology, 2, double, int, int, void > TestEdgeEntityTopology;
 typedef tnlMeshConfigBase< tnlMeshVertexTopology, 2, double, int, int, void > TestVertexEntityTopology;
@@ -38,35 +31,35 @@ typedef tnlMeshConfigBase< tnlMeshVertexTopology, 2, double, int, int, void > Te
 class TestTriangleMeshConfig : public tnlMeshConfigBase< tnlMeshTriangleTopology >
 {
    public:
-      
+ 
       template< typename MeshEntity >
       static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions )
       {
          return true;
-      }  
-      
+      }
+ 
       template< typename MeshEntity >
       static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions )
       {
          return true;
-      }  
+      }
 };
 
 class TestTetrahedronMeshConfig : public tnlMeshConfigBase< tnlMeshTetrahedronTopology >
 {
    public:
-      
+ 
       template< typename MeshEntity >
       static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions )
       {
          return true;
-      }  
-      
+      }
+ 
       template< typename MeshEntity >
       static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions )
       {
          return true;
-      }  
+      }
 };
 
 template< typename RealType, typename Device, typename IndexType >
@@ -94,7 +87,7 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
 
       return suiteOfTests;
    }
-       
+ 
 
    void vertexMeshEntityTest()
    {
@@ -116,7 +109,7 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
    {
       typedef tnlMeshEntity< TestEdgeEntityTopology, tnlMeshEdgeTopology > EdgeMeshEntityType;
       typedef tnlMeshEntity< TestEdgeEntityTopology, tnlMeshVertexTopology > VertexMeshEntityType;
-      
+ 
       typedef typename VertexMeshEntityType::PointType PointType;
       CPPUNIT_ASSERT( PointType::getType() == ( tnlStaticVector< 2, RealType >::getType() ) );
 
@@ -124,13 +117,13 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
        *
        * Here we test the following simple example:
        *
-       
-                point2   
+ 
+                point2
                    |\
                    | \
                    |  \
                    |   \
-               
+ 
                      ....
                 edge1     edge0
                      ....
@@ -142,11 +135,11 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
                 point0   edge2        point1
 
        */
-      
+ 
       PointType point0( 0.0, 0.0 ),
                 point1( 1.0, 0.0 ),
                 point2( 0.0, 1.0 );
-      
+ 
       tnlStaticArray< 3, VertexMeshEntityType > vertexEntities;
       vertexEntities[ 0 ].setPoint( point0 );
       vertexEntities[ 1 ].setPoint( point1 );
@@ -258,7 +251,7 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
                 point1( 1.0, 0.0, 0.0 ),
                 point2( 0.0, 1.0, 0.0 ),
                 point3( 0.0, 0.0, 1.0 );
-      
+ 
       tnlStaticArray< tnlMeshSubtopology< tnlMeshTetrahedronTopology, 0 >::count,
                       VertexMeshEntityType > vertexEntities;
 
@@ -455,7 +448,7 @@ class tnlMeshEntityTester : public CppUnit :: TestCase
        CPPUNIT_ASSERT( triangleEntities[ 1 ].template getSubentityIndex< 1 >( 0 ) == 0 );
        CPPUNIT_ASSERT( triangleEntities[ 1 ].template getSubentityIndex< 1 >( 1 ) == 3 );
        CPPUNIT_ASSERT( triangleEntities[ 1 ].template getSubentityIndex< 1 >( 2 ) == 4 );
-         
+ 
        /*vertexEntities[ 0 ].template setNumberOfSuperentities< 1 >( 2 );
        vertexEntities[ 0 ].template setSuperentityIndex< 1 >( 0, 2 );
        vertexEntities[ 0 ].template setSuperentityIndex< 1 >( 1, 1 );
diff --git a/tests/unit-tests/mesh/tnlMeshTest.cpp b/tests/unit-tests/mesh/tnlMeshTest.cpp
index 38f77e55418b9c64ec0916764c21e70988f4a2db..317522084734feeba65e1ae87f865e9797fbc1e2 100644
--- a/tests/unit-tests/mesh/tnlMeshTest.cpp
+++ b/tests/unit-tests/mesh/tnlMeshTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
diff --git a/tests/unit-tests/mesh/tnlMeshTester.h b/tests/unit-tests/mesh/tnlMeshTester.h
index d7f2a9b44efd43de06fbf89439090c31dca6ab96..80b989cddf7d19125ac121e885b8f70bddc9544b 100644
--- a/tests/unit-tests/mesh/tnlMeshTester.h
+++ b/tests/unit-tests/mesh/tnlMeshTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMESHTESTER_H_
 #define TNLMESHTESTER_H_
@@ -49,7 +42,7 @@ class TestTriangleMeshConfig : public tnlMeshConfigBase< tnlMeshTriangleTopology
 class TestQuadrilateralMeshConfig : public tnlMeshConfigBase< tnlMeshQuadrilateralTopology >
 {
    public:
-      
+ 
       static constexpr bool entityStorage( int dimensions ) { return true; };
       template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) { return true; };
       template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return ( SubentityDimensions % 2 != 0 ); };
@@ -136,7 +129,7 @@ class tnlMeshTester : public CppUnit :: TestCase
        meshBuilder.setPoint( 1, PointType( 1.0, 0.0 ) );
        meshBuilder.setPoint( 2, PointType( 0.0, 1.0 ) );
        meshBuilder.setPoint( 3, PointType( 1.0, 1.0 ) );
-       
+ 
        meshBuilder.setCellsCount( 2 );
        meshBuilder.getCellSeed( 0 ).setCornerId( 0, 0 );
        meshBuilder.getCellSeed( 0 ).setCornerId( 1, 1 );
@@ -145,7 +138,7 @@ class tnlMeshTester : public CppUnit :: TestCase
        meshBuilder.getCellSeed( 1 ).setCornerId( 1, 2 );
        meshBuilder.getCellSeed( 1 ).setCornerId( 2, 3 );
        meshBuilder.build( mesh );
-      
+ 
        CPPUNIT_ASSERT( mesh.getNumberOfEntities< 2 >() == 2 );
        CPPUNIT_ASSERT( mesh.getNumberOfEntities< 1 >() == 5 );
        CPPUNIT_ASSERT( mesh.getNumberOfEntities< 0 >() == 4 );
@@ -164,7 +157,7 @@ class tnlMeshTester : public CppUnit :: TestCase
       typedef tnlMeshEntity< TestTetrahedronMeshConfig, tnlMeshEdgeTopology > EdgeMeshEntityType;
       typedef tnlMeshEntity< TestTetrahedronMeshConfig, tnlMeshVertexTopology > VertexMeshEntityType;
       typedef typename VertexMeshEntityType::PointType PointType;
-      typedef tnlMesh< TestTetrahedronMeshConfig > TestTetrahedronMesh;      
+      typedef tnlMesh< TestTetrahedronMeshConfig > TestTetrahedronMesh;
       TestTetrahedronMesh mesh;
       tnlMeshBuilder< TestTetrahedronMesh > meshBuilder;
       meshBuilder.setPointsCount( 13 );
@@ -205,7 +198,7 @@ class tnlMeshTester : public CppUnit :: TestCase
        *  12        6        3        5
        *  12        3        6       10
        */
-      
+ 
       meshBuilder.setCellsCount( 18 );
        //  12        8        7        5
       meshBuilder.getCellSeed( 0 ).setCornerId( 0, 12 );
@@ -218,85 +211,85 @@ class tnlMeshTester : public CppUnit :: TestCase
       meshBuilder.getCellSeed( 1 ).setCornerId( 1, 7 );
       meshBuilder.getCellSeed( 1 ).setCornerId( 2, 8 );
       meshBuilder.getCellSeed( 1 ).setCornerId( 3, 10 );
-                 
+ 
        //  12       11        8        9
       meshBuilder.getCellSeed( 2 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 2 ).setCornerId( 1, 11 );
       meshBuilder.getCellSeed( 2 ).setCornerId( 2, 8 );
       meshBuilder.getCellSeed( 2 ).setCornerId( 3, 9 );
-                 
+ 
        //  10       11        2        8
       meshBuilder.getCellSeed( 3 ).setCornerId( 0, 10 );
       meshBuilder.getCellSeed( 3 ).setCornerId( 1, 11 );
       meshBuilder.getCellSeed( 3 ).setCornerId( 2, 2 );
       meshBuilder.getCellSeed( 3 ).setCornerId( 3, 8 );
-                 
+ 
        //  12        7        6        5
       meshBuilder.getCellSeed( 4 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 4 ).setCornerId( 1, 7 );
       meshBuilder.getCellSeed( 4 ).setCornerId( 2, 6 );
       meshBuilder.getCellSeed( 4 ).setCornerId( 3, 5 );
-                 
+ 
        //   9       12        5        8
       meshBuilder.getCellSeed( 5 ).setCornerId( 0, 9 );
       meshBuilder.getCellSeed( 5 ).setCornerId( 1, 12 );
       meshBuilder.getCellSeed( 5 ).setCornerId( 2, 5 );
       meshBuilder.getCellSeed( 5 ).setCornerId( 3, 8 );
-                 
+ 
        //  12       11        9        3
       meshBuilder.getCellSeed( 6 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 6 ).setCornerId( 1, 11 );
       meshBuilder.getCellSeed( 6 ).setCornerId( 2, 9 );
       meshBuilder.getCellSeed( 6 ).setCornerId( 3, 3 );
-                 
+ 
        //   9        4       11        8
       meshBuilder.getCellSeed( 7 ).setCornerId( 0, 9 );
       meshBuilder.getCellSeed( 7 ).setCornerId( 1, 4 );
       meshBuilder.getCellSeed( 7 ).setCornerId( 2, 11 );
       meshBuilder.getCellSeed( 7 ).setCornerId( 3, 8 );
-                
+ 
        //  12        9        5        3
       meshBuilder.getCellSeed( 8 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 8 ).setCornerId( 1, 9 );
       meshBuilder.getCellSeed( 8 ).setCornerId( 2, 5 );
       meshBuilder.getCellSeed( 8 ).setCornerId( 3, 3 );
-                 
+ 
        //   1        2        0       11
       meshBuilder.getCellSeed( 9 ).setCornerId( 0, 1 );
       meshBuilder.getCellSeed( 9 ).setCornerId( 1, 2 );
       meshBuilder.getCellSeed( 9 ).setCornerId( 2, 0 );
       meshBuilder.getCellSeed( 9 ).setCornerId( 3, 11 );
-                 
+ 
        //   8       11        2        4
       meshBuilder.getCellSeed( 10 ).setCornerId( 0, 8 );
       meshBuilder.getCellSeed( 10 ).setCornerId( 1, 11 );
       meshBuilder.getCellSeed( 10 ).setCornerId( 2, 2 );
       meshBuilder.getCellSeed( 10 ).setCornerId( 3, 4 );
-                 
+ 
        //   1        2       11        4
       meshBuilder.getCellSeed( 11 ).setCornerId( 0, 1 );
       meshBuilder.getCellSeed( 11 ).setCornerId( 1, 2 );
       meshBuilder.getCellSeed( 11 ).setCornerId( 2, 11 );
       meshBuilder.getCellSeed( 11 ).setCornerId( 3, 4 );
-                 
+ 
        //   9        4        1       11
       meshBuilder.getCellSeed( 12 ).setCornerId( 0, 9 );
       meshBuilder.getCellSeed( 12 ).setCornerId( 1, 4 );
       meshBuilder.getCellSeed( 12 ).setCornerId( 2, 1 );
       meshBuilder.getCellSeed( 12 ).setCornerId( 3, 11 );
-                 
+ 
        //  10       11        8       12
       meshBuilder.getCellSeed( 13 ).setCornerId( 0, 10 );
       meshBuilder.getCellSeed( 13 ).setCornerId( 1, 11 );
       meshBuilder.getCellSeed( 13 ).setCornerId( 2, 8 );
       meshBuilder.getCellSeed( 13 ).setCornerId( 3, 12 );
-                 
+ 
        //  12        6        7       10
       meshBuilder.getCellSeed( 14 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 14 ).setCornerId( 1, 6 );
       meshBuilder.getCellSeed( 14 ).setCornerId( 2, 7 );
       meshBuilder.getCellSeed( 14 ).setCornerId( 3, 10 );
-                 
+ 
        //  10       11       12        3
       meshBuilder.getCellSeed( 15 ).setCornerId( 0, 10 );
       meshBuilder.getCellSeed( 15 ).setCornerId( 1, 11 );
@@ -308,13 +301,13 @@ class tnlMeshTester : public CppUnit :: TestCase
       meshBuilder.getCellSeed( 16 ).setCornerId( 1, 6 );
       meshBuilder.getCellSeed( 16 ).setCornerId( 2, 3 );
       meshBuilder.getCellSeed( 16 ).setCornerId( 3, 5 );
-                 
+ 
        //  12        3        6       10
       meshBuilder.getCellSeed( 17 ).setCornerId( 0, 12 );
       meshBuilder.getCellSeed( 17 ).setCornerId( 1, 3 );
       meshBuilder.getCellSeed( 17 ).setCornerId( 2, 6 );
       meshBuilder.getCellSeed( 17 ).setCornerId( 3, 10 );
-      
+ 
       meshBuilder.build( mesh );
 
       /*CPPUNIT_ASSERT( mesh.save( "mesh.tnl" ) );
@@ -339,7 +332,7 @@ class tnlMeshTester : public CppUnit :: TestCase
 
       typedef tnlMesh< TestTriangleMeshConfig > TestTriangleMesh;
       tnlMesh< TestTriangleMeshConfig > mesh;
-      tnlMeshBuilder< TestTriangleMesh > meshBuilder;      
+      tnlMeshBuilder< TestTriangleMesh > meshBuilder;
       meshBuilder.setPointsCount( numberOfVertices );
       meshBuilder.setCellsCount( numberOfCells );
 
@@ -378,7 +371,7 @@ class tnlMeshTester : public CppUnit :: TestCase
 
    void regularMeshOfQuadrilateralsTest()
    {
-#ifdef UNDEF      
+#ifdef UNDEF
       typedef tnlMeshEntity< TestQuadrilateralMeshConfig, tnlMeshQuadrilateralTopology > QuadrilateralMeshEntityType;
       typedef tnlMeshEntity< TestQuadrilateralMeshConfig, tnlMeshEdgeTopology > EdgeMeshEntityType;
       typedef tnlMeshEntity< TestQuadrilateralMeshConfig, tnlMeshVertexTopology > VertexMeshEntityType;
@@ -425,12 +418,12 @@ class tnlMeshTester : public CppUnit :: TestCase
       CPPUNIT_ASSERT( mesh2.load( "mesh-test.tnl" ) );
       CPPUNIT_ASSERT( mesh == mesh2 );
       //mesh.print( cout );
-#endif      
+#endif
    }
 
    void regularMeshOfHexahedronsTest()
    {
-#ifdef UNDEF      
+#ifdef UNDEF
       typedef tnlMeshEntity< TestHexahedronMeshConfig, tnlMeshHexahedronTopology > HexahedronMeshEntityType;
       typedef tnlMeshEntity< TestHexahedronMeshConfig, tnlMeshEdgeTopology > EdgeMeshEntityType;
       typedef tnlMeshEntity< TestHexahedronMeshConfig, tnlMeshVertexTopology > VertexMeshEntityType;
@@ -489,7 +482,7 @@ class tnlMeshTester : public CppUnit :: TestCase
       CPPUNIT_ASSERT( mesh2.load( "mesh-test.tnl" ) );
       CPPUNIT_ASSERT( mesh == mesh2 );*/
       //mesh.print( cout );
-#endif      
+#endif
    }
 
 
diff --git a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cpp b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cpp
index dc456b3092abddfb62c35b0ef81ec555738b3077..32cd28168231c72a569402f3632051ef424d3aaa 100644
--- a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cpp
+++ b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlLinearDiffusionTest.h"
diff --git a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cu b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cu
index dd44de3206c2d417ab16485313dfa55be33188e3..93e5c4f79786f62c734792897c6193ae5fe615e6 100644
--- a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cu
+++ b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlLinearDiffusionTest.h"
diff --git a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h
index 663c0a9d9e5f8314bb464cd514ccc08e4b01d667..5ddfef3e849c6f8c2d0278739df5817596548e43 100644
--- a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h
+++ b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLLINEARDIFFUSIONTEST_H
 #define	TNLLINEARDIFFUSIONTEST_H
@@ -30,33 +23,33 @@ template< typename ApproximateOperator,
           bool write = false,
           bool verbose = false >
 class tnlLinearDiffusionTest
-   : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction > 
+   : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperator::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
-      
+ 
       const RealType  eoc[ 3 ] =       { 2.0,  2.0,  2.0 };
-      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };      
-   
+      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlLinearDiffusionTest< " ) + 
+      {
+         return tnlString( "tnlLinearDiffusionTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
@@ -68,19 +61,19 @@ class tnlLinearDiffusionTest
                             verbose );
 
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose );
       }
-      
+ 
    protected:
 
       ApproximateOperator approximateOperator;
-      
+ 
       ExactOperatorType exactOperator;
 
 };
@@ -94,13 +87,13 @@ bool runTest()
 {
    typedef tnlLinearDiffusion< Mesh > ApproximateOperator;
    typedef tnlLinearDiffusionTest< ApproximateOperator, Function, write, verbose > OperatorTest;
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
 #else
    return false;
-#endif      
+#endif
 }
 
 template< typename Mesh,
@@ -125,13 +118,13 @@ int main( int argc, char* argv[] )
 {
    const bool verbose( false );
    const bool write( false );
-   
+ 
    if( ! setMesh< tnlHost, write, verbose  >() )
       return EXIT_FAILURE;
 #ifdef HAVE_CUDA
    if( ! setMesh< tnlCuda, write, verbose >() )
       return EXIT_FAILURE;
-#endif   
+#endif
    return EXIT_SUCCESS;
 }
 
diff --git a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cpp b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cpp
index 526154ab4962dd34f07b301d20ffbfc3ab5f6683..7f2439ffda74850c9e65abbc91d24bf96620cd79 100644
--- a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cpp
+++ b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlOneSidedMeanCurvatureTest.h"
diff --git a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cu b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cu
index 823198441ab0efb5891751667c5c3ed598a706fc..6dd745cb1d0e0f28add25affe5d47a601f710d79 100644
--- a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cu
+++ b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlOneSidedMeanCurvatureTest.h"
diff --git a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h
index 6b53f3d910a6a962d501fff696d3e3abda7b3bd6..37fa3c647c1ccfd2176fbe2cf9384f5a1c8c9159 100644
--- a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h
+++ b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMEANCURVATURETEST_H
 #define	TNLMEANCURVATURETEST_H
@@ -30,35 +23,35 @@ template< typename ApproximateOperator,
           bool write = false,
           bool verbose = false >
 class tnlOneSidedMeanCurvatureTest
-   : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction > 
+   : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperatorType::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
-      typedef typename ApproximateOperator::IndexType IndexType;   
-      
+      typedef typename ApproximateOperator::IndexType IndexType;
+ 
       const IndexType coarseMeshSize[ 3 ] = { 128, 256, 64 };
-      
+ 
       const RealType  eoc[ 3 ] =       { 2.0,  2.0,  2.0 };
       const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
-      
+ 
       tnlOneSidedMeanCurvatureTest(){};
-   
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlOneSidedMeanCurvatureTest< " ) + 
+      {
+         return tnlString( "tnlOneSidedMeanCurvatureTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
@@ -66,7 +59,7 @@ class tnlOneSidedMeanCurvatureTest
          ApproximateOperator approximateOperator( this->mesh );
          ExactOperatorType exactOperator;
          approximateOperator.setRegularizationEpsilon( 1.0 );
-         exactOperator.setRegularizationEpsilon( 1.0 );         
+         exactOperator.setRegularizationEpsilon( 1.0 );
          this->performTest( approximateOperator,
                             exactOperator,
                             errors,
@@ -74,18 +67,18 @@ class tnlOneSidedMeanCurvatureTest
                             verbose );
 
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose );
       }
-      
+ 
    protected:
 
-      
+ 
 
 };
 
@@ -100,13 +93,13 @@ bool runTest()
    typedef tnlOneSidedMeanCurvatureTest< ApproximateOperator, Function, write, verbose > OperatorTest;
    OperatorTest test;
    test.runUnitTest();
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
 #else
-   return false;   
-#endif      
+   return false;
+#endif
 }
 
 template< typename Mesh,
@@ -131,13 +124,13 @@ int main( int argc, char* argv[] )
 {
    const bool verbose( true );
    const bool write( true );
-   
+ 
    if( ! setMesh< tnlHost, write, verbose  >() )
       return EXIT_FAILURE;
 #ifdef HAVE_CUDA
    if( ! setMesh< tnlCuda, write, verbose >() )
       return EXIT_FAILURE;
-#endif   
+#endif
    return EXIT_SUCCESS;
 }
 
diff --git a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cpp b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cpp
index 7649c3a4ace53c322306fd61becdcea7041743d2..a9b5ce220521bd94cbcd29b0819c9924c79543b3 100644
--- a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cpp
+++ b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlFiniteDifferencesTest.h"
diff --git a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cu b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cu
index f4c526d729f3d15f16b270391378f42a06cb1023..9af1bda5b58e5010dcdea68f892f0cec5d458afd 100644
--- a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cu
+++ b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.cu
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlFiniteDifferencesTest.h"
 
diff --git a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h
index 28b8e5d16bc6d6754a094d647973aeec761de2d3..12fc61e9fc4990e9721bdc1601d1dc4acdba65e9 100644
--- a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h
+++ b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <core/tnlHost.h>
@@ -34,11 +27,11 @@ template< typename ApproximateOperator >
 class tnlFinitDifferenceEocTestResults
 {
    public:
-        
+ 
       typedef typename ApproximateOperator::RealType RealType;
-      
+ 
       const RealType  eoc[ 3 ] =       { 1.0,  1.0,  1.0 };
-      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };      
+      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
 
 };
 
@@ -51,9 +44,9 @@ template< typename MeshType,
 class tnlFinitDifferenceEocTestResults< tnlCentralFiniteDifference< MeshType, XDifference, YDifference, ZDifference, RealType, IndexType > >
 {
    public:
-      
+ 
       const RealType  eoc[ 3 ] =       { 2.0,  2.0,  2.0 };
-      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };         
+      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
 };
 
 template< typename ApproximateOperator,
@@ -65,28 +58,28 @@ class tnlFiniteDifferenceTest
      public tnlFinitDifferenceEocTestResults< ApproximateOperator >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperatorType::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
-      
-   
+ 
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlLinearDiffusionTest< " ) + 
+      {
+         return tnlString( "tnlLinearDiffusionTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
@@ -98,19 +91,19 @@ class tnlFiniteDifferenceTest
                             verbose );
 
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );
       }
-      
+ 
    protected:
 
       ApproximateOperator approximateOperator;
-      
+ 
       ExactOperatorType exactOperator;
 
 };
@@ -123,7 +116,7 @@ template< typename FiniteDifferenceOperator,
 bool testFiniteDifferenceOperator()
 {
     typedef tnlFiniteDifferenceTest< FiniteDifferenceOperator, Function, write, verbose > OperatorTest;
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
@@ -145,7 +138,7 @@ bool setFiniteDifferenceOperator()
     typedef tnlForwardFiniteDifference< Mesh, XDifference, YDifference, ZDifference, RealType, IndexType > ForwardFiniteDifference;
     typedef tnlBackwardFiniteDifference< Mesh, XDifference, YDifference, ZDifference, RealType, IndexType > BackwardFiniteDifference;
     typedef tnlCentralFiniteDifference< Mesh, XDifference, YDifference, ZDifference, RealType, IndexType > CentralFiniteDifference;
-    
+ 
     if( XDifference < 2 && YDifference < 2 && ZDifference < 2 )
       return ( testFiniteDifferenceOperator< ForwardFiniteDifference, Function, WriteFunctions, Verbose >() &&
                testFiniteDifferenceOperator< BackwardFiniteDifference, Function, WriteFunctions, Verbose >() &&
@@ -159,7 +152,7 @@ template< typename Mesh,
           typename IndexType,
           int XDifference,
           int YDifference,
-          int ZDifference,        
+          int ZDifference,
           int MeshSize,
           bool WriteFunctions,
           bool Verbose >
@@ -187,14 +180,14 @@ bool setDifferenceOrder()
              setFunction< Grid1D, RealType, IndexType, 2, 0, 0, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid2D, RealType, IndexType, 1, 0, 0, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid2D, RealType, IndexType, 0, 1, 0, MeshSize, WriteFunctions, Verbose >() &&
-             setFunction< Grid2D, RealType, IndexType, 2, 0, 0, MeshSize, WriteFunctions, Verbose >() &&            
+             setFunction< Grid2D, RealType, IndexType, 2, 0, 0, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid2D, RealType, IndexType, 0, 2, 0, MeshSize, WriteFunctions, Verbose >() &&
-             setFunction< Grid3D, RealType, IndexType, 1, 0, 0, MeshSize, WriteFunctions, Verbose >() &&             
+             setFunction< Grid3D, RealType, IndexType, 1, 0, 0, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid3D, RealType, IndexType, 0, 1, 0, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid3D, RealType, IndexType, 0, 0, 1, MeshSize, WriteFunctions, Verbose >() &&
              setFunction< Grid3D, RealType, IndexType, 2, 0, 0, MeshSize, WriteFunctions, Verbose >() &&
-             setFunction< Grid3D, RealType, IndexType, 0, 2, 0, MeshSize, WriteFunctions, Verbose >() &&             
-             setFunction< Grid3D, RealType, IndexType, 0, 0, 2, MeshSize, WriteFunctions, Verbose >() );            
+             setFunction< Grid3D, RealType, IndexType, 0, 2, 0, MeshSize, WriteFunctions, Verbose >() &&
+             setFunction< Grid3D, RealType, IndexType, 0, 0, 2, MeshSize, WriteFunctions, Verbose >() );
 }
 
 bool test()
@@ -206,8 +199,8 @@ bool test()
 #ifdef HAVE_CUDA
    if( ! setDifferenceOrder< double, tnlCuda, int, double, int, 64, writeFunctions, verbose >() )
       return false;
-#endif    
-    return true;    
+#endif
+    return true;
 }
 
 int main( int argc, char* argv[] )
diff --git a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cpp b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cpp
index de3df7a05c7b143b113d0290eb8971a10bbb83b5..6ed0dcf6bd0119dd04dc396bdac5753a81bc2e24 100644
--- a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cpp
+++ b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlCoFVMGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cu b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cu
index f0223132842f96e9d0cd5f7c28c855a2c584fa11..bd3cf7fb76a51973adeb5a633833ed22f19c7f1c 100644
--- a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cu
+++ b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlCoFVMGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h
index 9f43de6841cd44729a3e1aaf4d6f283b14774ef0..7c7d7e8120b768810a2fd50f4db9fab7b37b53b4 100644
--- a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h
+++ b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLTWOSIDEDGRADIENTNORMTEST_H
 #define	TNLTWOSIDEDGRADIENTNORMTEST_H
@@ -34,40 +27,40 @@ class tnlCoFVMGradientNormTest
    : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperatorType::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
 
       const RealType eoc[ 3 ] =       { 2.0,  2.0, 2.0 };
-      const RealType tolerance[ 3 ] = { 1.05, 1.1, 1.3 };      
-      
+      const RealType tolerance[ 3 ] = { 1.05, 1.1, 1.3 };
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlCoFVMGradientNormTest< " ) + 
+      {
+         return tnlString( "tnlCoFVMGradientNormTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
          this->setupMesh( meshSize );
-         
+ 
          tnlMeshFunction< MeshType > u;
-      
+ 
          typename ApproximateOperator::InnerOperator gradientNorm;
          typename ApproximateOperator::OuterOperator interpolant;
-         ApproximateOperator approximateOperator( interpolant, gradientNorm, this->mesh );      
+         ApproximateOperator approximateOperator( interpolant, gradientNorm, this->mesh );
          typename ApproximateOperator::InnerOperator::ExactOperatorType exactOperator;
 
          this->performTest( approximateOperator,
@@ -76,15 +69,15 @@ class tnlCoFVMGradientNormTest
                             write,
                             verbose );
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );
       }
-      
+ 
    protected:
 
 
@@ -92,17 +85,17 @@ class tnlCoFVMGradientNormTest
 
 
 template< typename Operator,
-          typename Function, 
+          typename Function,
           bool write,
           bool verbose >
 bool runTest()
 {
    typedef tnlCoFVMGradientNormTest< Operator, Function, write, verbose > OperatorTest;
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
-#endif      
+#endif
 }
 
 template< typename Mesh,
@@ -137,13 +130,13 @@ int main( int argc, char* argv[] )
 {
    const bool verbose( true );
    const bool write( false );
-   
+ 
    if( ! setMesh< tnlHost, write, verbose  >() )
       return EXIT_FAILURE;
 #ifdef HAVE_CUDA
    if( ! setMesh< tnlCuda, write, verbose >() )
       return EXIT_FAILURE;
-#endif   
+#endif
    return EXIT_SUCCESS;
 }
 
diff --git a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cpp b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cpp
index b0ffb834694f5e357f66392fe2d18a4cd990935e..4ead5725e04b85e517bd3e68871149c729933c32 100644
--- a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cpp
+++ b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlFDMGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cu b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cu
index 5fb5b112b0fa230e5906e80f247cefdefd8d6f4e..cc3700de630a064ac2c5710f3b3c0be565b1e166 100644
--- a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cu
+++ b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlFDMGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h
index 790cf0ec9a52a248c5e4e4316e9cba5ad4950873..7ebea5c0ee9e6c45a2cf3369a259f4dd101a382d 100644
--- a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h
+++ b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLFDMGRADIENTNORMTEST_H
 #define	TNLFDMGRADIENTNORMTEST_H
@@ -31,12 +24,12 @@
 template< typename ApproximateOperator >
 class tnlFDMGradientNormEocTestResults
 {
-   public:       
+   public:
  
       typedef typename ApproximateOperator::RealType RealType;
-           
+ 
       const RealType eoc[ 3 ] =       { 1.0,  1.0,  1.0 };
-      const RealType tolerance[ 3 ] = { 0.05, 0.05, 0.05 };      
+      const RealType tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
 };
 
 template< typename MeshType,
@@ -45,7 +38,7 @@ template< typename MeshType,
 class tnlFDMGradientNormEocTestResults< tnlCentralFiniteDifference< MeshType, 1, 0, 0, RealType, IndexType > >
 {
    public:
-      
+ 
       const RealType eoc[ 3 ] =       { 2.0,  2.0,  2.0 };
       const RealType tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
 };
@@ -59,27 +52,27 @@ class tnlFDMGradientNormTest
      public tnlFDMGradientNormEocTestResults< typename ApproximateOperator::template XDifferenceOperatorType< typename ApproximateOperator::MeshType::Cell > >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperatorType::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
-      
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlFDMGradientNormTest< " ) + 
+      {
+         return tnlString( "tnlFDMGradientNormTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
@@ -91,35 +84,35 @@ class tnlFDMGradientNormTest
                             verbose );
 
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );
       }
-      
+ 
    protected:
 
       ApproximateOperator approximateOperator;
-      
+ 
       ExactOperatorType exactOperator;
 
 };
 
 template< typename Operator,
-          typename Function, 
+          typename Function,
           bool write,
           bool verbose >
 bool runTest()
 {
    typedef tnlFDMGradientNormTest< Operator, Function, write, verbose > OperatorTest;
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
-#endif      
+#endif
 }
 
 template< typename Mesh,
@@ -158,13 +151,13 @@ int main( int argc, char* argv[] )
 {
    const bool verbose( false );
    const bool write( false );
-   
+ 
    if( ! setMesh< tnlHost, write, verbose  >() )
       return EXIT_FAILURE;
 #ifdef HAVE_CUDA
    if( ! setMesh< tnlCuda, write, verbose >() )
       return EXIT_FAILURE;
-#endif   
+#endif
    return EXIT_SUCCESS;
 }
 
diff --git a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cpp b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cpp
index 2125cd13a7af6766146561913180ee64925fe6b9..e67070c44d2d8423712343bd731269f2b5c8e79b 100644
--- a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cpp
+++ b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cpp
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlTwoSidedGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cu b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cu
index 040cbc91047bc62abf2a19654e73ed236c907452..e5f30b5e0e48ecca9a075cad2b853e0ce84d0cfa 100644
--- a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cu
+++ b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlTwoSidedGradientNormTest.h"
diff --git a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h
index d2d29c4b0817e941587095fdde428d380d1442d9..b55192ba74af431107758926784b993ca223b311 100644
--- a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h
+++ b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLTWOSIDEDGRADIENTNORMTEST_H
 #define	TNLTWOSIDEDGRADIENTNORMTEST_H
@@ -32,30 +25,30 @@ class tnlTwoSidedGradientNormTest
    : public tnlPDEOperatorEocTest< ApproximateOperator, TestFunction >
 {
    public:
-      
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef typename ApproximateOperatorType::ExactOperatorType ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
 
       const RealType eoc[ 3 ] =       { 1.0,  1.9, 1.75 };
-      const RealType tolerance[ 3 ] = { 0.05, 0.1, 0.3 };      
-      
+      const RealType tolerance[ 3 ] = { 0.05, 0.1, 0.3 };
+ 
       static tnlString getType()
-      { 
-         return tnlString( "tnlTwoSidedGradientNormTest< " ) + 
+      {
+         return tnlString( "tnlTwoSidedGradientNormTest< " ) +
                 ApproximateOperator::getType() + ", " +
                 TestFunction::getType() + " >";
       }
-      
+ 
       void setupTest()
       {
          this->setupFunction();
       }
-            
+ 
       void getApproximationError( const IndexType meshSize,
                                   RealType errors[ 3 ] )
       {
@@ -67,36 +60,36 @@ class tnlTwoSidedGradientNormTest
                             verbose );
 
       }
-      
+ 
       void runUnitTest()
-      {  
+      {
          RealType coarseErrors[ 3 ], fineErrors[ 3 ];
          this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors );
          this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors );
-         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );                            
+         this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose );
       }
-      
+ 
    protected:
 
       ApproximateOperator approximateOperator;
-      
+ 
       ExactOperatorType exactOperator;
 
 };
 
 
 template< typename Operator,
-          typename Function, 
+          typename Function,
           bool write,
           bool verbose >
 bool runTest()
 {
    typedef tnlTwoSidedGradientNormTest< Operator, Function, write, verbose > OperatorTest;
-#ifdef HAVE_CPPUNIT   
+#ifdef HAVE_CPPUNIT
    if( ! tnlUnitTestStarter::run< tnlPDEOperatorEocUnitTest< OperatorTest > >() )
       return false;
    return true;
-#endif      
+#endif
 }
 
 template< typename Mesh,
@@ -131,13 +124,13 @@ int main( int argc, char* argv[] )
 {
    const bool verbose( true );
    const bool write( false );
-   
+ 
    if( ! setMesh< tnlHost, write, verbose  >() )
       return EXIT_FAILURE;
 #ifdef HAVE_CUDA
    if( ! setMesh< tnlCuda, write, verbose >() )
       return EXIT_FAILURE;
-#endif   
+#endif
    return EXIT_SUCCESS;
 }
 
diff --git a/tests/unit-tests/operators/tnlApproximationError.h b/tests/unit-tests/operators/tnlApproximationError.h
index 859dc2674efccec4769f835b28c47de8fc7a071e..b62c817d2f5e719d13df115e95a4e7a70f89a8db 100644
--- a/tests/unit-tests/operators/tnlApproximationError.h
+++ b/tests/unit-tests/operators/tnlApproximationError.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLAPPROXIMATIONERROR_H_
 #define TNLAPPROXIMATIONERROR_H_
@@ -33,7 +26,7 @@ template< typename ExactOperator,
 class tnlApproximationError
 {
    public:
-   
+ 
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename MeshType::DeviceType DeviceType;
@@ -58,7 +51,7 @@ class tnlApproximationError
          typedef tnlExactOperatorFunction< ExactOperator, Function > ExactOperatorFunction;
 
          tnlMeshFunction< MeshType, MeshEntity::getDimensions() > exactU( mesh ), u( mesh ), v( mesh );
-         OperatorFunction operatorFunction( approximateOperator, v );         
+         OperatorFunction operatorFunction( approximateOperator, v );
          ExactOperatorFunction exactOperatorFunction( exactOperator, function );
          DirichletBoundaryConditions boundaryConditions;
          BoundaryOperatorFunction boundaryOperatorFunction( boundaryConditions, u );
@@ -91,19 +84,19 @@ class tnlApproximationError
          {
             cerr << "Error in operator refreshing." << endl;
             return;
-         }         
+         }
          u = operatorFunction;
          tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u );
          if( writeFunctions )
             u.write( "approximate-result-" + dimensionsString + meshSizeString, "gnuplot" ) ;
 
          //cerr << "Evaluate difference ... " << endl;
-         u -= exactU;   
+         u -= exactU;
          tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u );
          if( writeFunctions )
             u.write( "difference-" + dimensionsString + meshSizeString, "gnuplot" ) ;
          l1Error = u.getLpNorm( 1.0 );
-         l2Error = u.getLpNorm( 2.0 );   
+         l2Error = u.getLpNorm( 2.0 );
          maxError = u.getMaxNorm();
       }
 };
diff --git a/tests/unit-tests/operators/tnlOperatorCompositionTest.cpp b/tests/unit-tests/operators/tnlOperatorCompositionTest.cpp
index c489cbec436ac32aa1942a5ee176839453da653d..962b4752ebc7c38aaad7b27ff3c69b668601b0f1 100644
--- a/tests/unit-tests/operators/tnlOperatorCompositionTest.cpp
+++ b/tests/unit-tests/operators/tnlOperatorCompositionTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlOperatorCompositionTest.h"
 
diff --git a/tests/unit-tests/operators/tnlOperatorCompositionTest.h b/tests/unit-tests/operators/tnlOperatorCompositionTest.h
index 31396690009405d4ec5575fb581ef2a2fa88bd9d..d4a94355a20738bb615b3863df984a8b09425961 100644
--- a/tests/unit-tests/operators/tnlOperatorCompositionTest.h
+++ b/tests/unit-tests/operators/tnlOperatorCompositionTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLOPERATORFUNCTIONTEST_H
 #define	TNLOPERATORFUNCTIONTEST_H
@@ -50,7 +43,7 @@ class tnlOperatorCompositionTest
    typedef tnlExpBumpFunction< MeshType::getMeshDimensions(), typename MeshType::RealType > TestFunctionType;
    typedef tnlConstantFunction< MeshType::getMeshDimensions(), typename MeshType::RealType > ConstantFunction;
    typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction > BoundaryConditions;
-   typedef tnlOperatorComposition< OperatorType, OperatorType, BoundaryConditions > OperatorComposition;   
+   typedef tnlOperatorComposition< OperatorType, OperatorType, BoundaryConditions > OperatorComposition;
    typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions() > MeshFunctionType;
    typedef tnlOperatorFunction< OperatorType, MeshFunctionType, BoundaryConditions > OperatorFunction;
    typedef tnlOperatorFunction< OperatorType, OperatorFunction, BoundaryConditions > OperatorFunction2;
@@ -68,9 +61,9 @@ class tnlOperatorCompositionTest
       suiteOfTests -> addTest( new TestCallerType( "test", &TesterType::test ) );
       return suiteOfTests;
    }
-   
+ 
    void test()
-   {      
+   {
       MeshType mesh;
       mesh.setDimensions( CoordinatesType( 25 ) );
       mesh.setDomain( VertexType( -1.0 ), VertexType( 2.0 ) );
@@ -85,23 +78,23 @@ class tnlOperatorCompositionTest
       operatorFunction1.refresh();
       OperatorFunction2 operatorFunction2( operator_, boundaryConditions, operatorFunction1 );
       operatorFunction2.refresh();
-      
+ 
       //f1 = testFunction;
       OperatorComposition operatorComposition( operator_, operator_, boundaryConditions, mesh );
       //operatorComposition.refresh();
       tnlOperatorFunction< OperatorComposition, MeshFunctionType, BoundaryConditions > operatorFunction3( operatorComposition, boundaryConditions, f1 );
       operatorFunction3.refresh();
-      
+ 
       /*f1 = testFunction;
       f1.write( "testFunction", "gnuplot" );
       f1 = operatorFunction1;
       f1.write( "operator1", "gnuplot" );
       f1 = operatorFunction2;
       f1.write( "operator2", "gnuplot" );
-      
+ 
       f1 = operatorFunction3;
       f1.write( "operatorComposition", "gnuplot" );      */
-      
+ 
       //CPPUNIT_ASSERT( operatorFunction2 == operatorFunction3 );
       for( IndexType i = 0; i < mesh.template getEntitiesCount< typename MeshType::Cell >(); i++ )
       {
@@ -113,14 +106,14 @@ class tnlOperatorCompositionTest
             CPPUNIT_ASSERT( boundaryConditions( f1, entity ) == operatorFunction( entity ) );
          else
          {
-            
-            
+ 
+ 
          }*/
-      }      
-   }   
+      }
+   }
 };
 #endif
-   
+ 
 template< typename Operator >
 bool runTest()
 {
@@ -131,7 +124,7 @@ bool runTest()
    return true;
 #else
    return false;
-#endif        
+#endif
 }
 
 template< typename MeshType >
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTest.h b/tests/unit-tests/operators/tnlPDEOperatorEocTest.h
index 07af09254827fb2da5ab930f75b1db484557390d..d4a83788b6726ea9fcac329cb335afaab3bff4c2 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocTest.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOSTEST_H
 #define	TNLPDEOPERATOREOSTEST_H
@@ -35,29 +28,29 @@ template< typename ApproximateOperator,
           typename ExactOperator = typename ApproximateOperator::ExactOperatorType >
 class tnlPDEOperatorEocTest
 {
-   public:      
-      
+   public:
+ 
       typedef ApproximateOperator ApproximateOperatorType;
       typedef TestFunction TestFunctionType;
       typedef ExactOperator ExactOperatorType;
       typedef typename ApproximateOperator::MeshType MeshType;
       typedef typename ApproximateOperator::RealType RealType;
       typedef typename ApproximateOperator::IndexType IndexType;
-      
+ 
       //static_assert( std::is_same< ExactOperatorType, void >::value,
       //   "Exact operator type is not defined (it is void in fact)." );
-   
+ 
       void setupMesh( const IndexType meshSize )
       {
          tnlPDEOperatorEocTestMeshSetter< MeshType >::setup( mesh, meshSize );
       }
-      
+ 
       void setupFunction()
       {
          tnlPDEOperatorEocTestFunctionSetter< TestFunction >::setup( function );
       }
-     
-      template< typename MeshEntityType = typename MeshType::Cell > 
+ 
+      template< typename MeshEntityType = typename MeshType::Cell >
       void performTest( ApproximateOperator& approximateOperator,
                         ExactOperatorType& exactOperator,
                         RealType errors[ 3 ],
@@ -79,7 +72,7 @@ class tnlPDEOperatorEocTest
          if( verbose )
             std::cout << "L1 err. " << errors[ 1 ] << " L2 err. " << errors[ 2 ] << " Max. err. " << errors[ 0 ] << std::endl;
       }
-      
+ 
       void checkEoc( const RealType coarse[ 3 ],
                      const RealType fine[ 3 ],
                      const RealType eoc[ 3 ],
@@ -95,33 +88,33 @@ class tnlPDEOperatorEocTest
 #ifdef HAVE_CPPUNIT
          CPPUNIT_ASSERT( fabs( maxEoc - eoc[ 0 ] ) < tolerance[ 0 ] );
 #endif
-         
+ 
          /****
           * Max error
           */
          RealType l1Eoc = log( coarse[ 1 ] / fine[ 1 ] ) / log( 2.0 );
          if( verbose )
-            std::cout << "L1 error EOC = " << l1Eoc << " expected " << eoc[ 1 ]  << std::endl;         
+            std::cout << "L1 error EOC = " << l1Eoc << " expected " << eoc[ 1 ]  << std::endl;
 #ifdef HAVE_CPPUNIT
          CPPUNIT_ASSERT( fabs( l1Eoc - eoc[ 1 ] ) < tolerance[ 1 ] );
-#endif         
-         
+#endif
+ 
          /****
           * L2 error
           */
          RealType l2Eoc = log( coarse[ 2 ] / fine[ 2 ] ) / log( 2.0 );
          if( verbose )
             std::cout << "L2 error EOC = " << l2Eoc << " expected " << eoc[ 2 ] << std::endl;
-#ifdef HAVE_CPPUNIT         
+#ifdef HAVE_CPPUNIT
          CPPUNIT_ASSERT( fabs( l2Eoc - eoc[ 2 ] ) < tolerance[ 2 ] );
-#endif         
+#endif
       }
-      
+ 
    protected:
-      
+ 
       MeshType mesh;
-      
-      TestFunction function;               
+ 
+      TestFunction function;
 };
 
 
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h
index 8004c93884798af119a04db4a1ef79dd70ad92f4..965897b0e5c2c39159b7928a133aac9b80591bd2 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOCTESTFUNCTIONSETTER_H
 #define	TNLPDEOPERATOREOCTESTFUNCTIONSETTER_H
@@ -31,10 +24,10 @@ class tnlPDEOperatorEocTestFunctionSetter< tnlExpBumpFunction< Dimensions, Real
 {
    static_assert( Dimensions >= 0 && Dimensions <= 3,
       "Wrong parameter Dimensions." );
-   public:      
-      
+   public:
+ 
       typedef tnlExpBumpFunction< Dimensions, Real > FunctionType;
-      
+ 
       static void setup( FunctionType& function )
       {
          function.setAmplitude( 1.5 );
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h
index 06a1244adf8b6a60aaca553525bcc91d39113f7f..473e6ef57746f7344e1c5571f67dfcfdba878b43 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOCTESTMESHSETTER_H
 #define	TNLPDEOPERATOREOCTESTMESHSETTER_H
@@ -31,14 +24,14 @@ template< typename Real,
 class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 1, Real, Device, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 1, Real, Device, Index > MeshType;
       typedef typename MeshType::VertexType VertexType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
       typedef Index IndexType;
-      
+ 
       static bool setup( MeshType& mesh, const IndexType meshSize )
       {
          VertexType origin, proportions;
@@ -60,14 +53,14 @@ template< typename Real,
 class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 2, Real, Device, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 2, Real, Device, Index > MeshType;
       typedef typename MeshType::VertexType VertexType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
       typedef Real RealType;
       typedef Device DeviceType;
       typedef Index IndexType;
-      
+ 
       static bool setup( MeshType& mesh, const IndexType meshSize )
       {
          VertexType origin, proportions;
@@ -80,7 +73,7 @@ class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 2, Real, Device, Index > >
          CoordinatesType dimensions;
          dimensions.x() = meshSize;
          dimensions.y() = meshSize;
-         mesh.setDimensions( dimensions );         
+         mesh.setDimensions( dimensions );
 
          return true;
       }
@@ -92,7 +85,7 @@ template< typename Real,
 class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 3, Real, Device, Index > >
 {
    public:
-      
+ 
       typedef tnlGrid< 3, Real, Device, Index > MeshType;
       typedef typename MeshType::VertexType VertexType;
       typedef typename MeshType::CoordinatesType CoordinatesType;
@@ -100,7 +93,7 @@ class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 3, Real, Device, Index > >
       typedef Device DeviceType;
       typedef Index IndexType;
 
-      static bool setup( MeshType& mesh, const IndexType meshSize )      
+      static bool setup( MeshType& mesh, const IndexType meshSize )
       {
          VertexType origin, proportions;
          origin.x() = -1.0;
@@ -115,8 +108,8 @@ class tnlPDEOperatorEocTestMeshSetter< tnlGrid< 3, Real, Device, Index > >
          dimensions.x() = meshSize;
          dimensions.y() = meshSize;
          dimensions.z() = meshSize;
-         mesh.setDimensions( dimensions );         
-         
+         mesh.setDimensions( dimensions );
+ 
          return true;
       }
 };
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestResult.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestResult.h
index 0214a086e02688b8a017cfd2b897c76a4cd0d817..4f467bea209e12e6268107b426ecdfff6febd0c5 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocTestResult.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestResult.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOCTESTRESULT_H_
 #define TNLPDEOPERATOREOCTESTRESULT_H_
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h
index d4922b7f8493643465237b170562ffbfadaf5273..6cba3723400689adf46c46db65d20afd0f5033b8 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOCTESTSETTER_H_
 #define TNLPDEOPERATOREOCTESTSETTER_H_
diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocUnitTest.h b/tests/unit-tests/operators/tnlPDEOperatorEocUnitTest.h
index 8c3aa09736de4c351396783395352bb1062afef0..e6750819e1bb384aa855da612cc9bf72ffe7574a 100644
--- a/tests/unit-tests/operators/tnlPDEOperatorEocUnitTest.h
+++ b/tests/unit-tests/operators/tnlPDEOperatorEocUnitTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLPDEOPERATOREOCUNITTEST_H_
 #define TNLPDEOPERATOREOCUNITTEST_H_
diff --git a/tests/unit-tests/solver/tnlMersonSolverTester.h b/tests/unit-tests/solver/tnlMersonSolverTester.h
index 726f270a512c3e06e2ad29895032238485c6451c..fee85b3f6d3a77c62b955e89b7389efeb4255baa 100644
--- a/tests/unit-tests/solver/tnlMersonSolverTester.h
+++ b/tests/unit-tests/solver/tnlMersonSolverTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMERSONSOLVERTESTER_H_
 #define TNLMERSONSOLVERTESTER_H_
diff --git a/tests/unit-tests/solver/tnlSolverTest.cpp b/tests/unit-tests/solver/tnlSolverTest.cpp
index 24b4ea2d98eaf9953e1e5e08665a905bc6481ff5..e9ed619a72bfd496cf5c7a0a74888fa8975cc875 100644
--- a/tests/unit-tests/solver/tnlSolverTest.cpp
+++ b/tests/unit-tests/solver/tnlSolverTest.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlSolverTest.h"
 
diff --git a/tests/unit-tests/solver/tnlSolverTest.cu b/tests/unit-tests/solver/tnlSolverTest.cu
index 356c696f4e9590313ff4fe8fcbe2ce7b5d8daa32..c9d7435ecbc9b545efbfec8428bd011452d37a91 100644
--- a/tests/unit-tests/solver/tnlSolverTest.cu
+++ b/tests/unit-tests/solver/tnlSolverTest.cu
@@ -6,13 +6,6 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnlSolverTest.h"
diff --git a/tests/unit-tests/solver/tnlSolverTest.h b/tests/unit-tests/solver/tnlSolverTest.h
index 9175ec31842d9e337138228e44cba0597a5d512c..7a2267f2670eddf9c284ff7aae4a7ffa4aee2403 100644
--- a/tests/unit-tests/solver/tnlSolverTest.h
+++ b/tests/unit-tests/solver/tnlSolverTest.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERTEST_H_
 #define TNLSOLVERTEST_H_
diff --git a/tests/unit-tests/solver/tnlSolverTester.h b/tests/unit-tests/solver/tnlSolverTester.h
index 2a998cb0bd764150f5c7c687dddfee3b88a8d979..e32b248bf9c8a62967652b9a65cf14d2e832d08d 100644
--- a/tests/unit-tests/solver/tnlSolverTester.h
+++ b/tests/unit-tests/solver/tnlSolverTester.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLSOLVERTESTER_H_
 #define TNLSOLVERTESTER_H_
diff --git a/tests/unit-tests/tnlUnitTestStarter.h b/tests/unit-tests/tnlUnitTestStarter.h
index 4a84861f5f892febc4d50c46625d8762fed19784..d841f452220e4e1bd7105519090c4cbed5e58680 100644
--- a/tests/unit-tests/tnlUnitTestStarter.h
+++ b/tests/unit-tests/tnlUnitTestStarter.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLUNITTESTSTARTER_H_
 #define TNLUNITTESTSTARTER_H_
diff --git a/tools/src/functions-benchmark.cpp b/tools/src/functions-benchmark.cpp
index 762ad97cef2baa871913e667ce5b10ad952b922b..a47dcced31b33c61052a68331d89e9df746fe552 100644
--- a/tools/src/functions-benchmark.cpp
+++ b/tools/src/functions-benchmark.cpp
@@ -6,24 +6,15 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
-#include <core/tnlTimerRT.h>
-#include <core/tnlTimerCPU.h>
 #include "functions-benchmark.h"
 
 int main( int argc, char* argv[] )
 {
    const long int loops = 1 << 24;
 
-   cout << "Runnning benchmarks in single precision on CPU ... " << endl;
+   std::cout << "Runnning benchmarks in single precision on CPU ... " << std::endl;
    benchmarkAddition< float >( loops );
    benchmarkMultiplication< float >( loops );
    benchmarkDivision< float >( loops );
@@ -32,7 +23,7 @@ int main( int argc, char* argv[] )
    benchmarkExp< float >( loops );
    benchmarkPow< float >( loops );
 
-   cout << "Runnning benchmarks in double precision on CPU ... " << endl;
+   std::cout << "Runnning benchmarks in double precision on CPU ... " << std::endl;
    benchmarkAddition< double >( loops );
    benchmarkMultiplication< float >( loops );
    benchmarkDivision< double >( loops );
diff --git a/tools/src/functions-benchmark.h b/tools/src/functions-benchmark.h
index a9f79a0d1026a979cd42dec69154b057f096d654..8e1239a382db2a25c98e3d696fe460f077d90838 100644
--- a/tools/src/functions-benchmark.h
+++ b/tools/src/functions-benchmark.h
@@ -6,23 +6,20 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef FUNCTIONSBENCHMARK_H_
 #define FUNCTIONSBENCHMARK_H_
 
+#include <iostream>
 #include <math.h>
 
+#include <core/tnlTimerRT.h>
+#include <core/tnlTimerCPU.h>
+
 template< typename REAL > void benchmarkAddition( long int loops )
 {
-   cout << "Benchmarking addition on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking addition on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1 = 1.2;
@@ -38,12 +35,12 @@ template< typename REAL > void benchmarkAddition( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 + a2 + a3 + a4 << " ) " <<  cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 + a2 + a3 + a4 << " ) " <<  cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkMultiplication( const long int loops )
 {
-   cout << "Benchmarking multiplication on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking multiplication on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1 = 1.0e9;
@@ -62,12 +59,12 @@ template< typename REAL > void benchmarkMultiplication( const long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 * a2 * a3 * a4 << " ) " <<  cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 * a2 * a3 * a4 << " ) " <<  cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkDivision( long int loops )
 {
-   cout << "Benchmarking division on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking division on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1( 1.0e9 );
@@ -84,12 +81,12 @@ template< typename REAL > void benchmarkDivision( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 / a2 / a3 / a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops / 2 ) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 / a2 / a3 / a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops / 2 ) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkSqrt( long int loops )
 {
-   cout << "Benchmarking sqrt on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking sqrt on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1( 1.0e9 );
@@ -106,12 +103,12 @@ template< typename REAL > void benchmarkSqrt( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops / 2 ) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops / 2 ) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkSin( long int loops )
 {
-   cout << "Benchmarking sin on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking sin on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1( 1.0e9 );
@@ -127,12 +124,12 @@ template< typename REAL > void benchmarkSin( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops ) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkExp( long int loops )
 {
-   cout << "Benchmarking exp on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking exp on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1( 1.1 );
@@ -149,12 +146,12 @@ template< typename REAL > void benchmarkExp( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 template< typename REAL > void benchmarkPow( long int loops )
 {
-   cout << "Benchmarking pow on CPU ( " << loops << " loops ) ... " << flush;
+   std::cout << "Benchmarking pow on CPU ( " << loops << " loops ) ... " << std::flush;
    tnlTimerCPU cpu_timer;
 
    REAL a1( 1.0e9 );
@@ -171,7 +168,7 @@ template< typename REAL > void benchmarkPow( long int loops )
    }
 
    double cpu_time = cpu_timer. getTime();
-   cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops) / cpu_time * 1.0e-9 << " GFLOPS." << endl;
+   std::cout << " ( " << a1 + a2 + a3 + a4 << " ) " << cpu_time << "secs. " << 4.0 * ( ( double ) loops) / cpu_time * 1.0e-9 << " GFLOPS." << std::endl;
 }
 
 
diff --git a/tools/src/polygonizer.cpp b/tools/src/polygonizer.cpp
index 12da32574cf7cb498c2787d330fa01aaaf82dbbb..06c3e63bc619d089a91c939d725f7df037dc99b0 100644
--- a/tools/src/polygonizer.cpp
+++ b/tools/src/polygonizer.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <string.h>
 #include "polygonizer.h"
diff --git a/tools/src/polygonizer.h b/tools/src/polygonizer.h
index 0ff406051b1d1335125ebb86bb33064acb1be63f..d0d9e6df5f16528533e8a4eef519f4657a5275fb 100644
--- a/tools/src/polygonizer.h
+++ b/tools/src/polygonizer.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef POLYGONIZER_H
 #define POLYGONIZER_H
@@ -130,10 +123,10 @@ class POLYGONIZER
     int is poligonization mode - polygonize cube or tetrahedrons
     */
    int Implicit( const SOLID*, RECIEVER*, const VECTOR&, const VECTOR&, const double&, int );
-   
+ 
    int Parametric( const SOLID*, RECIEVER*, const unsigned int, const unsigned int );
    protected:
-   
+ 
    //! This solid will be polygonized using method SOLID :: Solid_Function( const VECTOR& );
    const SOLID* solid;
 
@@ -141,10 +134,10 @@ class POLYGONIZER
    RECIEVER* reciever;
 
    //! Position of the first cube
-   /*! Thus, it is also position of the origin for cubes indexing 
+   /*! Thus, it is also position of the origin for cubes indexing
     */
    VECTOR position;
-   
+ 
    //! Bounds for polygonizer
    /*! All coubes outside culled.
     */
diff --git a/tools/src/tnl-dicom-reader.cpp b/tools/src/tnl-dicom-reader.cpp
index 7150436b52b13a6b78dbbe7200818b9c800f54a0..76e0de8f064bcf6e90c7becc28f0c5b51e33b8ee 100644
--- a/tools/src/tnl-dicom-reader.cpp
+++ b/tools/src/tnl-dicom-reader.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <tnlConfig.h>
 #include <config/tnlConfigDescription.h>
@@ -32,29 +25,29 @@ void setupConfig( tnlConfigDescription& config )
    config.addEntry        < int >      ( "roi-bottom",    "Bottom (larger number) line of the region of interest.", -1 );
    config.addEntry        < int >      ( "roi-left",      "Left (smaller number) column of the region of interest.", -1 );
    config.addEntry        < int >      ( "roi-right",     "Right (larger number) column of the region of interest.", -1 );
-   config.addEntry        < bool >     ( "verbose",       "Set the verbosity of the program.", true );   
+   config.addEntry        < bool >     ( "verbose",       "Set the verbosity of the program.", true );
 }
 
 #ifdef HAVE_DCMTK_H
 bool processDicomFiles( const tnlParameterContainer& parameters )
 {
-   
+ 
 }
 
 bool processDicomSeries( const tnlParameterContainer& parameters )
 {
    const tnlList< tnlString >& dicomSeriesNames = parameters.getParameter< tnlList< tnlString > >( "dicom-series" );
-   tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );    
+   tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );
    bool verbose = parameters.getParameter< bool >( "verbose" );
 
    typedef tnlGrid< 2, double, tnlHost, int > GridType;
    GridType grid;
    tnlVector< double, tnlHost, int > vector;
-   tnlRegionOfInterest< int > roi;   
+   tnlRegionOfInterest< int > roi;
    for( int i = 0; i < dicomSeriesNames.getSize(); i++ )
    {
       const tnlString& seriesName = dicomSeriesNames[ i ];
-      cout << "Reading a file " << seriesName << endl;   
+      cout << "Reading a file " << seriesName << endl;
       tnlDicomSeries dicomSeries( seriesName.getString() );
       if( !dicomSeries.isDicomSeriesLoaded() )
       {
@@ -77,7 +70,7 @@ bool processDicomSeries( const tnlParameterContainer& parameters )
          FileNameBaseNumberEnding( seriesName.getString(), imageIdx, 2, ".tnl", fileName );
          cout << "Writing file " << fileName << " ... " << endl;
          vector.save( fileName );
-      }      
+      }
    }
 }
 #endif
@@ -91,7 +84,7 @@ int main( int argc, char* argv[] )
    {
       configDescription.printUsage( argv[ 0 ] );
       return EXIT_FAILURE;
-   }   
+   }
    if( ! parameters.checkParameter( "dicom-files" ) &&
        ! parameters.checkParameter( "dicom-series") )
    {
@@ -99,13 +92,13 @@ int main( int argc, char* argv[] )
        configDescription.printUsage( argv[ 0 ] );
        return EXIT_FAILURE;
    }
-#ifdef HAVE_DCMTK_H   
+#ifdef HAVE_DCMTK_H
    if( parameters.checkParameter( "dicom-files" ) && ! processDicomFiles( parameters ) )
       return EXIT_FAILURE;
    if( parameters.checkParameter( "dicom-series" ) && ! processDicomSeries( parameters ) )
-      return EXIT_FAILURE;   
+      return EXIT_FAILURE;
    return EXIT_SUCCESS;
 #else
    cerr << "TNL was not compiled with DCMTK support." << endl;
-#endif   
+#endif
 }
diff --git a/tools/src/tnl-diff.cpp b/tools/src/tnl-diff.cpp
index 07493f1157332d8105cab3a32554c343f0a0dd8d..26cda49745e87cd16118d8a2639362811c12e3fd 100644
--- a/tools/src/tnl-diff.cpp
+++ b/tools/src/tnl-diff.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-diff.h"
 #include <mesh/tnlDummyMesh.h>
diff --git a/tools/src/tnl-diff.h b/tools/src/tnl-diff.h
index 6699647af809d1c752241e5a469dcd9785852bf0..d6f6c0a2304b47ed07e07a69f9757eb8c7e154b1 100644
--- a/tools/src/tnl-diff.h
+++ b/tools/src/tnl-diff.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_DIFF_H_
 #define TNL_DIFF_H_
@@ -119,7 +112,7 @@ bool computeDifferenceOfMeshFunctions( const Mesh& mesh, const tnlParameterConta
          outputFile << std::setw( 6 ) << ( i - half ) * snapshotPeriod << " ";
       }
       diff = v1;
-      diff -= v2;      
+      diff -= v2;
       Real l1Diff = diff.getLpNorm( 1.0 );
       Real l2Diff = diff.getLpNorm( 2.0 );
       Real maxDiff = diff.getMaxNorm();
@@ -321,7 +314,7 @@ bool setIndexType( const Mesh& mesh,
 
    if(parsedObjectType[ 0 ] == "tnlMeshFunction" )
       return computeDifference< Mesh, Element, Real, typename Mesh::IndexType >( mesh, parsedObjectType[ 0 ], parameters );
-   
+ 
    if( indexType == "int" )
       return computeDifference< Mesh, Element, Real, int >( mesh, parsedObjectType[ 0 ], parameters );
    if( indexType == "long-int" )
diff --git a/tools/src/tnl-grid-setup.cpp b/tools/src/tnl-grid-setup.cpp
index 6f57aa894742765ceae1e01a1c3e27678280befd..8024017eeb29fa27fe8e40d99be0218151c2403e 100644
--- a/tools/src/tnl-grid-setup.cpp
+++ b/tools/src/tnl-grid-setup.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-grid-setup.h"
 #include <config/tnlParameterContainer.h>
diff --git a/tools/src/tnl-grid-setup.h b/tools/src/tnl-grid-setup.h
index bd4521d2bea09ca094406d5adb4b6b1472658a09..1d856637687925cc3938e9f3869c702a072b048c 100644
--- a/tools/src/tnl-grid-setup.h
+++ b/tools/src/tnl-grid-setup.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_GRID_SETUP_H_
 #define TNL_GRID_SETUP_H_
diff --git a/tools/src/tnl-image-converter.cpp b/tools/src/tnl-image-converter.cpp
index 6ff1e2ae80e5ec202e987ad891cc68a58c05b677..f12e7155fe442a28fa29fcabd64af692bd468993 100644
--- a/tools/src/tnl-image-converter.cpp
+++ b/tools/src/tnl-image-converter.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
@@ -29,7 +22,7 @@ void configSetup( tnlConfigDescription& config )
    config.addDelimiter( "General parameters" );
    config.addList < tnlString >( "input-images",  "Input images for conversion to .tnl files." );
    config.addList < tnlString >( "input-files",   "Input .tnl files for conversion to images." );
-   config.addEntry        < tnlString >( "image-format",  "Output images file format.", "pgm" );   
+   config.addEntry        < tnlString >( "image-format",  "Output images file format.", "pgm" );
    config.addEntry        < tnlString >( "mesh-file",     "Mesh file.", "mesh.tnl" );
    config.addEntry        < bool >     ( "one-mesh-file", "Generate only one mesh file. All the images dimensions must be the same.", true );
    config.addEntry        < int >      ( "roi-top",       "Top (smaller number) line of the region of interest.", -1 );
@@ -43,9 +36,9 @@ void configSetup( tnlConfigDescription& config )
 bool processImages( const tnlParameterContainer& parameters )
 {
     const tnlList< tnlString >& inputImages = parameters.getParameter< tnlList< tnlString > >( "input-images" );
-    tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );    
+    tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );
     bool verbose = parameters.getParameter< bool >( "verbose" );
-    
+ 
     typedef tnlGrid< 2, double, tnlHost, int > GridType;
     GridType grid;
     tnlVector< double, tnlHost, int > vector;
@@ -67,7 +60,7 @@ bool processImages( const tnlParameterContainer& parameters )
             cout << "Writing grid to file " << meshFile << endl;
             grid.save( meshFile );
          }
-         else 
+         else
             if( ! roi.check( &pgmImage ) )
                return false;
          if( ! pgmImage.read( roi, grid, vector ) )
@@ -93,7 +86,7 @@ bool processImages( const tnlParameterContainer& parameters )
             cout << "Writing grid to file " << meshFile << endl;
             grid.save( meshFile );
          }
-         else 
+         else
             if( ! roi.check( &pgmImage ) )
                return false;
          if( ! pngImage.read( roi, grid, vector ) )
@@ -119,7 +112,7 @@ bool processImages( const tnlParameterContainer& parameters )
             cout << "Writing grid to file " << meshFile << endl;
             grid.save( meshFile );
          }
-         else 
+         else
             if( ! roi.check( &jpegImage ) )
                return false;
          if( ! jpegImage.read( roi, grid, vector ) )
@@ -139,9 +132,9 @@ bool processTNLFiles( const tnlParameterContainer& parameters )
 {
    const tnlList< tnlString >& inputFiles = parameters.getParameter< tnlList< tnlString > >( "input-files" );
    const tnlString& imageFormat = parameters.getParameter< tnlString >( "image-format" );
-   tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );    
+   tnlString meshFile = parameters.getParameter< tnlString >( "mesh-file" );
    bool verbose = parameters.getParameter< bool >( "verbose" );
-    
+ 
    tnlGrid< 2, double, tnlHost, int > grid;
    if( ! grid.load( meshFile ) )
    {
@@ -193,7 +186,7 @@ bool processTNLFiles( const tnlParameterContainer& parameters )
          image.close();
       }
 
-   }     
+   }
 }
 
 int main( int argc, char* argv[] )
diff --git a/tools/src/tnl-init.cpp b/tools/src/tnl-init.cpp
index d3141c87dc36615ef1cce8294e92d340186f53e0..d58d3d071494c358d600ecfb094ed410911d5e66 100644
--- a/tools/src/tnl-init.cpp
+++ b/tools/src/tnl-init.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-init.h"
 
@@ -35,7 +28,7 @@ void setupConfig( tnlConfigDescription& config )
       config.addEntryEnum< tnlString >( "float" );
       config.addEntryEnum< tnlString >( "double" );
       config.addEntryEnum< tnlString >( "long-double" );
-   config.addEntry< double >( "initial-time", "Initial time for a serie of snapshots of the time-dependent function.", 0.0 );      
+   config.addEntry< double >( "initial-time", "Initial time for a serie of snapshots of the time-dependent function.", 0.0 );
    config.addEntry< double >( "final-time", "Final time for a serie of snapshots of the time-dependent function.", 0.0 );
    config.addEntry< double >( "snapshot-period", "Period between snapshots in a serie of the time-dependent function.", 0.0 );
    config.addEntry< int >( "x-derivative", "Order of the partial derivative w.r.t x.", 0 );
@@ -44,8 +37,8 @@ void setupConfig( tnlConfigDescription& config )
    config.addEntry< bool >( "numerical-differentiation", "The partial derivatives will be computed numerically.", false );
    config.addRequiredEntry< tnlString >( "output-file", "Output file name." );
    config.addEntry< bool >( "check-output-file", "If the output file already exists, do not recreate it.", false );
-   config.addEntry< tnlString >( "help", "Write help." );   
-   
+   config.addEntry< tnlString >( "help", "Write help." );
+ 
    config.addDelimiter                            ( "Functions parameters:" );
    tnlTestFunction< 1 >::configSetup( config );
 }
@@ -56,7 +49,7 @@ int main( int argc, char* argv[] )
    tnlConfigDescription conf_desc;
 
    setupConfig( conf_desc );
-   
+ 
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
       return EXIT_FAILURE;
 
diff --git a/tools/src/tnl-init.h b/tools/src/tnl-init.h
index 7f5fba252c11410f7a03e861ce39d1460a0c9cd7..4a0e490ff93bafb58c7cc3ef978385a368f04a28 100644
--- a/tools/src/tnl-init.h
+++ b/tools/src/tnl-init.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_INIT_H_
 #define TNL_INIT_H_
@@ -49,7 +42,7 @@ bool renderFunction( const tnlParameterContainer& parameters )
    MeshFunctionType meshFunction( mesh );
    //if( ! discreteFunction.setSize( mesh.template getEntitiesCount< typename MeshType::Cell >() ) )
    //   return false;
-   
+ 
    double finalTime = parameters.getParameter< double >( "final-time" );
    double initialTime = parameters.getParameter< double >( "initial-time" );
    double tau = parameters.getParameter< double >( "snapshot-period" );
diff --git a/tools/src/tnl-matrix-convert.cpp b/tools/src/tnl-matrix-convert.cpp
index 85b130f973bafd6cf6827c8569e2051ffc826cd7..5de857daad154b2982c98af3e4fdf1b77b313f55 100644
--- a/tools/src/tnl-matrix-convert.cpp
+++ b/tools/src/tnl-matrix-convert.cpp
@@ -6,19 +6,12 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-matrix-convert.h"
 #include <string.h>
 #include <debug/tnlDebug.h>
-#include <core/tnlObject.h>
+#include <tnlObject.h>
 #include <config/tnlConfigDescription.h>
 #include <config/tnlParameterContainer.h>
 
diff --git a/tools/src/tnl-matrix-convert.h b/tools/src/tnl-matrix-convert.h
index 60cff3bd610229960ffbb3ad2f4e6dd671060a15..a2602c26bc19ffc441a3d1d22a9b64c68799b3e2 100644
--- a/tools/src/tnl-matrix-convert.h
+++ b/tools/src/tnl-matrix-convert.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNLMATRIXCONVERT_H_
 #define TNLMATRIXCONVERT_H_
diff --git a/tools/src/tnl-mesh-convert.cpp b/tools/src/tnl-mesh-convert.cpp
index 016272c9cbdf67e17a9e99f418874c97d03499ba..b0fb79ebd2bd9ad7037970c052732cce3b35ef0b 100644
--- a/tools/src/tnl-mesh-convert.cpp
+++ b/tools/src/tnl-mesh-convert.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef HAVE_ICPC
 #include "tnl-mesh-convert.h"
@@ -27,15 +20,15 @@ void configSetup( tnlConfigDescription& config )
    config.addRequiredEntry< tnlString >( "input-file", "Input file with the mesh." );
    config.addEntry< tnlString >( "output-file", "Output mesh file in TNL or VTK format.", "mesh.tnl" );
    //config.addEntry< tnlString >( "output-format", "Output mesh file format.", "vtk" );
-   config.addEntry< int >( "verbose", "Set the verbosity of the program.", 1 );     
-   config.addEntry< tnlString >( "mesh-name", "The mesh name.", "tnl-mesh" ); 
+   config.addEntry< int >( "verbose", "Set the verbosity of the program.", 1 );
+   config.addEntry< tnlString >( "mesh-name", "The mesh name.", "tnl-mesh" );
 }
 
 int main( int argc, char* argv[] )
 {
    tnlParameterContainer parameters;
    tnlConfigDescription conf_desc;
-   
+ 
    configSetup( conf_desc );
 
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
diff --git a/tools/src/tnl-mesh-convert.h b/tools/src/tnl-mesh-convert.h
index 4578d7e3e45b0be1c80acdba49a7e8e7759837c9..3dd6c8a8e1381a8d8b837c2e187e1106d7ba085d 100644
--- a/tools/src/tnl-mesh-convert.h
+++ b/tools/src/tnl-mesh-convert.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_MESH_CONVERT_H_
 #define TNL_MESH_CONVERT_H_
@@ -49,7 +42,7 @@ bool convertMesh( const tnlParameterContainer& parameters )
    cout << mesh << endl;
    cout << "Writing the mesh to a file " << outputFileName << "." << endl;
    if( outputFileExt == "tnl" )
-   {         
+   {
       if( ! mesh.save( outputFileName ) )
       {
          cerr << "I am not able to write the mesh into the file " << outputFileName << "." << endl;
@@ -61,22 +54,22 @@ bool convertMesh( const tnlParameterContainer& parameters )
       if( ! tnlMeshWriterVTKLegacy::write( outputFileName, mesh, true ) )
       {
          cerr << "I am not able to write the mesh into the file " << outputFileName << "." << endl;
-         return false;         
+         return false;
       }
       return true;
-   }   
+   }
 }
 
 bool readNetgenMesh( const tnlParameterContainer& parameters )
 {
    const tnlString& inputFileName = parameters.getParameter< tnlString >( "input-file" );
-   
+ 
    tnlMeshReaderNetgen meshReader;
    if( ! meshReader.detectMesh( inputFileName ) )
       return false;
 
    cout << "Reading mesh with " << meshReader.getDimensions() << " dimensions..." << endl;
-   
+ 
    if( meshReader.getDimensions() == 2 )
    {
       if( meshReader.getVerticesInCell() == 3 )
@@ -90,7 +83,7 @@ bool readNetgenMesh( const tnlParameterContainer& parameters )
          typedef tnlMesh< tnlMeshConfigBase< tnlMeshQuadrilateralTopology > > MeshType;
          cout << "Mesh consisting of quadrilaterals was detected ... " << endl;
          return convertMesh< tnlMeshReaderNetgen, MeshType >( parameters );
-      }            
+      }
    }
    if( meshReader.getDimensions() == 3 )
    {
diff --git a/tools/src/tnl-view.cpp b/tools/src/tnl-view.cpp
index 90fd1ce802b967fa533495828e7fadda0249cc9d..f1c8b9378d231a1f11b7ad7e6bc2a46554bb1e7f 100644
--- a/tools/src/tnl-view.cpp
+++ b/tools/src/tnl-view.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include "tnl-view.h"
 #include <cstdlib>
@@ -40,7 +33,7 @@ void setupConfig( tnlConfigDescription& config )
    config.addEntry        < double >              ( "scale", "Multiply the function by given number.", 1.0 );
    config.addEntry        < tnlString >           ( "output-format", "Output file format.", "gnuplot" );
       config.addEntryEnum  < tnlString >             ( "gnuplot" );
-      config.addEntryEnum  < tnlString >             ( "vti" );
+      config.addEntryEnum  < tnlString >             ( "vtk" );
    config.addEntry        < int >                 ( "verbose", "Set the verbosity of the program.", 1 );
 
    config.addDelimiter( "Matrix settings:" );
diff --git a/tools/src/tnl-view.h b/tools/src/tnl-view.h
index f6760e202427c399002c76b7e56080d0edadf32b..13ea2524aa62f34cbe68d40d5d65f092f6107ac2 100644
--- a/tools/src/tnl-view.h
+++ b/tools/src/tnl-view.h
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #ifndef TNL_VIEW_H_
 #define TNL_VIEW_H_
@@ -40,11 +33,13 @@ bool getOutputFileName( const tnlString& inputFileName,
       outputFileName += ".gplt";
       return true;
    }
-   else
+   if( outputFormat == "vtk" )
    {
-      cerr << "Unknown file format " << outputFormat << ".";
-      return false;
+      outputFileName += ".vtk";
+      return true;
    }
+   cerr << "Unknown file format " << outputFormat << ".";
+   return false;
 }
 
 
@@ -113,7 +108,7 @@ bool setMeshEntityDimensions( const tnlGrid< 1, MeshReal, tnlHost, MeshIndex >&
    {
       case 0:
          return setMeshEntityType< Mesh, 0 >( mesh, inputFileName, parsedObjectType, parameters );
-         break;      
+         break;
       case 1:
          return setMeshEntityType< Mesh, 1 >( mesh, inputFileName, parsedObjectType, parameters );
          break;
@@ -136,7 +131,7 @@ bool setMeshEntityDimensions( const tnlGrid< 2, MeshReal, tnlHost, MeshIndex >&
    {
       case 0:
          return setMeshEntityType< Mesh, 0 >( mesh, inputFileName, parsedObjectType, parameters );
-         break;            
+         break;
       case 1:
          return setMeshEntityType< Mesh, 1 >( mesh, inputFileName, parsedObjectType, parameters );
          break;
@@ -162,7 +157,7 @@ bool setMeshEntityDimensions( const tnlGrid< 3, MeshReal, tnlHost, MeshIndex >&
    {
       case 0:
          return setMeshEntityType< Mesh, 0 >( mesh, inputFileName, parsedObjectType, parameters );
-         break;      
+         break;
       case 1:
          return setMeshEntityType< Mesh, 1 >( mesh, inputFileName, parsedObjectType, parameters );
          break;
@@ -431,7 +426,7 @@ bool processFiles( const tnlParameterContainer& parameters )
             continue;
          }
          if( parsedObjectType[ 0 ] == "tnlMultiVector" ||
-             parsedObjectType[ 0 ] == "tnlSharedMultiVector" ||      
+             parsedObjectType[ 0 ] == "tnlSharedMultiVector" ||
              parsedObjectType[ 0 ] == "tnlSharedVector" ||
              parsedObjectType[ 0 ] == "tnlVector" )
             setElementType< Mesh >( mesh, inputFiles[ i ], parsedObjectType, parameters );
diff --git a/tools/src/tnlcurve2gnuplot.cpp b/tools/src/tnlcurve2gnuplot.cpp
index da67b5314774d146e15d6de03d4cefef477ec62b..c2c9f8c26de81266a9a7b9b035ff1f119f356c04 100644
--- a/tools/src/tnlcurve2gnuplot.cpp
+++ b/tools/src/tnlcurve2gnuplot.cpp
@@ -6,14 +6,7 @@
     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.                                   *
- *                                                                         *
- ***************************************************************************/
+/* See Copyright Notice in tnl/Copyright */
 
 #include <config/tnlParameterContainer.h>
 #include <core/tnlCurve.h>
@@ -36,7 +29,7 @@ int main( int argc, char* argv[] )
 {
    tnlParameterContainer parameters;
    tnlConfigDescription conf_desc;
-   
+ 
    setupConfig( conf_desc );
    if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
    {
@@ -64,7 +57,7 @@ int main( int argc, char* argv[] )
    {
       const char* input_file = input_files[ i ]. getString();
       cout << "Processing file " << input_file << " ... " << flush;
-          
+ 
       tnlFile file;
       if( ! file. open( input_files[ i ], tnlReadMode ) )
       {
diff --git a/tools/tnl-compile.in b/tools/tnl-compile.in
index b5bd16e7ae1c88cc5138239211b73170e523a2eb..62dd15771afa36e3ccf44468f14644929bce4405 100644
--- a/tools/tnl-compile.in
+++ b/tools/tnl-compile.in
@@ -12,4 +12,4 @@ do
     esac
 done
 
-echo -I@CMAKE_INSTALL_PREFIX@/include/tnl-@tnlVersion@ ${CUDA_FLAGS} ${CXX_STD_FLAGS} ${DEBUG_FLAGS}
\ No newline at end of file
+echo -I@CMAKE_INSTALL_PREFIX@/include/tnl-@tnlVersion@ ${CUDA_FLAGS} ${CXX_STD_FLAGS} ${DEBUG_FLAGS}
diff --git a/tools/tnl-quickstart/tnl-quickstart.py b/tools/tnl-quickstart/tnl-quickstart.py
index 198771045ed675557106d04775bd1a3521acdce8..3f1732c6aac2d28f6f3d4cf5031a45cabce7946e 100644
--- a/tools/tnl-quickstart/tnl-quickstart.py
+++ b/tools/tnl-quickstart/tnl-quickstart.py
@@ -793,11 +793,15 @@ def generateBuildConfigTags( problemBaseName ):
     file.write( " */\n" )
     file.write( "template<> struct tnlConfigTagIndex< " + problemBaseName + "BuildConfigTag, short int >{ enum { enabled = false }; };\n" )
     file.write( "template<> struct tnlConfigTagIndex< " + problemBaseName + "BuildConfigTag, long int >{ enum { enabled = false }; };\n" )
+    file.write( "\n" )    
+    file.write( "/****\n" )
+    file.write( " * How many dimensions may have the problem to be solved...\n" )
+    file.write( " */\n" )    
+    file.write( "template< int Dimensions > struct tnlConfigTagDimensions< " + problemName + "BuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 1 ) }; };\n" )
     file.write( "\n" )
     file.write( "/****\n" )
     file.write( " * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.\n" )
     file.write( " */\n" )
-    file.write( "\n" )
     file.write( "template< int Dimensions, typename Real, typename Device, typename Index >\n" )
     file.write( "   struct tnlConfigTagMesh< " + problemBaseName + "BuildConfigTag, tnlGrid< Dimensions, Real, Device, Index > >\n" )
     file.write( "      { enum { enabled = tnlConfigTagDimensions< " + problemBaseName + "BuildConfigTag, Dimensions >::enabled  &&\n" )