using enum class to replace boolean onlyTrans for

Transmissibility::update() for better readability, which is suggested by the reviewer.
This commit is contained in:
Kai Bao 2024-06-06 15:15:56 +02:00
parent 303a677a81
commit 8f67881809
5 changed files with 17 additions and 8 deletions

View File

@ -190,7 +190,8 @@ public:
getPropValue<TypeTag,
Properties::EnableDispersion>());
// Re-ordering for ALUGrid
globalTrans_->update(false, true, [&](unsigned int i) { return gridEquilIdxToGridIdx(i);});
globalTrans_->update(false, TransmissibilityType::TransUpdateQuantities::Trans,
[&](unsigned int i) { return gridEquilIdxToGridIdx(i);});
}
}

View File

@ -285,7 +285,7 @@ protected:
getPropValue<TypeTag, Properties::EnableEnergy>(),
getPropValue<TypeTag, Properties::EnableDiffusion>(),
getPropValue<TypeTag, Properties::EnableDispersion>()));
globalTrans_->update(false, true);
globalTrans_->update(false, TransmissibilityType::TransUpdateQuantities::Trans);
}
double getTransmissibility(unsigned I, unsigned J) const override

View File

@ -538,7 +538,8 @@ public:
};
// re-compute all quantities which may possibly be affected.
transmissibilities_.update(true, false, equilGridToGrid);
using TransUpdateQuantities = typename Vanguard::TransmissibilityType::TransUpdateQuantities;
transmissibilities_.update(true, TransUpdateQuantities::All, equilGridToGrid);
this->referencePorosity_[1] = this->referencePorosity_[0];
updateReferencePorosity_();
updatePffDofData_();
@ -700,8 +701,9 @@ public:
.applyActions(episodeIdx, simulator.time() + simulator.timeStepSize(),
[this](const bool global)
{
using TransUpdateQuantities = typename Vanguard::TransmissibilityType::TransUpdateQuantities;
this->transmissibilities_
.update(global, false, [&vg = this->simulator().vanguard()]
.update(global, TransUpdateQuantities::All, [&vg = this->simulator().vanguard()]
(const unsigned int i)
{
return vg.gridIdxToEquilGridIdx(i);

View File

@ -128,7 +128,7 @@ public:
*/
void finishInit(const std::function<unsigned int(unsigned int)>& map = {})
{
this->update(true, false, map, /*applyNncMultRegT = */ true);
this->update(true, TransUpdateQuantities::All, map, /*applyNncMultRegT = */ true);
}
/*!
@ -138,10 +138,12 @@ public:
* processes. Also, this updates the "thermal half
* transmissibilities" if energy is enabled.
*
* \param[in] onlyTrans Whether we only allocate and upate trans_ without considering
* \param[in] trans Indicating whether we only allocate and upate trans_ without considering
* thermalHalfTrans_, diffusivity_, dispersivity_. For many usage, we only need trans_,
* e.g. weights for domain decomposition, INIT file output. It might change following
* further development.
* Trans only update the trans_, which is related to permeability
* All upate rans_, thermalHalfTrans_, diffusivity_ and dispersivity_.
*
* \param[in] map Undocumented.
*
@ -152,7 +154,9 @@ public:
* numerical aquifers. Default value: \c false, meaning do not apply
* regional multipliers to explicit NNCs.
*/
void update(bool global, bool onlyTrans = false, const std::function<unsigned int(unsigned int)>& map = {}, bool applyNncMultRegT = false);
enum class TransUpdateQuantities { Trans, All };
void update(bool global, TransUpdateQuantities update_quantities = TransUpdateQuantities::All,
const std::function<unsigned int(unsigned int)>& map = {}, bool applyNncMultRegT = false);
protected:
void updateFromEclState_(bool global);

View File

@ -159,9 +159,11 @@ dispersivity(unsigned elemIdx1, unsigned elemIdx2) const
template<class Grid, class GridView, class ElementMapper, class CartesianIndexMapper, class Scalar>
void Transmissibility<Grid,GridView,ElementMapper,CartesianIndexMapper,Scalar>::
update(bool global, const bool onlyTrans,
update(bool global, const TransUpdateQuantities update_quantities,
const std::function<unsigned int(unsigned int)>& map, const bool applyNncMultregT)
{
// whether only update the permeability related transmissibility
const bool onlyTrans = (update_quantities == TransUpdateQuantities::Trans);
const auto& cartDims = cartMapper_.cartesianDimensions();
const auto& transMult = eclState_.getTransMult();
const auto& comm = gridView_.comm();