mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-normalMethods' into 'develop-pre-release'
STYLE: separate areaNormal/unitNormal method for primitives (issue #885) See merge request Development/OpenFOAM-plus!208
This commit is contained in:
@ -81,7 +81,7 @@ Foam::label Foam::face::mostConcaveAngle
|
|||||||
scalar& maxAngle
|
scalar& maxAngle
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector n(normal(points));
|
vector n(areaNormal(points));
|
||||||
|
|
||||||
label index = 0;
|
label index = 0;
|
||||||
maxAngle = -GREAT;
|
maxAngle = -GREAT;
|
||||||
@ -542,17 +542,16 @@ Foam::point Foam::face::centre(const UList<point>& points) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::face::normal(const UList<point>& p) const
|
Foam::vector Foam::face::areaNormal(const UList<point>& p) const
|
||||||
{
|
{
|
||||||
const label nPoints = size();
|
const label nPoints = size();
|
||||||
|
|
||||||
// Calculate the normal by summing the face triangle normals.
|
// Calculate the area normal by summing the face triangle area normals.
|
||||||
// Changed to deal with small concavity by using a central decomposition
|
// Changed to deal with small concavity by using a central decomposition
|
||||||
//
|
|
||||||
|
|
||||||
// If the face is a triangle, do a direct calculation to avoid round-off
|
// If the face is a triangle, do a direct calculation to avoid round-off
|
||||||
// error-related problems
|
// error-related problems
|
||||||
//
|
|
||||||
if (nPoints == 3)
|
if (nPoints == 3)
|
||||||
{
|
{
|
||||||
return triPointRef
|
return triPointRef
|
||||||
@ -560,7 +559,7 @@ Foam::vector Foam::face::normal(const UList<point>& p) const
|
|||||||
p[operator[](0)],
|
p[operator[](0)],
|
||||||
p[operator[](1)],
|
p[operator[](1)],
|
||||||
p[operator[](2)]
|
p[operator[](2)]
|
||||||
).normal();
|
).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
label pI;
|
label pI;
|
||||||
@ -594,7 +593,7 @@ Foam::vector Foam::face::normal(const UList<point>& p) const
|
|||||||
p[operator[](pI)],
|
p[operator[](pI)],
|
||||||
nextPoint,
|
nextPoint,
|
||||||
centrePoint
|
centrePoint
|
||||||
).normal();
|
).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,7 +39,6 @@ SourceFiles
|
|||||||
faceTemplates.C
|
faceTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef face_H
|
#ifndef face_H
|
||||||
#define face_H
|
#define face_H
|
||||||
|
|
||||||
@ -194,12 +193,22 @@ public:
|
|||||||
const Field<Type>& fld
|
const Field<Type>& fld
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- The area normal - with magnitude equal to area of face
|
||||||
|
vector areaNormal(const UList<point>& p) const;
|
||||||
|
|
||||||
|
//- The unit normal
|
||||||
|
inline vector unitNormal(const UList<point>& p) const;
|
||||||
|
|
||||||
|
//- Legacy name for areaNormal.
|
||||||
|
// \deprecated Deprecated for new use (JUN-2018)
|
||||||
|
inline vector normal(const UList<point>& p) const
|
||||||
|
{
|
||||||
|
return areaNormal(p); // Legacy definition
|
||||||
|
}
|
||||||
|
|
||||||
//- Magnitude of face area
|
//- Magnitude of face area
|
||||||
inline scalar mag(const UList<point>& p) const;
|
inline scalar mag(const UList<point>& p) const;
|
||||||
|
|
||||||
//- Vector normal; magnitude is equal to area of face
|
|
||||||
vector normal(const UList<point>& p) const;
|
|
||||||
|
|
||||||
//- Return face with reverse direction
|
//- Return face with reverse direction
|
||||||
// The starting points of the original and reverse face are identical.
|
// The starting points of the original and reverse face are identical.
|
||||||
face reverseFace() const;
|
face reverseFace() const;
|
||||||
|
|||||||
@ -37,10 +37,8 @@ Foam::scalar Foam::face::contactSphereDiameter
|
|||||||
const UList<point>& meshPoints
|
const UList<point>& meshPoints
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalar magN = Foam::mag(n);
|
vector n1 = n/(Foam::mag(n) + SMALL);
|
||||||
|
vector n2 = areaNormal(meshPoints);
|
||||||
vector n1 = n/(magN + SMALL);
|
|
||||||
vector n2 = normal(meshPoints);
|
|
||||||
|
|
||||||
n2 /= Foam::mag(n2) + SMALL;
|
n2 /= Foam::mag(n2) + SMALL;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -105,9 +105,17 @@ inline Foam::pointField Foam::face::points
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::face::unitNormal(const UList<point>& p) const
|
||||||
|
{
|
||||||
|
const vector n(areaNormal(p));
|
||||||
|
const scalar s(Foam::mag(n));
|
||||||
|
return s < ROOTVSMALL ? Zero : n/s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::face::mag(const UList<point>& p) const
|
inline Foam::scalar Foam::face::mag(const UList<point>& p) const
|
||||||
{
|
{
|
||||||
return ::Foam::mag(normal(p));
|
return ::Foam::mag(areaNormal(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -124,12 +124,22 @@ public:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Type average(const UList<point>& unused, const Field<Type>& fld) const;
|
Type average(const UList<point>& unused, const Field<Type>& fld) const;
|
||||||
|
|
||||||
|
//- The area normal - with magnitude equal to area of face
|
||||||
|
inline vector areaNormal(const UList<point>& points) const;
|
||||||
|
|
||||||
|
//- The unit normal
|
||||||
|
inline vector unitNormal(const UList<point>& points) const;
|
||||||
|
|
||||||
|
//- Legacy name for areaNormal.
|
||||||
|
// \deprecated Deprecated for new use (JUN-2018)
|
||||||
|
inline vector normal(const UList<point>& points) const
|
||||||
|
{
|
||||||
|
return areaNormal(points); // Legacy definition
|
||||||
|
}
|
||||||
|
|
||||||
//- Magnitude of face area
|
//- Magnitude of face area
|
||||||
inline scalar mag(const UList<point>& points) const;
|
inline scalar mag(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Vector normal; magnitude is equal to area of face
|
|
||||||
inline vector normal(const UList<point>& points) const;
|
|
||||||
|
|
||||||
//- Number of triangles after splitting
|
//- Number of triangles after splitting
|
||||||
inline label nTriangles() const;
|
inline label nTriangles() const;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -171,15 +171,9 @@ inline Foam::point Foam::triFace::centre(const UList<point>& points) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::triFace::mag(const UList<point>& points) const
|
inline Foam::vector Foam::triFace::areaNormal(const UList<point>& points) const
|
||||||
{
|
|
||||||
return ::Foam::mag(normal(points));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// could also delegate to triPointRef(...).normal()
|
|
||||||
inline Foam::vector Foam::triFace::normal(const UList<point>& points) const
|
|
||||||
{
|
{
|
||||||
|
// As per triPointRef(...).areaNormal()
|
||||||
return 0.5*
|
return 0.5*
|
||||||
(
|
(
|
||||||
(points[operator[](1)] - points[operator[](0)])
|
(points[operator[](1)] - points[operator[](0)])
|
||||||
@ -188,6 +182,20 @@ inline Foam::vector Foam::triFace::normal(const UList<point>& points) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::triFace::unitNormal(const UList<point>& points) const
|
||||||
|
{
|
||||||
|
const vector n(areaNormal(points));
|
||||||
|
const scalar s(Foam::mag(n));
|
||||||
|
return s < ROOTVSMALL ? Zero : n/s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::triFace::mag(const UList<point>& points) const
|
||||||
|
{
|
||||||
|
return ::Foam::mag(areaNormal(points));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::nTriangles() const
|
inline Foam::label Foam::triFace::nTriangles() const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public:
|
|||||||
//- Operate on a triangle
|
//- Operate on a triangle
|
||||||
result operator()(const FixedList<point, 3>& p) const
|
result operator()(const FixedList<point, 3>& p) const
|
||||||
{
|
{
|
||||||
return result(triPointRef(p[0], p[1], p[2]).normal());
|
return result(triPointRef(p[0], p[1], p[2]).areaNormal());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,9 @@ typename Foam::cut::opAddResult<AboveOp, BelowOp>::type Foam::triCut
|
|||||||
{
|
{
|
||||||
// Set the level set to the signed distance from the plane
|
// Set the level set to the signed distance from the plane
|
||||||
FixedList<scalar, 3> level;
|
FixedList<scalar, 3> level;
|
||||||
for (label i = 0; i < 3; ++ i)
|
for (label i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
// uses unit-normal
|
||||||
level[i] = (tri[i] - p.refPoint()) & p.normal();
|
level[i] = (tri[i] - p.refPoint()) & p.normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,8 +252,9 @@ typename Foam::cut::opAddResult<AboveOp, BelowOp>::type Foam::tetCut
|
|||||||
{
|
{
|
||||||
// Set the level set to the signed distance from the plane
|
// Set the level set to the signed distance from the plane
|
||||||
FixedList<scalar, 4> level;
|
FixedList<scalar, 4> level;
|
||||||
for (label i = 0; i < 4; ++ i)
|
for (label i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
|
// uses unit-normal
|
||||||
level[i] = (tet[i] - p.refPoint()) & p.normal();
|
level[i] = (tet[i] - p.refPoint()) & p.normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -195,7 +195,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return plane normal
|
//- Return the plane unit normal
|
||||||
const vector& normal() const;
|
const vector& normal() const;
|
||||||
|
|
||||||
//- Return plane base point
|
//- Return plane base point
|
||||||
|
|||||||
@ -89,7 +89,7 @@ inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
|
|||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return (1.0/3.0)*(base_.normal(points)&(height(points)));
|
return (1.0/3.0)*(base_.areaNormal(points) & (height(points)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,13 +54,12 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class Istream;
|
class Istream;
|
||||||
class Ostream;
|
class Ostream;
|
||||||
class tetPoints;
|
class tetPoints;
|
||||||
class plane;
|
class plane;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
|
|
||||||
template<class Point, class PointRef> class tetrahedron;
|
template<class Point, class PointRef> class tetrahedron;
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
@ -210,13 +209,16 @@ public:
|
|||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
|
||||||
//- Return face normal
|
//- Face area normal for side a
|
||||||
inline vector Sa() const;
|
inline vector Sa() const;
|
||||||
|
|
||||||
|
//- Face area normal for side b
|
||||||
inline vector Sb() const;
|
inline vector Sb() const;
|
||||||
|
|
||||||
|
//- Face area normal for side c
|
||||||
inline vector Sc() const;
|
inline vector Sc() const;
|
||||||
|
|
||||||
|
//- Face area normal for side d
|
||||||
inline vector Sd() const;
|
inline vector Sd() const;
|
||||||
|
|
||||||
//- Return centre (centroid)
|
//- Return centre (centroid)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -133,28 +133,28 @@ inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
|
|||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const
|
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const
|
||||||
{
|
{
|
||||||
return triangle<Point, PointRef>(b_, c_, d_).normal();
|
return triangle<Point, PointRef>(b_, c_, d_).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sb() const
|
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sb() const
|
||||||
{
|
{
|
||||||
return triangle<Point, PointRef>(a_, d_, c_).normal();
|
return triangle<Point, PointRef>(a_, d_, c_).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sc() const
|
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sc() const
|
||||||
{
|
{
|
||||||
return triangle<Point, PointRef>(a_, b_, d_).normal();
|
return triangle<Point, PointRef>(a_, b_, d_).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sd() const
|
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sd() const
|
||||||
{
|
{
|
||||||
return triangle<Point, PointRef>(a_, c_, b_).normal();
|
return triangle<Point, PointRef>(a_, c_, b_).areaNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
|
|||||||
// "definitively" shown otherwise by obtaining a positive dot
|
// "definitively" shown otherwise by obtaining a positive dot
|
||||||
// product greater than a tolerance of SMALL.
|
// product greater than a tolerance of SMALL.
|
||||||
|
|
||||||
// The tet is defined: tet(Cc, tetBasePt, pA, pB) where the normal
|
// The tet is defined: tet(Cc, tetBasePt, pA, pB) where the area normal
|
||||||
// vectors and base points for the half-space planes are:
|
// vectors and base points for the half-space planes are:
|
||||||
// area[0] = Sa();
|
// area[0] = Sa();
|
||||||
// area[1] = Sb();
|
// area[1] = Sb();
|
||||||
@ -575,10 +575,11 @@ inline void Foam::tetrahedron<Point, PointRef>::tetSliceWithPlane
|
|||||||
label nPos = 0;
|
label nPos = 0;
|
||||||
forAll(tet, i)
|
forAll(tet, i)
|
||||||
{
|
{
|
||||||
|
// with plane unit-normal
|
||||||
d[i] = ((tet[i] - pl.refPoint()) & pl.normal());
|
d[i] = ((tet[i] - pl.refPoint()) & pl.normal());
|
||||||
if (d[i] > 0)
|
if (d[i] > 0)
|
||||||
{
|
{
|
||||||
nPos++;
|
++nPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -206,12 +206,22 @@ public:
|
|||||||
//- Return centre (centroid)
|
//- Return centre (centroid)
|
||||||
inline Point centre() const;
|
inline Point centre() const;
|
||||||
|
|
||||||
|
//- The area normal - with magnitude equal to area of triangle
|
||||||
|
inline vector areaNormal() const;
|
||||||
|
|
||||||
|
//- Return unit normal
|
||||||
|
inline vector unitNormal() const;
|
||||||
|
|
||||||
|
//- Legacy name for areaNormal.
|
||||||
|
// \deprecated Deprecated for new use (JUN-2018)
|
||||||
|
inline vector normal() const
|
||||||
|
{
|
||||||
|
return areaNormal();
|
||||||
|
}
|
||||||
|
|
||||||
//- Return scalar magnitude
|
//- Return scalar magnitude
|
||||||
inline scalar mag() const;
|
inline scalar mag() const;
|
||||||
|
|
||||||
//- Return vector normal
|
|
||||||
inline vector normal() const;
|
|
||||||
|
|
||||||
//- Return circum-centre
|
//- Return circum-centre
|
||||||
inline Point circumCentre() const;
|
inline Point circumCentre() const;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -106,16 +106,25 @@ inline Point Foam::triangle<Point, PointRef>::centre() const
|
|||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::scalar Foam::triangle<Point, PointRef>::mag() const
|
inline Foam::vector Foam::triangle<Point, PointRef>::areaNormal() const
|
||||||
{
|
{
|
||||||
return Foam::mag(normal());
|
return 0.5*((b_ - a_)^(c_ - a_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::vector Foam::triangle<Point, PointRef>::normal() const
|
inline Foam::vector Foam::triangle<Point, PointRef>::unitNormal() const
|
||||||
{
|
{
|
||||||
return 0.5*((b_ - a_)^(c_ - a_));
|
const vector n(areaNormal());
|
||||||
|
const scalar s(Foam::mag(n));
|
||||||
|
return s < ROOTVSMALL ? Zero : n/s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Point, class PointRef>
|
||||||
|
inline Foam::scalar Foam::triangle<Point, PointRef>::mag() const
|
||||||
|
{
|
||||||
|
return ::Foam::mag(areaNormal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -392,7 +401,7 @@ inline Foam::pointHit Foam::triangle<Point, PointRef>::ray
|
|||||||
|| (alg == intersection::HALF_RAY && dist > -planarPointTol)
|
|| (alg == intersection::HALF_RAY && dist > -planarPointTol)
|
||||||
|| (
|
|| (
|
||||||
alg == intersection::VISIBLE
|
alg == intersection::VISIBLE
|
||||||
&& ((q1 & normal()) < -VSMALL)
|
&& ((q1 & areaNormal()) < -VSMALL)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hit && eligible)
|
if (hit && eligible)
|
||||||
|
|||||||
@ -526,11 +526,6 @@ public:
|
|||||||
// current tet.
|
// current tet.
|
||||||
inline vector normal() const;
|
inline vector normal() const;
|
||||||
|
|
||||||
//- Return the normal of the tri on tetFacei_ for the
|
|
||||||
// current tet at the start of the timestep, i.e. based
|
|
||||||
// on oldPoints
|
|
||||||
inline vector oldNormal() const;
|
|
||||||
|
|
||||||
//- Is the particle on a face?
|
//- Is the particle on a face?
|
||||||
inline bool onFace() const;
|
inline bool onFace() const;
|
||||||
|
|
||||||
|
|||||||
@ -280,12 +280,6 @@ inline Foam::vector Foam::particle::normal() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::vector Foam::particle::oldNormal() const
|
|
||||||
{
|
|
||||||
return currentTetIndices().oldFaceTri(mesh_).normal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::particle::onFace() const
|
inline bool Foam::particle::onFace() const
|
||||||
{
|
{
|
||||||
return facei_ >= 0;
|
return facei_ >= 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user