geometry.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. .. _api-geometry:
  2. ********
  3. Geometry
  4. ********
  5. Color
  6. =====
  7. Represents color with alpha component.
  8. Provides two means to set value, either red, green, blue and alpha,
  9. or rgba. If both color individual components and rgba are set in initialization,
  10. the individual components are used.
  11. Attributes:
  12. ***********
  13. .. _Color__red:
  14. red: float
  15. ----------
  16. | Red component in range 0-1.
  17. | - default argument value in constructor: None
  18. .. _Color__green:
  19. green: float
  20. ------------
  21. | Green component in range 0-1.
  22. | - default argument value in constructor: None
  23. .. _Color__blue:
  24. blue: float
  25. -----------
  26. | Blue component in range 0-1.
  27. | - default argument value in constructor: None
  28. .. _Color__alpha:
  29. alpha: float
  30. ------------
  31. | Alpha component in range 0-1. 1 means nontransparent.
  32. | - default argument value in constructor: 1
  33. .. _Color__rgba:
  34. rgba: int
  35. ---------
  36. | This attribute provides an alternative way of defining colors by supplying a
  37. | 32-bit unsigned integer representation of the color with an aplha channel.
  38. | In hexadecimal notation the first 2 digits are value for red, second 2 digits are
  39. | green, third 2 digits are blue and the last two digits are alpha.
  40. | The range for each component is thus 0x0-0xFF (0-255).
  41. | Example\: 0x0000ffcc represents the same color as rgba(0, 0, 100%, 80%).
  42. | All values are valid.
  43. | - default argument value in constructor: 0
  44. GeometryObject
  45. ==============
  46. Class represents geometry objects defined by triangular surface elements.
  47. Example: `1330_get_wall/geometry.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1330_get_wall/geometry.py>`_
  48. Attributes:
  49. ***********
  50. .. _GeometryObject__name:
  51. name: str
  52. ---------
  53. | Name of the object. Also represents BNGL compartment name if 'is_bngl_compartment' is True.
  54. .. _GeometryObject__vertex_list:
  55. vertex_list: List[List[float]]
  56. ------------------------------
  57. | List of [x,y,z] triplets specifying positions of individual vertices of each triangle.
  58. .. _GeometryObject__wall_list:
  59. wall_list: List[List[int]]
  60. --------------------------
  61. | List of [a,b,c] triplets specifying each wall, individual values are indices into the
  62. | vertex_list attribute.
  63. .. _GeometryObject__is_bngl_compartment:
  64. is_bngl_compartment: bool
  65. -------------------------
  66. | Set to True if this object represents a 3D BNGL compartment.
  67. | Its name will be then the BNGL compartment name.
  68. | - default argument value in constructor: False
  69. .. _GeometryObject__surface_compartment_name:
  70. surface_compartment_name: str
  71. -----------------------------
  72. | When is_bngl_compartment is True, this attribute can be set to specify its
  73. | membrane (2D) compartment name.
  74. | - default argument value in constructor: None
  75. .. _GeometryObject__surface_regions:
  76. surface_regions: List[SurfaceRegion]
  77. ------------------------------------
  78. | All surface regions associated with this geometry object.
  79. | - default argument value in constructor: None
  80. .. _GeometryObject__surface_class:
  81. surface_class: SurfaceClass
  82. ---------------------------
  83. | Surface class for the whole object's surface. It is applied to the whole surface of this object
  84. | except for those surface regions that have their specific surface class set explicitly.
  85. | - default argument value in constructor: None
  86. .. _GeometryObject__initial_surface_releases:
  87. initial_surface_releases: List[InitialSurfaceRelease]
  88. -----------------------------------------------------
  89. | Each item in this list defines either density or number of molecules to be released on this surface
  90. | regions when simulation starts.
  91. | - default argument value in constructor: None
  92. .. _GeometryObject__initial_color:
  93. initial_color: Color
  94. --------------------
  95. | Initial color for this geometry object. If a surface region has its color set, its value
  96. | is used for the walls of that surface region.
  97. | - default argument value in constructor: None
  98. .. _GeometryObject__node_type:
  99. node_type: RegionNodeType
  100. -------------------------
  101. | When this values is LeafGeometryObject, then this object is of class GeometryObject,
  102. | when LeafSurfaceRegion, then it is of class SurfaceRegion.
  103. | - default argument value in constructor: RegionNodeType.UNSET
  104. .. _GeometryObject__left_node:
  105. left_node: Region
  106. -----------------
  107. | Internal, do not use. When node_type is not Leaf, this is the left operand
  108. | - default argument value in constructor: None
  109. .. _GeometryObject__right_node:
  110. right_node: Region
  111. ------------------
  112. | Internal, do not use. When node_type is not Leaf, this is the right operand
  113. | - default argument value in constructor: None
  114. Methods:
  115. *********
  116. .. _GeometryObject__translate:
  117. translate (move: List[float])
  118. -----------------------------
  119. | Move object by a specified vector.
  120. | Cannot be called after model was initialized.
  121. * | move: List[float]
  122. | 3D vector [x, y, z] that will be added to each vertex of this object.
  123. | Example: `1400_object_translate/model.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1400_object_translate/model.py>`_
  124. .. _GeometryObject____add__:
  125. __add__ (other: Region) -> Region
  126. ---------------------------------
  127. | Computes union of two regions, use with Python operator '+'.
  128. * | other: Region
  129. .. _GeometryObject____sub__:
  130. __sub__ (other: Region) -> Region
  131. ---------------------------------
  132. | Computes difference of two regions, use with Python operator '-'.
  133. * | other: Region
  134. .. _GeometryObject____mul__:
  135. __mul__ (other: Region) -> Region
  136. ---------------------------------
  137. | Computes intersection of two regions, use with Python operator '\*'.
  138. * | other: Region
  139. Region
  140. ======
  141. Represents region construted from 1 or more multiple, usually unnamed?
  142. Attributes:
  143. ***********
  144. .. _Region__node_type:
  145. node_type: RegionNodeType
  146. -------------------------
  147. | When this values is LeafGeometryObject, then this object is of class GeometryObject,
  148. | when LeafSurfaceRegion, then it is of class SurfaceRegion.
  149. | - default argument value in constructor: RegionNodeType.UNSET
  150. .. _Region__left_node:
  151. left_node: Region
  152. -----------------
  153. | Internal, do not use. When node_type is not Leaf, this is the left operand
  154. | - default argument value in constructor: None
  155. .. _Region__right_node:
  156. right_node: Region
  157. ------------------
  158. | Internal, do not use. When node_type is not Leaf, this is the right operand
  159. | - default argument value in constructor: None
  160. Methods:
  161. *********
  162. .. _Region____add__:
  163. __add__ (other: Region) -> Region
  164. ---------------------------------
  165. | Computes union of two regions, use with Python operator '+'.
  166. * | other: Region
  167. .. _Region____sub__:
  168. __sub__ (other: Region) -> Region
  169. ---------------------------------
  170. | Computes difference of two regions, use with Python operator '-'.
  171. * | other: Region
  172. .. _Region____mul__:
  173. __mul__ (other: Region) -> Region
  174. ---------------------------------
  175. | Computes intersection of two regions, use with Python operator '\*'.
  176. * | other: Region
  177. SurfaceRegion
  178. =============
  179. Defines a region on the object. The extent of a region is given by the wall_indices list.
  180. Molecules can be added and surface properties can be set with the optional regional surface commands.
  181. You can have an arbitrary number of regions on an object, and they may overlap if
  182. you wish. Molecules added to overlapping regions accumulate. Triangles belonging to
  183. multiple regions inherit all parent regions’ surface properties. Users
  184. have to make sure that in case of overlapped regions their surface properties
  185. are compatible.
  186. Example: `1700_linear_conc_gradient_w_conc_clamp/geometry.py <https://github.com/mcellteam/mcell_tests/blob/master/tests/pymcell4_positive/1700_linear_conc_gradient_w_conc_clamp/geometry.py>`_
  187. Attributes:
  188. ***********
  189. .. _SurfaceRegion__name:
  190. name: str
  191. ---------
  192. | Name of this region.
  193. .. _SurfaceRegion__wall_indices:
  194. wall_indices: List[int]
  195. -----------------------
  196. | Surface region must be a part of a GeometryObject, items in this list are indices to
  197. | its wall_list array.
  198. .. _SurfaceRegion__surface_class:
  199. surface_class: SurfaceClass
  200. ---------------------------
  201. | Optional surface class assigned to this surface region.
  202. | If not set, it is inherited from the parent geometry object's surface_class.
  203. | - default argument value in constructor: None
  204. .. _SurfaceRegion__initial_surface_releases:
  205. initial_surface_releases: List[InitialSurfaceRelease]
  206. -----------------------------------------------------
  207. | Each item of this list defines either density or number of molecules to be released on this surface
  208. | regions when simulation starts.
  209. | - default argument value in constructor: None
  210. .. _SurfaceRegion__initial_color:
  211. initial_color: Color
  212. --------------------
  213. | Initial color for this specific surface region. If not set, color of the parent's GeometryObject is used.
  214. | - default argument value in constructor: None
  215. .. _SurfaceRegion__node_type:
  216. node_type: RegionNodeType
  217. -------------------------
  218. | When this values is LeafGeometryObject, then this object is of class GeometryObject,
  219. | when LeafSurfaceRegion, then it is of class SurfaceRegion.
  220. | - default argument value in constructor: RegionNodeType.UNSET
  221. .. _SurfaceRegion__left_node:
  222. left_node: Region
  223. -----------------
  224. | Internal, do not use. When node_type is not Leaf, this is the left operand
  225. | - default argument value in constructor: None
  226. .. _SurfaceRegion__right_node:
  227. right_node: Region
  228. ------------------
  229. | Internal, do not use. When node_type is not Leaf, this is the right operand
  230. | - default argument value in constructor: None
  231. Methods:
  232. *********
  233. .. _SurfaceRegion____add__:
  234. __add__ (other: Region) -> Region
  235. ---------------------------------
  236. | Computes union of two regions, use with Python operator '+'.
  237. * | other: Region
  238. .. _SurfaceRegion____sub__:
  239. __sub__ (other: Region) -> Region
  240. ---------------------------------
  241. | Computes difference of two regions, use with Python operator '-'.
  242. * | other: Region
  243. .. _SurfaceRegion____mul__:
  244. __mul__ (other: Region) -> Region
  245. ---------------------------------
  246. | Computes intersection of two regions, use with Python operator '\*'.
  247. * | other: Region