Loading src/UnitTests/Meshes/CMakeLists.txt +36 −15 Original line number Diff line number Diff line Loading @@ -3,22 +3,24 @@ SET_TARGET_PROPERTIES( BoundaryTagsTest${mpiExt}${debugExt} PROPERTIES COMPILE_F TARGET_LINK_LIBRARIES( BoundaryTagsTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) IF( BUILD_CUDA ) if( BUILD_CUDA ) # FIXME: nvcc fails with "Invalid memory reference" error, so we assume that ${CXX} is clang #CUDA_ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cu OPTIONS "${CXX_TESTS_FLAGS}" ) #TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} # tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cpp ) SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} cudart dl rt "-L ${CUDA_TOOLKIT_ROOT_DIR}/lib64/" ) ELSE( BUILD_CUDA ) else( BUILD_CUDA ) ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cpp ) SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ENDIF( BUILD_CUDA ) endif( BUILD_CUDA ) ADD_EXECUTABLE( MeshEntityTest${mpiExt}${debugExt} ${headers} MeshEntityTest.cpp ) SET_TARGET_PROPERTIES( MeshEntityTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) Loading Loading @@ -54,15 +56,34 @@ if( VTK_FOUND ) AddCompilerFlag( "-DHAVE_VTK " ) if( BUILD_CUDA ) # FIXME: nvcc fails with "Invalid memory reference" error, so we assume that ${CXX} is clang #CUDA_ADD_EXECUTABLE( MeshReaderTest${mpiExt}${debugExt} ${headers} MeshTest.cu OPTIONS "${CXX_TESTS_FLAGS}" ) #TARGET_LINK_LIBRARIES( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} # vtkCommonCore # vtkIOLegacy # tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( MeshReaderTest${mpiExt}${debugExt} ${headers} MeshReaderTest.cpp ) SET_TARGET_PROPERTIES( MeshReaderTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} vtkCommonCore vtkIOLegacy tnl${mpiExt}${debugExt}-${tnlVersion} cudart dl rt "-L ${CUDA_TOOLKIT_ROOT_DIR}/lib64/" ) else( BUILD_CUDA ) add_executable( MeshReaderTest${mpiExt}${debugExt} MeshReaderTest.cpp ) #target_link_libraries( MeshReaderTest${mpiExt}${debugExt} # ${VTK_LIBRARIES} # tnl${debugExt}-${tnlVersion} ) target_link_libraries( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} vtkCommonCore vtkIOLegacy tnl${debugExt}-${tnlVersion} ) endif( BUILD_CUDA ) else( VTK_FOUND ) message( "Please install VTK to enable the MeshReaderTest." ) Loading src/UnitTests/Meshes/MeshReaderTest.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #include <TNL/Debugging/MemoryUsage.h> #include "MeshTest.h" using namespace TNL; using namespace TNL::Meshes; Loading Loading @@ -118,9 +120,6 @@ public: if( ! loadMesh( fileName, mesh ) ) return false; // TODO: add tests std::cout << "NOTE: there is no real test, but the file was loaded fine..." << std::endl; std::cout << "vertices: " << mesh.template getEntitiesCount< 0 >() << std::endl; std::cout << "faces: " << mesh.template getEntitiesCount< MeshType::getMeshDimension() - 1 >() << std::endl; std::cout << "cells: " << mesh.template getEntitiesCount< MeshType::getMeshDimension() >() << std::endl; Loading @@ -128,6 +127,10 @@ public: std::cout << "post-init\t"; Debugging::printMemoryUsage(); #ifdef HAVE_GTEST std::cout << "Running basic I/O tests..." << std::endl; testFinishedMesh( mesh ); #endif // mesh.save( "mesh-test.tnl" ); return true; Loading src/UnitTests/Meshes/MeshTest.cpp +0 −4 Original line number Diff line number Diff line #ifdef HAVE_GTEST #include "gtest/gtest.h" #endif #include "MeshTest.h" int main( int argc, char* argv[] ) Loading src/UnitTests/Meshes/MeshTest.h +5 −0 Original line number Diff line number Diff line #pragma once #ifdef HAVE_GTEST #include <gtest/gtest.h> #include <sstream> #include <TNL/Meshes/Mesh.h> Loading Loading @@ -112,6 +114,8 @@ void testMeshOnCuda( const Mesh& mesh ) ASSERT_TRUE( dmesh1.save( "mesh.tnl" ) ); ASSERT_TRUE( mesh2.load( "mesh.tnl" ) ); EXPECT_EQ( mesh2, mesh ); EXPECT_EQ( std::remove( "mesh.tnl" ), 0 ); #endif } Loading @@ -121,6 +125,7 @@ void testFinishedMesh( const Mesh& mesh ) Mesh mesh2; ASSERT_TRUE( mesh.save( "mesh.tnl" ) ); ASSERT_TRUE( mesh2.load( "mesh.tnl" ) ); EXPECT_EQ( std::remove( "mesh.tnl" ), 0 ); ASSERT_EQ( mesh, mesh2 ); compareStringRepresentation( mesh, mesh2 ); testCopyAssignment( mesh ); Loading Loading
src/UnitTests/Meshes/CMakeLists.txt +36 −15 Original line number Diff line number Diff line Loading @@ -3,22 +3,24 @@ SET_TARGET_PROPERTIES( BoundaryTagsTest${mpiExt}${debugExt} PROPERTIES COMPILE_F TARGET_LINK_LIBRARIES( BoundaryTagsTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) IF( BUILD_CUDA ) if( BUILD_CUDA ) # FIXME: nvcc fails with "Invalid memory reference" error, so we assume that ${CXX} is clang #CUDA_ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cu OPTIONS "${CXX_TESTS_FLAGS}" ) #TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} # tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cpp ) SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} cudart dl rt "-L ${CUDA_TOOLKIT_ROOT_DIR}/lib64/" ) ELSE( BUILD_CUDA ) else( BUILD_CUDA ) ADD_EXECUTABLE( MeshTest${mpiExt}${debugExt} ${headers} MeshTest.cpp ) SET_TARGET_PROPERTIES( MeshTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( MeshTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ENDIF( BUILD_CUDA ) endif( BUILD_CUDA ) ADD_EXECUTABLE( MeshEntityTest${mpiExt}${debugExt} ${headers} MeshEntityTest.cpp ) SET_TARGET_PROPERTIES( MeshEntityTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) Loading Loading @@ -54,15 +56,34 @@ if( VTK_FOUND ) AddCompilerFlag( "-DHAVE_VTK " ) if( BUILD_CUDA ) # FIXME: nvcc fails with "Invalid memory reference" error, so we assume that ${CXX} is clang #CUDA_ADD_EXECUTABLE( MeshReaderTest${mpiExt}${debugExt} ${headers} MeshTest.cu OPTIONS "${CXX_TESTS_FLAGS}" ) #TARGET_LINK_LIBRARIES( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} # vtkCommonCore # vtkIOLegacy # tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( MeshReaderTest${mpiExt}${debugExt} ${headers} MeshReaderTest.cpp ) SET_TARGET_PROPERTIES( MeshReaderTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS} -DHAVE_CUDA -x cuda --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} --cuda-gpu-arch=sm_21" ) TARGET_LINK_LIBRARIES( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} vtkCommonCore vtkIOLegacy tnl${mpiExt}${debugExt}-${tnlVersion} cudart dl rt "-L ${CUDA_TOOLKIT_ROOT_DIR}/lib64/" ) else( BUILD_CUDA ) add_executable( MeshReaderTest${mpiExt}${debugExt} MeshReaderTest.cpp ) #target_link_libraries( MeshReaderTest${mpiExt}${debugExt} # ${VTK_LIBRARIES} # tnl${debugExt}-${tnlVersion} ) target_link_libraries( MeshReaderTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} vtkCommonCore vtkIOLegacy tnl${debugExt}-${tnlVersion} ) endif( BUILD_CUDA ) else( VTK_FOUND ) message( "Please install VTK to enable the MeshReaderTest." ) Loading
src/UnitTests/Meshes/MeshReaderTest.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #include <TNL/Debugging/MemoryUsage.h> #include "MeshTest.h" using namespace TNL; using namespace TNL::Meshes; Loading Loading @@ -118,9 +120,6 @@ public: if( ! loadMesh( fileName, mesh ) ) return false; // TODO: add tests std::cout << "NOTE: there is no real test, but the file was loaded fine..." << std::endl; std::cout << "vertices: " << mesh.template getEntitiesCount< 0 >() << std::endl; std::cout << "faces: " << mesh.template getEntitiesCount< MeshType::getMeshDimension() - 1 >() << std::endl; std::cout << "cells: " << mesh.template getEntitiesCount< MeshType::getMeshDimension() >() << std::endl; Loading @@ -128,6 +127,10 @@ public: std::cout << "post-init\t"; Debugging::printMemoryUsage(); #ifdef HAVE_GTEST std::cout << "Running basic I/O tests..." << std::endl; testFinishedMesh( mesh ); #endif // mesh.save( "mesh-test.tnl" ); return true; Loading
src/UnitTests/Meshes/MeshTest.cpp +0 −4 Original line number Diff line number Diff line #ifdef HAVE_GTEST #include "gtest/gtest.h" #endif #include "MeshTest.h" int main( int argc, char* argv[] ) Loading
src/UnitTests/Meshes/MeshTest.h +5 −0 Original line number Diff line number Diff line #pragma once #ifdef HAVE_GTEST #include <gtest/gtest.h> #include <sstream> #include <TNL/Meshes/Mesh.h> Loading Loading @@ -112,6 +114,8 @@ void testMeshOnCuda( const Mesh& mesh ) ASSERT_TRUE( dmesh1.save( "mesh.tnl" ) ); ASSERT_TRUE( mesh2.load( "mesh.tnl" ) ); EXPECT_EQ( mesh2, mesh ); EXPECT_EQ( std::remove( "mesh.tnl" ), 0 ); #endif } Loading @@ -121,6 +125,7 @@ void testFinishedMesh( const Mesh& mesh ) Mesh mesh2; ASSERT_TRUE( mesh.save( "mesh.tnl" ) ); ASSERT_TRUE( mesh2.load( "mesh.tnl" ) ); EXPECT_EQ( std::remove( "mesh.tnl" ), 0 ); ASSERT_EQ( mesh, mesh2 ); compareStringRepresentation( mesh, mesh2 ); testCopyAssignment( mesh ); Loading