debug.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2020 by
  4. * The Salk Institute for Biological Studies and
  5. * Pittsburgh Supercomputing Center, Carnegie Mellon University
  6. *
  7. * Use of this source code is governed by an MIT-style
  8. * license that can be found in the LICENSE file or at
  9. * https://opensource.org/licenses/MIT.
  10. *
  11. ******************************************************************************/
  12. #include "defines.h"
  13. namespace MCell {
  14. // TODO: move to cpp
  15. static void dump_vol_mol_timing(
  16. std::string extra_comment,
  17. uint64_t iteration,
  18. molecule_id_t id,
  19. double scheduled_time, double max_time, double unimol_time,
  20. double rate_factor, double r_rate_factor, double steps, double t_steps
  21. ) {
  22. std::cout
  23. << extra_comment << ": it:" << iteration << ", id:" << id
  24. << ", scheduled_time: " << scheduled_time
  25. << ", max_time: " << max_time
  26. << ", unimol_time: " << ((unimol_time != TIME_INVALID && unimol_time != scheduled_time) ? unimol_time : 0)
  27. << ", rate_factor: " << rate_factor
  28. << ", r_rate_factor: " << r_rate_factor
  29. << ", steps: " << steps
  30. << ", t_steps: " << t_steps
  31. << "\n";
  32. }
  33. static void dump_surf_mol_timing(
  34. std::string extra_comment,
  35. uint64_t iteration,
  36. molecule_id_t id,
  37. double scheduled_time, double max_time, double unimol_time,
  38. double space_factor, double steps, double t_steps
  39. ) {
  40. std::cout
  41. << extra_comment << ": it:" << iteration << ", id:" << id
  42. << ", scheduled_time: " << scheduled_time
  43. << ", max_time: " << max_time
  44. << ", unimol_time: " << ((unimol_time != TIME_INVALID && unimol_time != scheduled_time) ? unimol_time : 0)
  45. << ", space_factor: " << space_factor
  46. << ", steps: " << steps
  47. << ", t_steps: " << t_steps
  48. << "\n";
  49. }
  50. static void dump_react_2D_all_neighbors_timing(
  51. double time,
  52. double mol_time
  53. ) {
  54. std::cout
  55. << "react_2D_all_neighbors: "
  56. << "time: " << time
  57. << ", mol_time (sm->t): " << mol_time
  58. << "\n";
  59. }
  60. static void dump_outcome_bimolecular_timing(
  61. double time
  62. ) {
  63. std::cout
  64. << "outcome_bimolecular: time: " << time
  65. << "\n";
  66. }
  67. static void dump_uint_vector(const std::vector<uint> v) {
  68. for (uint i = 0; i < v.size(); i++) {
  69. std::cout << v[i] << ", ";
  70. }
  71. std::cout << "\n";
  72. }
  73. static void dump_uint_set(const std::set<uint> s) {
  74. for (uint val: s) {
  75. std::cout << val << ", ";
  76. }
  77. std::cout << "\n";
  78. }
  79. } // namespace?