coding_style.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Includes ordering:
  2. Mcell3 if under extern "C"
  3. C++
  4. MCell
  5. Naming is inspired by Halide and PIP3
  6. class names (only class, not struct), including typedef over containers or other STL code: UpperCamelCase
  7. namespaces: UpperCamelCase
  8. method names: lower_underscore_case
  9. local variable names: lower_underscore_case
  10. base types (type that maps to int, float, long, vec3, ..., structs as well): lower_underscore_case_t (followed by _t)
  11. constants: CONSTANT_CASE
  12. Preactially everything except for vec3_t is a class, therefore in UpperCamelCase.
  13. Can we get rid of the _t? _t as type, everything else is a class
  14. Naming:
  15. molecule, mol, m
  16. volume molecule, vm
  17. reaction, rx
  18. index, indices - not abbreviated as idx
  19. id
  20. partition, p for variables
  21. subpartition, subpart - not sp
  22. species
  23. displacement
  24. interation
  25. pos, not position
  26. rx_radius
  27. len - distance, not length
  28. ind, ind2 - local; indent - in parameter
  29. rel - relative
  30. llf - low, left, front
  31. urb - up, right, back
  32. rcp - reciprocal ( = 1/x)
  33. no spaces like this: < a >, use this <a> instead
  34. comments start with lowercase except for /* ... */ spanning multiple lines
  35. using namespace std; - in all C++ files where needed, not in headers
  36. Parameters:
  37. outputs are always as the last arguments (unless there are some that really need to have default values)
  38. order
  39. world
  40. parition
  41. vm
  42. ...
  43. contants
  44. ...
  45. rng
  46. ...
  47. outputs
  48. use const whenever possible to explicitly specify that it is an input
  49. blocks are marked like this:
  50. // ---------------------------------- dumping methods ----------------------------------
  51. there are two newlines between functions
  52. dump methods are always at the end of a file
  53. Includes:
  54. system, mcell3, mcell4
  55. Optimization notes:
  56. diffuse - make some of the methods static?