Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 #ifndef triFace_H
00036 #define triFace_H
00037 
00038 #include <OpenFOAM/FixedList.H>
00039 #include <OpenFOAM/edgeList.H>
00040 #include <OpenFOAM/pointHit.H>
00041 #include <OpenFOAM/intersection.H>
00042 #include <OpenFOAM/pointField.H>
00043 #include <OpenFOAM/triPointRef.H>
00044 
00045 
00046 
00047 namespace Foam
00048 {
00049 
00050 class face;
00051 
00052 
00053 
00054 class triFace;
00055 inline bool operator==(const triFace&, const triFace&);
00056 inline bool operator!=(const triFace&, const triFace&);
00057 
00058 
00059 
00060 
00061 
00062 
00063 class triFace
00064 :
00065     public FixedList<label, 3>
00066 {
00067 
00068 public:
00069 
00070     
00071 
00072         
00073         inline triFace();
00074 
00075         
00076         inline triFace
00077         (
00078             const label a,
00079             const label b,
00080             const label c
00081         );
00082 
00083         
00084         explicit inline triFace(const UList<label>&);
00085 
00086         
00087         inline triFace(Istream&);
00088 
00089 
00090     
00091 
00092         
00093         
00094         inline label collapse();
00095 
00096         
00097         
00098         
00099         
00100         inline int edgeDirection(const edge&) const;
00101 
00102 
00103         
00104 
00105             
00106             inline pointField points(const pointField& points) const;
00107 
00108             
00109             inline face triFaceFace() const;
00110 
00111             
00112             inline label nEdges() const;
00113 
00114             
00115             inline edgeList edges() const;
00116 
00117             
00118             inline point centre(const pointField&) const;
00119 
00120             
00121             inline scalar mag(const pointField&) const;
00122 
00123             
00124             inline vector normal(const pointField&) const;
00125 
00126             
00127             inline label nTriangles() const;
00128 
00129             
00130             inline triFace reverseFace() const;
00131 
00132             
00133             inline scalar sweptVol
00134             (
00135                 const pointField& oldPoints,
00136                 const pointField& newPoints
00137             ) const;
00138 
00139             
00140             
00141             inline pointHit ray
00142             (
00143                 const point& p,
00144                 const vector& q,
00145                 const pointField& points,
00146                 const intersection::algorithm = intersection::FULL_RAY,
00147                 const intersection::direction dir = intersection::VECTOR
00148             ) const;
00149 
00150             
00151             inline triPointRef tri(const pointField&) const;
00152 
00153         
00154         
00155         
00156         
00157         static inline int compare(const triFace&, const triFace&);
00158 
00159     
00160 
00161         friend bool operator==(const triFace&, const triFace&);
00162         friend bool operator!=(const triFace&, const triFace&);
00163 };
00164 
00165 
00166 
00167 
00168 template<>
00169 inline unsigned Hash<triFace>::operator()(const triFace& t, unsigned seed) const
00170 {
00171     
00172     const uLabel t0(t[0]);
00173     const uLabel t1(t[1]);
00174     const uLabel t2(t[2]);
00175 
00176     const uLabel val = (t0*t1*t2 + t0+t1+t2);
00177 
00178     return Hash<uLabel>()(val, seed);
00179 }
00180 
00181 
00182 
00183 
00184 template<>
00185 inline unsigned Hash<triFace>::operator()(const triFace& t) const
00186 {
00187     return Hash<triFace>::operator()(t, 0);
00188 }
00189 
00190 
00191 template<>
00192 inline bool contiguous<triFace>()  {return true;}
00193 
00194 
00195 
00196 
00197 } 
00198 
00199 
00200 
00201 #include <OpenFOAM/triFaceI.H>
00202 
00203 
00204 
00205 #endif
00206 
00207