From 8652848dcb27308afe39b84211a5b3e493ae7f4a Mon Sep 17 00:00:00 2001
From: Tomas Sobotik <sobotto4@fjfi.cvut.cz>
Date: Tue, 14 Apr 2015 18:57:43 +0200
Subject: [PATCH] Minor improvements to scheme

---
 .../tnlParallelEikonalSolver_impl.h           |  6 ++---
 .../parallelGodunovEikonal2D_impl.h           | 27 ++++++++++++-------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/examples/hamilton-jacobi-parallel/tnlParallelEikonalSolver_impl.h b/examples/hamilton-jacobi-parallel/tnlParallelEikonalSolver_impl.h
index 11272d8ecb..8e12f82ceb 100644
--- a/examples/hamilton-jacobi-parallel/tnlParallelEikonalSolver_impl.h
+++ b/examples/hamilton-jacobi-parallel/tnlParallelEikonalSolver_impl.h
@@ -1176,15 +1176,15 @@ void tnlParallelEikonalSolver<SchemeHost, SchemeDevice, Device, double, int>::ru
 
 	for(unsigned int s = blockDim.x*blockDim.y/2; s>0; s>>=1)
 	{
-		if( l < s )
-			sharedRes[l] = Max(sharedRes[l],sharedRes[l+s]);
+		//if( l < s )
+		//	sharedRes[l] = Max(sharedRes[l],sharedRes[l+s]);
 		if(l >= blockDim.x*blockDim.y - s)
 			sharedTau[l] = Min(sharedTau[l],sharedTau[l-s]);
 		__syncthreads();
 	}
 	if(l==0)
 	{
-		maxResidue=sharedRes[l];
+		//maxResidue=sharedRes[l];
 		currentTau=sharedTau[blockDim.x*blockDim.y - 1];
 		/*if( this -> cflCondition * maxResidue != 0.0)
 			currentTau = Min(this -> cflCondition / maxResidue, currentTau);*/
diff --git a/src/operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h b/src/operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h
index 31d6ca7982..a5b23b9f1b 100644
--- a/src/operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h
+++ b/src/operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h
@@ -323,35 +323,44 @@ Real parallelGodunovEikonalScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Re
 
 	//RealType acc = hx*hy*hx*hy;
 
-	RealType nabla, xb, xf, yb, yf, signui;
+	RealType nabla,  signui;
 	signui = sign(u[cellIndex],epsilon);
+
 #ifdef HAVE_CUDA
 	//printf("%d   :    %d ;;;; %d   :   %d  , %f \n",threadIdx.x, mesh.getDimensions().x() , threadIdx.y,mesh.getDimensions().y(), epsilon );
 #endif
 
+	RealType xb = u[cellIndex];
+	RealType xf = -u[cellIndex];
+	RealType yb = u[cellIndex];
+	RealType yf = -u[cellIndex];
 
 
 	   if(coordinates.x() == mesh.getDimensions().x() - 1)
-		   xf = ((u[mesh.template getCellNextToCell<-1,0>( cellIndex )] - u[cellIndex])/hx);
+		   xf += u[mesh.template getCellNextToCell<-1,0>( cellIndex )];
 	   else
-		   xf = ((u[mesh.template getCellNextToCell<1,0>( cellIndex )] - u[cellIndex])/hx);
+		   xf += u[mesh.template getCellNextToCell<1,0>( cellIndex )];
 
 	   if(coordinates.x() == 0)
-		   xb = ((u[cellIndex] - u[mesh.template getCellNextToCell<1,0>( cellIndex )])/hx);
+		   xb -= u[mesh.template getCellNextToCell<1,0>( cellIndex )];
 	   else
-		   xb = ((u[cellIndex] - u[mesh.template getCellNextToCell<-1,0>( cellIndex )])/hx);
+		   xb -= u[mesh.template getCellNextToCell<-1,0>( cellIndex )];
 
 	   if(coordinates.y() == mesh.getDimensions().y() - 1)
-		   yf = ((u[mesh.template getCellNextToCell<0,-1>( cellIndex )] - u[cellIndex])/hy);
+		   yf += u[mesh.template getCellNextToCell<0,-1>( cellIndex )];
 	   else
-		   yf = ((u[mesh.template getCellNextToCell<0,1>( cellIndex )] - u[cellIndex])/hy);
+		   yf += u[mesh.template getCellNextToCell<0,1>( cellIndex )];
 
 	   if(coordinates.y() == 0)
-		   yb = ((u[cellIndex] - u[mesh.template getCellNextToCell<0,1>( cellIndex )])/hy);
+		   yb -= u[mesh.template getCellNextToCell<0,1>( cellIndex )];
 	   else
-		   yb = ((u[cellIndex] - u[mesh.template getCellNextToCell<0,-1>( cellIndex )])/hy);
+		   yb -= u[mesh.template getCellNextToCell<0,-1>( cellIndex )];
 
 
+	   xb /= hx;
+	   xf /= hx;
+	   yb /= hy;
+	   yf /= hy;
 
 	   if(signui > 0.0)
 	   {
-- 
GitLab