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
Introduce private SolverInterfaceImpl constructor #1261
Introduce private SolverInterfaceImpl constructor #1261
Conversation
…or argument depending on context.
I'm not sure whether this is actually breaking and must go into |
This is an ideal fit for an It allows you to write: if (communicator.has_value()) {
PREICE_CHECK(communicator.value() != nullptr,
"...");
} There are 2 ways to implement this cleanly: 1. keep the pimple cleanHave 2 constructors with the same interface in both SolverInterface and SolverInterfaceImpl, then forward the latter two to a single private constructor that takes a class SolverInterfaceImpl{
public:
SolverInterfaceImpl(
std::string participantName,
const std::string &configurationFileName,
int solverProcessIndex,
int solverProcessSize)
: SolverInterfaceImpl(participantName, configurationFileName, solverProcessIndex, solverProcessSize, nullopt) {}
SolverInterfaceImpl(
std::string participantName,
const std::string &configurationFileName,
int solverProcessIndex,
int solverProcessSize,
void * communicator)
: SolverInterfaceImpl(participantName, configurationFileName, solverProcessIndex, solverProcessSize, make_optional(communicator)) {}
private:
SolverInterfaceImpl(
std::string participantName,
const std::string &configurationFileName,
int solverProcessIndex,
int solverProcessSize,
std::optional<void *> communicator)
} 2. keep the interface cleanHave 1 constructor in SolverInterfaceImpl that takes a class SolverInterfaceImpl{
public:
SolverInterfaceImpl(
std::string participantName,
const std::string &configurationFileName,
int solverProcessIndex,
int solverProcessSize,
std::optional<void *> communicator)
} |
As long as we did not conclude on #1201 I'm a bit hesitant implementing it here, because this would make this PR unmergable until we upgrade to C++ 17. The solution sounds reasonable, but does (at the current state) not fit into preCICE (we can still keep it as an issue and improve it in the future). |
An optional is really only a slight refactoring of this solution. So, let's merge this once CI passes. |
I just realized that this change is considered breaking. Therefore, we should not merge this PR before we are sure that our next release will be |
The case, which could be regarded as a breaking change, would already break MPI. |
This PR is ready to merge as soon as the tests are complete. |
Main changes of this PR
Introduces a private constructor. Closes #1260.
Author's checklist
make changelog
if there are user-observable changes since the last release.make format
to ensure everything is formatted correctly.Reviewers' checklist