Remove Multi- and BiCouplingScheme#1432
Remove Multi- and BiCouplingScheme#1432BenjaminRodenberg wants to merge 19 commits intoprecice:develop-v3.0.0from
Conversation
* Remove mapReadDataTo and mapWriteDataFrom. * Remove tests using removed API.
* Merge initialize and initializeData in SolverInterfaceImpl. * Merge initialize and initializeData in CouplingScheme. * Update tests correspondingly * Allow to check actions before initialize, especially checking whether initial data has to be written * Check for sending and receiving of initial data during coupling scheme configuration * Code simplification w.r.t waveform. * Use dt=0.0 in actions in initialize. Co-authored-by: Benjamin Uekermann <[email protected]> Co-authored-by: Frédéric Simonis <[email protected]>
…recice#1352) * Get tests and configs for serial implicit waveform interpolation from precice#1029. * Differentiate between received initial data and data (from advance). * Split data communication for SerialCouplingScheme and store initial data in waveform. * Move common functionality of serial and parallel coupling scheme into BiCouplingScheme. Co-authored-by: Benjamin Uekermann <[email protected]>
* Add test Integration/Serial/InitializeData/ImplicitBoth where both participants initialize. * Allow initialize=true for both participants in serial-implicit coupling scheme. * Raise warning, if first participant in serial coupling scheme initializes data with waveform order zero. * Remove check for write data, because participant does not know about waveform order. Co-authored-by: Benjamin Uekermann <[email protected]>
Co-authored-by: Benjamin Uekermann <[email protected]>
* Make read mapping conditional to avoid unnecessary mappings. * Update corresponding tests. Co-authored-by: Benjamin Uekermann <[email protected]>
* Merge Multi- and ParallelCouplingScheme * Remove BiCouplingScheme in favor of SerialCouplingScheme * Simplifies class hierarchy and limits amount of duplicate code
* Remove mapReadDataTo and mapWriteDataFrom. * Remove tests using removed API.
* Merge initialize and initializeData in SolverInterfaceImpl. * Merge initialize and initializeData in CouplingScheme. * Update tests correspondingly * Allow to check actions before initialize, especially checking whether initial data has to be written * Check for sending and receiving of initial data during coupling scheme configuration * Code simplification w.r.t waveform. * Use dt=0.0 in actions in initialize. Co-authored-by: Benjamin Uekermann <[email protected]> Co-authored-by: Frédéric Simonis <[email protected]>
…recice#1352) * Get tests and configs for serial implicit waveform interpolation from precice#1029. * Differentiate between received initial data and data (from advance). * Split data communication for SerialCouplingScheme and store initial data in waveform. * Move common functionality of serial and parallel coupling scheme into BiCouplingScheme. Co-authored-by: Benjamin Uekermann <[email protected]>
* Add test Integration/Serial/InitializeData/ImplicitBoth where both participants initialize. * Allow initialize=true for both participants in serial-implicit coupling scheme. * Raise warning, if first participant in serial coupling scheme initializes data with waveform order zero. * Remove check for write data, because participant does not know about waveform order. Co-authored-by: Benjamin Uekermann <[email protected]>
Co-authored-by: Benjamin Uekermann <[email protected]>
* Make read mapping conditional to avoid unnecessary mappings. * Update corresponding tests. Co-authored-by: Benjamin Uekermann <[email protected]>
f3ef21d to
85c325a
Compare
uekerman
left a comment
There was a problem hiding this comment.
I see the motivation behind this step (parallel cpl scheme and multi cpl scheme have some similarities), but I must admit I am not too convinced that this step will help us in the long run 😟
The suggested changes reduce some duplicated code (but not that much), but make the new version harder to understand (why does a serial cpl scheme have a single m2n, but a parallel cpl scheme many?).
I my opinion, the old version was easier to read and understand. Sometimes code duplication is good if it makes things more understandable.
Additional disadvantage: configuration and classes are no longer alligned (there is a cplscheme::multi but no MultiCouplingScheme.
| /// Local participant name. | ||
| std::string _localParticipant = "unknown"; | ||
|
|
||
| /// name of the controller participant ( = second participant in serial bi coupling scheme) |
There was a problem hiding this comment.
| /// name of the controller participant ( = second participant in serial bi coupling scheme) | |
| /// name of the controller participant ( = second participant in serial or parallel coupling scheme) |
|
|
||
| std::vector<PtrCouplingData> allReceiveCouplingData(); | ||
|
|
||
| std::vector<PtrCouplingData> allCouplingDataWithId(DataID dataId); |
There was a problem hiding this comment.
Can there be multiple data with the same data id? I guess the name is a bit confusing. And we have getSendData and getReceiveData already.
| * @brief Checks whether any CouplingData in dataMap requires initialization | ||
| * @param dataMap map containing CouplingData | ||
| * @return true, if any CouplingData in dataMap requires initialization | ||
| * @brief Checks whether any CouplingData in vector requires initialization |
There was a problem hiding this comment.
| * @brief Checks whether any CouplingData in vector requires initialization | |
| * @brief Checks whether any CouplingData requires initialization |
| * @return true, if any CouplingData in vector requires initialization | ||
| */ | ||
| bool anyDataRequiresInitialization(DataMap &dataMap) const; | ||
| bool anyDataRequiresInitialization(std::vector<PtrCouplingData> datas) const; |
There was a problem hiding this comment.
| bool anyDataRequiresInitialization(std::vector<PtrCouplingData> datas) const; | |
| bool anyDataRequiresInitialization(std::vector<PtrCouplingData> dataVector) const; |
| "Maximal iteration limit has to be larger than zero."); | ||
|
|
||
| if (_controller == _localParticipant) { | ||
| // Controller participant never does the first step, because it is never the first participant |
There was a problem hiding this comment.
| // Controller participant never does the first step, because it is never the first participant |
A does A because it is A ... not needed I guess.
| /// Sets the values | ||
| CouplingData *getSendData(DataID dataID); |
| auto dataWithId = allCouplingDataWithId(dataID); | ||
| PRECICE_ASSERT(dataWithId.size() >= 1, "Data with given data ID must exist!"); | ||
| for (auto &data : dataWithId) { |
There was a problem hiding this comment.
Why should there be multiple ones?
| // @todo implement ParallelCouplingScheme with multi coupling for explicit coupling | ||
| PRECICE_ASSERT(isImplicitCouplingScheme(), "ParallelCouplingScheme with multi coupling is always Implicit."); | ||
| } | ||
| PRECICE_DEBUG("MultiCoupling scheme is created for {}.", localParticipant); |
There was a problem hiding this comment.
| PRECICE_DEBUG("MultiCoupling scheme is created for {}.", localParticipant); |
|
|
||
| bool ParallelCouplingScheme::exchangeDataAndAccelerate() | ||
| { | ||
| PRECICE_DEBUG("Computed full length of iteration"); |
There was a problem hiding this comment.
What do you mean with "full length of iteration"?
| const std::string &accessor) const; | ||
|
|
||
| PtrCouplingScheme createMultiCouplingScheme( | ||
| PtrCouplingScheme createParallelMultiCouplingScheme( |
There was a problem hiding this comment.
| PtrCouplingScheme createParallelMultiCouplingScheme( | |
| PtrCouplingScheme createParallelCouplingScheme( |
|
After discussion with @uekerman: Let's keep this PR as it is for the moment. The change is definitely not a clear thing, but useful during the development on #1414 (it reduces code duplication and simplifies changes in BenjaminRodenberg#13). As soon as BenjaminRodenberg#13 has converged, we can either include the refactoring of #1432 or drop it (and implement the relevant changes from BenjaminRodenberg#13 in #1414). |
721976f to
c5c7b50
Compare
|
Closing for now as we decided against this refactoring. |
Main changes of this PR
Motivation and additional information
Removes a lot of code and reduces the implementation effort necessary for #1414. On the long run I assume that the MultiCouplingScheme will also profit from this change, because it gets automatically tested by the ParallelCouplingScheme.
Author's checklist
make changelogif there are user-observable changes since the last release.make formatto ensure everything is formatted correctly.Reviewers' checklist