1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 This class describes the interaction of a face and a point. It
30 carries the info of a successful hit and (if successful), returns
31 the interaction point.
33 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
51 // Forward declaration of friend functions and operators
53 template<class Point> class PointHit;
56 inline Ostream& operator<<(Ostream&, const PointHit<Point>&);
59 /*---------------------------------------------------------------------------*\
60 Class PointHit Declaration
61 \*---------------------------------------------------------------------------*/
71 //- Point of hit; for miss holds best estimate outside the object
74 //- Distance to hit point
85 //- Construct from components
91 const bool eligibleMiss
97 eligibleMiss_(eligibleMiss)
100 //- Construct from point. Hit and distance set later
101 PointHit(const Point& p)
119 const Point& hitPoint() const
123 FatalErrorIn("const Point& PointHit::hitPoint() const")
124 << "requested a hit point for a miss"
125 << abort(FatalError);
131 //- Return distance to hit
132 scalar distance() const
137 //- Return miss point
138 const Point& missPoint() const
142 FatalErrorIn("const Point& PointHit::missPoint() const")
143 << "requested a miss point for a hit"
144 << abort(FatalError);
150 //- Return point with no checking
151 const Point& rawPoint() const
156 //- Is this an eligible miss
157 bool eligibleMiss() const
159 return eligibleMiss_;
165 eligibleMiss_ = false;
168 void setMiss(const bool eligible)
171 eligibleMiss_ = eligible;
174 void setPoint(const Point& p)
179 void setDistance(const scalar d)
187 friend Ostream& operator<< <Point>
190 const PointHit<Point>& b
195 template<class Point>
196 inline Ostream& operator<<(Ostream& os, const PointHit<Point>& b)
198 os << b.hit() << token::SPACE
199 << b.rawPoint() << token::SPACE
200 << b.distance() << token::SPACE
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 // ************************************************************************* //