Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticNonLinULSolidFoam / calcUnusedNewPoints.H
blob691e8fed27b54a0cf5b25eee3944b2f22a1b1a51
1 forAll(globalFaceZones, zoneI)
3     const label curZoneID = globalFaceZones[zoneI];
5     const labelList& curMap =
6         globalToLocalFaceZonePointMap[zoneI];
8     const labelList& curZoneMeshPoints =
9         mesh.faceZones()[curZoneID]().meshPoints();
11     vectorField curGlobalZonePointDispl
12     (
13         curZoneMeshPoints.size(),
14         vector::zero
15     );
17     //-Inter-proc points are shared by multiple procs
18     // pointNumProc is the number of procs which a point lies on
19     scalarField pointNumProcs(curZoneMeshPoints.size(), 0);
21     forAll(curGlobalZonePointDispl, globalPointI)
22     {
23         label localPoint = curMap[globalPointI];
25         if(curZoneMeshPoints[localPoint] < mesh.nPoints())
26         {
27             label procPoint = curZoneMeshPoints[localPoint];
29             curGlobalZonePointDispl[globalPointI] = pointDUI[procPoint];
31             pointNumProcs[globalPointI] = 1;
32         }
33     }
35     if (Pstream::parRun())
36     {
37         reduce(curGlobalZonePointDispl, sumOp<vectorField>());
38         reduce(pointNumProcs, sumOp<scalarField>());
40         //- now average the displacement between all procs
41         curGlobalZonePointDispl /= pointNumProcs;
42     }
44     //- The curZonePointsDisplGlobal now contains the correct face zone
45     //  displacement in a global master processor order, now convert them
46     //  back into the local proc order
48     vectorField curZonePointDispl
49     (
50         curZoneMeshPoints.size(),
51         vector::zero
52     );
54     forAll(curGlobalZonePointDispl, globalPointI)
55     {
56         label localPoint = curMap[globalPointI];
58         curZonePointDispl[localPoint] =
59             curGlobalZonePointDispl[globalPointI];
60     }
62     forAll(curZonePointDispl, pointI)
63     {
64         // unused points
65         if (curZoneMeshPoints[pointI] >= mesh.nPoints())
66         {
67             newPoints[curZoneMeshPoints[pointI]] +=
68                 curZonePointDispl[pointI];
69         }
70     }