writeDMAT.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_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. /// @tparam Mat matrix type that supports .rows(), .cols(), operator(i,j)
  20. /// @param[in] file_name path to .dmat file
  21. /// @param[in] W eigen matrix containing to-be-written coefficients
  22. /// @param[in] ascii write ascii file {true}
  23. /// @return true on success, false on error
  24. ///
  25. /// \see readDMAT
  26. template <typename DerivedW>
  27. IGL_INLINE bool writeDMAT(
  28. const std::string file_name,
  29. const Eigen::MatrixBase<DerivedW> & W,
  30. const bool ascii=true);
  31. /// \overload
  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. /// \overload
  38. template <typename Scalar>
  39. IGL_INLINE bool writeDMAT(
  40. const std::string file_name,
  41. const std::vector<Scalar > &W,
  42. const bool ascii=true);
  43. }
  44. #ifndef IGL_STATIC_LIBRARY
  45. # include "writeDMAT.cpp"
  46. #endif
  47. #endif