Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1133 Change member functions in Model class from public to private in IDE model #1166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

annawendler
Copy link
Member

@annawendler annawendler commented Dec 19, 2024

Changes and Information

  • Make member functions that are required for simulating private
  • Define Simulation class and set_initial_flows() as friends

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 for new functionality has been added (Doxygen in the code and Markdown files if necessary)
  • 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).

Closes #1133

Copy link
Member

@lenaploetzke lenaploetzke left a comment

Choose a reason for hiding this comment

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

Nice PR, I guess this really prevents the model functions from being misused. :) I just have a few comments. Please also tick the boxes of the checks by author.

@@ -61,6 +61,67 @@ class Model
CustomIndexArray<ScalarType, AgeGroup> deaths, size_t num_agegroups,
Copy link
Member

Choose a reason for hiding this comment

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

Just a side note: Can you remove the second #include here? And what is the header cstddef needed for?

* @brief Checks constraints on model parameters and initial data.
* @return Returns true if one (or more) constraint(s) are not satisfied, otherwise false.
*/
bool check_constraints(ScalarType dt) const
Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe move the implementation of the function in the cpp file? This got a little long. If you want to keep it in place, we should include the logging.h file.

@@ -61,6 +61,67 @@ class Model
CustomIndexArray<ScalarType, AgeGroup> deaths, size_t num_agegroups,
CustomIndexArray<ScalarType, AgeGroup> total_confirmed_cases = CustomIndexArray<ScalarType, AgeGroup>());
Copy link
Member

Choose a reason for hiding this comment

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

We have a typo in lines 54+55: containg instead of containing

*
* @return Index representing the initialization method.
*/
int get_initialization_method_compartments()
Copy link
Member

Choose a reason for hiding this comment

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

Can you add the const keyword here?

CustomIndexArray<ScalarType, AgeGroup>
m_total_confirmed_cases; ///< CustomIndexArray that contains the total number of confirmed cases at time t0 for every AgeGroup.

private:
// ---- Functionality to calculate the sizes of the compartments for time t0. ----
/**
* @brief Compute the compartment specified in idx_InfectionState at the current time -- only using historic flow
Copy link
Member

Choose a reason for hiding this comment

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

In line 224 there is also a typo: infoming instead of incoming.

@@ -406,6 +407,11 @@ class Model
m_transitiondistributions_in_forceofinfection; ///< CustomIndexArray
// of Type AgeGroup containing a Vector containing the weighted TransitionDistributions for all necessary time
// points in the force of infection term.

// ---- Friend classes/functions. ----
friend class Simulation;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can add some small comments why these friends are necessary.

// Attention: m_populations and m_transitions do not necessarily have the same number of time points due to the
// initialization part.
TimeSeries<ScalarType>
m_transitions; ///< TimeSeries containing points of time and the corresponding number of transitions for every
Copy link
Member

Choose a reason for hiding this comment

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

Btw: Actually, m_ is only used for private variables. I dont know if you want to change this,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change member functions in Model class from public to private in IDE model
2 participants