Skip to content

Add write data buffer#1612

Merged
BenjaminRodenberg merged 108 commits intoprecice:developfrom
BenjaminRodenberg:add-write-data-buffer
May 15, 2023
Merged

Add write data buffer#1612
BenjaminRodenberg merged 108 commits intoprecice:developfrom
BenjaminRodenberg:add-write-data-buffer

Conversation

@BenjaminRodenberg
Copy link
Copy Markdown
Contributor

@BenjaminRodenberg BenjaminRodenberg commented Apr 3, 2023

Main changes of this PR

Moves buffer, where write data is stored from mesh::Data into WriteDataContext.

Motivation and additional information

Since the ReadDataContext provides read data through a waveform that is stored inside of the ReadDataContext a similar implementation makes sense for WriteDataContext: Store data in a buffer and persist the data in a Storage in the WriteDataContext. This would also simplify mesh:Data by removing the values from mesh:Data.

Author's checklist

  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I added a test to cover the proposed changes in our test suite.
  • For breaking changes: I documented the changes in the appropriate porting guide.
  • I sticked to C++17 features.
  • I sticked to CMake version 3.16.3.
  • 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?

@BenjaminRodenberg BenjaminRodenberg added this to the Version 3.0.0 milestone Apr 3, 2023
@BenjaminRodenberg BenjaminRodenberg self-assigned this Apr 3, 2023
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.

I think such refactoring makes a lot of sense

Comment thread src/time/Sample.hpp Outdated
bool isAtWindowEnd = false;
for (const auto scheme : schemesToRun()) {
scheme->addComputedTime(timeToAdd);
isAtWindowEnd |= scheme->addComputedTime(timeToAdd); // @todo should be &= ?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fsimonis @uekerman : Any opinion on this? I'm a bit puzzled, because I would expect &=, but with &= I got failures of intergration tests in #1520. In this PR, it does not matter (so we are probably missing a test).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess that we anyway don't support composition of coupling schemes with different time windows. Correct @fsimonis ?
Could then also become an assertion here. All true or all false.

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.

Final tweaking.

Do we have an action unit test with subcycling? A single one could be enough already.

Comment thread src/action/PythonAction.cpp Outdated
Comment thread src/action/ScaleByAreaAction.cpp
Comment thread src/action/SummationAction.cpp Outdated
Comment thread src/cplscheme/BaseCouplingScheme.cpp Outdated
Comment thread src/cplscheme/BaseCouplingScheme.cpp
bool isAtWindowEnd = false;
for (const auto scheme : schemesToRun()) {
scheme->addComputedTime(timeToAdd);
isAtWindowEnd |= scheme->addComputedTime(timeToAdd); // @todo should be &= ?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess that we anyway don't support composition of coupling schemes with different time windows. Correct @fsimonis ?
Could then also become an assertion here. All true or all false.

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.

Final favor: Please improve error messages 🙏

@BenjaminRodenberg BenjaminRodenberg merged commit bc0b847 into precice:develop May 15, 2023
@BenjaminRodenberg BenjaminRodenberg deleted the add-write-data-buffer branch May 16, 2023 11:12
BenjaminRodenberg added a commit that referenced this pull request May 20, 2023

void WriteDataContext::writeValuesIntoDataBuffer(::precice::span<const VertexID> vertices, ::precice::span<const double> values)
{
PRECICE_ASSERT(vertices.size() * getDataDimensions() == values.size());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This assertion is also checked in ParticipantImp::writeData, looks like it can be removed from there

kanishkbh added a commit to kanishkbh/precice that referenced this pull request May 20, 2023
kanishkbh added a commit to kanishkbh/precice that referenced this pull request Jun 1, 2023
kanishkbh added a commit to kanishkbh/precice that referenced this pull request Jul 6, 2023
kanishkbh added a commit to kanishkbh/precice that referenced this pull request Jul 12, 2023
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.

Use data structure similar to time::Storage in mesh::Data::_values

4 participants