You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.3 KiB

  1. #pragma once
  2. #include "storm/settings/SettingsManager.h"
  3. #include "storm/utility/DirectEncodingExporter.h"
  4. #include "storm/utility/DDEncodingExporter.h"
  5. #include "storm/utility/file.h"
  6. #include "storm/utility/macros.h"
  7. #include "storm/storage/Scheduler.h"
  8. namespace storm {
  9. namespace jani {
  10. class Model;
  11. }
  12. namespace api {
  13. void exportJaniModelAsDot(storm::jani::Model const& model, std::string const& filename);
  14. template <typename ValueType>
  15. void exportSparseModelAsDrn(std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model, std::string const& filename, std::vector<std::string> const& parameterNames = {}) {
  16. std::ofstream stream;
  17. storm::utility::openFile(filename, stream);
  18. storm::exporter::explicitExportSparseModel(stream, model, parameterNames);
  19. storm::utility::closeFile(stream);
  20. }
  21. template<storm::dd::DdType Type, typename ValueType>
  22. void exportSparseModelAsDrdd(std::shared_ptr<storm::models::symbolic::Model<Type,ValueType>> const& model, std::string const& filename) {
  23. storm::exporter::explicitExportSymbolicModel(filename, model);
  24. }
  25. template <typename ValueType>
  26. void exportSparseModelAsDot(std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model, std::string const& filename, size_t maxWidth = 30) {
  27. std::ofstream stream;
  28. storm::utility::openFile(filename, stream);
  29. model->writeDotToStream(stream, maxWidth);
  30. storm::utility::closeFile(stream);
  31. }
  32. template<storm::dd::DdType Type, typename ValueType>
  33. void exportSymbolicModelAsDot(std::shared_ptr<storm::models::symbolic::Model<Type,ValueType>> const& model, std::string const& filename) {
  34. model->writeDotToFile(filename);
  35. }
  36. template <typename ValueType>
  37. void exportScheduler(std::shared_ptr<storm::models::sparse::Model<ValueType>> const& model, storm::storage::Scheduler<ValueType> const& scheduler, std::string const& filename) {
  38. std::ofstream stream;
  39. storm::utility::openFile(filename, stream);
  40. scheduler.printToStream(stream, model);
  41. storm::utility::closeFile(stream);
  42. }
  43. }
  44. }