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 #include <OpenFOAM/SLList.H>
00030 #include <OpenFOAM/boolList.H>
00031
00032
00033
00034 template
00035 <
00036 class Face,
00037 template<class> class FaceList,
00038 class PointField,
00039 class PointType
00040 >
00041 void
00042 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00043 calcLocalPointOrder() const
00044 {
00045
00046
00047
00048
00049 if (debug)
00050 {
00051 Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00052 << "calcLocalPointOrder() : "
00053 << "calculating local point order"
00054 << endl;
00055 }
00056
00057 if (localPointOrderPtr_)
00058 {
00059
00060
00061 FatalErrorIn
00062 (
00063 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00064 "calcLocalPointOrder()"
00065 ) << "local point order already calculated"
00066 << abort(FatalError);
00067 }
00068
00069 const List<Face>& lf = localFaces();
00070
00071 const labelListList& ff = faceFaces();
00072
00073 boolList visitedFace(lf.size(), false);
00074
00075 localPointOrderPtr_ = new labelList(meshPoints().size(), -1);
00076
00077 labelList& pointOrder = *localPointOrderPtr_;
00078
00079 boolList visitedPoint(pointOrder.size(), false);
00080
00081 label nPoints = 0;
00082
00083 forAll (lf, faceI)
00084 {
00085 if (!visitedFace[faceI])
00086 {
00087 SLList<label> faceOrder(faceI);
00088
00089 do
00090 {
00091 const label curFace = faceOrder.first();
00092
00093 faceOrder.removeHead();
00094
00095 if (!visitedFace[curFace])
00096 {
00097 visitedFace[curFace] = true;
00098
00099 const labelList& curPoints = lf[curFace];
00100
00101
00102 forAll (curPoints, pointI)
00103 {
00104 if (!visitedPoint[curPoints[pointI]])
00105 {
00106 visitedPoint[curPoints[pointI]] = true;
00107
00108 pointOrder[nPoints] = curPoints[pointI];
00109
00110 nPoints++;
00111 }
00112 }
00113
00114
00115 const labelList& nbrs = ff[curFace];
00116
00117 forAll (nbrs, nbrI)
00118 {
00119 if (!visitedFace[nbrs[nbrI]])
00120 {
00121 faceOrder.append(nbrs[nbrI]);
00122 }
00123 }
00124 }
00125 } while (faceOrder.size());
00126 }
00127 }
00128
00129 if (debug)
00130 {
00131 Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
00132 << "calcLocalPointOrder() "
00133 << "finished calculating local point order"
00134 << endl;
00135 }
00136 }
00137
00138
00139