Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cpp/memilio/mobility/metapopulation_mobility_instant.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void calculate_mobility_returns(Eigen::Ref<typename TimeSeries<FP>::Vector> mobi
* detect a get_infections_relative function for the Model type.
*/
template <typename FP, class Sim>
using get_infections_relative_expr_t = decltype(get_infections_relative(
using get_infections_relative_expr_t = decltype(get_infections_relative<FP>(
std::declval<const Sim&>(), std::declval<FP>(), std::declval<const Eigen::Ref<const Eigen::VectorX<FP>>&>()));

/**
Expand Down Expand Up @@ -509,7 +509,7 @@ FP get_infections_relative(const SimulationNode<FP, Sim>& node, FP t, const Eige
* detect a get_mobility_factors function for the Model type.
*/
template <typename FP, class Sim>
using get_mobility_factors_expr_t = decltype(get_mobility_factors(
using get_mobility_factors_expr_t = decltype(get_mobility_factors<FP>(
std::declval<const Sim&>(), std::declval<FP>(), std::declval<const Eigen::Ref<const Eigen::VectorX<FP>>&>()));

/**
Expand Down Expand Up @@ -541,8 +541,8 @@ auto get_mobility_factors(const SimulationNode<FP, Sim>& node, FP t, const Eigen
* detect a get_mobility_factors function for the Model type.
*/
template <typename FP, class Sim>
using test_commuters_expr_t = decltype(test_commuters(
std::declval<Sim&>(), std::declval<Eigen::Ref<const Eigen::VectorX<FP>>&>(), std::declval<FP>()));
using test_commuters_expr_t = decltype(test_commuters<FP>(
std::declval<Sim&>(), std::declval<Eigen::Ref<Eigen::VectorX<FP>>>(), std::declval<FP>()));
Comment on lines +544 to +545
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metaprogramming uses incorrect function declaration.
const& must be removed.


/**
* Test persons when moving from their source node.
Expand Down Expand Up @@ -581,7 +581,7 @@ void mio::MobilityEdge<FP>::apply_mobility(FP t, FP dt, SimulationNode<FP, Sim>&
if (dyn_npis.get_thresholds().size() > 0 &&
floating_point_greater_equal<FP>(t, m_t_last_dynamic_npi_check + dyn_npis.get_interval().get())) {
auto inf_rel =
get_infections_relative<FP, Sim>(node_from, t, node_from.get_last_state()) * dyn_npis.get_base_value();
get_infections_relative<FP>(node_from, t, node_from.get_last_state()) * dyn_npis.get_base_value();
auto exceeded_threshold = dyn_npis.get_max_exceeded_threshold(inf_rel);
if (exceeded_threshold != dyn_npis.get_thresholds().end() &&
(exceeded_threshold->first > m_dynamic_npi.first ||
Expand All @@ -602,8 +602,8 @@ void mio::MobilityEdge<FP>::apply_mobility(FP t, FP dt, SimulationNode<FP, Sim>&
if (m_return_times.get_time(i) <= t) {
auto v0 = find_value_reverse<FP>(node_to.get_result(), m_mobile_population.get_time(i), 1e-10, 1e-10);
assert(v0 != node_to.get_result().rend() && "unexpected error.");
calculate_mobility_returns<FP, Sim>(m_mobile_population[i], node_to.get_simulation(), *v0,
m_mobile_population.get_time(i), dt);
calculate_mobility_returns<FP>(m_mobile_population[i], node_to.get_simulation(), *v0,
m_mobile_population.get_time(i), dt);

//the lower-order return calculation may in rare cases produce negative compartments,
//especially at the beginning of the simulation.
Expand Down
4 changes: 2 additions & 2 deletions cpp/models/ode_secir/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ IOResult<FP> get_reproduction_number(FP t_value, const Simulation<FP, Base>& sim
* @tparam FP floating point type, e.g., double.
* @tparam Base simulation type that uses a secir compartment model; see Simulation.
*/
template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto get_mobility_factors(const Simulation<FP, Base>& sim, FP /*t*/, const Eigen::Ref<const Eigen::VectorX<FP>>& y)
{
auto& params = sim.get_model().parameters;
Expand Down Expand Up @@ -689,7 +689,7 @@ auto get_mobility_factors(const Simulation<FP, Base>& sim, FP /*t*/, const Eigen
return factors;
}

template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto test_commuters(Simulation<FP, Base>& sim, Eigen::Ref<Eigen::VectorX<FP>> mobile_population, FP time)
{
auto& model = sim.get_model();
Expand Down
4 changes: 2 additions & 2 deletions cpp/models/ode_secirts/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ FP get_infections_relative(const Simulation<FP, Base>& sim, FP /*t*/, const Eige
* @return vector expression, same size as y, with migration factors per compartment.
* @tparam Base simulation type that uses a SECIRS-type compartment model. see Simulation.
*/
template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto get_migration_factors(const Simulation<Base>& sim, FP /*t*/, const Eigen::Ref<const Eigen::VectorX<FP>>& y)
{
auto& params = sim.get_model().parameters;
Expand Down Expand Up @@ -943,7 +943,7 @@ auto get_migration_factors(const Simulation<Base>& sim, FP /*t*/, const Eigen::R
* @param[in,out] migrated Vector representing the number of commuters in each state.
* @param[in] time Current simulation time, used to determine the commuter detection period.
*/
template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto test_commuters(Simulation<FP, Base>& sim, Eigen::Ref<Eigen::VectorX<FP>> migrated, FP time)
{
auto& model = sim.get_model();
Expand Down
4 changes: 2 additions & 2 deletions cpp/models/ode_secirvvs/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ FP get_infections_relative(const Simulation<FP, Base>& sim, FP /*t*/, const Eige
* @return vector expression, same size as y, with mobility factors per compartment.
* @tparam Base simulation type that uses a secir compartment model. see Simulation.
*/
template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto get_mobility_factors(const Simulation<Base>& sim, FP /*t*/, const Eigen::Ref<const Eigen::VectorX<FP>>& y)

{
Expand Down Expand Up @@ -866,7 +866,7 @@ auto get_mobility_factors(const Simulation<Base>& sim, FP /*t*/, const Eigen::Re
return factors;
}

template <typename FP, class Base = mio::Simulation<Model<FP>, FP>>
template <typename FP, class Base = mio::Simulation<FP, Model<FP>>>
auto test_commuters(Simulation<FP, Base>& sim, Eigen::Ref<Eigen::VectorX<FP>> mobile_population, FP time)
{
auto& model = sim.get_model();
Expand Down
Loading