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