Commit 40058bc8 authored by Tomas Sobotik's avatar Tomas Sobotik
Browse files

Merging parallel solver 3

parent 9dae3f80
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -44,12 +44,12 @@ int main( int argc, char* argv[] )
   tnlDeviceEnum device;
   device = tnlHostDevice;

   typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlHost, int>, double, int > SchemeTypeHost;
   typedef parallelGodunovEikonalScheme< tnlGrid<3,double,tnlHost, int>, double, int > SchemeTypeHost;
/*#ifdef HAVE_CUDA
   typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlCuda, int>, double, int > SchemeTypeDevice;
#endif
#ifndef HAVE_CUDA*/
   typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlHost, int>, double, int > SchemeTypeDevice;
   typedef parallelGodunovEikonalScheme< tnlGrid<3,double,tnlHost, int>, double, int > SchemeTypeDevice;
/*#endif*/

   if(device==tnlHostDevice)
@@ -57,7 +57,7 @@ int main( int argc, char* argv[] )
	   typedef tnlHost Device;


   	   tnlParallelEikonalSolver<2,SchemeTypeHost,SchemeTypeDevice, Device> solver;
   	   tnlParallelEikonalSolver<3,SchemeTypeHost,SchemeTypeDevice, Device> solver;
   	   if(!solver.init(parameters))
   	   {
   		   cerr << "Solver failed to initialize." << endl;
@@ -72,7 +72,7 @@ int main( int argc, char* argv[] )
	   typedef tnlCuda Device;
  	   //typedef parallelGodunovEikonalScheme< tnlGrid<2,double,Device, int>, double, int > SchemeType;

   	   tnlParallelEikonalSolver<2,SchemeTypeHost,SchemeTypeDevice, Device> solver;
   	   tnlParallelEikonalSolver<3,SchemeTypeHost,SchemeTypeDevice, Device> solver;
   	   if(!solver.init(parameters))
   	   {
   		   cerr << "Solver failed to initialize." << endl;
+190 −410

File changed.

Preview size limit exceeded, changes collapsed.

+5 −3
Original line number Diff line number Diff line
@@ -224,7 +224,8 @@ public:
                   const CoordinatesType& coordinates,
                   const Vector& u,
                   const RealType& time,
                   const IndexType boundaryCondition ) const;
                   const IndexType boundaryCondition,
  	  	  	       const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities  ) const;

#ifdef HAVE_CUDA
   __device__
@@ -234,7 +235,8 @@ public:
                  const CoordinatesType& coordinates,
                  const RealType* u,
                  const RealType& time,
                  const IndexType boundaryCondition) const;
                  const IndexType boundaryCondition,
 	  	  	      const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities ) const;

#ifdef HAVE_CUDA
   __device__ __host__
@@ -261,7 +263,7 @@ protected:

//#include <operators/godunov-eikonal/parallelGodunovEikonal1D_impl.h>
#include <operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h>
//#include <operators/godunov-eikonal/parallelGodunovEikonal3D_impl.h>
#include <operators/godunov-eikonal/parallelGodunovEikonal3D_impl.h>


