Skip to content

examples/ode_secir_graph.cpp does not use test_commuters overload #1382

@julianlitz

Description

@julianlitz

Description:
While running the ode_secir_graph.cpp example, the test_commuters logic is not executed correctly. Instead, the fallback (empty) overload of test_commuters is always chosen.

Details:

  • The intended overload test_commuters(FP, Simulation<FP, Model<FP>>&, Eigen::Ref<Eigen::VectorX<FP>>, FP) is not found by the metaprogramming detection in test_commuters_expr_t.
  • As a result, commuter testing is skipped in the example.
  • Debug output confirms that execution always falls back to the empty implementation with:
template <typename FP, class Sim,
          std::enable_if_t<!is_expression_valid<test_commuters_expr_t, Sim>::value, void*> = nullptr>
void test_commuters(SimulationNode<FP, Sim>& /*node*/, Eigen::Ref<Eigen::VectorX<FP>> /*mobile_population*/,
                    FP /*time*/)
{
    std::cout << "Fallback to empty implementation" << std::endl;
}

template <typename FP, class Sim,
          std::enable_if_t<is_expression_valid<test_commuters_expr_t, Sim>::value, void*> = nullptr>
void test_commuters(SimulationNode<FP, Sim>& node, Eigen::Ref<Eigen::VectorX<FP>> mobile_population, FP time)
{
    return test_commuters<FP, Sim>(node.get_simulation(), mobile_population, time);
}

Impact:
The mobility simulation runs without applying commuter testing.

Version

Linux

To reproduce

./../build/bin/ode_secir_graph_example

Relevant log output

Add any relevant information, e.g. used compiler, screenshots.

Checklist

  • Attached labels, especially loc:: or model:: labels.
  • Linked to project

Metadata

Metadata

Assignees

Labels

class::bugBugs found in the software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions