diff --git a/dumux/common/loggingparametertree.hh b/dumux/common/loggingparametertree.hh index aeb5c1ef145c0ab99e872eb5528284cccbce47f7..0675a0e638b6d79d3e2d2449463d71a11b5c8d48 100644 --- a/dumux/common/loggingparametertree.hh +++ b/dumux/common/loggingparametertree.hh @@ -131,7 +131,7 @@ public: if (params_.hasSub(compoundGroup) || defaultParams_.hasSub(compoundGroup)) groupNames.push_back(compoundGroup); - groupPrefix = groupPrefix.substr(0, dotPos); + groupPrefix.resize(dotPos); compoundGroup = groupPrefix + "." + subGroupName; } } @@ -192,7 +192,7 @@ public: auto dot = prefix.rfind("."); while (dot != std::string::npos) { - prefix = prefix.substr(0, dot); + prefix.resize(dot); std::string compoundKey = prefix + "." + key; if (tree.hasKey(compoundKey)) diff --git a/dumux/discretization/box/boxgeometryhelper.hh b/dumux/discretization/box/boxgeometryhelper.hh index de996db8a2466e0fa682869ba3a9dfe6979f6f65..0549c4152dc3722b67b2c44f1cd489f9b6893518 100644 --- a/dumux/discretization/box/boxgeometryhelper.hh +++ b/dumux/discretization/box/boxgeometryhelper.hh @@ -274,7 +274,7 @@ private: static constexpr int dim = 1; public: - BoxGeometryHelper(const typename Element::Geometry& geometry) + explicit BoxGeometryHelper(const typename Element::Geometry& geometry) : geo_(geometry) {} @@ -349,7 +349,7 @@ class BoxGeometryHelper<GridView, 2, ScvType, ScvfType> static constexpr auto dimWorld = GridView::dimensionworld; public: - BoxGeometryHelper(const typename Element::Geometry& geometry) + explicit BoxGeometryHelper(const typename Element::Geometry& geometry) : geo_(geometry) {} @@ -485,7 +485,7 @@ class BoxGeometryHelper<GridView, 3, ScvType, ScvfType> static constexpr auto dimWorld = GridView::dimensionworld; public: - BoxGeometryHelper(const typename Element::Geometry& geometry) + explicit BoxGeometryHelper(const typename Element::Geometry& geometry) : geo_(geometry) {} diff --git a/dumux/discretization/facecentered/diamond/geometryhelper.hh b/dumux/discretization/facecentered/diamond/geometryhelper.hh index 895ba54cb7e6796ee2fe01ae74f044fa985ebd89..6601b9cd488371b3f24e93c52975b77d7fa11191 100644 --- a/dumux/discretization/facecentered/diamond/geometryhelper.hh +++ b/dumux/discretization/facecentered/diamond/geometryhelper.hh @@ -267,7 +267,7 @@ class DiamondGeometryHelper using GlobalPosition = typename Dune::FieldVector<ctype, GridView::dimensionworld>; public: - DiamondGeometryHelper(const typename Element::Geometry& geo) + explicit DiamondGeometryHelper(const typename Element::Geometry& geo) : geo_(geo) {} diff --git a/dumux/geometry/boundingboxtree.hh b/dumux/geometry/boundingboxtree.hh index 8d54d3d32c30eb17fa54239993d75ab59382d42b..5d56630feb0f17438ddfab73370f91b559cfcb9c 100644 --- a/dumux/geometry/boundingboxtree.hh +++ b/dumux/geometry/boundingboxtree.hh @@ -87,7 +87,7 @@ public: BoundingBoxTree() = default; //! Constructor with gridView - BoundingBoxTree(std::shared_ptr<const GeometricEntitySet> set) + explicit BoundingBoxTree(std::shared_ptr<const GeometricEntitySet> set) { build(set); } //! Build up bounding box tree for a grid with leafGridView diff --git a/dumux/geometry/distancefield.hh b/dumux/geometry/distancefield.hh index 7102df28feaccecc37c27d1c9cdf34f9de8a27ad..ec5df4e93e4ba4c03925f2dd63d9368752c49947 100644 --- a/dumux/geometry/distancefield.hh +++ b/dumux/geometry/distancefield.hh @@ -58,7 +58,7 @@ public: * \brief The constructor. * \param geometries A vector of geometries describing the boundaries of the spatial domain. */ - AABBDistanceField(const std::vector<Geometry>& geometries) + explicit AABBDistanceField(const std::vector<Geometry>& geometries) : tree_(std::make_unique<AABBTree>(std::make_shared<GeoSet>(geometries))) { std::vector<PointGeometry> points; diff --git a/dumux/geometry/geometricentityset.hh b/dumux/geometry/geometricentityset.hh index 78b308f7ac8c44594267d9312e678c4375e52cd1..2d073537d9391ba975b9ad28d9ba99c5df252d34 100644 --- a/dumux/geometry/geometricentityset.hh +++ b/dumux/geometry/geometricentityset.hh @@ -39,7 +39,7 @@ class GridViewGeometricEntitySet public: using Entity = typename GridView::template Codim<codim>::Entity; - GridViewGeometricEntitySet(const GridView& gridView) + explicit GridViewGeometricEntitySet(const GridView& gridView) : GridViewGeometricEntitySet(gridView, Mapper(gridView, Dune::mcmgLayout(Dune::Codim<codim>()))) {} @@ -177,7 +177,7 @@ public: /*! * \brief Constructor for a vector of geometries */ - GeometriesEntitySet(const std::vector<typename Entity::Geometry>& geometries) + explicit GeometriesEntitySet(const std::vector<typename Entity::Geometry>& geometries) { std::size_t index = 0; for (auto&& g : geometries) @@ -187,7 +187,7 @@ public: /*! * \brief Constructor for a vector of geometries */ - GeometriesEntitySet(std::vector<typename Entity::Geometry>&& geometries) + explicit GeometriesEntitySet(std::vector<typename Entity::Geometry>&& geometries) { std::size_t index = 0; for (auto&& g : geometries) diff --git a/dumux/material/fluidmatrixinteractions/2p/materiallaw.hh b/dumux/material/fluidmatrixinteractions/2p/materiallaw.hh index 74b9243ab41c62988763fc1beedc58625ade6be5..8c8251663f43464cac78d63a2b2aff8dfabe196c 100644 --- a/dumux/material/fluidmatrixinteractions/2p/materiallaw.hh +++ b/dumux/material/fluidmatrixinteractions/2p/materiallaw.hh @@ -87,9 +87,9 @@ public: * \brief Construct from parameter structs * \note More efficient constructor but you need to ensure all parameters are initialized */ - TwoPMaterialLaw(const BasicParams& baseParams, - const EffToAbsParams& effToAbsParams = {}, - const RegularizationParams& regParams = {}) + explicit TwoPMaterialLaw(const BasicParams& baseParams, + const EffToAbsParams& effToAbsParams = {}, + const RegularizationParams& regParams = {}) : basicParams_(baseParams) , effToAbsParams_(effToAbsParams) { diff --git a/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh b/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh index ed04dafe06f5593e97c2161e5b3e0602e797774a..e20ea66456f65fe6a960f4a8bc34d7f4bc89c915 100644 --- a/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh +++ b/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh @@ -26,7 +26,7 @@ namespace Dumux { template<class... Laws> struct FluidMatrixInteraction : public Laws... { - FluidMatrixInteraction(Laws&&... laws) : Laws(std::forward<Laws>(laws))... {} + explicit FluidMatrixInteraction(Laws&&... laws) : Laws(std::forward<Laws>(laws))... {} }; /*! @@ -69,7 +69,7 @@ public: using PcKrSwType = T; - PcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit PcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} Scalar pc(const Scalar sw) const { return impl_.pc(sw); } Scalar dpc_dsw(const Scalar sw) const { return impl_.dpc_dsw(sw); } @@ -107,7 +107,7 @@ class MultiPhasePcKrSw public: using Scalar = typename std::decay_t<T>::Scalar; - MultiPhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit MultiPhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} template<class FS> auto capillaryPressures(const FS& fs, int wp) const { return impl_.capillaryPressures(fs, wp); } @@ -141,7 +141,7 @@ struct ThreePhasePcKrSw using PcKrSwType = T; - ThreePhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit ThreePhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} Scalar pcgw(const Scalar sw, const Scalar sn) const { return impl_.pcgw(sw, sn); } Scalar pcnw(const Scalar sw, const Scalar sn) const { return impl_.pcnw(sw, sn); } @@ -176,7 +176,7 @@ template<class T> class WettingNonwettingInterfacialAreaPcSw { public: - WettingNonwettingInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit WettingNonwettingInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} const T& wettingNonwettingInterface() const { return impl_; } private: T impl_; @@ -199,7 +199,7 @@ template<class T> class WettingSolidInterfacialAreaPcSw { public: - WettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit WettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} const T& wettingSolidInterface() const { return impl_; } private: T impl_; @@ -222,7 +222,7 @@ template<class T> class NonwettingSolidInterfacialAreaPcSw { public: - NonwettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit NonwettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} const T& nonwettingSolidInterface() const { return impl_; } private: T impl_; @@ -248,7 +248,7 @@ class Adsorption public: using value_type = T; - Adsorption(T&& impl) : impl_(std::forward<T>(impl)) {} + explicit Adsorption(T&& impl) : impl_(std::forward<T>(impl)) {} const T& adsorptionModel() const { return impl_; } private: T impl_; diff --git a/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh b/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh index c4406ce25a0eba6c014da98e143d9591c95218b2..97353d01cccc41cba31e7fff290b14faa2efba3a 100644 --- a/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh +++ b/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh @@ -50,7 +50,7 @@ public: using BasicParams = Params; using Scalar = S; - MPLinearMaterial(const BasicParams& basicParams) + explicit MPLinearMaterial(const BasicParams& basicParams) : basicParams_(basicParams) {} diff --git a/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/multishapelocalrules.hh b/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/multishapelocalrules.hh index eba5129f6e9de5836f319bf4909bb67c0678c5b1..f539dd07d53c4b20382326ffe2346c4c5eb21549 100644 --- a/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/multishapelocalrules.hh +++ b/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/multishapelocalrules.hh @@ -98,9 +98,9 @@ public: static constexpr int numFluidPhases() { return 2; } - MultiShapeTwoPLocalRules(const BasicParams& baseParams, - //const RegularizationParams& regParams = {}, TODO - const std::string& paramGroup = "") + explicit MultiShapeTwoPLocalRules(const BasicParams& baseParams, + //const RegularizationParams& regParams = {}, TODO + const std::string& paramGroup = "") { shape_ = baseParams.poreShape(); switch (shape_) diff --git a/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/singleshapelocalrules.hh b/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/singleshapelocalrules.hh index 5f5c3ae9f79f9e39c67fb4b3f751fac06b4791b8..9cf2d1757f901f9e5ded3a053dd8d0f49fc4bf2a 100644 --- a/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/singleshapelocalrules.hh +++ b/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/singleshapelocalrules.hh @@ -66,9 +66,9 @@ public: * \brief Construct from parameter structs * \note More efficient constructor but you need to ensure all parameters are initialized */ - SingleShapeTwoPLocalRules(const BasicParams& baseParams = {}, - const RegularizationParams& regParams = {}, - const std::string& paramGroup = "") + explicit SingleShapeTwoPLocalRules(const BasicParams& baseParams = {}, + const RegularizationParams& regParams = {}, + const std::string& paramGroup = "") : basicParams_(baseParams) { diff --git a/dumux/material/fluidstates/compositional.hh b/dumux/material/fluidstates/compositional.hh index 93d4c100ab1fa459c486a2ee9292813d00fb0f4c..6dd97c14c817883cd94a4ed6c21ec4b84169a67f 100644 --- a/dumux/material/fluidstates/compositional.hh +++ b/dumux/material/fluidstates/compositional.hh @@ -45,7 +45,7 @@ public: //! copy constructor from arbitrary fluid state template <class FluidState, typename std::enable_if_t<!std::is_same<FluidState, CompositionalFluidState>::value, int> = 0> - CompositionalFluidState(const FluidState &fs) + explicit CompositionalFluidState(const FluidState &fs) { assign(fs); } // copy and move constructor / assignment operator diff --git a/dumux/material/fluidstates/immiscible.hh b/dumux/material/fluidstates/immiscible.hh index 4402c64dd6d340de7d1fd5b52a20f4f9cf543946..9d276f3b72b82b04ad3ec15e87c98c9226bd0c8c 100644 --- a/dumux/material/fluidstates/immiscible.hh +++ b/dumux/material/fluidstates/immiscible.hh @@ -40,7 +40,7 @@ public: //! copy constructor from arbitrary fluid state template <class FluidState, typename std::enable_if_t<!std::is_same<FluidState, ImmiscibleFluidState>::value, int> = 0> - ImmiscibleFluidState(const FluidState &fs) + explicit ImmiscibleFluidState(const FluidState &fs) { assign(fs); } // copy and move constructor / assignment operator diff --git a/dumux/material/fluidstates/isothermalimmiscible.hh b/dumux/material/fluidstates/isothermalimmiscible.hh index c4b4bcec63d27141d19ded432b397598fb0eaba0..e0b22cfa37e1beaab43d42badf9798a71934e1e9 100644 --- a/dumux/material/fluidstates/isothermalimmiscible.hh +++ b/dumux/material/fluidstates/isothermalimmiscible.hh @@ -40,7 +40,7 @@ public: //! copy constructor from arbitrary fluid state template <class FluidState, typename std::enable_if_t<!std::is_same<FluidState, IsothermalImmiscibleFluidState>::value, int> = 0> - IsothermalImmiscibleFluidState(const FluidState &fs) + explicit IsothermalImmiscibleFluidState(const FluidState &fs) { assign(fs); } // copy and move constructor / assignment operator diff --git a/dumux/material/fluidstates/pressureoverlay.hh b/dumux/material/fluidstates/pressureoverlay.hh index 0dc6251d4f98eccf11b5c84f1bea94b42db32432..84946911c96a7de8627d513aa584a2c5f09d4dd9 100644 --- a/dumux/material/fluidstates/pressureoverlay.hh +++ b/dumux/material/fluidstates/pressureoverlay.hh @@ -40,7 +40,7 @@ public: * so it initially behaves exactly like the underlying fluid * state. */ - PressureOverlayFluidState(const FluidState &fs) + explicit PressureOverlayFluidState(const FluidState &fs) : fs_(&fs) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) diff --git a/dumux/material/fluidstates/saturationoverlay.hh b/dumux/material/fluidstates/saturationoverlay.hh index 9553a769f35262023870c6c7776fe01ddbbcba11..d09fa7d48b6b763e562fa60d363a02d1e6a5f8cb 100644 --- a/dumux/material/fluidstates/saturationoverlay.hh +++ b/dumux/material/fluidstates/saturationoverlay.hh @@ -40,7 +40,7 @@ public: * so it initially behaves exactly like the underlying fluid * state. */ - SaturationOverlayFluidState(const FluidState &fs) + explicit SaturationOverlayFluidState(const FluidState &fs) : fs_(&fs) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) diff --git a/dumux/material/fluidstates/temperatureoverlay.hh b/dumux/material/fluidstates/temperatureoverlay.hh index 2bb789b64907ac55233dcad186749dbf9d38e059..64a78ea260b773564a4bc3291695f15f2c52d0d4 100644 --- a/dumux/material/fluidstates/temperatureoverlay.hh +++ b/dumux/material/fluidstates/temperatureoverlay.hh @@ -40,7 +40,7 @@ public: * so it initially behaves exactly like the underlying fluid * state. */ - TemperatureOverlayFluidState(const FluidState &fs) + explicit TemperatureOverlayFluidState(const FluidState &fs) : fs_(&fs) { temperature_ = fs.temperature(/*phaseIdx=*/0); diff --git a/test/material/fluidmatrixinteractions/porenetwork/test_throattransmissibility.cc b/test/material/fluidmatrixinteractions/porenetwork/test_throattransmissibility.cc index deb08cd2a6024f4506886ffccf88cc980857e110..112d12ea35fa6b495577e2a28713232ba52d409d 100644 --- a/test/material/fluidmatrixinteractions/porenetwork/test_throattransmissibility.cc +++ b/test/material/fluidmatrixinteractions/porenetwork/test_throattransmissibility.cc @@ -31,7 +31,7 @@ struct MockFVElementGeometry struct MockFluxVariablesCacheOneP { using Scalar = double; - MockFluxVariablesCacheOneP(const PoreNetwork::Throat::Shape shape) + explicit MockFluxVariablesCacheOneP(const PoreNetwork::Throat::Shape shape) : shape_(shape) {}