rng_state.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2020 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_RNG_STATE_H
  12. #define API_RNG_STATE_H
  13. #include "generated/gen_rng_state.h"
  14. #include "api/api_common.h"
  15. struct rng_state;
  16. namespace MCell {
  17. namespace API {
  18. class RngState: public GenRngState {
  19. public:
  20. RNG_STATE_CTOR()
  21. void check_semantics() const override {
  22. if (randslr.size() != RNG_SIZE) {
  23. throw ValueError(S("List ") + NAME_RANDSLR + " must have exactly " + std::to_string(RNG_SIZE) + " items.");
  24. }
  25. if (mm.size() != RNG_SIZE) {
  26. throw ValueError(S("List ") + NAME_MM + " must have exactly " + std::to_string(RNG_SIZE) + " items.");
  27. }
  28. }
  29. // internal, used for checkpointing
  30. RngState(const rng_state& rng);
  31. };
  32. } // namespace API
  33. } // namespace MCell
  34. #endif // API_RNG_STATE_H