writeMSH.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // high level interface for MshSaver
  2. //
  3. // Copyright (C) 2020 Vladimir Fonov <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla
  6. // Public License v. 2.0. If a copy of the MPL was not distributed
  7. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_WRITE_MSH_H
  9. #define IGL_WRITE_MSH_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. #include <vector>
  14. namespace igl
  15. {
  16. /// write triangle surface mesh and tetrahedral volume mesh to .msh file
  17. ///
  18. /// @param[in] msh - file name
  19. /// @param[in] X eigen double matrix of vertex positions #X by 3
  20. /// @param[in] Tri #Tri eigen integer matrix of triangular faces indices into vertex positions
  21. /// @param[in] Tet #Tet eigen integer matrix of tetrahedral indices into vertex positions
  22. /// @param[in] TriTag #Tri eigen integer vector of tags associated with surface faces
  23. /// @param[in] TetTag #Tet eigen integer vector of tags associated with volume elements
  24. /// @param[in] XFields #XFields list of strings with field names associated with nodes
  25. /// @param[in] XF #XFields list of eigen double matrices, fields associated with nodes
  26. /// @param[in] EFields #EFields list of strings with field names associated with elements
  27. /// @param[in] TriF #EFields list of eigen double matrices, fields associated with surface elements
  28. /// @param[in] TetF #EFields list of eigen double matrices, fields associated with volume elements
  29. ///
  30. /// \bug files are always stored in binary format
  31. /// \bug file format is 2.2
  32. /// \bug only triangle surface elements and tetrahedral volumetric elements are supported
  33. /// \bug only 3D information is supported
  34. /// \bug the tag id is duplicated for physical (0) and elementary (1)
  35. /// \bug same element fields are expected to be associated with surface elements and volumetric elements
  36. IGL_INLINE bool writeMSH(
  37. const std::string &msh,
  38. const Eigen::MatrixXd &X,
  39. const Eigen::MatrixXi &Tri,
  40. const Eigen::MatrixXi &Tet,
  41. const Eigen::MatrixXi &TriTag,
  42. const Eigen::MatrixXi &TetTag,
  43. const std::vector<std::string> &XFields,
  44. const std::vector<Eigen::MatrixXd> &XF,
  45. const std::vector<std::string> &EFields,
  46. const std::vector<Eigen::MatrixXd> &TriF,
  47. const std::vector<Eigen::MatrixXd> &TetF);
  48. }
  49. #ifndef IGL_STATIC_LIBRARY
  50. # include "writeMSH.cpp"
  51. #endif
  52. #endif //IGL_WRITE_MSH_H