move allocation of MICP data into MICPContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-07 08:58:29 +01:00
parent 012141b281
commit 3f94ace151
3 changed files with 20 additions and 5 deletions

View File

@ -1036,11 +1036,7 @@ doAllocBuffers(const unsigned bufferSize,
}
if (enableMICP_) {
micpC_.cMicrobes_.resize(bufferSize, 0.0);
micpC_.cOxygen_.resize(bufferSize, 0.0);
micpC_.cUrea_.resize(bufferSize, 0.0);
micpC_.cBiofilm_.resize(bufferSize, 0.0);
micpC_.cCalcite_.resize(bufferSize, 0.0);
this->micpC_.allocate(bufferSize);
}
if (vapparsActive) {

View File

@ -25,6 +25,19 @@
namespace Opm {
template<class Scalar>
void MICPContainer<Scalar>::
allocate(const unsigned bufferSize)
{
cMicrobes_.resize(bufferSize, 0.0);
cOxygen_.resize(bufferSize, 0.0);
cUrea_.resize(bufferSize, 0.0);
cBiofilm_.resize(bufferSize, 0.0);
cCalcite_.resize(bufferSize, 0.0);
allocated_ = true;
}
template class MICPContainer<double>;
#if FLOW_INSTANTIATE_FLOAT

View File

@ -36,6 +36,11 @@ class MICPContainer
using ScalarBuffer = std::vector<Scalar>;
public:
void allocate(const unsigned bufferSize);
bool allocated() const
{ return allocated_; }
Scalar getMicrobialConcentration(unsigned elemIdx) const
{
if (cMicrobes_.size() > elemIdx)
@ -76,6 +81,7 @@ public:
return 0;
}
bool allocated_ = false;
ScalarBuffer cMicrobes_;
ScalarBuffer cOxygen_;
ScalarBuffer cUrea_;