readDMAT.h 832 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef IGL_READDMAT_H
  2. #define IGL_READDMAT_H
  3. #include "igl_inline.h"
  4. // .dmat is a simple ascii matrix file type, defined as follows. The first line
  5. // is always:
  6. // <#columns> <#rows>
  7. // Then the coefficients of the matrix are given separated by whitespace with
  8. // columns running fastest.
  9. //
  10. // Example:
  11. // The matrix m = [1 2 3; 4 5 6];
  12. // corresponds to a .dmat file containing:
  13. // 3 2
  14. // 1 4 2 5 3 6
  15. #include <Eigen/Core>
  16. #include <string>
  17. namespace igl
  18. {
  19. // Read a matrix from an ascii dmat file
  20. //
  21. // Inputs:
  22. // file_name path to .dmat file
  23. // Outputs:
  24. // W eigen matrix containing read-in coefficients
  25. // Returns true on success, false on error
  26. //
  27. IGL_INLINE bool readDMAT(const std::string file_name, Eigen::MatrixXd & W);
  28. }
  29. #ifdef IGL_HEADER_ONLY
  30. # include "readDMAT.cpp"
  31. #endif
  32. #endif