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_); }