Skip to content

Conversation

@julianlitz
Copy link
Contributor

@julianlitz julianlitz commented Sep 15, 2025

Changes and Information

Please briefly list the changes (main added features, changed items, or corrected bugs) made:

  • Moved IO functions from source to header file, such that they can be templated

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

  • Every addressed issue is linked (use the "Closes #ISSUE" keyword below)
  • New code adheres to coding guidelines
  • No large data files have been added (files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • Tests are added for new functionality and a local test run was successful (with and without OpenMP)
  • Appropriate documentation within the code (Doxygen) for new functionality has been added in the code
  • Appropriate external documentation (ReadTheDocs) for new functionality has been added to the online documentation
  • Proper attention to licenses, especially no new third-party software with conflicting license has been added
  • (For ABM development) Checked benchmark results and ran and posted a local test above from before and after development to ensure performance is monitored.

Checks by code reviewer(s)

  • Corresponding issue(s) is/are linked and addressed
  • Code is clean of development artifacts (no deactivated or commented code lines, no debugging printouts, etc.)
  • Appropriate unit tests have been added, CI passes, code coverage and performance is acceptable (did not decrease)
  • No large data files added in the whole history of commits(files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • On merge, add 2-5 lines with the changes (main added features, changed items, or corrected bugs) to the merge-commit-message. This can be taken from the briefly-list-the-changes above (best case) or the separate commit messages (worst case).

Comment on lines -21 to -31
#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>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure keeping default setting
bool save_percentiles = true

Comment on lines +43 to +44
// Forward declaration of get_region_id
int get_region_id(int id);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add forward declaration for in .cpp remaining functions.

Comment on lines 56 to +57
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,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure keeping default parameter
double delay = 14.0

Comment on lines +292 to +294
decltype(mio::read_mobility_plain<double>)>(
mobility_data_file, params_graph, mobile_comp, contact_locations_size, mio::read_mobility_plain<double>,
weights);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pycode explicitly needs these double template parameters.

Comment on lines +46 to +48
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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Be careful if names are different in .h and .cpp.
Here result -> results differs.

@julianlitz julianlitz self-assigned this Sep 16, 2025
@julianlitz julianlitz added loc::backend This issue concerns the C++ backend implementation. class::improvement Cleanup that doesn't affect functionality labels Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

class::improvement Cleanup that doesn't affect functionality loc::backend This issue concerns the C++ backend implementation.

Projects

Development

Successfully merging this pull request may close these issues.

2 participants