readCSV.h 915 B

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_READ_CSV_H
  9. #define IGL_READ_CSV_H
  10. #include "igl/igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. #include <vector>
  14. namespace igl
  15. {
  16. /// read a matrix from a csv file into a Eigen matrix
  17. /// @tparam Scalar type for the matrix
  18. /// @param[in] str path to .csv file
  19. /// @param[out] M eigen matrix
  20. /// @return true on success
  21. template <typename Scalar>
  22. IGL_INLINE bool readCSV(
  23. const std::string str,
  24. Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic>& M);
  25. }
  26. #ifndef IGL_STATIC_LIBRARY
  27. # include "readCSV.cpp"
  28. #endif
  29. #endif