surface_class.cpp 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include "api/surface_class.h"
  12. #include "api/surface_property.h"
  13. #include <set>
  14. using namespace std;
  15. namespace MCell {
  16. namespace API {
  17. bool SurfaceClass::__eq__(const SurfaceClass& other) const {
  18. if (!eq_nonarray_attributes(other)) {
  19. return false;
  20. }
  21. // are surface properties the same?
  22. std::set<SurfaceProperty> s1;
  23. for (auto& c: properties) {
  24. s1.insert(*c);
  25. }
  26. std::set<SurfaceProperty> s2;
  27. for (auto& c: other.properties) {
  28. s2.insert(*c);
  29. }
  30. return s1 == s2;
  31. }
  32. } // namespace API
  33. } // namespace MCell