Skip to content
Snippets Groups Projects
Commit 40058bc8 authored by Tomas Sobotik's avatar Tomas Sobotik
Browse files

Merging parallel solver 3

parent 9dae3f80
No related branches found
No related tags found
No related merge requests found
...@@ -44,12 +44,12 @@ int main( int argc, char* argv[] ) ...@@ -44,12 +44,12 @@ int main( int argc, char* argv[] )
tnlDeviceEnum device; tnlDeviceEnum device;
device = tnlHostDevice; 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 /*#ifdef HAVE_CUDA
typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlCuda, int>, double, int > SchemeTypeDevice; typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlCuda, int>, double, int > SchemeTypeDevice;
#endif #endif
#ifndef HAVE_CUDA*/ #ifndef HAVE_CUDA*/
typedef parallelGodunovEikonalScheme< tnlGrid<2,double,tnlHost, int>, double, int > SchemeTypeDevice; typedef parallelGodunovEikonalScheme< tnlGrid<3,double,tnlHost, int>, double, int > SchemeTypeDevice;
/*#endif*/ /*#endif*/
if(device==tnlHostDevice) if(device==tnlHostDevice)
...@@ -57,7 +57,7 @@ int main( int argc, char* argv[] ) ...@@ -57,7 +57,7 @@ int main( int argc, char* argv[] )
typedef tnlHost Device; typedef tnlHost Device;
tnlParallelEikonalSolver<2,SchemeTypeHost,SchemeTypeDevice, Device> solver; tnlParallelEikonalSolver<3,SchemeTypeHost,SchemeTypeDevice, Device> solver;
if(!solver.init(parameters)) if(!solver.init(parameters))
{ {
cerr << "Solver failed to initialize." << endl; cerr << "Solver failed to initialize." << endl;
...@@ -72,7 +72,7 @@ int main( int argc, char* argv[] ) ...@@ -72,7 +72,7 @@ int main( int argc, char* argv[] )
typedef tnlCuda Device; typedef tnlCuda Device;
//typedef parallelGodunovEikonalScheme< tnlGrid<2,double,Device, int>, double, int > SchemeType; //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)) if(!solver.init(parameters))
{ {
cerr << "Solver failed to initialize." << endl; cerr << "Solver failed to initialize." << endl;
......
...@@ -224,7 +224,8 @@ public: ...@@ -224,7 +224,8 @@ public:
const CoordinatesType& coordinates, const CoordinatesType& coordinates,
const Vector& u, const Vector& u,
const RealType& time, const RealType& time,
const IndexType boundaryCondition ) const; const IndexType boundaryCondition,
const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities ) const;
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
__device__ __device__
...@@ -234,7 +235,8 @@ public: ...@@ -234,7 +235,8 @@ public:
const CoordinatesType& coordinates, const CoordinatesType& coordinates,
const RealType* u, const RealType* u,
const RealType& time, const RealType& time,
const IndexType boundaryCondition) const; const IndexType boundaryCondition,
const tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 3, tnlGridEntityNoStencilStorage >,3> neighbourEntities ) const;
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
__device__ __host__ __device__ __host__
...@@ -261,7 +263,7 @@ protected: ...@@ -261,7 +263,7 @@ protected:
//#include <operators/godunov-eikonal/parallelGodunovEikonal1D_impl.h> //#include <operators/godunov-eikonal/parallelGodunovEikonal1D_impl.h>
#include <operators/godunov-eikonal/parallelGodunovEikonal2D_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_ */ #endif /* GODUNOVEIKONAL_H_ */
...@@ -126,7 +126,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re ...@@ -126,7 +126,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
const CoordinatesType& coordinates, const CoordinatesType& coordinates,
const Vector& u, const Vector& u,
const Real& time, 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 if ( ((coordinates.x() == 0 && (boundaryCondition & 4)) or
(coordinates.x() == mesh.getDimensions().x() - 1 && (boundaryCondition & 2)) or (coordinates.x() == mesh.getDimensions().x() - 1 && (boundaryCondition & 2)) or
...@@ -159,35 +160,35 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re ...@@ -159,35 +160,35 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
if(coordinates.x() == mesh.getDimensions().x() - 1) 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 else
xf += u[mesh.template getCellNextToCell<1,0,0>( cellIndex )]; xf += u[neighbourEntities.template getEntityIndex< 1, 0, 0 >()];
if(coordinates.x() == 0) if(coordinates.x() == 0)
xb -= u[mesh.template getCellNextToCell<1,0,0>( cellIndex )]; xb -= u[neighbourEntities.template getEntityIndex< 1, 0, 0 >()];
else 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) 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 else
yf += u[mesh.template getCellNextToCell<0,1,0>( cellIndex )]; yf += u[neighbourEntities.template getEntityIndex< 0, 1, 0 >()];
if(coordinates.y() == 0) if(coordinates.y() == 0)
yb -= u[mesh.template getCellNextToCell<0,1,0>( cellIndex )]; yb -= u[neighbourEntities.template getEntityIndex< 0, 1, 0 >()];
else 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) 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 else
zf += u[mesh.template getCellNextToCell<0,0,1>( cellIndex )]; zf += u[neighbourEntities.template getEntityIndex< 0, 0, 1 >()];
if(coordinates.z() == 0) if(coordinates.z() == 0)
zb -= u[mesh.template getCellNextToCell<0,0,1>( cellIndex )]; zb -= u[neighbourEntities.template getEntityIndex< 0, 0, 1 >()];
else else
zb -= u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )]; zb -= u[neighbourEntities.template getEntityIndex< 0, 0, -1 >()];
//xb *= ihx; //xb *= ihx;
...@@ -266,7 +267,9 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re ...@@ -266,7 +267,9 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
const CoordinatesType& coordinates, const CoordinatesType& coordinates,
const Real* u, const Real* u,
const Real& time, 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 ...@@ -300,35 +303,35 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re
if(coordinates.x() == mesh.getDimensions().x() - 1) 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 else
xf += u[mesh.template getCellNextToCell<1,0,0>( cellIndex )]; xf += u[neighbourEntities.template getEntityIndex< 1, 0, 0 >()];
if(coordinates.x() == 0) if(coordinates.x() == 0)
xb -= u[mesh.template getCellNextToCell<1,0,0>( cellIndex )]; xb -= u[neighbourEntities.template getEntityIndex< 1, 0, 0 >()];
else 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) 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 else
yf += u[mesh.template getCellNextToCell<0,1,0>( cellIndex )]; yf += u[neighbourEntities.template getEntityIndex< 0, 1, 0 >()];
if(coordinates.y() == 0) if(coordinates.y() == 0)
yb -= u[mesh.template getCellNextToCell<0,1,0>( cellIndex )]; yb -= u[neighbourEntities.template getEntityIndex< 0, 1, 0 >()];
else 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) 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 else
zf += u[mesh.template getCellNextToCell<0,0,1>( cellIndex )]; zf += u[neighbourEntities.template getEntityIndex< 0, 0, 1 >()];
if(coordinates.z() == 0) if(coordinates.z() == 0)
zb -= u[mesh.template getCellNextToCell<0,0,1>( cellIndex )]; zb -= u[neighbourEntities.template getEntityIndex< 0, 0, 1 >()];
else else
zb -= u[mesh.template getCellNextToCell<0,0,-1>( cellIndex )]; zb -= u[neighbourEntities.template getEntityIndex< 0, 0, -1 >()];
//xb *= ihx; //xb *= ihx;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment