move allocation of Extbo data into ExtboContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-07 11:42:34 +01:00
parent 336a99a226
commit 14e7289059
3 changed files with 21 additions and 6 deletions

View File

@ -25,6 +25,20 @@
namespace Opm {
template<class Scalar>
void ExtboContainer<Scalar>::
allocate(const unsigned bufferSize)
{
X_volume_.resize(bufferSize, 0.0);
Y_volume_.resize(bufferSize, 0.0);
Z_fraction_.resize(bufferSize, 0.0);
mFracOil_.resize(bufferSize, 0.0);
mFracGas_.resize(bufferSize, 0.0);
mFracCo2_.resize(bufferSize, 0.0);
allocated_ = true;
}
template class ExtboContainer<double>;
#if FLOW_INSTANTIATE_FLOAT

View File

@ -36,6 +36,12 @@ class ExtboContainer
using ScalarBuffer = std::vector<Scalar>;
public:
void allocate(const unsigned bufferSize);
bool allocated() const
{ return allocated_; }
bool allocated_ = false;
ScalarBuffer X_volume_;
ScalarBuffer Y_volume_;
ScalarBuffer Z_fraction_;

View File

@ -1025,12 +1025,7 @@ doAllocBuffers(const unsigned bufferSize,
}
if (enableExtbo_) {
extboC_.X_volume_.resize(bufferSize, 0.0);
extboC_.Y_volume_.resize(bufferSize, 0.0);
extboC_.Z_fraction_.resize(bufferSize, 0.0);
extboC_.mFracOil_.resize(bufferSize, 0.0);
extboC_.mFracGas_.resize(bufferSize, 0.0);
extboC_.mFracCo2_.resize(bufferSize, 0.0);
extboC_.allocate(bufferSize);
}
if (enableMICP_) {