chkpt_surf_mol.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/chkpt_surf_mol.h"
  12. #include "api/api_utils.h"
  13. #include "api/geometry_object.h"
  14. #include "src4/molecule.h"
  15. #include "src4/geometry.h"
  16. #include "src4/partition.h"
  17. using namespace std;
  18. namespace MCell {
  19. namespace API {
  20. ChkptSurfMol::ChkptSurfMol(
  21. const MCell::Molecule& sm,
  22. const IdSpeciesMap& id_species_map, const double time_unit,
  23. const double length_unit,
  24. const MCell::Partition& p,
  25. const IdGeometryObjectMap& id_geometry_object_map) :
  26. GEN_CHKPT_MOL_CTOR(GenChkptSurfMol, sm, id_species_map, time_unit) {
  27. assert(sm.id != MOLECULE_ID_INVALID);
  28. type = MoleculeType::SURFACE;
  29. pos = sm.s.pos * Vec2(length_unit);
  30. orientation = convert_mcell_orientation(sm.s.orientation);
  31. const Wall& w = p.get_wall(sm.s.wall_index);
  32. auto it = id_geometry_object_map.find(w.object_id);
  33. assert(it != id_geometry_object_map.end());
  34. geometry_object = it->second;
  35. wall_index = geometry_object->get_object_wall_index(sm.s.wall_index);
  36. grid_tile_index = sm.s.grid_tile_index;
  37. }
  38. } // namespace API
  39. } // namespace MCell