writeDMAT.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  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_WRITEDMAT_H
  9. #define IGL_WRITEDMAT_H
  10. #include "igl_inline.h"
  11. // See writeDMAT.h for a description of the .dmat file type
  12. #include <Eigen/Core>
  13. #include <string>
  14. #include <vector>
  15. namespace igl
  16. {
  17. // Write a matrix using ascii dmat file type
  18. //
  19. // Template:
  20. // Mat matrix type that supports .rows(), .cols(), operator(i,j)
  21. // Inputs:
  22. // file_name path to .dmat file
  23. // W eigen matrix containing to-be-written coefficients
  24. // ascii write ascii file {true}
  25. // Returns true on success, false on error
  26. //
  27. template <typename DerivedW>
  28. IGL_INLINE bool writeDMAT(
  29. const std::string file_name,
  30. const Eigen::MatrixBase<DerivedW> & W,
  31. const bool ascii=true);
  32. template <typename Scalar>
  33. IGL_INLINE bool writeDMAT(
  34. const std::string file_name,
  35. const std::vector<std::vector<Scalar> > & W,
  36. const bool ascii=true);
  37. template <typename Scalar>
  38. IGL_INLINE bool writeDMAT(
  39. const std::string file_name,
  40. const std::vector<Scalar > &W,
  41. const bool ascii=true);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "writeDMAT.cpp"
  45. #endif
  46. #endif