api_config.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // NOTE: this file should be called config.h, however with MSVC, there is
  12. // an include collision and pybind11 includes it instead of some other file
  13. #ifndef LIBMCELL_API_CONFIG_H
  14. #define LIBMCELL_API_CONFIG_H
  15. #include "generated/gen_config.h"
  16. #include "api/api_common.h"
  17. namespace MCell {
  18. namespace API {
  19. class Config: public GenConfig {
  20. public:
  21. CONFIG_CTOR()
  22. void check_semantics() const override {
  23. GenConfig::check_semantics();
  24. if (cmp_gt(subpartition_dimension, partition_dimension, EPS)) {
  25. throw ValueError(S("Value ") + NAME_SUBPARTITION_DIMENSION + " must be smaller or equal than " + NAME_PARTITION_DIMENSION + ".");
  26. }
  27. if (is_set(initial_partition_origin)) {
  28. if (initial_partition_origin.size() != 3) {
  29. throw ValueError(S("Value ") + NAME_INITIAL_PARTITION_ORIGIN + " must be a vector of three floating point values.");
  30. }
  31. }
  32. }
  33. };
  34. } // namespace API
  35. } // namespace MCell
  36. #endif // LIBMCELL_API_CONFIG_H