Skip to content
Snippets Groups Projects
Commit ac44157a authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

Merge branch 'freeflow/improve-scvf' into 'master'

Freeflow/improve scvf

See merge request !1056
parents b98d2d53 47c92e6d
No related branches found
No related tags found
1 merge request!1056Freeflow/improve scvf
...@@ -56,7 +56,7 @@ struct PairData ...@@ -56,7 +56,7 @@ struct PairData
* \brief Returns the dirction index of the facet (0 = x, 1 = y, 2 = z) * \brief Returns the dirction index of the facet (0 = x, 1 = y, 2 = z)
*/ */
template<class Vector> template<class Vector>
inline static int directionIndex(Vector&& vector) inline static unsigned int directionIndex(Vector&& vector)
{ {
const auto eps = 1e-8; 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(); const int idx = std::find_if(vector.begin(), vector.end(), [eps](const auto& x) { return std::abs(x) > eps; } ) - vector.begin();
......
...@@ -68,10 +68,10 @@ public: ...@@ -68,10 +68,10 @@ public:
//! Constructor with intersection //! Constructor with intersection
template <class Intersection, class GeometryHelper> template <class Intersection, class GeometryHelper>
FreeFlowStaggeredSubControlVolumeFace(const Intersection& is, FreeFlowStaggeredSubControlVolumeFace(const Intersection& is,
const typename Intersection::Geometry& isGeometry, const typename Intersection::Geometry& isGeometry,
GridIndexType scvfIndex, GridIndexType scvfIndex,
const std::vector<GridIndexType>& scvIndices, const std::vector<GridIndexType>& scvIndices,
const GeometryHelper& geometryHelper const GeometryHelper& geometryHelper
) )
: ParentType(), : ParentType(),
geomType_(isGeometry.type()), geomType_(isGeometry.type()),
...@@ -87,8 +87,7 @@ public: ...@@ -87,8 +87,7 @@ public:
pairData_(geometryHelper.pairData()), pairData_(geometryHelper.pairData()),
localFaceIdx_(geometryHelper.localFaceIndex()), localFaceIdx_(geometryHelper.localFaceIndex()),
dirIdx_(geometryHelper.directionIndex()), dirIdx_(geometryHelper.directionIndex()),
normalInPosCoordDir_(unitOuterNormal_[directionIndex()] > 0.0), outerNormalSign_(sign(unitOuterNormal_[directionIndex()])),
outerNormalScalar_(unitOuterNormal_[directionIndex()]),
isGhostFace_(false) isGhostFace_(false)
{ {
corners_.resize(isGeometry.corners()); corners_.resize(isGeometry.corners());
...@@ -99,13 +98,15 @@ public: ...@@ -99,13 +98,15 @@ public:
//! Constructor for a ghost face outside of the domain. Only needed to retrieve the center and scvIndices //! Constructor for a ghost face outside of the domain. Only needed to retrieve the center and scvIndices
FreeFlowStaggeredSubControlVolumeFace(const GlobalPosition& dofPosition, FreeFlowStaggeredSubControlVolumeFace(const GlobalPosition& dofPosition,
const std::vector<GridIndexType>& scvIndices, const std::vector<GridIndexType>& scvIndices,
const int dofIdx = -1, const unsigned int dirIdx,
const int scvfIndex = -1) const int dofIdx,
const int scvfIndex)
: center_(dofPosition), : center_(dofPosition),
scvfIndex_(scvfIndex), scvfIndex_(scvfIndex),
scvIndices_(scvIndices), scvIndices_(scvIndices),
dofIdx_(dofIdx), dofIdx_(dofIdx),
selfToOppositeDistance_(0.0), selfToOppositeDistance_(0.0),
dirIdx_(dirIdx),
isGhostFace_(true) isGhostFace_(true)
{} {}
...@@ -197,7 +198,7 @@ public: ...@@ -197,7 +198,7 @@ public:
} }
//! Returns the dirction index of the facet (0 = x, 1 = y, 2 = z) //! Returns the dirction index of the facet (0 = x, 1 = y, 2 = z)
int directionIndex() const unsigned int directionIndex() const
{ {
return dirIdx_; return dirIdx_;
} }
...@@ -211,13 +212,13 @@ public: ...@@ -211,13 +212,13 @@ public:
//! Returns whether the unitNormal of the face points in positive coordinate direction //! Returns whether the unitNormal of the face points in positive coordinate direction
bool normalInPosCoordDir() const bool normalInPosCoordDir() const
{ {
return normalInPosCoordDir_; return directionSign() > 0;
} }
//! Returns the sign of the unit outer normal's vector //! 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 //! Returns the data for one sub face
...@@ -262,9 +263,8 @@ private: ...@@ -262,9 +263,8 @@ private:
Scalar selfToOppositeDistance_; Scalar selfToOppositeDistance_;
std::array<PairData<Scalar, GlobalPosition>, numPairs> pairData_; std::array<PairData<Scalar, GlobalPosition>, numPairs> pairData_;
int localFaceIdx_; int localFaceIdx_;
int dirIdx_; unsigned int dirIdx_;
bool normalInPosCoordDir_; int outerNormalSign_;
Scalar outerNormalScalar_;
bool isGhostFace_; bool isGhostFace_;
}; };
......
...@@ -565,7 +565,7 @@ private: ...@@ -565,7 +565,7 @@ private:
//! helper function to conveniently create a ghost face used to retrieve boundary values from the problem //! helper function to conveniently create a ghost face used to retrieve boundary values from the problem
SubControlVolumeFace makeGhostFace_(const SubControlVolumeFace& ownScvf, const GlobalPosition& pos) const SubControlVolumeFace makeGhostFace_(const SubControlVolumeFace& ownScvf, const GlobalPosition& pos) const
{ {
return SubControlVolumeFace(pos, std::vector<unsigned int>{ownScvf.insideScvIdx(), ownScvf.outsideScvIdx()}, ownScvf.dofIndex(), ownScvf.index()); return SubControlVolumeFace(pos, std::vector<unsigned int>{ownScvf.insideScvIdx(), ownScvf.outsideScvIdx()}, ownScvf.directionIndex(), ownScvf.dofIndex(), ownScvf.index());
}; };
//! helper function to conveniently create a ghost face which is outside the domain, parallel to the scvf of interest //! helper function to conveniently create a ghost face which is outside the domain, parallel to the scvf of interest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment