From 47c92e6d52d601b6af3bfe972dac0c2bf325d9fe Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 5 Jul 2018 11:09:06 +0200 Subject: [PATCH] [staggered][scvf] Use correct return types * directioSign() : int * directionIdx() : unsigned int --- .../staggered/freeflow/staggeredgeometryhelper.hh | 2 +- .../staggered/freeflow/subcontrolvolumeface.hh | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh index 326cc45d31..63d16d21a0 100644 --- a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh +++ b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh @@ -56,7 +56,7 @@ struct PairData * \brief Returns the dirction index of the facet (0 = x, 1 = y, 2 = z) */ template<class Vector> -inline static int directionIndex(Vector&& vector) +inline static unsigned int directionIndex(Vector&& vector) { const auto eps = 1e-8; const int idx = std::find_if(vector.begin(), vector.end(), [eps](const auto& x) { return std::abs(x) > eps; } ) - vector.begin(); diff --git a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh index 049168a91a..1444aaf5d5 100644 --- a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh @@ -87,8 +87,7 @@ public: pairData_(geometryHelper.pairData()), localFaceIdx_(geometryHelper.localFaceIndex()), dirIdx_(geometryHelper.directionIndex()), - normalInPosCoordDir_(unitOuterNormal_[directionIndex()] > 0.0), - outerNormalScalar_(unitOuterNormal_[directionIndex()]), + outerNormalSign_(sign(unitOuterNormal_[directionIndex()])), isGhostFace_(false) { corners_.resize(isGeometry.corners()); @@ -213,13 +212,13 @@ public: //! Returns whether the unitNormal of the face points in positive coordinate direction bool normalInPosCoordDir() const { - return normalInPosCoordDir_; + return directionSign() > 0; } //! Returns the sign of the unit outer normal's vector - Scalar directionSign() const + int directionSign() const { - return outerNormalScalar_; + return outerNormalSign_; } //! Returns the data for one sub face @@ -265,8 +264,7 @@ private: std::array<PairData<Scalar, GlobalPosition>, numPairs> pairData_; int localFaceIdx_; unsigned int dirIdx_; - bool normalInPosCoordDir_; - Scalar outerNormalScalar_; + int outerNormalSign_; bool isGhostFace_; }; -- GitLab