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