PatchToolsEdgeOwner.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 #include "PatchTools.H"
00028
00029
00030
00031 template
00032 <
00033 class Face,
00034 template<class> class FaceList,
00035 class PointField,
00036 class PointType
00037 >
00038
00039 Foam::labelList
00040 Foam::PatchTools::edgeOwner
00041 (
00042 const PrimitivePatch<Face, FaceList, PointField, PointType>& p
00043 )
00044 {
00045 const edgeList& edges = p.edges();
00046 const labelListList& edgeFaces = p.edgeFaces();
00047 const List<Face>& localFaces = p.localFaces();
00048
00049
00050 labelList edgeOwner(edges.size(), -1);
00051
00052 forAll(edges, edgeI)
00053 {
00054 const labelList& nbrFaces = edgeFaces[edgeI];
00055
00056 if (nbrFaces.size() == 1)
00057 {
00058 edgeOwner[edgeI] = nbrFaces[0];
00059 }
00060 else
00061 {
00062
00063
00064 forAll(nbrFaces, i)
00065 {
00066 const Face& f = localFaces[nbrFaces[i]];
00067
00068 if (f.edgeDirection(edges[edgeI]) > 0)
00069 {
00070 edgeOwner[edgeI] = nbrFaces[i];
00071 break;
00072 }
00073 }
00074
00075 if (edgeOwner[edgeI] == -1)
00076 {
00077 FatalErrorIn
00078 (
00079 "PatchTools::edgeOwner()"
00080 )
00081 << "Edge " << edgeI << " vertices:" << edges[edgeI]
00082 << " is used by faces " << nbrFaces
00083 << " vertices:"
00084 << UIndirectList<Face>(localFaces, nbrFaces)()
00085 << " none of which use the edge vertices in the same order"
00086 << nl << "I give up" << abort(FatalError);
00087 }
00088 }
00089 }
00090
00091 return edgeOwner;
00092 }
00093
00094
00095
Copyright © 2000-2009 OpenCFD Ltd