surface_class.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_SURFACE_CLASS_H
  12. #define API_SURFACE_CLASS_H
  13. #include "generated/gen_surface_class.h"
  14. #include "api/api_common.h"
  15. #include "api/surface_property.h"
  16. namespace MCell {
  17. namespace API {
  18. class SurfaceClass: public GenSurfaceClass {
  19. public:
  20. SURFACE_CLASS_CTOR()
  21. void postprocess_in_ctor() override {
  22. set_all_custom_attributes_to_default();
  23. }
  24. void set_all_custom_attributes_to_default() override {
  25. SurfaceProperty::set_all_custom_attributes_to_default();
  26. species_id = SPECIES_ID_INVALID;
  27. }
  28. void check_semantics() const override {
  29. GenSurfaceClass::check_semantics(); // does not call further derived classes
  30. if (properties.empty()) {
  31. SurfaceProperty::check_semantics_custom();
  32. }
  33. else {
  34. // type of used properties must be set
  35. for (std::shared_ptr<SurfaceProperty> property: properties) {
  36. property->check_semantics_custom();
  37. }
  38. }
  39. }
  40. bool __eq__(const SurfaceClass& other) const override;
  41. // added methods
  42. bool is_clamp() const {
  43. return type == SurfacePropertyType::CONCENTRATION_CLAMP ||
  44. type == SurfacePropertyType::FLUX_CLAMP;
  45. }
  46. // simulation engine mapping
  47. // this is the species_id created for this surface class, not for the affected species
  48. species_id_t species_id;
  49. };
  50. } // namespace API
  51. } // namespace MCell
  52. #endif // API_SURFACE_CLASS_H