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