Loading src/mesh/tnlGrid3D_impl.h +29 −8 Original line number Diff line number Diff line Loading @@ -548,7 +548,9 @@ Index tnlGrid< 3, Real, Device, Index >::getFaceNextToCell( const IndexType& cel if( nx ) result = cellIndex + cellIndex / this->getDimensions().x() + ( nx + ( nx < 0 ) ); if( ny ) result = this->numberOfNxFaces + cellIndex + ( ny + ( ny < 0 ) ) * this->getDimensions().x(); result = this->numberOfNxFaces + cellIndex + ( cellIndex / ( this->getDimensions().x() * this->getDimensions().y() ) + ( ny + ( ny < 0 ) ) ) * this->getDimensions().x(); if( nz ) result = this->numberOfNxAndNyFaces + cellIndex + ( nz + ( nz < 0 ) ) * this->getDimensions().x() * this->getDimensions().y(); tnlAssert( result >= 0 && result < this->getNumberOfFaces(), cerr << " cellIndex = " << cellIndex Loading @@ -574,22 +576,41 @@ Index tnlGrid< 3, Real, Device, Index >::getCellNextToFace( const IndexType& fac #ifndef NDEBUG int _nx, _ny, _nz; #endif tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny ).x() >= 0 && nx + this->getFaceCoordinates( faceIndex, _nx, _ny ).x() <= this->getDimensions().x() ), tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() >= 0 && nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() <= this->getDimensions().x() ), cerr << " nx = " << nx << " this->getFaceCoordinates( faceIndex, _nx, _ny ).x() = " << this->getFaceCoordinates( faceIndex, _nx, _ny ).x() << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() << " this->getDimensions().x() = " << this->getDimensions().x() ); tnlAssert( ( ny + this->getFaceCoordinates( faceIndex, _nx, _ny ).y() >= 0 && ny + this->getFaceCoordinates( faceIndex, _nx, _ny ).y() <= this->getDimensions().y() ), tnlAssert( ( ny + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() >= 0 && ny + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() <= this->getDimensions().y() ), cerr << " ny = " << ny << " this->getFaceCoordinates( faceIndex, _nx, _ny ).y() = " << this->getFaceCoordinates( faceIndex, _nx, _ny ).y() << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() << " this->getDimensions().y() = " << this->getDimensions().y() ); tnlAssert( ( nz + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() >= 0 && nz + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() <= this->getDimensions().z() ), cerr << " nz = " << nz << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() << " this->getDimensions().z() = " << this->getDimensions().z() ); IndexType result; if( nx ) result = faceIndex + ( nx - ( nx > 0 ) ) - faceIndex / ( this->getDimensions().x() + 1 ); if( ny ) result = faceIndex - this->numberOfNxFaces + ( ny - ( ny > 0 ) ) * this->getDimensions().x(); { IndexType aux = faceIndex - this->numberOfNxFaces; result = aux + ( ny - ( ny > 0 ) ) * this->getDimensions().x() - aux / ( ( this->getDimensions().y() + 1 ) * this->getDimensions().x() ) * this->getDimensions().x(); } if( nz ) result = faceIndex - this->numberOfNxAndNyFaces + ( nz - ( nz > 0 ) ) * this->getDimensions().y() * this->getDimensions().x(); tnlAssert( result >= 0 && result < this->getNumberOfFaces(), cerr << " faceIndex = " << faceIndex << " nx = " << nx << " ny = " << ny << " nz = " << nz << " this->getNumberOfCells() = " << this->getNumberOfCells() << " this->getName() " << this->getName(); ); return result; } template< typename Real, Loading src/mesh/tnlTraverser_Grid2D_impl.h +40 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ processBoundaryEntities( const GridType& grid, UserData& userData ) const { /**** * Boundary conditions * Traversing boundary cells */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); Loading Loading @@ -61,7 +61,7 @@ processInteriorEntities( const GridType& grid, UserData& userData ) const { /**** * Interior cells * Traversing interior cells */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); Loading Loading @@ -90,6 +90,25 @@ processBoundaryEntities( const GridType& grid, /**** * Traversing boundary faces */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); const IndexType& ySize = grid.getDimensions().y(); for( coordinates.x() = 0; coordinates.x() < xSize; coordinates.x() ++ ) { coordinates.y() = 0; EntitiesProcessor::processFace< 0, 1 >( grid, userData, grid.getFaceIndex< 0, 1 >( coordinates ), coordinates ); coordinates.y() = ySize; EntitiesProcessor::processFace< 0, 1 >( grid, userData, grid.getFaceIndex< 0, 1 >( coordinates ), coordinates ); } for( coordinates.y() = 0; coordinates.y() < ySize; coordinates.y() ++ ) { coordinates.x() = 0; EntitiesProcessor::processFace< 1, 0 >( grid, userData, grid.getFaceIndex< 1, 0 >( coordinates ), coordinates ); coordinates.x() = ySize; EntitiesProcessor::processFace< 1, 0 >( grid, userData, grid.getFaceIndex< 1, 0 >( coordinates ), coordinates ); } } template< typename Real, Loading @@ -104,6 +123,25 @@ processInteriorEntities( const GridType& grid, /**** * Traversing interior faces */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); const IndexType& ySize = grid.getDimensions().y(); #ifdef HAVE_OPENMP //#pragma omp parallel for #endif for( coordinates.y() = 1; coordinates.y() < ySize - 1; coordinates.y() ++ ) for( coordinates.x() = 1; coordinates.x() < xSize; coordinates.x() ++ ) { const IndexType index = grid.template getFaceIndex< 1, 0 >( coordinates ); EntitiesProcessor::processFace< 1, 0 >( grid, userData, index, coordinates ); } for( coordinates.y() = 1; coordinates.y() < ySize; coordinates.y() ++ ) for( coordinates.x() = 1; coordinates.x() < xSize - 1; coordinates.x() ++ ) { const IndexType index = grid.template getFaceIndex< 0, 1 >( coordinates ); EntitiesProcessor::processFace< 0, 1 >( grid, userData, index, coordinates ); } } Loading tests/unit-tests/mesh/tnlGrid3DTester.h +84 −57 Original line number Diff line number Diff line Loading @@ -264,30 +264,40 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas const IndexType xSize( 13 ); const IndexType ySize( 17 ); const IndexType zSize( 19 ); /*GridType grid; grid.setDimensions( xSize, ySize ); GridType grid; grid.setDimensions( xSize, ySize, zSize ); for( IndexType k = 0; k < zSize; k++ ) for( IndexType j = 0; j < ySize; j++ ) for( IndexType i = 0; i < xSize; i++ ) { const CoordinatesType cellCoordinates( i, j ); const CoordinatesType cellCoordinates( i, j, k ); const IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CoordinatesType faceCoordinates( i, j ); IndexType faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< -1, 0 >( cellIndex ) ) ); CoordinatesType faceCoordinates( i, j, k ); IndexType faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< -1, 0, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i + 1, j, k ); faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 1, 0, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k ); faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, -1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j + 1, k ); faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i + 1, j ); faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k ); faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 0, -1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j ); faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, -1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k + 1 ); faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 0, 1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j + 1 ); faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 1 >( cellIndex ) ) ); }*/ } } void getCellNextToFaceTest() Loading @@ -295,48 +305,65 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas const IndexType xSize( 13 ); const IndexType ySize( 17 ); const IndexType zSize( 19 ); /*GridType grid; grid.setDimensions( xSize, ySize ); GridType grid; grid.setDimensions( xSize, ySize, zSize ); for( IndexType k = 0; k <= zSize; k++ ) for( IndexType j = 0; j <= ySize; j++ ) for( IndexType i = 0; i <= xSize; i++ ) { const CoordinatesType faceCoordinates( i, j ); if( j < ySize ) const CoordinatesType faceCoordinates( i, j, k ); if( j < ySize && k < zSize ) { const IndexType faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); const IndexType faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); if( i > 0 ) { CoordinatesType cellCoordinates( i - 1, j ); CoordinatesType cellCoordinates( i - 1, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< -1, 0 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< -1, 0, 0 >( faceIndex ) ) ); } if( i < xSize ) { CoordinatesType cellCoordinates( i, j ); CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 1, 0 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 1, 0, 0 >( faceIndex ) ) ); } } if( i < xSize ) if( i < xSize && k < zSize ) { const IndexType faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); const IndexType faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); if( j > 0 ) { CoordinatesType cellCoordinates( i, j - 1 ); CoordinatesType cellCoordinates( i, j - 1, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, -1 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, -1, 0 >( faceIndex ) ) ); } if( j < ySize ) { CoordinatesType cellCoordinates( i, j ); CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 1, 0 >( faceIndex ) ) ); } } if( i < xSize && j < ySize ) { const IndexType faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); if( k > 0 ) { CoordinatesType cellCoordinates( i, j, k - 1 ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 1 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 0, -1 >( faceIndex ) ) ); } if( k < zSize ) { CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 0, 1 >( faceIndex ) ) ); } }*/ } } } }; #endif /* TESTS_UNIT_TESTS_MESH_TNLGRID3DTESTER_H_ */ Loading
src/mesh/tnlGrid3D_impl.h +29 −8 Original line number Diff line number Diff line Loading @@ -548,7 +548,9 @@ Index tnlGrid< 3, Real, Device, Index >::getFaceNextToCell( const IndexType& cel if( nx ) result = cellIndex + cellIndex / this->getDimensions().x() + ( nx + ( nx < 0 ) ); if( ny ) result = this->numberOfNxFaces + cellIndex + ( ny + ( ny < 0 ) ) * this->getDimensions().x(); result = this->numberOfNxFaces + cellIndex + ( cellIndex / ( this->getDimensions().x() * this->getDimensions().y() ) + ( ny + ( ny < 0 ) ) ) * this->getDimensions().x(); if( nz ) result = this->numberOfNxAndNyFaces + cellIndex + ( nz + ( nz < 0 ) ) * this->getDimensions().x() * this->getDimensions().y(); tnlAssert( result >= 0 && result < this->getNumberOfFaces(), cerr << " cellIndex = " << cellIndex Loading @@ -574,22 +576,41 @@ Index tnlGrid< 3, Real, Device, Index >::getCellNextToFace( const IndexType& fac #ifndef NDEBUG int _nx, _ny, _nz; #endif tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny ).x() >= 0 && nx + this->getFaceCoordinates( faceIndex, _nx, _ny ).x() <= this->getDimensions().x() ), tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() >= 0 && nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() <= this->getDimensions().x() ), cerr << " nx = " << nx << " this->getFaceCoordinates( faceIndex, _nx, _ny ).x() = " << this->getFaceCoordinates( faceIndex, _nx, _ny ).x() << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() << " this->getDimensions().x() = " << this->getDimensions().x() ); tnlAssert( ( ny + this->getFaceCoordinates( faceIndex, _nx, _ny ).y() >= 0 && ny + this->getFaceCoordinates( faceIndex, _nx, _ny ).y() <= this->getDimensions().y() ), tnlAssert( ( ny + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() >= 0 && ny + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() <= this->getDimensions().y() ), cerr << " ny = " << ny << " this->getFaceCoordinates( faceIndex, _nx, _ny ).y() = " << this->getFaceCoordinates( faceIndex, _nx, _ny ).y() << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).y() << " this->getDimensions().y() = " << this->getDimensions().y() ); tnlAssert( ( nz + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() >= 0 && nz + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() <= this->getDimensions().z() ), cerr << " nz = " << nz << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() << " this->getDimensions().z() = " << this->getDimensions().z() ); IndexType result; if( nx ) result = faceIndex + ( nx - ( nx > 0 ) ) - faceIndex / ( this->getDimensions().x() + 1 ); if( ny ) result = faceIndex - this->numberOfNxFaces + ( ny - ( ny > 0 ) ) * this->getDimensions().x(); { IndexType aux = faceIndex - this->numberOfNxFaces; result = aux + ( ny - ( ny > 0 ) ) * this->getDimensions().x() - aux / ( ( this->getDimensions().y() + 1 ) * this->getDimensions().x() ) * this->getDimensions().x(); } if( nz ) result = faceIndex - this->numberOfNxAndNyFaces + ( nz - ( nz > 0 ) ) * this->getDimensions().y() * this->getDimensions().x(); tnlAssert( result >= 0 && result < this->getNumberOfFaces(), cerr << " faceIndex = " << faceIndex << " nx = " << nx << " ny = " << ny << " nz = " << nz << " this->getNumberOfCells() = " << this->getNumberOfCells() << " this->getName() " << this->getName(); ); return result; } template< typename Real, Loading
src/mesh/tnlTraverser_Grid2D_impl.h +40 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ processBoundaryEntities( const GridType& grid, UserData& userData ) const { /**** * Boundary conditions * Traversing boundary cells */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); Loading Loading @@ -61,7 +61,7 @@ processInteriorEntities( const GridType& grid, UserData& userData ) const { /**** * Interior cells * Traversing interior cells */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); Loading Loading @@ -90,6 +90,25 @@ processBoundaryEntities( const GridType& grid, /**** * Traversing boundary faces */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); const IndexType& ySize = grid.getDimensions().y(); for( coordinates.x() = 0; coordinates.x() < xSize; coordinates.x() ++ ) { coordinates.y() = 0; EntitiesProcessor::processFace< 0, 1 >( grid, userData, grid.getFaceIndex< 0, 1 >( coordinates ), coordinates ); coordinates.y() = ySize; EntitiesProcessor::processFace< 0, 1 >( grid, userData, grid.getFaceIndex< 0, 1 >( coordinates ), coordinates ); } for( coordinates.y() = 0; coordinates.y() < ySize; coordinates.y() ++ ) { coordinates.x() = 0; EntitiesProcessor::processFace< 1, 0 >( grid, userData, grid.getFaceIndex< 1, 0 >( coordinates ), coordinates ); coordinates.x() = ySize; EntitiesProcessor::processFace< 1, 0 >( grid, userData, grid.getFaceIndex< 1, 0 >( coordinates ), coordinates ); } } template< typename Real, Loading @@ -104,6 +123,25 @@ processInteriorEntities( const GridType& grid, /**** * Traversing interior faces */ CoordinatesType coordinates; const IndexType& xSize = grid.getDimensions().x(); const IndexType& ySize = grid.getDimensions().y(); #ifdef HAVE_OPENMP //#pragma omp parallel for #endif for( coordinates.y() = 1; coordinates.y() < ySize - 1; coordinates.y() ++ ) for( coordinates.x() = 1; coordinates.x() < xSize; coordinates.x() ++ ) { const IndexType index = grid.template getFaceIndex< 1, 0 >( coordinates ); EntitiesProcessor::processFace< 1, 0 >( grid, userData, index, coordinates ); } for( coordinates.y() = 1; coordinates.y() < ySize; coordinates.y() ++ ) for( coordinates.x() = 1; coordinates.x() < xSize - 1; coordinates.x() ++ ) { const IndexType index = grid.template getFaceIndex< 0, 1 >( coordinates ); EntitiesProcessor::processFace< 0, 1 >( grid, userData, index, coordinates ); } } Loading
tests/unit-tests/mesh/tnlGrid3DTester.h +84 −57 Original line number Diff line number Diff line Loading @@ -264,30 +264,40 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas const IndexType xSize( 13 ); const IndexType ySize( 17 ); const IndexType zSize( 19 ); /*GridType grid; grid.setDimensions( xSize, ySize ); GridType grid; grid.setDimensions( xSize, ySize, zSize ); for( IndexType k = 0; k < zSize; k++ ) for( IndexType j = 0; j < ySize; j++ ) for( IndexType i = 0; i < xSize; i++ ) { const CoordinatesType cellCoordinates( i, j ); const CoordinatesType cellCoordinates( i, j, k ); const IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CoordinatesType faceCoordinates( i, j ); IndexType faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< -1, 0 >( cellIndex ) ) ); CoordinatesType faceCoordinates( i, j, k ); IndexType faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< -1, 0, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i + 1, j, k ); faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 1, 0, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k ); faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, -1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j + 1, k ); faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i + 1, j ); faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 1, 0 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k ); faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 0, -1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j ); faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, -1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j, k + 1 ); faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 0, 1 >( cellIndex ) ) ); faceCoordinates = CoordinatesType( i, j + 1 ); faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); CPPUNIT_ASSERT( ( faceIndex == grid.template getFaceNextToCell< 0, 1 >( cellIndex ) ) ); }*/ } } void getCellNextToFaceTest() Loading @@ -295,48 +305,65 @@ class tnlGridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCas const IndexType xSize( 13 ); const IndexType ySize( 17 ); const IndexType zSize( 19 ); /*GridType grid; grid.setDimensions( xSize, ySize ); GridType grid; grid.setDimensions( xSize, ySize, zSize ); for( IndexType k = 0; k <= zSize; k++ ) for( IndexType j = 0; j <= ySize; j++ ) for( IndexType i = 0; i <= xSize; i++ ) { const CoordinatesType faceCoordinates( i, j ); if( j < ySize ) const CoordinatesType faceCoordinates( i, j, k ); if( j < ySize && k < zSize ) { const IndexType faceIndex = grid.template getFaceIndex< 1, 0 >( faceCoordinates ); const IndexType faceIndex = grid.template getFaceIndex< 1, 0, 0 >( faceCoordinates ); if( i > 0 ) { CoordinatesType cellCoordinates( i - 1, j ); CoordinatesType cellCoordinates( i - 1, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< -1, 0 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< -1, 0, 0 >( faceIndex ) ) ); } if( i < xSize ) { CoordinatesType cellCoordinates( i, j ); CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 1, 0 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 1, 0, 0 >( faceIndex ) ) ); } } if( i < xSize ) if( i < xSize && k < zSize ) { const IndexType faceIndex = grid.template getFaceIndex< 0, 1 >( faceCoordinates ); const IndexType faceIndex = grid.template getFaceIndex< 0, 1, 0 >( faceCoordinates ); if( j > 0 ) { CoordinatesType cellCoordinates( i, j - 1 ); CoordinatesType cellCoordinates( i, j - 1, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, -1 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, -1, 0 >( faceIndex ) ) ); } if( j < ySize ) { CoordinatesType cellCoordinates( i, j ); CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 1, 0 >( faceIndex ) ) ); } } if( i < xSize && j < ySize ) { const IndexType faceIndex = grid.template getFaceIndex< 0, 0, 1 >( faceCoordinates ); if( k > 0 ) { CoordinatesType cellCoordinates( i, j, k - 1 ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 1 >( faceIndex ) ) ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 0, -1 >( faceIndex ) ) ); } if( k < zSize ) { CoordinatesType cellCoordinates( i, j, k ); IndexType cellIndex = grid.getCellIndex( cellCoordinates ); CPPUNIT_ASSERT( ( cellIndex == grid.template getCellNextToFace< 0, 0, 1 >( faceIndex ) ) ); } }*/ } } } }; #endif /* TESTS_UNIT_TESTS_MESH_TNLGRID3DTESTER_H_ */