diff --git a/ebos/alucartesianindexmapper.hh b/ebos/alucartesianindexmapper.hh index 25f2bccd7..26d7df5a1 100644 --- a/ebos/alucartesianindexmapper.hh +++ b/ebos/alucartesianindexmapper.hh @@ -85,7 +85,7 @@ public: int idx_; }; - typedef typename Dune::PersistentContainer GlobalIndexContainer; + using GlobalIndexContainer = typename Dune::PersistentContainer; public: // constructor copying cartesian index to persistent container @@ -174,7 +174,7 @@ public: public: /** \brief dimension of the grid */ - static const int dimension = Grid::dimension ; + static constexpr int dimension = Grid::dimension ; /** \brief constructor taking grid */ CartesianIndexMapper(const Grid& grid, @@ -222,17 +222,17 @@ public: void cartesianCoordinate(const int compressedElementIndex, std::array& coords) const { int gc = cartesianIndex(compressedElementIndex); - if (dimension == 3) { + if constexpr (dimension == 3) { coords[0] = gc % cartesianDimensions()[0]; gc /= cartesianDimensions()[0]; coords[1] = gc % cartesianDimensions()[1]; coords[2] = gc / cartesianDimensions()[1]; } - else if (dimension == 2) { + else if constexpr (dimension == 2) { coords[0] = gc % cartesianDimensions()[0]; coords[1] = gc / cartesianDimensions()[0]; } - else if (dimension == 1) + else if constexpr (dimension == 1) coords[0] = gc ; else throw std::invalid_argument("cartesianCoordinate not implemented for dimension " + std::to_string(dimension)); @@ -241,7 +241,7 @@ public: template std::unique_ptr > dataHandle(const GridView& gridView) { - typedef GlobalIndexDataHandle DataHandle ; + using DataHandle = GlobalIndexDataHandle; assert(&grid_ == &gridView.grid()); return std::make_unique(gridView, cartesianIndex_); } diff --git a/ebos/collecttoiorank.hh b/ebos/collecttoiorank.hh index 34c497b73..e98ac852e 100644 --- a/ebos/collecttoiorank.hh +++ b/ebos/collecttoiorank.hh @@ -52,7 +52,7 @@ public: using IndexMapType = std::vector; using IndexMapStorageType = std::vector; - static const int dimension = Grid::dimension; + static constexpr int dimension = Grid::dimension; enum { ioRank = 0 }; diff --git a/ebos/eclalugridvanguard.hh b/ebos/eclalugridvanguard.hh index 7ddf8ab5e..8fa62d3b6 100644 --- a/ebos/eclalugridvanguard.hh +++ b/ebos/eclalugridvanguard.hh @@ -85,7 +85,7 @@ template class EclAluGridVanguard : public EclBaseVanguard { friend class EclBaseVanguard; - typedef EclBaseVanguard ParentType; + using ParentType = EclBaseVanguard; using ElementMapper = GetPropType; using Scalar = GetPropType; @@ -95,13 +95,13 @@ public: using Grid = GetPropType; using EquilGrid = GetPropType; using GridView = GetPropType; - typedef Dune::CartesianIndexMapper CartesianIndexMapper; - typedef Dune::CartesianIndexMapper EquilCartesianIndexMapper; + using CartesianIndexMapper = Dune::CartesianIndexMapper; + using EquilCartesianIndexMapper = Dune::CartesianIndexMapper; using TransmissibilityType = EclTransmissibility; - typedef Dune::FromToGridFactory Factory; + using Factory = Dune::FromToGridFactory; - static const int dimension = Grid::dimension; - static const int dimensionworld = Grid::dimensionworld; + static constexpr int dimension = Grid::dimension; + static constexpr int dimensionworld = Grid::dimensionworld; public: EclAluGridVanguard(Simulator& simulator) : EclBaseVanguard(simulator) @@ -146,10 +146,10 @@ public: void releaseEquilGrid() { delete equilCartesianIndexMapper_; - equilCartesianIndexMapper_ = 0; + equilCartesianIndexMapper_ = nullptr; delete equilGrid_; - equilGrid_ = 0; + equilGrid_ = nullptr; } /*! @@ -170,17 +170,17 @@ public: if (grid().size(0)) { - globalTrans_.reset(new TransmissibilityType(this->eclState(), - this->gridView(), - this->cartesianIndexMapper(), - this->grid(), - this->cellCentroids(), - getPropValue(), - getPropValue())); - // Re-ordering for ALUGrid - globalTrans_->update(false, [&](unsigned int i) { return gridEquilIdxToGridIdx(i);}); + globalTrans_ = std::make_unique(this->eclState(), + this->gridView(), + this->cartesianIndexMapper(), + this->grid(), + this->cellCentroids(), + getPropValue(), + getPropValue()); + // Re-ordering for ALUGrid + globalTrans_->update(false, [&](unsigned int i) { return gridEquilIdxToGridIdx(i);}); } } @@ -293,7 +293,7 @@ protected: } this->equilGrid_ = std::make_unique(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 = this->equilGrid_->processEclipseFormat(input_grid, &this->eclState(), diff --git a/ebos/eclcpgridvanguard.hh b/ebos/eclcpgridvanguard.hh index 39da1f6e9..5d9920697 100644 --- a/ebos/eclcpgridvanguard.hh +++ b/ebos/eclcpgridvanguard.hh @@ -79,7 +79,7 @@ class EclCpGridVanguard : public EclBaseVanguard GetPropType> { friend class EclBaseVanguard; - typedef EclBaseVanguard ParentType; + using ParentType = EclBaseVanguard; using Scalar = GetPropType; using Simulator = GetPropType; @@ -91,7 +91,7 @@ public: using EquilGrid = GetPropType; using GridView = GetPropType; using TransmissibilityType = EclTransmissibility; - static const int dimensionworld = Grid::dimensionworld; + static constexpr int dimensionworld = Grid::dimensionworld; private: using Element = typename GridView::template Codim<0>::Entity; diff --git a/ebos/ecldummygradientcalculator.hh b/ebos/ecldummygradientcalculator.hh index c0596f175..1bd7f150f 100644 --- a/ebos/ecldummygradientcalculator.hh +++ b/ebos/ecldummygradientcalculator.hh @@ -52,7 +52,7 @@ class EclDummyGradientCalculator enum { dimWorld = GridView::dimensionworld }; - typedef Dune::FieldVector DimVector; + using DimVector = Dune::FieldVector; public: static void registerParameters() diff --git a/ebos/eclequilinitializer.hh b/ebos/eclequilinitializer.hh index 211b345f7..3eb43acbb 100644 --- a/ebos/eclequilinitializer.hh +++ b/ebos/eclequilinitializer.hh @@ -156,11 +156,11 @@ public: } // set the salt concentration - if (enableBrine) + if constexpr (enableBrine) fluidState.setSaltConcentration(initialState.saltConcentration()[elemIdx]); //set the (solid) salt saturation - if (enableSaltPrecipitation) + if constexpr (enableSaltPrecipitation) fluidState.setSaltSaturation(initialState.saltSaturation()[elemIdx]); } } diff --git a/ebos/eclfluxmodule.hh b/ebos/eclfluxmodule.hh index 9b63bac89..69facab4b 100644 --- a/ebos/eclfluxmodule.hh +++ b/ebos/eclfluxmodule.hh @@ -58,9 +58,9 @@ class EclTransBaseProblem; template struct EclTransFluxModule { - typedef EclTransIntensiveQuantities FluxIntensiveQuantities; - typedef EclTransExtensiveQuantities FluxExtensiveQuantities; - typedef EclTransBaseProblem FluxBaseProblem; + using FluxIntensiveQuantities = EclTransIntensiveQuantities; + using FluxExtensiveQuantities = EclTransExtensiveQuantities; + using FluxBaseProblem = EclTransBaseProblem; /*! * \brief Register all run-time parameters for the flux module. @@ -115,10 +115,10 @@ class EclTransExtensiveQuantities enum { enableExtbo = getPropValue() }; enum { enableEnergy = getPropValue() }; - typedef MathToolbox Toolbox; - typedef Dune::FieldVector DimVector; - typedef Dune::FieldVector EvalDimVector; - typedef Dune::FieldMatrix DimMatrix; + using Toolbox = MathToolbox; + using DimVector = Dune::FieldVector; + using EvalDimVector = Dune::FieldVector; + using DimMatrix = Dune::FieldMatrix; public: /*! diff --git a/ebos/eclgenerictracermodel.hh b/ebos/eclgenerictracermodel.hh index 434bac0b2..db5f8c4ed 100644 --- a/ebos/eclgenerictracermodel.hh +++ b/ebos/eclgenerictracermodel.hh @@ -51,7 +51,7 @@ public: using TracerMatrix = Dune::BCRSMatrix>; using TracerVector = Dune::BlockVector>; using CartesianIndexMapper = Dune::CartesianIndexMapper; - static const int dimWorld = Grid::dimensionworld; + static constexpr int dimWorld = Grid::dimensionworld; /*! * \brief Return the number of tracers considered by the tracerModel. */ diff --git a/ebos/eclgenericwriter.hh b/ebos/eclgenericwriter.hh index 353e54940..367060376 100644 --- a/ebos/eclgenericwriter.hh +++ b/ebos/eclgenericwriter.hh @@ -65,9 +65,9 @@ namespace Opm { template class EclGenericWriter -{ - typedef Dune::CartesianIndexMapper CartesianIndexMapper; - typedef Dune::CartesianIndexMapper EquilCartesianIndexMapper; +{ + using CartesianIndexMapper = Dune::CartesianIndexMapper; + using EquilCartesianIndexMapper = Dune::CartesianIndexMapper; using CollectDataToIORankType = CollectDataToIORank; using TransmissibilityType = EclTransmissibility; @@ -103,7 +103,7 @@ public: { simulation_report_ = report; } - + protected: const TransmissibilityType& globalTrans() const; unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const; diff --git a/ebos/eclnewtonmethod.hh b/ebos/eclnewtonmethod.hh index 38a9c9fdb..5846da6a6 100644 --- a/ebos/eclnewtonmethod.hh +++ b/ebos/eclnewtonmethod.hh @@ -65,7 +65,7 @@ namespace Opm { template class EclNewtonMethod : public BlackOilNewtonMethod { - typedef BlackOilNewtonMethod ParentType; + using ParentType = BlackOilNewtonMethod; using DiscNewtonMethod = GetPropType; using Simulator = GetPropType; @@ -79,7 +79,7 @@ class EclNewtonMethod : public BlackOilNewtonMethod using Linearizer = GetPropType; using ElementContext = GetPropType; - static const unsigned numEq = getPropValue(); + static constexpr unsigned numEq = getPropValue(); static constexpr int contiSolventEqIdx = Indices::contiSolventEqIdx; static constexpr int contiPolymerEqIdx = Indices::contiPolymerEqIdx; diff --git a/ebos/eclpolyhedralgridvanguard.hh b/ebos/eclpolyhedralgridvanguard.hh index 0f2573222..903722d98 100644 --- a/ebos/eclpolyhedralgridvanguard.hh +++ b/ebos/eclpolyhedralgridvanguard.hh @@ -76,7 +76,7 @@ template class EclPolyhedralGridVanguard : public EclBaseVanguard { friend class EclBaseVanguard; - typedef EclBaseVanguard ParentType; + using ParentType = EclBaseVanguard; using ElementMapper = GetPropType; using Scalar = GetPropType; @@ -89,10 +89,10 @@ public: using TransmissibilityType = EclTransmissibility; private: - typedef Grid* GridPointer; - typedef EquilGrid* EquilGridPointer; - typedef Dune::CartesianIndexMapper CartesianIndexMapper; - typedef std::unique_ptr CartesianIndexMapperPointer; + using GridPointer = Grid*; + using EquilGridPointer = EquilGrid*; + using CartesianIndexMapper = Dune::CartesianIndexMapper; + using CartesianIndexMapperPointer = std::unique_ptr; public: EclPolyhedralGridVanguard(Simulator& simulator) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index a94d2eabb..6c9c2fa0b 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -869,10 +869,10 @@ public: #ifdef HAVE_DUNE_ALUGRID using Grid = GetPropType; typename std::is_same>::type isAlugrid; - if (isAlugrid) { - gridToEquilGrid = [&simulator](unsigned int i) { - return simulator.vanguard().gridIdxToEquilGridIdx(i); - }; + if constexpr (isAlugrid) { + gridToEquilGrid = [&simulator](unsigned int i) { + return simulator.vanguard().gridIdxToEquilGridIdx(i); + }; } #endif // HAVE_DUNE_ALUGRID transmissibilities_.finishInit(gridToEquilGrid); @@ -1046,10 +1046,10 @@ public: using Grid = GetPropType; typename std::is_same>::type isAlugrid; - if (isAlugrid) { - equilGridToGrid = [&simulator](unsigned int i) { - return simulator.vanguard().gridEquilIdxToGridIdx(i); - }; + if constexpr (isAlugrid) { + equilGridToGrid = [&simulator](unsigned int i) { + return simulator.vanguard().gridEquilIdxToGridIdx(i); + }; } #endif // HAVE_DUNE_ALUGRID @@ -1197,10 +1197,10 @@ public: #ifdef HAVE_DUNE_ALUGRID using Grid = GetPropType; typename std::is_same>::type isAlugrid; - if (isAlugrid) { - gridToEquilGrid = [&simulator](unsigned int i) { - return simulator.vanguard().gridIdxToEquilGridIdx(i); - }; + if constexpr (isAlugrid) { + gridToEquilGrid = [&simulator](unsigned int i) { + return simulator.vanguard().gridIdxToEquilGridIdx(i); + }; } #endif // HAVE_DUNE_ALUGRID @@ -2766,11 +2766,11 @@ private: tempiData = fp.get_double("TEMPI"); // initial salt concentration data - if (enableBrine) + if constexpr (enableBrine) saltData = fp.get_double("SALT"); // initial precipitated salt saturation data - if (enableSaltPrecipitation) + if constexpr (enableSaltPrecipitation) saltpData = fp.get_double("SALTP"); // calculate the initial fluid states @@ -2790,13 +2790,13 @@ private: ////// // set salt concentration ////// - if (enableBrine) + if constexpr (enableBrine) dofFluidState.setSaltConcentration(saltData[dofIdx]); ////// // set precipitated salt saturation ////// - if (enableSaltPrecipitation) + if constexpr (enableSaltPrecipitation) dofFluidState.setSaltSaturation(saltpData[dofIdx]); ////// diff --git a/ebos/eclthresholdpressure.hh b/ebos/eclthresholdpressure.hh index a3ef95e2f..7dae845e9 100644 --- a/ebos/eclthresholdpressure.hh +++ b/ebos/eclthresholdpressure.hh @@ -101,7 +101,7 @@ private: const auto& vanguard = simulator_.vanguard(); const auto& gridView = vanguard.gridView(); - typedef MathToolbox Toolbox; + using Toolbox = MathToolbox; // loop over the whole grid and compute the maximum gravity adjusted pressure // difference between two EQUIL regions. auto elemIt = gridView.template begin(); diff --git a/ebos/femcpgridcompat.hh b/ebos/femcpgridcompat.hh index b6585025d..c480f5e74 100644 --- a/ebos/femcpgridcompat.hh +++ b/ebos/femcpgridcompat.hh @@ -57,8 +57,8 @@ namespace Fem { template struct GridEntityAccess > { - typedef Dune::cpgrid::Entity EntityType; - typedef EntityType GridEntityType; + using EntityType = Dune::cpgrid::Entity; + using GridEntityType = EntityType; static const GridEntityType& gridEntity(const EntityType& entity) { return entity; } diff --git a/ebos/vtkecltracermodule.hh b/ebos/vtkecltracermodule.hh index b1b2ec608..a37d3b27a 100644 --- a/ebos/vtkecltracermodule.hh +++ b/ebos/vtkecltracermodule.hh @@ -70,7 +70,7 @@ namespace Opm { template class VtkEclTracerModule : public BaseOutputModule { - typedef BaseOutputModule ParentType; + using ParentType = BaseOutputModule; using Simulator = GetPropType; using Scalar = GetPropType; @@ -80,11 +80,11 @@ namespace Opm { using GridView = GetPropType; using FluidSystem = GetPropType; - static const int vtkFormat = getPropValue(); - typedef ::Opm::VtkMultiWriter VtkMultiWriter; + static constexpr int vtkFormat = getPropValue(); + using VtkMultiWriter = ::Opm::VtkMultiWriter; - typedef typename ParentType::ScalarBuffer ScalarBuffer; + using ScalarBuffer = typename ParentType::ScalarBuffer; public: VtkEclTracerModule(const Simulator& simulator)