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 #include "IOstreams.H"
00030
00031
00032
00033 inline Foam::tetCell::tetCell()
00034 {}
00035
00036
00037 inline Foam::tetCell::tetCell
00038 (
00039 const label a,
00040 const label b,
00041 const label c,
00042 const label d
00043 )
00044 {
00045 operator[](0) = a;
00046 operator[](1) = b;
00047 operator[](2) = c;
00048 operator[](3) = d;
00049 }
00050
00051
00052 inline Foam::tetCell::tetCell(const FixedList<label, 4>& lst)
00053 :
00054 FixedList<label, 4>(lst)
00055 {}
00056
00057
00058 inline Foam::tetCell::tetCell(Istream& is)
00059 :
00060 FixedList<label, 4>(is)
00061 {}
00062
00063
00064
00065
00066 inline Foam::triFace Foam::tetCell::face(const label faceI) const
00067 {
00068
00069
00070 static const label a[] = {1, 0, 0, 0};
00071 static const label b[] = {2, 3, 1, 2};
00072 static const label c[] = {3, 2, 3, 1};
00073
00074 # ifdef FULLDEBUG
00075 if (faceI >= 4)
00076 {
00077 FatalErrorIn("tetCell::tetEdge(const label faceI) const")
00078 << "index out of range 0 -> 3. faceI = " << faceI
00079 << abort(FatalError);
00080 }
00081 # endif
00082
00083 return triFace
00084 (
00085 operator[](a[faceI]),
00086 operator[](b[faceI]),
00087 operator[](c[faceI])
00088 );
00089 }
00090
00091
00092 inline Foam::label Foam::tetCell::edgeFace(const label edgeI) const
00093 {
00094
00095
00096
00097 static const label edgeFaces[6] = {2, 3, 1, 0, 0, 1};
00098
00099 # ifdef FULLDEBUG
00100 if (edgeI >= 6)
00101 {
00102 FatalErrorIn
00103 (
00104 "tetCell::edgeFace(const label edgeI)"
00105 "const"
00106 ) << "edge index out of range 0 -> 5. edgeI = " << edgeI
00107 << abort(FatalError);
00108 }
00109 # endif
00110
00111 return edgeFaces[edgeI];
00112 }
00113
00114
00115 inline Foam::label Foam::tetCell::edgeAdjacentFace
00116 (
00117 const label edgeI,
00118 const label faceI
00119 ) const
00120 {
00121
00122
00123 static const label adjacentFace[6][4] =
00124 {
00125 {-1, -1, 3, 2},
00126 {-1, 3, -1, 1},
00127 {-1, 2, 1, -1},
00128 {2, -1, 0, -1},
00129 {3, -1, -1, 0},
00130 {1, 0, -1, -1}
00131 };
00132
00133 # ifdef FULLDEBUG
00134 if (faceI >= 4)
00135 {
00136 FatalErrorIn
00137 (
00138 "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
00139 "const"
00140 ) << "face index out of range 0 -> 3. faceI = " << faceI
00141 << abort(FatalError);
00142 }
00143
00144 if (edgeI >= 6)
00145 {
00146 FatalErrorIn
00147 (
00148 "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
00149 "const"
00150 ) << "edge index out of range 0 -> 5. edgeI = " << edgeI
00151 << abort(FatalError);
00152 }
00153 # endif
00154
00155 return adjacentFace[edgeI][faceI];
00156 }
00157
00158
00159 inline Foam::edge Foam::tetCell::tetEdge(const label edgeI) const
00160 {
00161
00162
00163
00164 static const label start[] = {0, 0, 0, 3, 1, 3};
00165 static const label end[] = {1, 2, 3, 1, 2, 2};
00166
00167 # ifdef FULLDEBUG
00168 if (edgeI >= 6)
00169 {
00170 FatalErrorIn("tetCell::tetEdge(const label edgeI) const")
00171 << "index out of range 0 -> 5. edgeI = " << edgeI
00172 << abort(FatalError);
00173 }
00174 # endif
00175
00176 return edge(operator[](start[edgeI]), operator[](end[edgeI]));
00177 }
00178
00179
00180 inline Foam::tetPointRef Foam::tetCell::tet(const pointField& points) const
00181 {
00182 return tetPointRef
00183 (
00184 points[operator[](0)],
00185 points[operator[](1)],
00186 points[operator[](2)],
00187 points[operator[](3)]
00188 );
00189 }
00190
00191
00192