From 0d2adf573a826f381b5b5f6cc66726aaef11d82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Thu, 15 Nov 2018 11:02:48 +0100 Subject: [PATCH] [mpfa] minor cleanup --- .../cellcentered/mpfa/dualgridindexset.hh | 8 ++--- .../cellcentered/mpfa/fvgridgeometry.hh | 12 ++++--- .../cellcentered/mpfa/helper.hh | 34 ++++++------------- 3 files changed, 20 insertions(+), 34 deletions(-) diff --git a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh index 64802261dc..01c369b4ee 100644 --- a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh +++ b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh @@ -70,8 +70,8 @@ class CCMpfaDualGridNodalIndexSet using LI = typename T::LocalIndexType; using GI = typename T::GridIndexType; - using DimLocalIndexVector = Dune::ReservedVector<LI, T::GridView::dimension>; - using ScvfIndicesInScvStorage = typename T::template NodalScvDataStorage< DimLocalIndexVector >; + using DimIndexVector = Dune::ReservedVector<LI, T::GridView::dimension>; + using ScvfIndicesInScvStorage = typename T::template NodalScvDataStorage< DimIndexVector >; public: //! Export the traits type @@ -96,9 +96,7 @@ public: template<typename SubControlVolumeFace> void insert(const SubControlVolumeFace& scvf) { - insert(scvf.index(), - scvf.insideScvIdx(), - scvf.boundary()); + insert(scvf.index(), scvf.insideScvIdx(), scvf.boundary()); } //! Inserts scvf data diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh index a1f315aec6..8c73955c03 100644 --- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh @@ -166,7 +166,8 @@ public: //! Returns true if secondary interaction volumes are used around a given vertex (index). //! If the use of secondary interaction volumes is disabled, this can be evaluated at compile time. template<bool useSecondary = !hasSingleInteractionVolumeType, std::enable_if_t<!useSecondary, bool> = 0> - constexpr bool vertexUsesSecondaryInteractionVolume(GridIndexType vIdxGlobal) const { return false; } + constexpr bool vertexUsesSecondaryInteractionVolume(GridIndexType vIdxGlobal) const + { return false; } //! update all fvElementGeometries (do this again after grid adaption) void update() @@ -354,7 +355,7 @@ public: // building the geometries has finished std::cout << "Initializing of the grid finite volume geometry took " << timer.elapsed() << " seconds." << std::endl; - // Initialize the grid interaction volume seeds + // Initialize the grid interaction volume index sets timer.reset(); ivIndexSets_.update(*this, std::move(dualIdSet)); std::cout << "Initializing of the grid interaction volume index sets took " << timer.elapsed() << " seconds." << std::endl; @@ -533,7 +534,8 @@ public: //! Returns true if secondary interaction volumes are used around a given vertex (index). //! If the use of secondary interaction volumes is disabled, this can be evaluated at compile time. template<bool useSecondary = !hasSingleInteractionVolumeType, std::enable_if_t<!useSecondary, bool> = 0> - constexpr bool vertexUsesSecondaryInteractionVolume(GridIndexType vIdxGlobal) const { return false; } + constexpr bool vertexUsesSecondaryInteractionVolume(GridIndexType vIdxGlobal) const + { return false; } //! Returns true if a given vertex lies on a processor boundary inside a ghost element. bool isGhostVertex(const Vertex& v) const @@ -715,12 +717,12 @@ public: // building the geometries has finished std::cout << "Initializing of the grid finite volume geometry took " << timer.elapsed() << " seconds." << std::endl; - // Initialize the grid interaction volume seeds + // Initialize the grid interaction volume index sets timer.reset(); ivIndexSets_.update(*this, std::move(dualIdSet)); std::cout << "Initializing of the grid interaction volume index sets took " << timer.elapsed() << " seconds." << std::endl; - // build the connectivity map for an effecient assembly + // build the connectivity map for an efficient assembly timer.reset(); connectivityMap_.update(*this); std::cout << "Initializing of the connectivity map took " << timer.elapsed() << " seconds." << std::endl; diff --git a/dumux/discretization/cellcentered/mpfa/helper.hh b/dumux/discretization/cellcentered/mpfa/helper.hh index 318df5512a..63debf94c6 100644 --- a/dumux/discretization/cellcentered/mpfa/helper.hh +++ b/dumux/discretization/cellcentered/mpfa/helper.hh @@ -65,7 +65,6 @@ class MpfaDimensionHelper<FVGridGeometry, /*dim*/2, /*dimWorld*/2> public: /*! * \brief Calculates the inner normal vectors to a given scv basis. - * * \param scvBasis The basis of an scv */ template< class ScvBasis > @@ -89,7 +88,6 @@ public: /*! * \brief Calculates the determinant of an scv basis. * This is equal to the cross product for dim = dimWorld = 2 - * * \param scvBasis The basis of an scv */ template< class ScvBasis > @@ -102,7 +100,6 @@ public: /*! * \brief Returns the global number of scvfs in the grid. Assumes the grid to be made up of only * basic geometry types. Overlad this function if you want to use different geometry types. - * * \param gridView The grid view to be checked */ static std::size_t getGlobalNumScvf(const GridView& gridView) @@ -118,7 +115,6 @@ public: /*! * \brief Checks whether or not a given scv basis forms a right hand system. - * * \param scvBasis The basis of an scv */ template< class ScvBasis > @@ -172,15 +168,12 @@ public: assert(cornerIdx < 2 && "provided index exceeds the number of corners of facets in 2d"); // create & return the scvf corner vector - if (cornerIdx == 0) - return ScvfCornerVector({p[0], p[1]}); - else - return ScvfCornerVector({p[0], p[2]}); + return cornerIdx == 0 ? ScvfCornerVector({p[0], p[1]}) + : ScvfCornerVector({p[0], p[2]}); } /*! * \brief Calculates the area of an scvf. - * * \param scvfCorners Container with the corners of the scvf */ static CoordScalar getScvfArea(const ScvfCornerVector& scvfCorners) @@ -188,7 +181,6 @@ public: /*! * \brief Calculates the number of scvfs in a given element geometry type. - * * \param gt The element geometry type */ static std::size_t getNumLocalScvfs(const Dune::GeometryType gt) @@ -209,7 +201,7 @@ public: */ template<class FVGridGeometry> class MpfaDimensionHelper<FVGridGeometry, /*dim*/2, /*dimWorld*/3> - : public MpfaDimensionHelper<FVGridGeometry, 2, 2> +: public MpfaDimensionHelper<FVGridGeometry, 2, 2> { using GridView = typename FVGridGeometry::GridView; using CoordScalar = typename GridView::ctype; @@ -217,18 +209,18 @@ public: /*! * \brief Calculates the inner normal vectors to a given scv basis. - * * \param scvBasis The basis of an scv */ template< class ScvBasis > static ScvBasis calculateInnerNormals(const ScvBasis& scvBasis) { // compute vector normal to the basis plane - const auto normal = [&] () { - auto n = crossProduct<CoordScalar>(scvBasis[0], scvBasis[1]); - n /= n.two_norm(); - return n; - } (); + const auto normal = [&scvBasis] () + { + auto n = crossProduct<CoordScalar>(scvBasis[0], scvBasis[1]); + n /= n.two_norm(); + return n; + } (); // compute inner normals using the normal vector ScvBasis innerNormals; @@ -302,11 +294,7 @@ public: innerNormals[2] = crossProduct<CoordScalar>(scvBasis[0], scvBasis[1]); if (!isRightHandSystem(scvBasis)) - { - innerNormals[0] *= -1.0; - innerNormals[1] *= -1.0; - innerNormals[2] *= -1.0; - } + std::for_each(innerNormals.begin(), innerNormals.end(), [] (auto& n) { n *= -1.0; }); return innerNormals; } @@ -349,7 +337,6 @@ public: /*! * \brief Checks whether or not a given scv basis forms a right hand system. - * * \param scvBasis The basis of an scv */ template< class ScvBasis > @@ -479,7 +466,6 @@ public: /*! * \brief Calculates the area of an scvf. - * * \param scvfCorners Container with the corners of the scvf */ static CoordScalar getScvfArea(const ScvfCornerVector& scvfCorners) -- GitLab