PrimitivePatchEdgeLoops.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 "PrimitivePatch.H"
00032
00033
00034
00035
00036
00037 template
00038 <
00039 class Face,
00040 template<class> class FaceList,
00041 class PointField,
00042 class PointType
00043 >
00044
00045 void
00046 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00047 calcEdgeLoops() const
00048 {
00049 if (debug)
00050 {
00051 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00052 << "calcEdgeLoops() : "
00053 << "calculating boundary edge loops"
00054 << endl;
00055 }
00056
00057 if (edgeLoopsPtr_)
00058 {
00059
00060
00061 FatalErrorIn
00062 (
00063 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00064 "calcIntBdryEdges()"
00065 ) << "edge loops already calculated"
00066 << abort(FatalError);
00067 }
00068
00069 const edgeList& patchEdges = edges();
00070 label nIntEdges = nInternalEdges();
00071 label nBdryEdges = patchEdges.size() - nIntEdges;
00072
00073 if (nBdryEdges == 0)
00074 {
00075 edgeLoopsPtr_ = new labelListList(0);
00076 return;
00077 }
00078
00079 const labelListList& patchPointEdges = pointEdges();
00080
00081
00082
00083
00084
00085
00086
00087 labelList loopNumber(nBdryEdges, -1);
00088
00089
00090 edgeLoopsPtr_ = new labelListList(nBdryEdges);
00091 labelListList& edgeLoops = *edgeLoopsPtr_;
00092
00093
00094
00095 label loopI = 0;
00096
00097 while (true)
00098 {
00099
00100 label currentEdgeI = -1;
00101
00102 for (label edgeI = nIntEdges; edgeI < patchEdges.size(); edgeI++)
00103 {
00104 if (loopNumber[edgeI-nIntEdges] == -1)
00105 {
00106 currentEdgeI = edgeI;
00107 break;
00108 }
00109 }
00110
00111 if (currentEdgeI == -1)
00112 {
00113
00114 break;
00115 }
00116
00117
00118 DynamicList<label> loop(nBdryEdges);
00119
00120
00121 label currentVertI = patchEdges[currentEdgeI].start();
00122
00123 do
00124 {
00125 loop.append(currentVertI);
00126
00127 loopNumber[currentEdgeI - nIntEdges] = loopI;
00128
00129
00130 currentVertI = patchEdges[currentEdgeI].otherVertex(currentVertI);
00131
00132
00133 const labelList& curEdges = patchPointEdges[currentVertI];
00134
00135 currentEdgeI = -1;
00136
00137 forAll(curEdges, pI)
00138 {
00139 label edgeI = curEdges[pI];
00140
00141 if (edgeI >= nIntEdges && (loopNumber[edgeI - nIntEdges] == -1))
00142 {
00143
00144 currentEdgeI = edgeI;
00145
00146 break;
00147 }
00148 }
00149 }
00150 while (currentEdgeI != -1);
00151
00152
00153 edgeLoops[loopI].transfer(loop);
00154
00155 loopI++;
00156 }
00157
00158 edgeLoops.setSize(loopI);
00159
00160 if (debug)
00161 {
00162 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00163 << "calcEdgeLoops() : "
00164 << "finished calculating boundary edge loops"
00165 << endl;
00166 }
00167 }
00168
00169
00170 template
00171 <
00172 class Face,
00173 template<class> class FaceList,
00174 class PointField,
00175 class PointType
00176 >
00177
00178 const Foam::labelListList&
00179 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00180 edgeLoops() const
00181 {
00182 if (!edgeLoopsPtr_)
00183 {
00184 calcEdgeLoops();
00185 }
00186
00187 return *edgeLoopsPtr_;
00188 }
00189
00190
00191
Copyright © 2000-2009 OpenCFD Ltd