Skip to content

Refactor DataContext#1038

Merged
BenjaminRodenberg merged 53 commits intoprecice:developfrom
BenjaminRodenberg:refactor-mapped-data
Sep 1, 2021
Merged

Refactor DataContext#1038
BenjaminRodenberg merged 53 commits intoprecice:developfrom
BenjaminRodenberg:refactor-mapped-data

Conversation

@BenjaminRodenberg
Copy link
Copy Markdown
Contributor

Main changes of this PR

Turns DataContext into a class. Add corresponding getters, setters and restrict access. Add member participantData and only set toData and fromData, when a mapping exists.

Motivation and additional information

This allows us to control access on toData and fromData. We will be able to add further functionality to the DataContext that might be required for implementation of waveform relaxation (#1029).

Author's checklist

  • I added a changelog file with this PR number in docs/changelog/ if there are noteworthy changes. --> Not relevant, since refactoring.
  • I ran tools/formatting/check-format and everything is formatted correctly.
  • I sticked to C++14 features.
  • I sticked to CMake version 3.10.
  • I squashed / am about to squash all commits that should be seen as one.

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?
  • (more questions/tasks)

@BenjaminRodenberg BenjaminRodenberg added the maintainability Working on this will make our lives easier in the long run as preCICE gets easier to maintain. label Jun 25, 2021
@BenjaminRodenberg BenjaminRodenberg self-assigned this Jun 25, 2021
Copy link
Copy Markdown
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

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

Good effort to bring more structure into DataContext.
I am, however, not sure whether the solution to have a third field participantData is the best way to go. Before, there were two data fields, which isn't ideal already. Now, we solve this by adding a third field 😁
If we stick with this solution (I see the advantages as well), we need to add more documentation and find a more intuitive name than "participantData".

Comment thread src/precice/impl/DataContext.hpp Outdated
Comment thread src/precice/impl/DataContext.hpp Outdated
Comment thread src/precice/impl/DataContext.hpp Outdated
Comment thread src/precice/impl/DataContext.cpp
Comment thread src/precice/impl/Participant.hpp Outdated
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

BenjaminRodenberg commented Aug 2, 2021

@BenjaminRodenberg BenjaminRodenberg added this to the Version 2.3.0 milestone Aug 13, 2021
Copy link
Copy Markdown
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

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

Looks good. One minor comment below.
Last thing: now that we moved functionality into DataContext it could be helpful for the long run to unit-test this separated functionality, right?

Comment thread src/precice/impl/SolverInterfaceImpl.cpp
Comment thread src/precice/impl/SolverInterfaceImpl.cpp
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

I added two tests for the mapping context. There are two minor todos that I will take a look at later, but the test is generally ready for review.

@uekerman
Copy link
Copy Markdown
Member

Tests look good

Comment thread src/precice/impl/DataContext.hpp Outdated
Comment thread src/precice/impl/SolverInterfaceImpl.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainability Working on this will make our lives easier in the long run as preCICE gets easier to maintain.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants