python_exporter.h 1.8 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 LIBMCELL_API_PYTHON_EXPORTER_H_
  12. #define LIBMCELL_API_PYTHON_EXPORTER_H_
  13. #include <string>
  14. #include <map>
  15. #include <ostream>
  16. namespace MCell {
  17. class World;
  18. namespace API {
  19. class Model;
  20. class PythonExportContext;
  21. class PythonExporter {
  22. public:
  23. PythonExporter(Model* model_);
  24. void save_checkpoint(const std::string& output_dir_);
  25. private:
  26. void open_and_check_file(
  27. const std::string file_name, std::ofstream& out,
  28. const bool for_append = false,
  29. const bool bngl = false);
  30. std::string export_subsystem(PythonExportContext& ctx);
  31. std::string export_geometry(PythonExportContext& ctx);
  32. std::string export_instantiation(PythonExportContext& ctx, const std::string& geometry_objects_name);
  33. std::string export_observables(PythonExportContext& ctx);
  34. void export_simulation_state(
  35. PythonExportContext& ctx, std::map<std::string, std::string>& config_variable_names);
  36. void export_molecules(std::ostream& out, PythonExportContext& ctx);
  37. std::string export_model(
  38. PythonExportContext& ctx,
  39. const std::string& subsystem_name,
  40. const std::string& instantiation_name,
  41. const std::string& observables_name,
  42. const std::map<std::string, std::string>& config_variable_names);
  43. void export_checkpoint_iterations(std::ostream& out);
  44. Model* model;
  45. World* world;
  46. std::string output_dir;
  47. };
  48. } // namespace API
  49. } // namespace MCell
  50. #endif /* LIBMCELL_API_PYTHON_EXPORTER_H_ */