converting std::vector<double> to std::vector<float> for BIC coefficients in GenericOilGasWaterFluidSystem#5178
Conversation
ec4a8bc to
1730d97
Compare
|
jenkins build this please |
|
It is used to compile the float version of flow variants. https://ci.opm-project.org/job/opm-simulators-PR-builder/9985/console But it is also possible the refactoring in OPM/opm-simulators#7049 should not have triggered this issue. |
There was a problem hiding this comment.
Pull request overview
Updates GenericOilGasWaterFluidSystem initialization to allow BIC (binary interaction coefficient) data coming from CompositionalConfig (std::vector<double>) to be stored in the fluid system’s interaction_coefficients_ (std::vector<Scalar>), enabling builds where Scalar is float (as needed for the referenced simulator PR).
Changes:
- Replace direct assignment of BIC (
std::vector<double>) intointeraction_coefficients_with an iterator-based copy to support differing element types (double→Scalar). - Introduce a local
bicreference for the retrieved BIC vector.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Without looking into details yet, since OPM/opm-simulators#7049 is trying to make compositial based on the Flow framework, when the instantiation based on the GenericOilGasWaterFluidSystem for FlowGenericProblem might be necessary. |
|
jenkins build this please |
e73a736 to
2490261
Compare
|
It is needed if (-DBUILD_FLOW_FLOAT_VARIANTS is on) through OPM/opm-simulators#7049 . |
|
jenkins build this please |
|
though clang might not agree, so maybe something akin to https://github.com/OPM/opm-simulators/blob/master/opm/simulators/flow/equil/InitStateEquil_impl.hpp#L1528 is necessary to shut it up |
There was a problem hiding this comment.
Can we at least keep the current assignment if Scalar is double? For instance, something along the lines of
if constexpr (std::is_same_v<Scalar, double>) {
this->interaction_coefficients_ = ...;
}
else {
const auto& bic = ...;
this->interaction_coefficients_.assign(bic.begin(), bic.end());
}with std::is_same_v<> from the <type_traits> header.
for BIC coefficients in GenericOilGasWaterFluidSystem
2490261 to
2ffc30f
Compare
|
I combined both comments, please let me know if it is okay. Implicit conversion from |
|
jenkins build this please |
bska
left a comment
There was a problem hiding this comment.
Thanks a lot for the updates. This looks good to me now and I'll merge into master.
for testing the PR OPM/opm-simulators#7049 .