#endif /* GODUNOVEIKONAL_H_ */
+29 −26
Original line number Diff line number Diff line
@@ -126,7 +126,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const CoordinatesType& coordinates,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const Vector& u,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const Real& time,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const IndexType boundaryCondition ) const
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const IndexType boundaryCondition,
          	  	          	  	  	  	  	  	  	  	  	  	                     const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities  ) const
{
	if ( ((coordinates.x() == 0 && (boundaryCondition & 4)) or
		 (coordinates.x() == mesh.getDimensions().x() - 1 && (boundaryCondition & 2)) or
@@ -159,35 +160,35 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re


	   if(coordinates.x() == mesh.getDimensions().x() - 1)
		   xf += u[mesh.template getCellNextToCell<-1,0,0>( cellIndex )];
		   xf += u[neighbourEntities.template getEntityIndex< -1,  0,  0 >()];
	   else
		   xf += u[mesh.template getCellNextToCell<1,0,0>( cellIndex )];
		   xf += u[neighbourEntities.template getEntityIndex< 1,  0,  0 >()];

	   if(coordinates.x() == 0)
		   xb -= u[mesh.template getCellNextToCell<1,0,0>( cellIndex )];
		   xb -= u[neighbourEntities.template getEntityIndex< 1,  0,  0 >()];
	   else
		   xb -= u[mesh.template getCellNextToCell<-1,0,0>( cellIndex )];
		   xb -= u[neighbourEntities.template getEntityIndex< -1,  0,  0 >()];

	   if(coordinates.y() == mesh.getDimensions().y() - 1)
		   yf += u[mesh.template getCellNextToCell<0,-1,0>( cellIndex )];
		   yf += u[neighbourEntities.template getEntityIndex< 0,  -1,  0 >()];
	   else
		   yf += u[mesh.template getCellNextToCell<0,1,0>( cellIndex )];
		   yf += u[neighbourEntities.template getEntityIndex< 0,  1,  0 >()];

	   if(coordinates.y() == 0)
		   yb -= u[mesh.template getCellNextToCell<0,1,0>( cellIndex )];
		   yb -= u[neighbourEntities.template getEntityIndex< 0,  1,  0 >()];
	   else
		   yb -= u[mesh.template getCellNextToCell<0,-1,0>( cellIndex )];
		   yb -= u[neighbourEntities.template getEntityIndex< 0,  -1,  0 >()];


	   if(coordinates.z() == mesh.getDimensions().z() - 1)
		   zf += u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )];
		   zf += u[neighbourEntities.template getEntityIndex< 0,  0,  -1 >()];
	   else
		   zf += u[mesh.template getCellNextToCell<0,0,1>( cellIndex )];
		   zf += u[neighbourEntities.template getEntityIndex< 0,  0,  1 >()];

	   if(coordinates.z() == 0)
		   zb -= u[mesh.template getCellNextToCell<0,0,1>( cellIndex )];
		   zb -= u[neighbourEntities.template getEntityIndex< 0,  0,  1 >()];
	   else
		   zb -= u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )];
		   zb -= u[neighbourEntities.template getEntityIndex< 0,  0,  -1 >()];


	   //xb *= ihx;
@@ -266,7 +267,9 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const CoordinatesType& coordinates,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const Real* u,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const Real& time,
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const IndexType boundaryCondition) const
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 const IndexType boundaryCondition,
          	  	          	  	  	  	  	  	  	  	  	  	                     const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities
          	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 ) const
{

/*
@@ -300,35 +303,35 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re


	   if(coordinates.x() == mesh.getDimensions().x() - 1)
		   xf += u[mesh.template getCellNextToCell<-1,0,0>( cellIndex )];
		   xf += u[neighbourEntities.template getEntityIndex< -1,  0,  0 >()];
	   else
		   xf += u[mesh.template getCellNextToCell<1,0,0>( cellIndex )];
		   xf += u[neighbourEntities.template getEntityIndex< 1,  0,  0 >()];

	   if(coordinates.x() == 0)
		   xb -= u[mesh.template getCellNextToCell<1,0,0>( cellIndex )];
		   xb -= u[neighbourEntities.template getEntityIndex< 1,  0,  0 >()];
	   else
		   xb -= u[mesh.template getCellNextToCell<-1,0,0>( cellIndex )];
		   xb -= u[neighbourEntities.template getEntityIndex< -1,  0,  0 >()];

	   if(coordinates.y() == mesh.getDimensions().y() - 1)
		   yf += u[mesh.template getCellNextToCell<0,-1,0>( cellIndex )];
		   yf += u[neighbourEntities.template getEntityIndex< 0,  -1,  0 >()];
	   else
		   yf += u[mesh.template getCellNextToCell<0,1,0>( cellIndex )];
		   yf += u[neighbourEntities.template getEntityIndex< 0,  1,  0 >()];

	   if(coordinates.y() == 0)
		   yb -= u[mesh.template getCellNextToCell<0,1,0>( cellIndex )];
		   yb -= u[neighbourEntities.template getEntityIndex< 0,  1,  0 >()];
	   else
		   yb -= u[mesh.template getCellNextToCell<0,-1,0>( cellIndex )];
		   yb -= u[neighbourEntities.template getEntityIndex< 0,  -1,  0 >()];


	   if(coordinates.z() == mesh.getDimensions().z() - 1)
		   zf += u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )];
		   zf += u[neighbourEntities.template getEntityIndex< 0,  0,  -1 >()];
	   else
		   zf += u[mesh.template getCellNextToCell<0,0,1>( cellIndex )];
		   zf += u[neighbourEntities.template getEntityIndex< 0,  0,  1 >()];

	   if(coordinates.z() == 0)
		   zb -= u[mesh.template getCellNextToCell<0,0,1>( cellIndex )];
		   zb -= u[neighbourEntities.template getEntityIndex< 0,  0,  1 >()];
	   else
		   zb -= u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )];
		   zb -= u[neighbourEntities.template getEntityIndex< 0,  0,  -1 >()];


	   //xb *= ihx;