Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / mesh / generation / blockMesh / mergePatchPairs.H
blob0112c8cbe4c5f28bf4de7832114f4c75ae3f2ff9
1         if (mergePatchPairs.size())
2         {
3             Info<< "Creating merge patch pairs" << nl << endl;
5             // Create and add point and face zones and mesh modifiers
6             List<pointZone*> pz(mergePatchPairs.size());
7             List<faceZone*> fz(3*mergePatchPairs.size());
8             List<cellZone*> cz(0);
10             forAll(mergePatchPairs, pairI)
11             {
12                 const word mergeName
13                 (
14                     mergePatchPairs[pairI].first()
15                   + mergePatchPairs[pairI].second()
16                   + name(pairI)
17                 );
19                 pz[pairI] = new pointZone
20                 (
21                     mergeName + "CutPointZone",
22                     labelList(0),
23                     0,
24                     mesh.pointZones()
25                 );
27                 // Master patch
28                 const word masterPatchName(mergePatchPairs[pairI].first());
29                 const polyPatch& masterPatch =
30                     mesh.boundaryMesh()[masterPatchName];
32                 labelList isf(masterPatch.size());
34                 forAll(isf, i)
35                 {
36                     isf[i] = masterPatch.start() + i;
37                 }
39                 fz[3*pairI] = new faceZone
40                 (
41                     mergeName + "MasterZone",
42                     isf,
43                     boolList(masterPatch.size(), false),
44                     0,
45                     mesh.faceZones()
46                 );
48                 // Slave patch
49                 const word slavePatchName(mergePatchPairs[pairI].second());
50                 const polyPatch& slavePatch =
51                     mesh.boundaryMesh()[slavePatchName];
53                 labelList osf(slavePatch.size());
55                 forAll(osf, i)
56                 {
57                     osf[i] = slavePatch.start() + i;
58                 }
60                 fz[3*pairI + 1] = new faceZone
61                 (
62                     mergeName + "SlaveZone",
63                     osf,
64                     boolList(slavePatch.size(), false),
65                     1,
66                     mesh.faceZones()
67                 );
69                 // Add empty zone for cut faces
70                 fz[3*pairI + 2] = new faceZone
71                 (
72                     mergeName + "CutFaceZone",
73                     labelList(0),
74                     boolList(0, false),
75                     2,
76                     mesh.faceZones()
77                 );
78             }  // end of all merge pairs
80             Info<< "Adding point and face zones" << endl;
81             mesh.addZones(pz, fz, cz);
84             Info<< "Creating attachPolyTopoChanger" << endl;
85             polyTopoChanger polyMeshAttacher(mesh);
86             polyMeshAttacher.setSize(mergePatchPairs.size());
88             forAll(mergePatchPairs, pairI)
89             {
90                 const word mergeName
91                 (
92                     mergePatchPairs[pairI].first()
93                   + mergePatchPairs[pairI].second()
94                   + name(pairI)
95                 );
97                 // Add the sliding interface mesh modifier
98                 polyMeshAttacher.set
99                 (
100                     pairI,
101                     new slidingInterface
102                     (
103                         "couple" + name(pairI),
104                         pairI,
105                         polyMeshAttacher,
106                         mergeName + "MasterZone",
107                         mergeName + "SlaveZone",
108                         mergeName + "CutPointZone",
109                         mergeName + "CutFaceZone",
110                         mergePatchPairs[pairI].first(),
111                         mergePatchPairs[pairI].second(),
112                         slidingInterface::INTEGRAL, // always integral
113                         false,
114                         intersection::VISIBLE
115                     )
116                 );
117             }
119             polyMeshAttacher.changeMesh();
120         }