Skip to content
Snippets Groups Projects
Commit e3c970e1 authored by Matouš Fencl's avatar Matouš Fencl Committed by Tomáš Oberhuber
Browse files

FIM implemented in 3D

parent 39b4889c
No related branches found
No related tags found
2 merge requests!12Hamilton jacobi,!11Hamilton jacobi
......@@ -160,11 +160,17 @@ __global__ void CudaInitCaller3d( const Functions::MeshFunction< Meshes::Grid< 3
Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index > >& output,
Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index >, 3, bool >& interfaceMap );
template < typename Real, typename Device, typename Index >
template < int sizeSArray, typename Real, typename Device, typename Index >
__global__ void CudaUpdateCellCaller( tnlDirectEikonalMethodsBase< Meshes::Grid< 3, Real, Device, Index > > ptr,
const Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index >, 3, bool >& interfaceMap,
Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index > >& aux,
const Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index > >& aux,
Functions::MeshFunction< Meshes::Grid< 3, Real, Device, Index > >& helpFunc,
TNL::Containers::Array< int, Devices::Cuda, Index > BlockIterDevice );
template < typename Index >
__global__ void GetNeighbours3D( TNL::Containers::Array< int, Devices::Cuda, Index > BlockIterDevice,
TNL::Containers::Array< int, Devices::Cuda, Index > BlockIterPom,
int numBlockX, int numBlockY, int numBlockZ );
#endif
#include "tnlDirectEikonalMethodsBase_impl.h"
......@@ -85,7 +85,7 @@ solve( const MeshPointer& mesh,
{
if( std::is_same< DeviceType, Devices::Host >::value )
{
int numThreadsPerBlock = 1024;
int numThreadsPerBlock = 16;
int numBlocksX = mesh->getDimensions().x() / numThreadsPerBlock + (mesh->getDimensions().x() % numThreadsPerBlock != 0 ? 1:0);
......@@ -115,13 +115,13 @@ solve( const MeshPointer& mesh,
}
std::cout<<std::endl;*/
unsigned int numWhile = 0;
while( IsCalculationDone )
while( IsCalculationDone && numWhile < 1 )
{
IsCalculationDone = 0;
helpFunc1 = auxPtr;
auxPtr = helpFunc;
helpFunc = helpFunc1;
this->template updateBlocks< 1026 >( interfaceMap, *auxPtr, *helpFunc, BlockIterHost, numThreadsPerBlock/*, sArray*/ );
this->template updateBlocks< 18 >( interfaceMap, *auxPtr, *helpFunc, BlockIterHost, numThreadsPerBlock/*, sArray*/ );
//Reduction
for( int i = 0; i < BlockIterHost.getSize(); i++ ){
......@@ -394,9 +394,7 @@ solve( const MeshPointer& mesh,
numIter ++;
}
if( numIter == 1 ){
helpFunc1 = auxPtr;
auxPtr = helpFunc;
helpFunc = helpFunc1;
}
/*cudaFree( BlockIterDevice );
cudaFree( dBlock );
......@@ -535,10 +533,10 @@ __global__ void CudaUpdateCellCaller( tnlDirectEikonalMethodsBase< Meshes::Grid<
__syncthreads();
/**-----------------------------------------*/
const Meshes::Grid< 2, Real, Device, Index >& mesh = interfaceMap.template getMesh< Devices::Cuda >();
__shared__ volatile int dimX;
__shared__ volatile int dimY;
__shared__ volatile Real hx;
__shared__ volatile Real hy;
__shared__ int dimX;
__shared__ int dimY;
__shared__ Real hx;
__shared__ Real hy;
if( thri==0 && thrj == 0)
{
dimX = mesh.getDimensions().x();
......
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