test_common.h 782 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <string>
  3. #include <Eigen/Core>
  4. #include <gtest/gtest.h>
  5. #include <igl/read_triangle_mesh.h>
  6. #include <igl/readDMAT.h>
  7. namespace test_common {
  8. template<typename DerivedV, typename DerivedF>
  9. void load_mesh(
  10. const std::string& filename,
  11. Eigen::PlainObjectBase<DerivedV>& V,
  12. Eigen::PlainObjectBase<DerivedF>& F) {
  13. auto find_file = [&](const std::string& val) {
  14. return std::string(TEST_DIR) + "/data/" + val;
  15. };
  16. igl::read_triangle_mesh(find_file(filename), V, F);
  17. }
  18. template<typename Derived>
  19. void load_matrix(const std::string& filename,
  20. Eigen::PlainObjectBase<Derived>& M) {
  21. igl::readDMAT(std::string(TEST_DIR) + "/data/" + filename, M);
  22. }
  23. }