gen_vectors_bind.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2021 by
  4. * The Salk Institute for Biological Studies
  5. *
  6. * Use of this source code is governed by an MIT-style
  7. * license that can be found in the LICENSE file or at
  8. * https://opensource.org/licenses/MIT.
  9. *
  10. ******************************************************************************/
  11. #include "api/pybind11_stl_include.h"
  12. #include "pybind11/include/pybind11/stl_bind.h"
  13. #include "pybind11/include/pybind11/numpy.h"
  14. namespace py = pybind11;
  15. #include "api/base_chkpt_mol.h"
  16. #include "api/complex.h"
  17. #include "api/component.h"
  18. #include "api/component_type.h"
  19. #include "api/count.h"
  20. #include "api/elementary_molecule.h"
  21. #include "api/elementary_molecule_type.h"
  22. #include "api/geometry_object.h"
  23. #include "api/initial_surface_release.h"
  24. #include "api/molecule_release_info.h"
  25. #include "api/reaction_rule.h"
  26. #include "api/release_site.h"
  27. #include "api/species.h"
  28. #include "api/surface_class.h"
  29. #include "api/surface_property.h"
  30. #include "api/surface_region.h"
  31. #include "api/viz_output.h"
  32. namespace MCell {
  33. namespace API {
  34. void gen_vectors_bind(py::module& m){
  35. py::bind_vector<std::vector<std::shared_ptr<MCell::API::BaseChkptMol>>>(m,"VectorBaseChkptMol");
  36. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::BaseChkptMol>>>();
  37. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::BaseChkptMol>>>();
  38. py::bind_vector<std::vector<std::shared_ptr<MCell::API::Complex>>>(m,"VectorComplex");
  39. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::Complex>>>();
  40. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::Complex>>>();
  41. py::bind_vector<std::vector<std::shared_ptr<MCell::API::Component>>>(m,"VectorComponent");
  42. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::Component>>>();
  43. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::Component>>>();
  44. py::bind_vector<std::vector<std::shared_ptr<MCell::API::ComponentType>>>(m,"VectorComponentType");
  45. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::ComponentType>>>();
  46. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::ComponentType>>>();
  47. py::bind_vector<std::vector<std::shared_ptr<MCell::API::Count>>>(m,"VectorCount");
  48. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::Count>>>();
  49. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::Count>>>();
  50. py::bind_vector<std::vector<std::shared_ptr<MCell::API::ElementaryMolecule>>>(m,"VectorElementaryMolecule");
  51. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::ElementaryMolecule>>>();
  52. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::ElementaryMolecule>>>();
  53. py::bind_vector<std::vector<std::shared_ptr<MCell::API::ElementaryMoleculeType>>>(m,"VectorElementaryMoleculeType");
  54. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::ElementaryMoleculeType>>>();
  55. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::ElementaryMoleculeType>>>();
  56. py::bind_vector<std::vector<std::shared_ptr<MCell::API::GeometryObject>>>(m,"VectorGeometryObject");
  57. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::GeometryObject>>>();
  58. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::GeometryObject>>>();
  59. py::bind_vector<std::vector<std::shared_ptr<MCell::API::InitialSurfaceRelease>>>(m,"VectorInitialSurfaceRelease");
  60. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::InitialSurfaceRelease>>>();
  61. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::InitialSurfaceRelease>>>();
  62. py::bind_vector<std::vector<std::vector<double>>>(m,"VectorVectorFloat");
  63. py::implicitly_convertible<py::list, std::vector<std::vector<double>>>();
  64. py::implicitly_convertible<py::tuple, std::vector<std::vector<double>>>();
  65. py::bind_vector<std::vector<std::vector<int>>>(m,"VectorVectorInt");
  66. py::implicitly_convertible<py::list, std::vector<std::vector<int>>>();
  67. py::implicitly_convertible<py::tuple, std::vector<std::vector<int>>>();
  68. py::bind_vector<std::vector<std::shared_ptr<MCell::API::MoleculeReleaseInfo>>>(m,"VectorMoleculeReleaseInfo");
  69. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::MoleculeReleaseInfo>>>();
  70. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::MoleculeReleaseInfo>>>();
  71. py::bind_vector<std::vector<std::shared_ptr<MCell::API::ReactionRule>>>(m,"VectorReactionRule");
  72. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::ReactionRule>>>();
  73. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::ReactionRule>>>();
  74. py::bind_vector<std::vector<std::shared_ptr<MCell::API::ReleaseSite>>>(m,"VectorReleaseSite");
  75. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::ReleaseSite>>>();
  76. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::ReleaseSite>>>();
  77. py::bind_vector<std::vector<std::shared_ptr<MCell::API::Species>>>(m,"VectorSpecies");
  78. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::Species>>>();
  79. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::Species>>>();
  80. py::bind_vector<std::vector<std::shared_ptr<MCell::API::SurfaceClass>>>(m,"VectorSurfaceClass");
  81. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::SurfaceClass>>>();
  82. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::SurfaceClass>>>();
  83. py::bind_vector<std::vector<std::shared_ptr<MCell::API::SurfaceProperty>>>(m,"VectorSurfaceProperty");
  84. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::SurfaceProperty>>>();
  85. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::SurfaceProperty>>>();
  86. py::bind_vector<std::vector<std::shared_ptr<MCell::API::SurfaceRegion>>>(m,"VectorSurfaceRegion");
  87. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::SurfaceRegion>>>();
  88. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::SurfaceRegion>>>();
  89. py::bind_vector<std::vector<std::shared_ptr<MCell::API::VizOutput>>>(m,"VectorVizOutput");
  90. py::implicitly_convertible<py::list, std::vector<std::shared_ptr<MCell::API::VizOutput>>>();
  91. py::implicitly_convertible<py::tuple, std::vector<std::shared_ptr<MCell::API::VizOutput>>>();
  92. py::bind_vector<std::vector<double>>(m,"VectorFloat");
  93. py::implicitly_convertible<py::list, std::vector<double>>();
  94. py::implicitly_convertible<py::tuple, std::vector<double>>();
  95. py::implicitly_convertible<py::array_t<double>, std::vector<double>>();
  96. py::bind_vector<std::vector<int>>(m,"VectorInt");
  97. py::implicitly_convertible<py::list, std::vector<int>>();
  98. py::implicitly_convertible<py::tuple, std::vector<int>>();
  99. py::implicitly_convertible<py::array_t<int>, std::vector<int>>();
  100. py::bind_vector<std::vector<std::string>>(m,"VectorStr");
  101. py::implicitly_convertible<py::list, std::vector<std::string>>();
  102. py::implicitly_convertible<py::tuple, std::vector<std::string>>();
  103. py::bind_vector<std::vector<uint64_t>>(m,"VectorUint64");
  104. py::implicitly_convertible<py::list, std::vector<uint64_t>>();
  105. py::implicitly_convertible<py::tuple, std::vector<uint64_t>>();
  106. }
  107. } // namespace API
  108. } // namespace MCell