gen_wall.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. #ifndef API_GEN_WALL_H
  12. #define API_GEN_WALL_H
  13. #include "api/api_common.h"
  14. #include "api/base_introspection_class.h"
  15. namespace MCell {
  16. namespace API {
  17. class Wall;
  18. class GeometryObject;
  19. class PythonExportContext;
  20. #define WALL_CTOR_NOARGS() \
  21. Wall( \
  22. ) { \
  23. class_name = "Wall"; \
  24. geometry_object = nullptr; \
  25. wall_index = INT_UNSET; \
  26. vertices = std::vector<std::vector<double>>(); \
  27. area = FLT_UNSET; \
  28. unit_normal = std::vector<double>(); \
  29. is_movable = true; \
  30. postprocess_in_ctor(); \
  31. check_semantics(); \
  32. } \
  33. Wall(DefaultCtorArgType) : \
  34. GenWall(DefaultCtorArgType()) { \
  35. set_all_attributes_as_default_or_unset(); \
  36. set_all_custom_attributes_to_default(); \
  37. }
  38. class GenWall: public BaseIntrospectionClass {
  39. public:
  40. GenWall() {
  41. }
  42. GenWall(DefaultCtorArgType) {
  43. }
  44. void postprocess_in_ctor() override {}
  45. void check_semantics() const override;
  46. void set_initialized() override;
  47. void set_all_attributes_as_default_or_unset() override;
  48. std::shared_ptr<Wall> copy_wall() const;
  49. std::shared_ptr<Wall> deepcopy_wall(py::dict = py::dict()) const;
  50. virtual bool __eq__(const Wall& other) const;
  51. virtual bool eq_nonarray_attributes(const Wall& other, const bool ignore_name = false) const;
  52. bool operator == (const Wall& other) const { return __eq__(other);}
  53. bool operator != (const Wall& other) const { return !__eq__(other);}
  54. std::string to_str(const bool all_details=false, const std::string ind="") const override;
  55. // --- attributes ---
  56. std::shared_ptr<GeometryObject> geometry_object;
  57. virtual void set_geometry_object(std::shared_ptr<GeometryObject> new_geometry_object_) {
  58. if (initialized) {
  59. throw RuntimeError("Value 'geometry_object' of object with name " + name + " (class " + class_name + ") "
  60. "cannot be set after model was initialized.");
  61. }
  62. cached_data_are_uptodate = false;
  63. geometry_object = new_geometry_object_;
  64. }
  65. virtual std::shared_ptr<GeometryObject> get_geometry_object() const {
  66. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  67. return geometry_object;
  68. }
  69. int wall_index;
  70. virtual void set_wall_index(const int new_wall_index_) {
  71. if (initialized) {
  72. throw RuntimeError("Value 'wall_index' of object with name " + name + " (class " + class_name + ") "
  73. "cannot be set after model was initialized.");
  74. }
  75. cached_data_are_uptodate = false;
  76. wall_index = new_wall_index_;
  77. }
  78. virtual int get_wall_index() const {
  79. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  80. return wall_index;
  81. }
  82. std::vector<std::vector<double>> vertices;
  83. virtual void set_vertices(const std::vector<std::vector<double>> new_vertices_) {
  84. if (initialized) {
  85. throw RuntimeError("Value 'vertices' of object with name " + name + " (class " + class_name + ") "
  86. "cannot be set after model was initialized.");
  87. }
  88. cached_data_are_uptodate = false;
  89. vertices = new_vertices_;
  90. }
  91. virtual std::vector<std::vector<double>>& get_vertices() {
  92. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  93. return vertices;
  94. }
  95. double area;
  96. virtual void set_area(const double new_area_) {
  97. if (initialized) {
  98. throw RuntimeError("Value 'area' of object with name " + name + " (class " + class_name + ") "
  99. "cannot be set after model was initialized.");
  100. }
  101. cached_data_are_uptodate = false;
  102. area = new_area_;
  103. }
  104. virtual double get_area() const {
  105. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  106. return area;
  107. }
  108. std::vector<double> unit_normal;
  109. virtual void set_unit_normal(const std::vector<double> new_unit_normal_) {
  110. if (initialized) {
  111. throw RuntimeError("Value 'unit_normal' of object with name " + name + " (class " + class_name + ") "
  112. "cannot be set after model was initialized.");
  113. }
  114. cached_data_are_uptodate = false;
  115. unit_normal = new_unit_normal_;
  116. }
  117. virtual std::vector<double>& get_unit_normal() {
  118. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  119. return unit_normal;
  120. }
  121. bool is_movable;
  122. virtual void set_is_movable(const bool new_is_movable_) {
  123. if (initialized) {
  124. throw RuntimeError("Value 'is_movable' of object with name " + name + " (class " + class_name + ") "
  125. "cannot be set after model was initialized.");
  126. }
  127. cached_data_are_uptodate = false;
  128. is_movable = new_is_movable_;
  129. }
  130. virtual bool get_is_movable() const {
  131. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  132. return is_movable;
  133. }
  134. // --- methods ---
  135. }; // GenWall
  136. class Wall;
  137. py::class_<Wall> define_pybinding_Wall(py::module& m);
  138. } // namespace API
  139. } // namespace MCell
  140. #endif // API_GEN_WALL_H