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

correcting solver builder constructor #616

Merged
merged 2 commits into from
Aug 7, 2024
Merged

correcting solver builder constructor #616

merged 2 commits into from
Aug 7, 2024

Conversation

K20shores
Copy link
Collaborator

Correct the constructor of the solver. Apparently this was preventing part of musica from building. I don't understand it

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.51%. Comparing base (68cd3e2) to head (cb3d1e2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #616   +/-   ##
=======================================
  Coverage   93.51%   93.51%           
=======================================
  Files          49       49           
  Lines        3502     3502           
=======================================
  Hits         3275     3275           
  Misses        227      227           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines -48 to -49
std::swap(this->solver_, other.solver_);
std::swap(this->processes_, other.processes_);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@K20shores @mattldawson I thought doing swap here would make sure when other is destroyed by the move constructor, it did not free the space now owned by this. Kyle's change basically means this is not necessary?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This Solver(&&) move constructor caused an error in musica, and I'm working on it. Also the move assignment has a bug in it. We might have to add test for this.

    Solver& operator=(Solver&& other)
    {
      std::swap(this->solver_, other.solver_);
      number_of_grid_cells_ = other.number_of_grid_cells_;
      number_of_species_ = other.number_of_species_;
      number_of_reactions_ = other.number_of_reactions_;
      state_parameters_ = other.state_parameters_;
      std::swap(this->solver_, other.processes_); <---- this should get corrected
      return *this;
    }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, thanks for catching this typo. I wonder whether we really need a move assignment in a actual case. If not, would it be easier if we just delete the move assignment operator?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no problem! yeah I don't see the need to have move assignment.

@K20shores K20shores merged commit 6b1c58a into main Aug 7, 2024
29 checks passed
@K20shores K20shores deleted the solver_fix branch August 7, 2024 18:37
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.

5 participants