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