Browse Source

added suffix for shield template classes

refactoring
Thomas Knoll 1 year ago
parent
commit
12bcd67300
  1. 16
      src/mod_shields.cpp
  2. 10
      src/shields/abstract_shield.cpp
  3. 2
      src/shields/abstract_shield.h
  4. 10
      src/shields/optimal_shield.cpp
  5. 2
      src/shields/optimal_shield.h
  6. 10
      src/shields/post_shield.cpp
  7. 2
      src/shields/post_shield.h
  8. 12
      src/shields/pre_shield.cpp
  9. 2
      src/shields/pre_shield.h

16
src/mod_shields.cpp

@ -22,12 +22,12 @@ PYBIND11_MODULE(shields, m) {
define_pet(m); define_pet(m);
define_add(m); define_add(m);
define_abstract_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m);
define_abstract_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m);
define_pre_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m);
define_pre_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m);
define_post_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m);
define_post_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m);
define_optimal_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m);
define_optimal_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m);
define_abstract_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m, "Double");
define_abstract_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m, "Exact");
define_pre_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m, "Double");
define_pre_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m, "Exact");
define_post_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m, "Double");
define_post_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m, "Exact");
define_optimal_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(m, "Double");
define_optimal_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(m, "Exact");
} }

10
src/shields/abstract_shield.cpp

@ -7,14 +7,16 @@
#include "storm/storage/Distribution.h" #include "storm/storage/Distribution.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_abstract_shield(py::module& m) {
void define_abstract_shield(py::module& m, std::string vt_suffix) {
using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>; using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>;
py::class_<AbstractShield>(m, "AbstractShield")
std::string shieldClassName = std::string("AbstractShield") + vt_suffix;
py::class_<AbstractShield>(m, shieldClassName.c_str())
.def("compute_row_group_size", &AbstractShield::computeRowGroupSizes) .def("compute_row_group_size", &AbstractShield::computeRowGroupSizes)
.def("get_class_name", &AbstractShield::getClassName) .def("get_class_name", &AbstractShield::getClassName)
.def("get_optimization_direction", &AbstractShield::getOptimizationDirection) .def("get_optimization_direction", &AbstractShield::getOptimizationDirection)
; ;
} }
template void define_abstract_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m);
template void define_abstract_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m);
template void define_abstract_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m, std::string vt_suffix);
template void define_abstract_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m, std::string vt_suffix);

2
src/shields/abstract_shield.h

@ -3,4 +3,4 @@
#include "common.h" #include "common.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_abstract_shield(py::module& m);
void define_abstract_shield(py::module& m, std::string vt_suffix);

10
src/shields/optimal_shield.cpp

@ -4,13 +4,15 @@
#include "storm/shields/OptimalShield.h" #include "storm/shields/OptimalShield.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_optimal_shield(py::module& m) {
void define_optimal_shield(py::module& m, std::string vt_suffix) {
using OptimalShield = tempest::shields::OptimalShield<ValueType, IndexType>; using OptimalShield = tempest::shields::OptimalShield<ValueType, IndexType>;
using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>; using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>;
py::class_<OptimalShield, AbstractShield>(m, "OptimalShield")
std::string shieldClassName = std::string("OptimalShield") + vt_suffix;
py::class_<OptimalShield, AbstractShield>(m, shieldClassName.c_str())
; ;
} }
template void define_optimal_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m);
template void define_optimal_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m);
template void define_optimal_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m, std::string vt_suffix);
template void define_optimal_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m, std::string vt_suffix);

2
src/shields/optimal_shield.h

@ -3,4 +3,4 @@
#include "common.h" #include "common.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_optimal_shield(py::module& m);
void define_optimal_shield(py::module& m, std::string vt_suffix);

10
src/shields/post_shield.cpp

@ -4,14 +4,16 @@
#include "storm/shields/PostShield.h" #include "storm/shields/PostShield.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_post_shield(py::module& m) {
void define_post_shield(py::module& m, std::string vt_suffix) {
using PostShield = tempest::shields::PostShield<ValueType, IndexType>; using PostShield = tempest::shields::PostShield<ValueType, IndexType>;
using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>; using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>;
std::string shieldClassName = std::string("PostShield") + vt_suffix;
py::class_<PostShield, AbstractShield>(m, "PostShield")
py::class_<PostShield, AbstractShield>(m, shieldClassName.c_str())
; ;
} }
template void define_post_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m);
template void define_post_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m);
template void define_post_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m, std::string vt_suffix);
template void define_post_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m, std::string vt_suffix);

2
src/shields/post_shield.h

@ -3,4 +3,4 @@
#include "common.h" #include "common.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_post_shield(py::module& m);
void define_post_shield(py::module& m, std::string vt_suffix);

12
src/shields/pre_shield.cpp

@ -11,12 +11,16 @@
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_pre_shield(py::module& m) {
void define_pre_shield(py::module& m, std::string vt_suffix) {
using PreShield = tempest::shields::PreShield<ValueType, IndexType>; using PreShield = tempest::shields::PreShield<ValueType, IndexType>;
using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>; using AbstractShield = tempest::shields::AbstractShield<ValueType, IndexType>;
py::class_<PreShield, AbstractShield>(m, "PreShield")
std::string shieldClassName = std::string("PreShield") + vt_suffix;
py::class_<PreShield, AbstractShield>(m, shieldClassName.c_str())
; ;
} }
template void define_pre_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m);
template void define_pre_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m);
template void define_pre_shield<double, typename storm::storage::SparseMatrix<double>::index_type>(py::module& m, std::string vt_suffix);
template void define_pre_shield<storm::RationalNumber, typename storm::storage::SparseMatrix<storm::RationalNumber>::index_type>(py::module& m, std::string vt_suffix);

2
src/shields/pre_shield.h

@ -3,4 +3,4 @@
#include "common.h" #include "common.h"
template <typename ValueType, typename IndexType> template <typename ValueType, typename IndexType>
void define_pre_shield(py::module& m);
void define_pre_shield(py::module& m, std::string vt_suffix);
Loading…
Cancel
Save