1370-1 Move function definitions from .cpp to header for upcoming templatization#1374
1370-1 Move function definitions from .cpp to header for upcoming templatization#1374julianlitz wants to merge 4 commits intomainfrom
Conversation
| #include "memilio/math/eigen.h" | ||
| #include "memilio/utils/logging.h" | ||
|
|
||
| #ifdef MEMILIO_HAS_HDF5 | ||
| #include "memilio/io/hdf5_cpp.h" | ||
| #endif // MEMILIO_HAS_HDF5 | ||
|
|
||
| #include <iostream> | ||
| #include <fstream> | ||
| #include <string> | ||
| #include <vector> |
There was a problem hiding this comment.
Includes are now needed in header instead.
| * @param filename name of file to be read | ||
| */ | ||
| IOResult<Eigen::MatrixXd> read_mobility_formatted(const std::string& filename); | ||
| template <typename FP = ScalarType> |
There was a problem hiding this comment.
Add a dummy template to be able to move it to the header without conflicts.
| IOResult<void> save_edges(const std::vector<std::vector<TimeSeries<ScalarType>>>& ensemble_edges, | ||
| const std::vector<std::pair<int, int>>& pairs_edges, const fs::path& result_dir, | ||
| bool save_single_runs = true, bool save_percentiles = true); | ||
| bool save_single_runs = true, bool save_percentiles = true) |
There was a problem hiding this comment.
Ensure keeping default setting
bool save_percentiles = true
| // Forward declaration of get_region_id | ||
| int get_region_id(int id); |
There was a problem hiding this comment.
Add forward declaration for in .cpp remaining functions.
| IOResult<void> read_confirmed_cases_data( | ||
| std::string const& path, std::vector<int> const& vregion, Date date, std::vector<std::vector<double>>& num_Exposed, | ||
| std::vector<std::vector<double>>& num_InfectedNoSymptoms, std::vector<std::vector<double>>& num_InfectedSymptoms, | ||
| std::vector<std::vector<double>>& num_InfectedSevere, std::vector<std::vector<double>>& num_icu, | ||
| std::vector<std::vector<double>>& num_death, std::vector<std::vector<double>>& num_rec, | ||
| const std::vector<std::vector<int>>& t_Exposed, const std::vector<std::vector<int>>& t_InfectedNoSymptoms, | ||
| const std::vector<std::vector<int>>& t_InfectedSymptoms, const std::vector<std::vector<int>>& t_InfectedSevere, | ||
| const std::vector<std::vector<int>>& t_InfectedCritical, const std::vector<std::vector<double>>& mu_C_R, | ||
| const std::vector<std::vector<double>>& mu_I_H, const std::vector<std::vector<double>>& mu_H_U, | ||
| const std::vector<double>& scaling_factor_inf); | ||
| const std::vector<ConfirmedCasesDataEntry>& rki_data, std::vector<int> const& vregion, Date date, |
There was a problem hiding this comment.
Swapped two function declarations here.
Define A first.
Then define B which uses A.
| IOResult<void> read_confirmed_cases_data_fix_recovered(const std::vector<ConfirmedCasesDataEntry>& rki_data, | ||
| std::vector<int> const& vregion, Date date, | ||
| std::vector<std::vector<double>>& vnum_rec, double delay = 14.); | ||
| std::vector<std::vector<double>>& vnum_rec, double delay = 14.0) |
There was a problem hiding this comment.
Ensure keeping default parameter
double delay = 14.0
| decltype(mio::read_mobility_plain<double>)>( | ||
| mobility_data_file, params_graph, mobile_comp, contact_locations_size, mio::read_mobility_plain<double>, | ||
| weights); |
There was a problem hiding this comment.
Pycode explicitly needs these double template parameters.
| template <typename FP = ScalarType> | ||
| IOResult<void> save_result(const std::vector<TimeSeries<ScalarType>>& results, const std::vector<int>& ids, | ||
| int num_groups, const std::string& filename) |
There was a problem hiding this comment.
Be careful if names are different in .h and .cpp.
Here result -> results differs.
Changes and Information
Please briefly list the changes (main added features, changed items, or corrected bugs) made:
If need be, add additional information and what the reviewer should look out for in particular:
Merge Request - Guideline Checklist
Please check our git workflow. Use the draft feature if the Pull Request is not yet ready to review.
Checks by code author
Checks by code reviewer(s)