From fec4c09b38a380d16e8bab2db110433aab8fd8eb Mon Sep 17 00:00:00 2001
From: Tomas Sobotik <sobotto4@fjfi.cvut.cz>
Date: Sun, 23 Nov 2014 13:47:57 +0100
Subject: [PATCH] Minor changes to generalized schemes.

---
 src/functions/tnlSDFGridValue.h               | 45 +++++------
 .../functions/tnlSDFGridValue_impl.h          | 74 ++++---------------
 ...NeumannReflectionBoundaryConditions_impl.h |  2 -
 .../godunov-eikonal/godunovEikonal.h          | 15 ----
 src/operators/godunov/godunov.h               | 15 ----
 .../tnlNeumannReflectionBoundaryConditions.h  |  1 +
 src/operators/upwind-eikonal/upwindEikonal.h  | 15 ----
 src/operators/upwind/upwind.h                 | 16 ----
 8 files changed, 38 insertions(+), 145 deletions(-)

diff --git a/src/functions/tnlSDFGridValue.h b/src/functions/tnlSDFGridValue.h
index 9efd692abb..f1372aa0fb 100644
--- a/src/functions/tnlSDFGridValue.h
+++ b/src/functions/tnlSDFGridValue.h
@@ -52,13 +52,7 @@ class tnlSDFGridValue< Mesh, 1, Real > : public tnlSDFGridValueBase< Real >
 	typedef typename Mesh::IndexType IndexType;
 	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
    typedef typename Mesh::CoordinatesType CoordinatesType;
-   VertexType origin;
-   RealType2 hx;
-   Mesh mesh;
-   DofVectorType u;
 
-   void bind( const Mesh& mesh,
-	          DofVectorType& dofVector );
    bool setup( const tnlParameterContainer& parameters,
            const tnlString& prefix = ""  );
 
@@ -78,6 +72,13 @@ class tnlSDFGridValue< Mesh, 1, Real > : public tnlSDFGridValueBase< Real >
            const Real& time = 0.0  ) const;
 #endif
 
+   private:
+
+   VertexType origin;
+   RealType2 hx;
+   Mesh mesh;
+   DofVectorType u;
+
 };
 
 template< typename Mesh, typename Real >
@@ -93,15 +94,7 @@ class tnlSDFGridValue< Mesh, 2, Real > : public tnlSDFGridValueBase< Real >
 	typedef typename Mesh::IndexType IndexType;
 	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
    typedef typename Mesh::CoordinatesType CoordinatesType;
-   CoordinatesType dimensions;
-   VertexType origin;
-   RealType2 hx, hy;
-   Mesh mesh;
-   DofVectorType u;
-
 
-   void bind( const Mesh& mesh,
-	          DofVectorType& dofVector );
    bool setup( const tnlParameterContainer& parameters,
            const tnlString& prefix = ""  );
 
@@ -121,6 +114,14 @@ class tnlSDFGridValue< Mesh, 2, Real > : public tnlSDFGridValueBase< Real >
            const Real& time = 0.0  ) const;
 #endif
 
+   private:
+
+   CoordinatesType dimensions;
+   VertexType origin;
+   RealType2 hx, hy;
+   Mesh mesh;
+   DofVectorType u;
+
 };
 
 template< typename Mesh, typename Real >
@@ -136,15 +137,7 @@ class tnlSDFGridValue< Mesh, 3, Real > : public tnlSDFGridValueBase< Real >
 	typedef typename Mesh::IndexType IndexType;
 	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
    typedef typename Mesh::CoordinatesType CoordinatesType;
-   CoordinatesType dimensions;
-   VertexType origin;
-   RealType2 hx, hy, hz;
-   Mesh mesh;
-   DofVectorType u;
-
 
-   void bind( const Mesh& mesh,
-	          DofVectorType& dofVector );
    bool setup( const tnlParameterContainer& parameters,
            const tnlString& prefix = ""  );
 
@@ -164,6 +157,14 @@ class tnlSDFGridValue< Mesh, 3, Real > : public tnlSDFGridValueBase< Real >
            const Real& time = 0.0  ) const;
 #endif
 
+   private:
+
+   CoordinatesType dimensions;
+   VertexType origin;
+   RealType2 hx, hy, hz;
+   Mesh mesh;
+   DofVectorType u;
+
 };
 
 #include <implementation/functions/tnlSDFGridValue_impl.h>
diff --git a/src/implementation/functions/tnlSDFGridValue_impl.h b/src/implementation/functions/tnlSDFGridValue_impl.h
index 70d27ba9ca..07ca34886e 100644
--- a/src/implementation/functions/tnlSDFGridValue_impl.h
+++ b/src/implementation/functions/tnlSDFGridValue_impl.h
@@ -29,73 +29,27 @@ template< typename Mesh, typename Real >
 bool tnlSDFGridValue< Mesh, 1, Real >::setup( const tnlParameterContainer& parameters,
         								 const tnlString& prefix)
 {
-	   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
-	   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
-	   this->origin=this->mesh.getOrigin();
-	   this->hx=this->mesh.getHx();
+   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
+   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
    return true;
 }
 template< typename Mesh, typename Real >
 bool tnlSDFGridValue< Mesh, 2, Real >::setup( const tnlParameterContainer& parameters,
         								 const tnlString& prefix)
 {
-	   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
-	   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
-	   this->dimensions=this->mesh.getDimensions();
-	   this->origin=this->mesh.getOrigin();
-	   this->hx=this->mesh.getHx();
-	   this->hy=this->mesh.getHy();
+   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
+   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
    return true;
 }
 template< typename Mesh, typename Real >
 bool tnlSDFGridValue< Mesh, 3, Real >::setup( const tnlParameterContainer& parameters,
         								 const tnlString& prefix)
 {
-	   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
-	   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
-	   this->dimensions=this->mesh.getDimensions();
-	   this->origin=this->mesh.getOrigin();
-	   this->hx=this->mesh.getHx();
-	   this->hy=this->mesh.getHy();
-	   this->hz=this->mesh.getHz();
+   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
+   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
    return true;
 }
 
-template< typename Mesh, typename Real >
-void tnlSDFGridValue< Mesh, 1, Real >::bind( const Mesh& mesh,
-        									  DofVectorType& dofVector )
-{
-	   const IndexType dofs = mesh.getNumberOfCells();
-	   this->u.bind( dofVector.getData(), dofs );
-	   this->origin=mesh.getOrigin();
-	   this->hx=mesh.getHx();
-
-}
-
-template< typename Mesh, typename Real >
-void tnlSDFGridValue< Mesh, 2, Real >::bind( const Mesh& mesh,
-        									  DofVectorType& dofVector )
-{
-	   const IndexType dofs = mesh.getNumberOfCells();
-	   this->u.bind( dofVector.getData(), dofs );
-	   this->dimensions=mesh.getDimensions();
-	   this->origin=mesh.getOrigin();
-	   this->hx=mesh.getHx();
-	   this->hy=mesh.getHy();
-}
-
-template< typename Mesh, typename Real >
-void tnlSDFGridValue< Mesh, 3, Real >::bind( const Mesh& mesh,
-        									  DofVectorType& dofVector )
-{
-	   const IndexType dofs = mesh.getNumberOfCells();
-	   this->u.bind( dofVector.getData(), dofs );
-	   this->dimensions=mesh.getDimensions();
-	   this->origin=mesh.getOrigin();
-	   this->hx=mesh.getHx();
-	   this->hy=mesh.getHy();
-	   this->hz=mesh.getHz();
-}
 
 
 template< typename Mesh, typename Real >
@@ -107,7 +61,7 @@ Real tnlSDFGridValue< Mesh, 1, Real >::getValue( const Vertex& v,
         									const Real& time) const
 {
 
-   const Real& x =  (v.x() - this->origin.x()  ) / this->hx;
+   const Real& x =  (v.x() - this->mesh.getOrigin().x()  ) / this->mesh.getHx();
 
    if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
@@ -125,13 +79,13 @@ Real tnlSDFGridValue< Mesh, 2, Real >::getValue( const Vertex& v,
         									const Real& time) const
 {
 
-	   const IndexType& x = ((v.x() - this->origin.x()) / this->hx);
-	   const IndexType& y = ((v.y() - this->origin.y()) / this->hy);
+	   const IndexType& x = ((v.x() - this->mesh.getOrigin().x()) / this->mesh.getHx());
+	   const IndexType& y = ((v.y() - this->mesh.getOrigin().y()) / this->mesh.getHy());
 
 	   if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
 	      return 0.0;
 	   else
-		   return u[y * this->dimensions.x() + x];
+		   return u[y * this->mesh.getDimensions().x() + x];
 }
 
 template< typename Mesh, typename Real >
@@ -142,13 +96,13 @@ template< typename Mesh, typename Real >
 Real tnlSDFGridValue< Mesh, 3, Real >::getValue( const Vertex& v,
         									const Real& time) const
 {
-	   const Real& x = floor( (v.x() - this->origin.x()) / this->hx);
-	   const Real& y = floor( (v.y() - this->origin.y()) / this->hy);
-	   const Real& z = floor( (v.z() - this->origin.z()) / this->hz);
+	   const Real& x = floor( (v.x() - this->mesh.getOrigin().x()) / this->mesh.getHx());
+	   const Real& y = floor( (v.y() - this->mesh.getOrigin().y()) / this->mesh.getHy());
+	   const Real& z = floor( (v.z() - this->mesh.getOrigin().z()) / this->mesh.getHz());
 	   if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
 	      return 0.0;
 	   else
-		   return u[( z * this->dimensions.y() + y ) * this->dimensions.x() + x];
+		   return u[( z * this->mesh.getDimensions().y() + y ) * this->mesh.getDimensions().x() + x];
 }
 
 #endif /* TNLSDFGRIDVALUE_IMPL_H_ */
diff --git a/src/implementation/operators/tnlNeumannReflectionBoundaryConditions_impl.h b/src/implementation/operators/tnlNeumannReflectionBoundaryConditions_impl.h
index 74bed2aac7..a7d7a3ea86 100644
--- a/src/implementation/operators/tnlNeumannReflectionBoundaryConditions_impl.h
+++ b/src/implementation/operators/tnlNeumannReflectionBoundaryConditions_impl.h
@@ -33,7 +33,6 @@ setBoundaryConditions( const RealType& time,
                        DofVectorType& u,
                        DofVectorType& fu )
 {
-   //fu[ index ] = 0;
 	tmp = coordinates;
 
    if(coordinates.x() == 0)
@@ -121,7 +120,6 @@ setBoundaryConditions( const RealType& time,
                        DofVectorType& u,
                        DofVectorType& fu )
 {
-   //fu[ index ] = 0;
 	tmp = coordinates;
 
    if(coordinates.x() == 0)
diff --git a/src/operators/godunov-eikonal/godunovEikonal.h b/src/operators/godunov-eikonal/godunovEikonal.h
index 0190dcea0d..486c7aeeb3 100644
--- a/src/operators/godunov-eikonal/godunovEikonal.h
+++ b/src/operators/godunov-eikonal/godunovEikonal.h
@@ -63,11 +63,6 @@ public:
 
 	RealType sign(const RealType x, const RealType eps) const;
 
-/*	void GetExplicitRHS( const RealType& time,
-                        const RealType& tau,
-                        DofVectorType& _u,
-                        DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -123,11 +118,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -181,11 +171,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
diff --git a/src/operators/godunov/godunov.h b/src/operators/godunov/godunov.h
index 198fa62aeb..1b890b66a2 100644
--- a/src/operators/godunov/godunov.h
+++ b/src/operators/godunov/godunov.h
@@ -64,11 +64,6 @@ public:
 
 	RealType sign(const RealType x, const RealType eps) const;
 
-/*	void GetExplicitRHS( const RealType& time,
-                        const RealType& tau,
-                        DofVectorType& _u,
-                        DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -128,11 +123,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -191,11 +181,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
diff --git a/src/operators/tnlNeumannReflectionBoundaryConditions.h b/src/operators/tnlNeumannReflectionBoundaryConditions.h
index 3854b4a53a..326a32d976 100644
--- a/src/operators/tnlNeumannReflectionBoundaryConditions.h
+++ b/src/operators/tnlNeumannReflectionBoundaryConditions.h
@@ -126,6 +126,7 @@ class tnlNeumannReflectionBoundaryConditions< tnlGrid< 3, MeshReal, Device, Mesh
                                DofVectorType& u,
                                DofVectorType& fu );
 
+   private:
 
    CoordinatesType tmp;
 
diff --git a/src/operators/upwind-eikonal/upwindEikonal.h b/src/operators/upwind-eikonal/upwindEikonal.h
index 85dbc845dc..af1cebda23 100644
--- a/src/operators/upwind-eikonal/upwindEikonal.h
+++ b/src/operators/upwind-eikonal/upwindEikonal.h
@@ -62,11 +62,6 @@ public:
 
 	RealType sign(const RealType x, const RealType eps) const;
 
-/*	void GetExplicitRHS( const RealType& time,
-                        const RealType& tau,
-                        DofVectorType& _u,
-                        DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -122,11 +117,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -180,11 +170,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
diff --git a/src/operators/upwind/upwind.h b/src/operators/upwind/upwind.h
index 988524d01d..93190235ee 100644
--- a/src/operators/upwind/upwind.h
+++ b/src/operators/upwind/upwind.h
@@ -65,11 +65,6 @@ public:
 
 	RealType sign(const RealType x, const RealType eps) const;
 
-/*	void GetExplicitRHS( const RealType& time,
-                        const RealType& tau,
-                        DofVectorType& _u,
-                        DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -87,7 +82,6 @@ protected:
 
 	Function f;
 
-
 	MeshType originalMesh;
 
 	DofVectorType dofVector;
@@ -131,11 +125,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
@@ -192,11 +181,6 @@ public:
 
     RealType sign(const RealType x, const Real eps) const;
 
-/*    void GetExplicitRHS( const RealType& time,
-                         const RealType& tau,
-                         DofVectorType& _u,
-                         DofVectorType& _fu );*/
-
     template< typename Vector >
  #ifdef HAVE_CUDA
     __device__ __host__
-- 
GitLab