constants.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. """
  2. Copyright (C) 2020 by
  3. The Salk Institute for Biological Studies
  4. Use of this source code is governed by an MIT-style
  5. license that can be found in the LICENSE file or at
  6. https://opensource.org/licenses/MIT.
  7. """
  8. # categories, defines input file names and
  9. # also ordering in documentation
  10. CATEGORY_CONSTANTS = 'constants'
  11. CATEGORIES = [
  12. CATEGORY_CONSTANTS,
  13. 'model',
  14. 'simulation_setup',
  15. 'subsystem',
  16. 'geometry',
  17. 'instantiation',
  18. 'observables',
  19. 'callbacks',
  20. 'introspection',
  21. 'checkpointing',
  22. 'submodules',
  23. ]
  24. COPYRIGHT = \
  25. """/******************************************************************************
  26. *
  27. * Copyright (C) 2021 by
  28. * The Salk Institute for Biological Studies
  29. *
  30. * Use of this source code is governed by an MIT-style
  31. * license that can be found in the LICENSE file or at
  32. * https://opensource.org/licenses/MIT.
  33. *
  34. ******************************************************************************/\n
  35. """
  36. EXAMPLES_BASE_URL = 'https://github.com/mcellteam/mcell_tests/blob/master/'
  37. TARGET_DIRECTORY = '..' + '/' + 'generated'
  38. DOC_DIRECTORY = '..' + '/' + 'documentation' + '/' + 'generated'
  39. API_DIRECTORY = 'api'
  40. WORK_DIRECTORY = '..' + '/' + 'work'
  41. KEY_ITEMS = 'items'
  42. KEY_NAME = 'name'
  43. ATTR_NAME_NAME = 'name' # attrribute with name 'name' is already defined in BaseDataClass
  44. KEY_TYPE = 'type'
  45. KEY_VALUE = 'value'
  46. KEY_VALUES = 'values'
  47. KEY_DEFAULT = 'default'
  48. KEY_DOC = 'doc'
  49. KEY_EXAMPLES = 'examples'
  50. KEY_CATEGORY = 'category' # set from input file name
  51. KEY_SUPERCLASS = 'superclass'
  52. KEY_SUPERCLASSES = 'superclasses'
  53. KEY_CONSTANTS = 'constants'
  54. KEY_ENUMS = 'enums'
  55. KEY_METHODS = 'methods'
  56. KEY_PARAMS = 'params'
  57. KEY_RETURN_TYPE = 'return_type'
  58. KEY_IS_CONST = 'is_const'
  59. KEY_INHERITED = 'inherited' # used only internally, not in input YAML
  60. KEY_NOT_AS_CTOR_ARG = 'not_as_ctor_arg'
  61. VALUE_CLASS = 'class'
  62. VALUE_SUBMODULE = 'submodule'
  63. YAML_TYPE_PY_OBJECT = 'py::object'
  64. YAML_TYPE_FLOAT = 'float'
  65. YAML_TYPE_STR = 'str'
  66. YAML_TYPE_INT = 'int'
  67. YAML_TYPE_UINT32 = 'uint32'
  68. YAML_TYPE_UINT64 = 'uint64'
  69. YAML_TYPE_BOOL = 'bool'
  70. YAML_TYPE_VEC2 = 'Vec2'
  71. YAML_TYPE_VEC3 = 'Vec3'
  72. YAML_TYPE_IVEC3 = 'IVec3'
  73. YAML_TYPE_LIST = 'List'
  74. YAML_TYPE_DICT = 'Dict'
  75. YAML_TYPE_SPECIES = 'Species'
  76. YAML_TYPE_ORIENTATION = 'Orientation'
  77. YAML_TYPE_FUNCTION = 'std::function'
  78. PYBIND_TYPE_OBJECT = 'object'
  79. PY_CAST = 'py::cast'
  80. CPP_TYPE_FLOAT = 'float'
  81. CPP_TYPE_DOUBLE = 'double'
  82. CPP_TYPE_STR = 'std::string'
  83. CPP_TYPE_INT = 'int'
  84. CPP_TYPE_UINT32 = 'uint'
  85. CPP_TYPE_UINT64 = 'uint64_t'
  86. CPP_TYPE_BOOL = 'bool'
  87. CPP_TYPE_VEC2 = 'Vec2'
  88. CPP_TYPE_VEC3 = 'Vec3'
  89. CPP_TYPE_IVEC3 = 'IVec3'
  90. CPP_VECTOR_TYPE = 'std::vector'
  91. CPP_MAP_TYPE = 'std::map'
  92. CPP_NONREFERENCE_TYPES = [CPP_TYPE_DOUBLE, CPP_TYPE_INT, CPP_TYPE_UINT64, CPP_TYPE_UINT32, CPP_TYPE_BOOL] # + CPP_VECTOR_TYPE but it must be checked with .startswith
  93. CPP_REFERENCE_TYPES = [CPP_TYPE_STR, CPP_TYPE_VEC2, CPP_TYPE_VEC3, CPP_TYPE_IVEC3, CPP_VECTOR_TYPE]
  94. UNSET_VALUE = 'unset'
  95. EMPTY_ARRAY = 'empty'
  96. UNSET_VALUE_FLOAT = 'FLT_UNSET'
  97. UNSET_VALUE_STR = 'STR_UNSET'
  98. UNSET_VALUE_INT = 'INT_UNSET'
  99. UNSET_VALUE_UINT64 = '0' # default value, not unset
  100. UNSET_VALUE_UINT32 = '0' # default value, not unset
  101. UNSET_VALUE_VEC2 = 'VEC2_UNSET'
  102. UNSET_VALUE_VEC3 = 'VEC3_UNSET'
  103. UNSET_VALUE_ORIENTATION = 'Orientation::NOT_SET'
  104. UNSET_VALUE_PTR = 'nullptr'
  105. PY_NONE = 'None'
  106. GEN_PREFIX = 'gen_'
  107. GEN_GUARD_PREFIX = 'API_GEN_'
  108. API_GUARD_PREFIX = 'API_'
  109. GUARD_SUFFIX = '_H'
  110. CTOR_SUFFIX = '_CTOR'
  111. CTOR_NOARGS_SUFFIX = '_CTOR_NOARGS'
  112. EXT_CPP = 'cpp'
  113. EXT_H = 'h'
  114. GEN_CLASS_PREFIX = 'Gen'
  115. BASE_DATA_CLASS = 'BaseDataClass'
  116. BASE_INTROSPECTION_CLASS = 'BaseIntrospectionClass'
  117. BASE_EXPORT_CLASS = 'BaseExportClass'
  118. CLASS_NAME_MODEL = 'Model'
  119. CLASS_NAME_SUBSYSTEM = 'Subsystem'
  120. CLASS_NAME_INSTANTIATION = 'Instantiation'
  121. CLASS_NAME_OBSERVABLES = 'Observables'
  122. CTOR_POSTPROCESS = 'postprocess_in_ctor'
  123. RET_CTOR_POSTPROCESS = 'void'
  124. COPY_NAME = 'copy'
  125. DEEPCOPY_NAME = 'deepcopy'
  126. DEEPCOPY_VEC = 'deepcopy_vec'
  127. DEEPCOPY_VEC_VEC = 'deepcopy_vec_vec'
  128. IS_SET = 'is_set'
  129. DEFAULT_CTOR_ARG_TYPE = 'DefaultCtorArgType'
  130. RET_TYPE_CHECK_SEMANTICS = 'void'
  131. CHECK_SEMANTICS = 'check_semantics'
  132. DECL_CHECK_SEMANTICS = CHECK_SEMANTICS + '() const'
  133. DECL_DEFINE_PYBINDIND_CONSTANTS = 'void define_pybinding_constants(py::module& m)'
  134. DECL_DEFINE_PYBINDIND_ENUMS = 'void define_pybinding_enums(py::module& m)'
  135. DECL_SET_INITIALIZED = 'set_initialized()'
  136. RET_TYPE_SET_ALL_DEFAULT_OR_UNSET = 'void'
  137. SET_ALL_DEFAULT_OR_UNSET_DECL = 'set_all_attributes_as_default_or_unset()'
  138. SET_ALL_CUSTOM_TO_DEFAULT_DECL = 'set_all_custom_attributes_to_default()'
  139. RET_TYPE_TO_STR = 'std::string'
  140. SHARED_PTR = 'std::shared_ptr'
  141. MAKE_SHARED = 'std::make_shared'
  142. DECL_TO_STR_W_DEFAULT = 'to_str(const bool all_details=false, const std::string ind="") const'
  143. DECL_TO_STR = 'to_str(const bool all_details, const std::string ind) const'
  144. RET_TYPE_EXPORT_TO_PYTHON = 'std::string'
  145. CTX = 'ctx'
  146. EXPORTED_NAME = 'exported_name'
  147. EXPORT_TO_PYTHON_ARGS = 'std::ostream& out, PythonExportContext& ' + CTX
  148. DECL_EXPORT_TO_PYTHON = 'export_to_python(' + EXPORT_TO_PYTHON_ARGS + ')'
  149. EXPORT_VEC_PREFIX = 'export_vec_'
  150. M_DOT = 'm.'
  151. KEYWORD_OVERRIDE = 'override'
  152. KEYWORD_VIRTUAL = 'virtual'
  153. CLASS_NAME_ATTR = 'class_name'
  154. CACHED_DATA_ARE_UPTODATE_ATTR = 'cached_data_are_uptodate'
  155. GEN_VECTORS_BIND = 'gen_vectors_bind(py::module& m)'
  156. GEN_CONSTANTS_H = 'gen_constants.h'
  157. GEN_CONSTANTS_CPP = 'gen_constants.cpp'
  158. GEN_VECTORS_MAKE_OPAQUE_H = 'gen_vectors_make_opaque.h'
  159. GEN_VECTORS_BIND_CPP = 'gen_vectors_bind.cpp'
  160. MCELL_PYI = 'mcell.pyi'
  161. EXT_RST = '.rst'
  162. API_RST = 'api' + EXT_RST
  163. GEN_NAMES_H = 'gen_names.h'
  164. NAME_PREFIX = 'NAME_'
  165. CLASS_PREFIX = 'CLASS_'
  166. ENUM_PREFIX = 'ENUM_'
  167. ENUM_VALUE_PREFIX = 'EV_'
  168. CONSTANT_VALUE_PREFIX = 'CV_'
  169. INCLUDE_API_MCELL_H = '#include "api/mcell.h"'
  170. INCLUDE_API_COMMON_H = '#include "api/api_common.h"'
  171. INCLUDE_API_PYTHON_EXPORT_UTILS_H = '#include "api/python_export_utils.h"'
  172. INCLUDE_API_BASE_DATA_CLASS_H = '#include "api/base_data_class.h"'
  173. INCLUDE_API_BASE_EXPORT_CLASS_H = '#include "api/base_export_class.h"'
  174. INCLUDE_API_BASE_INTROSPECTION_CLASS_H = '#include "api/base_introspection_class.h"'
  175. NAMESPACES_BEGIN = 'namespace MCell {\nnamespace API {'
  176. NAMESPACES_END = '} // namespace API\n} // namespace MCell'
  177. VEC_NONPTR_TO_STR = 'vec_nonptr_to_str'
  178. VEC_PTR_TO_STR = 'vec_ptr_to_str'
  179. F_TO_STR = 'f_to_str'
  180. PY_BIND_VECTOR = 'py::bind_vector'
  181. PY_IMPLICITLY_CONVERTIBLE = 'py::implicitly_convertible'
  182. PYBIND11_MAKE_OPAQUE = 'PYBIND11_MAKE_OPAQUE'