oppositeCellFace.C
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 #include "cell.H"
00032 #include "oppositeFace.H"
00033 #include "boolList.H"
00034
00035
00036
00037
00038
00039
00040 Foam::label Foam::cell::opposingFaceLabel
00041 (
00042 const label masterFaceLabel,
00043 const unallocFaceList& meshFaces
00044 ) const
00045 {
00046
00047
00048
00049
00050
00051
00052 const face& masterFace = meshFaces[masterFaceLabel];
00053
00054 const labelList& curFaceLabels = *this;
00055
00056 label oppositeFaceLabel = -1;
00057
00058 forAll (curFaceLabels, faceI)
00059 {
00060
00061 const face& curFace = meshFaces[curFaceLabels[faceI]];
00062
00063
00064 if
00065 (
00066 curFaceLabels[faceI] != masterFaceLabel
00067 && curFace.size() == masterFace.size()
00068 )
00069 {
00070 bool sharedPoint = false;
00071
00072
00073
00074 forAll (curFace, pointI)
00075 {
00076 const label l = curFace[pointI];
00077
00078 forAll (masterFace, masterPointI)
00079 {
00080 if (masterFace[masterPointI] == l)
00081 {
00082 sharedPoint = true;
00083 break;
00084 }
00085 }
00086
00087 if (sharedPoint) break;
00088 }
00089
00090
00091 if (!sharedPoint)
00092 {
00093 if (oppositeFaceLabel == -1)
00094 {
00095
00096 oppositeFaceLabel = curFaceLabels[faceI];
00097 }
00098 else
00099 {
00100
00101
00102 Info<< "Multiple faces not sharing vertex: "
00103 << oppositeFaceLabel << " and "
00104 << curFaceLabels[faceI] << endl;
00105 return -1;
00106 }
00107 }
00108 }
00109 }
00110
00111 return oppositeFaceLabel;
00112 }
00113
00114
00115 Foam::oppositeFace Foam::cell::opposingFace
00116 (
00117 const label masterFaceLabel,
00118 const unallocFaceList& meshFaces
00119 ) const
00120 {
00121
00122 label oppFaceLabel = opposingFaceLabel(masterFaceLabel, meshFaces);
00123
00124
00125 if (oppFaceLabel < 0)
00126 {
00127 return oppositeFace(face(0), masterFaceLabel, oppFaceLabel);
00128 }
00129 else
00130 {
00131
00132
00133
00134
00135
00136
00137
00138
00139 const face& masterFace = meshFaces[masterFaceLabel];
00140 const face& slaveFace = meshFaces[oppFaceLabel];
00141
00142
00143 const edgeList e = edges(meshFaces);
00144 boolList usedEdges(e.size(), false);
00145
00146 oppositeFace oppFace
00147 (
00148 face(masterFace.size()),
00149 masterFaceLabel,
00150 oppFaceLabel
00151 );
00152
00153 forAll (masterFace, pointI)
00154 {
00155
00156
00157 forAll (e, edgeI)
00158 {
00159 if (!usedEdges[edgeI])
00160 {
00161
00162 label otherVertex =
00163 e[edgeI].otherVertex(masterFace[pointI]);
00164
00165 if (otherVertex != -1)
00166 {
00167
00168
00169
00170 forAll (slaveFace, slavePointI)
00171 {
00172 if (slaveFace[slavePointI] == otherVertex)
00173 {
00174 usedEdges[edgeI] = true;
00175 oppFace[pointI] = otherVertex;
00176
00177 break;
00178 }
00179 }
00180 }
00181 }
00182 }
00183 }
00184
00185 return oppFace;
00186 }
00187 }
00188
00189
00190
Copyright © 2000-2009 OpenCFD Ltd