diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H index feb90f44a..a735459df 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H @@ -148,6 +148,14 @@ public: const intersection::direction dir = intersection::VECTOR ) const; + //- Return contact sphere diameter + inline scalar contactSphereDiameter + ( + const point& p, + const vector& n, + const pointField& meshPoints + ) const; + //- Return the triangle inline triPointRef tri(const pointField&) const; @@ -167,7 +175,11 @@ public: //- Hash specialization for hashing triFace - a commutative hash value. // Hash incrementally. template<> -inline unsigned Hash::operator()(const triFace& t, unsigned seed) const +inline unsigned Hash::operator() +( + const triFace& t, + unsigned seed +) const { // Fortunately we don't need this very often const uLabel t0(t[0]); diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H index e5cb930ee..9275169c7 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H @@ -288,6 +288,22 @@ inline Foam::pointHit Foam::triFace::ray } +inline Foam::scalar Foam::triFace::contactSphereDiameter +( + const point& p, + const vector& n, + const pointField& meshPoints +) const +{ + vector n1 = n/(Foam::mag(n) + SMALL); + vector n2 = normal(meshPoints); + + n2 /= Foam::mag(n2) + SMALL; + + return 2*((centre(meshPoints) - p) & n2)/((n1 & n2) - 1.0); +} + + inline Foam::triPointRef Foam::triFace::tri(const pointField& points) const { return triPointRef