PrimitivePatchMeshEdges.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 #include "PrimitivePatch.H"
00030
00031
00032
00033
00034 template
00035 <
00036 class Face,
00037 template<class> class FaceList,
00038 class PointField,
00039 class PointType
00040 >
00041
00042 Foam::labelList
00043 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00044 meshEdges
00045 (
00046 const edgeList& allEdges,
00047 const labelListList& cellEdges,
00048 const labelList& faceCells
00049 ) const
00050 {
00051 if (debug)
00052 {
00053 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
00054 << "::meshEdges() : "
00055 << "calculating labels of patch edges in mesh edge list"
00056 << endl;
00057 }
00058
00059
00060 const edgeList& PatchEdges = edges();
00061
00062 const labelListList& EdgeFaces = edgeFaces();
00063
00064
00065 labelList meshEdges(PatchEdges.size());
00066
00067 register bool found = false;
00068
00069
00070 const labelList& pp = meshPoints();
00071
00072
00073
00074 forAll (PatchEdges, edgeI)
00075 {
00076 const edge curEdge
00077 (pp[PatchEdges[edgeI].start()], pp[PatchEdges[edgeI].end()]);
00078
00079 found = false;
00080
00081
00082 const labelList& curFaces = EdgeFaces[edgeI];
00083
00084 forAll (curFaces, faceI)
00085 {
00086
00087 label curCell = faceCells[curFaces[faceI]];
00088
00089
00090 const labelList& ce = cellEdges[curCell];
00091
00092 forAll (ce, cellEdgeI)
00093 {
00094 if (allEdges[ce[cellEdgeI]] == curEdge)
00095 {
00096 found = true;
00097
00098 meshEdges[edgeI] = ce[cellEdgeI];
00099
00100 break;
00101 }
00102 }
00103
00104 if (found) break;
00105 }
00106 }
00107
00108 return meshEdges;
00109 }
00110
00111
00112 template
00113 <
00114 class Face,
00115 template<class> class FaceList,
00116 class PointField,
00117 class PointType
00118 >
00119
00120 Foam::labelList
00121 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00122 meshEdges
00123 (
00124 const edgeList& allEdges,
00125 const labelListList& pointEdges
00126 ) const
00127 {
00128 if (debug)
00129 {
00130 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
00131 << "::meshEdges() : "
00132 << "calculating labels of patch edges in mesh edge list"
00133 << endl;
00134 }
00135
00136
00137 const edgeList& PatchEdges = edges();
00138
00139
00140 labelList meshEdges(PatchEdges.size());
00141
00142
00143 const labelList& pp = meshPoints();
00144
00145
00146
00147 forAll (PatchEdges, edgeI)
00148 {
00149 const label globalPointI = pp[PatchEdges[edgeI].start()];
00150 const edge curEdge(globalPointI, pp[PatchEdges[edgeI].end()]);
00151
00152 const labelList& pe = pointEdges[globalPointI];
00153
00154 forAll (pe, i)
00155 {
00156 if (allEdges[pe[i]] == curEdge)
00157 {
00158 meshEdges[edgeI] = pe[i];
00159 break;
00160 }
00161 }
00162 }
00163
00164 return meshEdges;
00165 }
00166
00167
00168
00169
00170 template
00171 <
00172 class Face,
00173 template<class> class FaceList,
00174 class PointField,
00175 class PointType
00176 >
00177
00178 Foam::label
00179 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
00180 whichEdge
00181 (
00182 const edge& e
00183 ) const
00184 {
00185
00186 const edgeList& Edges = edges();
00187
00188 if (e.start() > -1 && e.start() < nPoints())
00189 {
00190 const labelList& pe = pointEdges()[e.start()];
00191
00192 forAll (pe, peI)
00193 {
00194 if (e == Edges[pe[peI]])
00195 {
00196 return pe[peI];
00197 }
00198 }
00199 }
00200
00201
00202 return -1;
00203 }
00204
00205
00206
Copyright © 2000-2009 OpenCFD Ltd