EclAluGridVanguard: some modernization

- typedef -> using
- use constexpr
- use nullptr, not 0
- fix some indents
This commit is contained in:
Arne Morten Kvarving 2022-08-10 12:31:15 +02:00
parent d0c528a240
commit c2de02a04d

View File

@ -85,7 +85,7 @@ template <class TypeTag>
class EclAluGridVanguard : public EclBaseVanguard<TypeTag> class EclAluGridVanguard : public EclBaseVanguard<TypeTag>
{ {
friend class EclBaseVanguard<TypeTag>; friend class EclBaseVanguard<TypeTag>;
typedef EclBaseVanguard<TypeTag> ParentType; using ParentType = EclBaseVanguard<TypeTag>;
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>; using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Scalar = GetPropType<TypeTag, Properties::Scalar>;
@ -95,13 +95,13 @@ public:
using Grid = GetPropType<TypeTag, Properties::Grid>; using Grid = GetPropType<TypeTag, Properties::Grid>;
using EquilGrid = GetPropType<TypeTag, Properties::EquilGrid>; using EquilGrid = GetPropType<TypeTag, Properties::EquilGrid>;
using GridView = GetPropType<TypeTag, Properties::GridView>; using GridView = GetPropType<TypeTag, Properties::GridView>;
typedef Dune::CartesianIndexMapper<Grid> CartesianIndexMapper; using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
typedef Dune::CartesianIndexMapper<EquilGrid> EquilCartesianIndexMapper; using EquilCartesianIndexMapper = Dune::CartesianIndexMapper<EquilGrid>;
using TransmissibilityType = EclTransmissibility<Grid, GridView, ElementMapper, CartesianIndexMapper, Scalar>; using TransmissibilityType = EclTransmissibility<Grid, GridView, ElementMapper, CartesianIndexMapper, Scalar>;
typedef Dune::FromToGridFactory<Grid> Factory; using Factory = Dune::FromToGridFactory<Grid>;
static const int dimension = Grid::dimension; static constexpr int dimension = Grid::dimension;
static const int dimensionworld = Grid::dimensionworld; static constexpr int dimensionworld = Grid::dimensionworld;
public: public:
EclAluGridVanguard(Simulator& simulator) EclAluGridVanguard(Simulator& simulator)
: EclBaseVanguard<TypeTag>(simulator) : EclBaseVanguard<TypeTag>(simulator)
@ -146,10 +146,10 @@ public:
void releaseEquilGrid() void releaseEquilGrid()
{ {
delete equilCartesianIndexMapper_; delete equilCartesianIndexMapper_;
equilCartesianIndexMapper_ = 0; equilCartesianIndexMapper_ = nullptr;
delete equilGrid_; delete equilGrid_;
equilGrid_ = 0; equilGrid_ = nullptr;
} }
/*! /*!
@ -170,17 +170,17 @@ public:
if (grid().size(0)) if (grid().size(0))
{ {
globalTrans_.reset(new TransmissibilityType(this->eclState(), globalTrans_ = std::make_unique<TransmissibilityType>(this->eclState(),
this->gridView(), this->gridView(),
this->cartesianIndexMapper(), this->cartesianIndexMapper(),
this->grid(), this->grid(),
this->cellCentroids(), this->cellCentroids(),
getPropValue<TypeTag, getPropValue<TypeTag,
Properties::EnableEnergy>(), Properties::EnableEnergy>(),
getPropValue<TypeTag, getPropValue<TypeTag,
Properties::EnableDiffusion>())); Properties::EnableDiffusion>());
// Re-ordering for ALUGrid // Re-ordering for ALUGrid
globalTrans_->update(false, [&](unsigned int i) { return gridEquilIdxToGridIdx(i);}); globalTrans_->update(false, [&](unsigned int i) { return gridEquilIdxToGridIdx(i);});
} }
} }
@ -293,7 +293,7 @@ protected:
} }
this->equilGrid_ = std::make_unique<Dune::CpGrid>(EclGenericVanguard::comm()); this->equilGrid_ = std::make_unique<Dune::CpGrid>(EclGenericVanguard::comm());
// Note: removed_cells is guaranteed to be empty on ranks other than 0. // Note: removed_cells is guaranteed to be empty on ranks other than 0.
auto removed_cells = auto removed_cells =
this->equilGrid_->processEclipseFormat(input_grid, this->equilGrid_->processEclipseFormat(input_grid,
&this->eclState(), &this->eclState(),