Loading src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h +6 −5 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ class tnlNeighbourGridEntityGetter< typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; typedef tnlGridEntityGetter< GridType, NeighbourEntityDimensions > GridEntityGetter; typedef tnlNeighbourGridEntityGetter< GridEntityType, 1, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); Loading Loading @@ -167,8 +168,8 @@ class tnlNeighbourGridEntityGetter< cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); //if( step < -stencilSize || step > stencilSize ) // return this->entity.getIndex() + step; if( step < -stencilSize || step > stencilSize ) return this->entity.getIndex() + step; return stencil[ stencilSize + step ]; } Loading @@ -178,16 +179,16 @@ class tnlNeighbourGridEntityGetter< public: __cuda_callable__ void exec( const IndexType& entityIndex ) static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { //stencil[ index + stencilSize ] = entityIndex + index; neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilRefresher >::exec( entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilRefresher >::exec( *this, entityIndex ); }; protected: Loading src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h +48 −5 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ class tnlNeighbourGridEntityGetter< typedef typename GridType::CoordinatesType CoordinatesType; typedef tnlGridEntityGetter< GridType, NeighbourEntityDimensions > GridEntityGetter; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline tnlNeighbourGridEntityGetter( const GridEntityType& entity ) : entity( entity ) Loading Loading @@ -168,16 +170,57 @@ class tnlNeighbourGridEntityGetter< cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); if( ( stepX != 0 && stepY != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize ) ) return this->entity.getIndex() + stepY * entity.getGrid().getDimensions().x() + stepX; if( stepY == 0 ) return stencilX[ stepX + stencilSize ]; return stencilY[ stepY + stencilSize ]; } template< IndexType index > class StencilXRefresher { public: __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ){}; static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; template< IndexType index > class StencilYRefresher { public: __cuda_callable__ static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index * neighbourEntityGetter.entity.getGrid().getDimensions().x(); } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, -1, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilXRefresher >::exec( *this, entityIndex ); }; protected: const GridEntityType& entity; IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; //tnlNeighbourGridEntityGetter(){}; }; Loading src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h +49 −2 Original line number Diff line number Diff line Loading @@ -171,16 +171,63 @@ class tnlNeighbourGridEntityGetter< << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); if( ( stepX != 0 && stepY != 0 && stepZ != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize || stepZ < -stencilSize || stepZ > stencilSize ) ) return this->entity.getIndex() + ( stepZ * entity.getGrid().getDimensions().y() + stepY ) * entity.getGrid().getDimensions().x() + stepX; if( stepY == 0 && stepZ == 0 ) return stencilX[ stepX + stencilSize ]; if( stepZ == 0 ) return stencilY[ stepY + stencilSize ]; return stencilZ[ stepZ + stencilSize ]; } template< IndexType index > class StencilXRefresher { public: __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ){}; static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; template< IndexType index > class StencilYRefresher { public: __cuda_callable__ static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index * neighbourEntityGetter.entity.getGrid().getDimensions().x(); } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, -1, StencilZRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilZRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, -1, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilXRefresher >::exec( *this, entityIndex ); }; protected: const GridEntityType& entity; IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; IndexType stencilZ[ 2 * stencilSize + 1 ]; //tnlNeighbourGridEntityGetter(){}; }; Loading Loading
src/mesh/grids/tnlNeighbourGridEntityGetter1D_impl.h +6 −5 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ class tnlNeighbourGridEntityGetter< typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; typedef tnlGridEntityGetter< GridType, NeighbourEntityDimensions > GridEntityGetter; typedef tnlNeighbourGridEntityGetter< GridEntityType, 1, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); Loading Loading @@ -167,8 +168,8 @@ class tnlNeighbourGridEntityGetter< cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); //if( step < -stencilSize || step > stencilSize ) // return this->entity.getIndex() + step; if( step < -stencilSize || step > stencilSize ) return this->entity.getIndex() + step; return stencil[ stencilSize + step ]; } Loading @@ -178,16 +179,16 @@ class tnlNeighbourGridEntityGetter< public: __cuda_callable__ void exec( const IndexType& entityIndex ) static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { //stencil[ index + stencilSize ] = entityIndex + index; neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilRefresher >::exec( entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilRefresher >::exec( *this, entityIndex ); }; protected: Loading
src/mesh/grids/tnlNeighbourGridEntityGetter2D_impl.h +48 −5 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ class tnlNeighbourGridEntityGetter< typedef typename GridType::CoordinatesType CoordinatesType; typedef tnlGridEntityGetter< GridType, NeighbourEntityDimensions > GridEntityGetter; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline tnlNeighbourGridEntityGetter( const GridEntityType& entity ) : entity( entity ) Loading Loading @@ -168,16 +170,57 @@ class tnlNeighbourGridEntityGetter< cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); if( ( stepX != 0 && stepY != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize ) ) return this->entity.getIndex() + stepY * entity.getGrid().getDimensions().x() + stepX; if( stepY == 0 ) return stencilX[ stepX + stencilSize ]; return stencilY[ stepY + stencilSize ]; } template< IndexType index > class StencilXRefresher { public: __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ){}; static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; template< IndexType index > class StencilYRefresher { public: __cuda_callable__ static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index * neighbourEntityGetter.entity.getGrid().getDimensions().x(); } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, -1, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilXRefresher >::exec( *this, entityIndex ); }; protected: const GridEntityType& entity; IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; //tnlNeighbourGridEntityGetter(){}; }; Loading
src/mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h +49 −2 Original line number Diff line number Diff line Loading @@ -171,16 +171,63 @@ class tnlNeighbourGridEntityGetter< << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getGrid().getDimensions() = " << entity.getGrid().getDimensions() << " EntityDimensions = " << EntityDimensions ); if( ( stepX != 0 && stepY != 0 && stepZ != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize || stepZ < -stencilSize || stepZ > stencilSize ) ) return this->entity.getIndex() + ( stepZ * entity.getGrid().getDimensions().y() + stepY ) * entity.getGrid().getDimensions().x() + stepX; if( stepY == 0 && stepZ == 0 ) return stencilX[ stepX + stencilSize ]; if( stepZ == 0 ) return stencilY[ stepY + stencilSize ]; return stencilZ[ stepZ + stencilSize ]; } template< IndexType index > class StencilXRefresher { public: __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ){}; static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; template< IndexType index > class StencilYRefresher { public: __cuda_callable__ static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) { neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index * neighbourEntityGetter.entity.getGrid().getDimensions().x(); } }; __cuda_callable__ void refresh( const GridType& grid, const IndexType& entityIndex ) { tnlStaticFor< IndexType, -stencilSize, -1, StencilZRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilZRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, -1, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, 1, stencilSize, StencilYRefresher >::exec( *this, entityIndex ); tnlStaticFor< IndexType, -stencilSize, stencilSize, StencilXRefresher >::exec( *this, entityIndex ); }; protected: const GridEntityType& entity; IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; IndexType stencilZ[ 2 * stencilSize + 1 ]; //tnlNeighbourGridEntityGetter(){}; }; Loading