00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013 #ifndef _FACEINDEX_H_
00014 #define _FACEINDEX_H_
00015
00016 #include "LoHiSide.H"
00017 #include "VolIndex.H"
00018 #include "SPMD.H"
00019 #include "NamespaceHeader.H"
00020
00022
00027 class FaceIndex
00028 {
00029 public:
00031
00036 FaceIndex(const VolIndex& a_vof1,
00037 const VolIndex& a_vof2,
00038 const int& a_direction);
00039
00041
00046 void define(const VolIndex& a_vof1,
00047 const VolIndex& a_vof2,
00048 const int& a_direction);
00049
00051
00053 FaceIndex();
00054
00056
00058 FaceIndex(const FaceIndex& a_facein);
00059
00061
00063 void define(const FaceIndex& a_facein);
00064
00066
00068 ~FaceIndex();
00069
00071
00073 FaceIndex& operator= (const FaceIndex& a_facein);
00074
00076
00077 friend bool operator<( const FaceIndex& f1, const FaceIndex& f2 );
00078
00080 friend ostream& operator<<( ostream& out, const FaceIndex& fi );
00081
00082
00084
00086 bool operator== (const FaceIndex& a_facein) const;
00087
00089
00091 bool operator!= (const FaceIndex& a_facein) const;
00092
00094
00096 const int& direction() const;
00097
00099
00101 const bool& isDefined() const;
00102
00104
00106 const bool& isBoundary() const;
00107
00109
00114 const int& cellIndex(const Side::LoHiSide& a_sd) const;
00115
00117
00121 const IntVect& gridIndex(const Side::LoHiSide& a_sd) const;
00122
00124
00127 VolIndex getVoF(const Side::LoHiSide& a_sd) const;
00128
00129
00130 static size_t lo_offset, hi_offset, rest_offset;
00131 static int initializeOffsets();
00132 private:
00133
00135
00137 IntVect m_loiv;
00138
00140
00142 IntVect m_hiiv;
00143
00145
00150 int m_loIndex;
00151
00153
00158 int m_hiIndex;
00159
00161 int m_direction;
00162
00164
00167 bool m_isDefined;
00168
00170
00174 bool m_isBoundary;
00175
00176 };
00177
00179 inline
00180 bool operator<( const FaceIndex& f1, const FaceIndex& f2 )
00181 {
00182 if( f1.m_loiv.lexLT( f2.m_loiv ) )
00183 {
00184 return true;
00185 }
00186 else
00187 if( f2.m_loiv.lexLT( f1.m_loiv ) )
00188 {
00189 return false;
00190 }
00191 else
00192 if( f1.m_loIndex < f2.m_loIndex )
00193 {
00194 return true;
00195 }
00196 else
00197 if( f2.m_loIndex < f1.m_loIndex )
00198 {
00199 return false;
00200 }
00201 else
00202 if( f1.m_hiiv.lexLT( f2.m_hiiv ) )
00203 {
00204 return true;
00205 }
00206 else
00207 if( f2.m_hiiv.lexLT( f1.m_hiiv ) )
00208 {
00209 return false;
00210 }
00211 else
00212 if( f1.m_hiIndex < f2.m_hiIndex )
00213 {
00214 return true;
00215 }
00216 else
00217 if( f2.m_hiIndex < f1.m_hiIndex )
00218 {
00219 return false;
00220 }
00221 else
00222 if( f1.m_direction < f2.m_direction )
00223 {
00224 return true;
00225 }
00226 else
00227 if( f2.m_direction < f1.m_direction )
00228 {
00229 return false;
00230 }
00231 else
00232 if( f1.m_isBoundary && (!f2.m_isBoundary) )
00233 {
00234 return true;
00235 }
00236 else
00237 if( (!f1.m_isBoundary) && f2.m_isBoundary )
00238 {
00239 return false;
00240 }
00241
00242 return false;
00243 }
00244
00245
00246 template < >
00247 int linearSize(const FaceIndex& findex);
00248
00249
00250 template < >
00251 void linearIn(FaceIndex& a_outputT, const void* const inBuf);
00252
00253
00254 template < >
00255 void linearOut(void* const a_outBuf, const FaceIndex& a_inputT);
00256
00257 #include "NamespaceFooter.H"
00258 #endif