tet_tet_adjacency.cpp 960 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <test_common.h>
  2. #include <igl/tet_tet_adjacency.h>
  3. #include <igl/readMESH.h>
  4. #include <iostream>
  5. TEST_CASE("tet_tet_adjacency: dot", "[igl]")
  6. {
  7. const auto test_case = [](const std::string &param)
  8. {
  9. Eigen::MatrixXd V;
  10. Eigen::MatrixXi F, T, TT,TTi;
  11. // Load example mesh: GetParam() will be name of mesh file
  12. igl::readMESH(test_common::data_path(param), V, T, F);
  13. igl::tet_tet_adjacency(T, TT, TTi);
  14. REQUIRE (TT.rows() == T.rows());
  15. REQUIRE (TTi.rows() == T.rows());
  16. REQUIRE (TT.cols() == T.cols());
  17. REQUIRE (TTi.cols() == T.cols());
  18. for(int t = 0;t<T.rows();t++)
  19. {
  20. for(int c = 0; c<4 ;c++)
  21. {
  22. if(TT(t, c) >= 0)
  23. {
  24. REQUIRE (T.rows() > TT(t, c));
  25. REQUIRE (0 <= TTi(t, c));
  26. REQUIRE (4 > TTi(t, c));
  27. REQUIRE (t == TT(TT(t, c), TTi(t,c)));
  28. }
  29. }
  30. }
  31. };
  32. test_common::run_test_cases(test_common::tet_meshes(), test_case);
  33. }