00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::pointEdgePoint 00026 00027 Description 00028 Holds information regarding nearest wall point. Used in pointEdgeWave. 00029 (so not standard meshWave) 00030 To be used in wall distance calculation. 00031 00032 SourceFiles 00033 pointEdgePointI.H 00034 pointEdgePoint.C 00035 00036 \*---------------------------------------------------------------------------*/ 00037 00038 #ifndef pointEdgePoint_H 00039 #define pointEdgePoint_H 00040 00041 #include <OpenFOAM/point.H> 00042 #include <OpenFOAM/label.H> 00043 #include <OpenFOAM/scalar.H> 00044 #include <OpenFOAM/tensor.H> 00045 #include <OpenFOAM/pTraits.H> 00046 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 // Forward declaration of classes 00054 class polyPatch; 00055 class polyMesh; 00056 00057 /*---------------------------------------------------------------------------*\ 00058 Class pointEdgePoint Declaration 00059 \*---------------------------------------------------------------------------*/ 00060 00061 class pointEdgePoint 00062 { 00063 // Private data 00064 00065 //- position of nearest wall center 00066 point origin_; 00067 00068 //- normal distance (squared) from point to origin 00069 scalar distSqr_; 00070 00071 // Private Member Functions 00072 00073 //- Evaluate distance to point. Update distSqr, origin from whomever 00074 // is nearer pt. Return true if w2 is closer to point, 00075 // false otherwise. 00076 inline bool update 00077 ( 00078 const point&, 00079 const pointEdgePoint& w2, 00080 const scalar tol 00081 ); 00082 00083 //- Combine current with w2. Update distSqr, origin if w2 has smaller 00084 // quantities and returns true. 00085 inline bool update 00086 ( 00087 const pointEdgePoint& w2, 00088 const scalar tol 00089 ); 00090 00091 public: 00092 00093 // Static data members 00094 00095 //- initial point far away. 00096 static point greatPoint; 00097 00098 // Constructors 00099 00100 //- Construct null 00101 inline pointEdgePoint(); 00102 00103 //- Construct from origin, distance 00104 inline pointEdgePoint(const point& origin, const scalar distSqr); 00105 00106 //- Construct as copy 00107 inline pointEdgePoint(const pointEdgePoint&); 00108 00109 00110 // Member Functions 00111 00112 // Access 00113 00114 inline const point& origin() const; 00115 00116 inline scalar distSqr() const; 00117 00118 00119 // Needed by meshWave 00120 00121 //- Check whether origin has been changed at all or 00122 // still contains original (invalid) value. 00123 inline bool valid() const; 00124 00125 //- Check for identical geometrical data. Used for cyclics checking. 00126 inline bool sameGeometry(const pointEdgePoint&, const scalar tol) 00127 const; 00128 00129 //- Convert origin to relative vector to leaving point 00130 // (= point coordinate) 00131 inline void leaveDomain 00132 ( 00133 const polyPatch& patch, 00134 const label patchPointI, 00135 const point& pos 00136 ); 00137 00138 //- Convert relative origin to absolute by adding entering point 00139 inline void enterDomain 00140 ( 00141 const polyPatch& patch, 00142 const label patchPointI, 00143 const point& pos 00144 ); 00145 00146 //- Apply rotation matrix to origin 00147 inline void transform(const tensor& rotTensor); 00148 00149 //- Influence of edge on point 00150 inline bool updatePoint 00151 ( 00152 const polyMesh& mesh, 00153 const label pointI, 00154 const label edgeI, 00155 const pointEdgePoint& edgeInfo, 00156 const scalar tol 00157 ); 00158 00159 //- Influence of different value on same point. 00160 // Merge new and old info. 00161 inline bool updatePoint 00162 ( 00163 const polyMesh& mesh, 00164 const label pointI, 00165 const pointEdgePoint& newPointInfo, 00166 const scalar tol 00167 ); 00168 00169 //- Influence of different value on same point. 00170 // No information about current position whatsoever. 00171 inline bool updatePoint 00172 ( 00173 const pointEdgePoint& newPointInfo, 00174 const scalar tol 00175 ); 00176 00177 //- Influence of point on edge. 00178 inline bool updateEdge 00179 ( 00180 const polyMesh& mesh, 00181 const label edgeI, 00182 const label pointI, 00183 const pointEdgePoint& pointInfo, 00184 const scalar tol 00185 ); 00186 00187 00188 // Member Operators 00189 00190 //Note: Used to determine whether to call update. 00191 inline bool operator==(const pointEdgePoint&) const; 00192 00193 inline bool operator!=(const pointEdgePoint&) const; 00194 00195 00196 // IOstream Operators 00197 00198 friend Ostream& operator<<(Ostream&, const pointEdgePoint&); 00199 friend Istream& operator>>(Istream&, pointEdgePoint&); 00200 }; 00201 00202 00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00204 00205 } // End namespace Foam 00206 00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00208 00209 #include <meshTools/pointEdgePointI.H> 00210 00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00212 00213 #endif 00214 00215 // ************************ vim: set sw=4 sts=4 et: ************************ //