1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 This class describes the interaction of a face and a point. It
29 carries the info of a successful hit and (if successful), returns
30 the interaction point.
32 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of classes
50 // Forward declaration of friend functions and operators
52 template<class Point> class PointHit;
55 inline Ostream& operator<<(Ostream&, const PointHit<Point>&);
58 /*---------------------------------------------------------------------------*\
59 Class PointHit Declaration
60 \*---------------------------------------------------------------------------*/
70 //- Point of hit; for miss holds best estimate outside the object
73 //- Distance to hit point
84 //- Construct from components
90 const bool eligibleMiss
96 eligibleMiss_(eligibleMiss)
99 //- Construct from point. Hit and distance set later
100 PointHit(const Point& p)
118 const Point& hitPoint() const
122 FatalErrorIn("const Point& PointHit::hitPoint() const")
123 << "requested a hit point for a miss"
124 << abort(FatalError);
130 //- Return distance to hit
131 scalar distance() const
136 //- Return miss point
137 const Point& missPoint() const
141 FatalErrorIn("const Point& PointHit::missPoint() const")
142 << "requested a miss point for a hit"
143 << abort(FatalError);
149 //- Return point with no checking
150 const Point& rawPoint() const
155 //- Is this an eligible miss
156 bool eligibleMiss() const
158 return eligibleMiss_;
164 eligibleMiss_ = false;
167 void setMiss(const bool eligible)
170 eligibleMiss_ = eligible;
173 void setPoint(const Point& p)
178 void setDistance(const scalar d)
186 friend Ostream& operator<< <Point>
189 const PointHit<Point>& b
194 template<class Point>
195 inline Ostream& operator<<(Ostream& os, const PointHit<Point>& b)
197 os << b.hit() << token::SPACE
198 << b.rawPoint() << token::SPACE
199 << b.distance() << token::SPACE
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 // ************************************************************************* //