Remove trailing whitespace systematically
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticNonLinULSolidFoam / findGlobalFaceZones.H
blobc7ce3a8024b69ecdebc2c8c39d7f795eaf5c39d4
1 labelList globalFaceZones;
4     SLList<label> globalFaceZonesSet;
6     const faceZoneMesh& faceZones = mesh.faceZones();
8     forAll(faceZones, zoneI)
9     {
10         const faceZone& curFaceZone = faceZones[zoneI];
12         forAll(curFaceZone, faceI)
13         {
14             // if unused face exist
15             if (curFaceZone[faceI] >= mesh.nFaces())
16             {
17                 globalFaceZonesSet.insert(zoneI);
18                 break;
19             }
20         }
21     }
23     globalFaceZones = labelList(globalFaceZonesSet);
26 labelListList globalToLocalFaceZonePointMap
28     globalFaceZones.size()
31 forAll(globalFaceZones, zoneI)
33     label curZoneID = globalFaceZones[zoneI];
35     labelList curMap(mesh.faceZones()[curZoneID]().nPoints(), -1);
37     vectorField fzGlobalPoints =
38         mesh.faceZones()[curZoneID]().localPoints();
40     //- set all slave points to zero because only the master order is used
41     if(!Pstream::master())
42     {
43         fzGlobalPoints *= 0.0;
44     }
46     //- pass points to all procs
47     reduce(fzGlobalPoints, sumOp<vectorField>());
49     //- now every proc has the master's list of FZ points
50     //- every proc must now find the mapping from their local FZ points to
51     //- the global FZ points
53     const vectorField& fzLocalPoints =
54         mesh.faceZones()[curZoneID]().localPoints();
56     const edgeList& fzLocalEdges =
57         mesh.faceZones()[curZoneID]().edges();
59     const labelListList& fzPointEdges =
60         mesh.faceZones()[curZoneID]().pointEdges();
62     scalarField minEdgeLength(fzLocalPoints.size(), GREAT);
64     forAll(minEdgeLength, pI)
65     {
66         const labelList& curPointEdges = fzPointEdges[pI];
68         forAll(curPointEdges, eI)
69         {
70             scalar Le = fzLocalEdges[curPointEdges[eI]].mag(fzLocalPoints);
71             if (Le < minEdgeLength[pI])
72             {
73                 minEdgeLength[pI] = Le;
74             }
75         }
76     }
78     forAll(fzGlobalPoints, globalPointI)
79     {
80 //         scalar minDist = GREAT;
82         forAll(fzLocalPoints, procPointI)
83         {
84             scalar curDist =
85                 mag
86                 (
87                     fzLocalPoints[procPointI]
88                   - fzGlobalPoints[globalPointI]
89                 );
91 //             if (curDist < minDist)
92 //             {
93 //                 minDist = curDist;
94 //             }
96             if (curDist < 1e-4*minEdgeLength[procPointI])
97             {
98                 curMap[globalPointI] = procPointI;
99                 break;
100             }
101         }
103 //         if (curMap[globalPointI] == -1)
104 //         {
105 //             Pout << "minDist: " << minDist << endl;
106 //         }
107     }
109     forAll(curMap, globalPointI)
110     {
111         if (curMap[globalPointI] == -1)
112         {
113             FatalErrorIn(args.executable())
114                 << "local to global face zone point map is not correct"
115                     << abort(FatalError);
116         }
117     }
119     globalToLocalFaceZonePointMap[zoneI] = curMap;