initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / generation / blockMesh / mergePatchPairs.H
blobaeb3137adfe091daaabbda9490016527a066afe9
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()
31                     [
32                         mesh.boundaryMesh().findPatchID(masterPatchName)
33                     ];
35                 labelList isf(masterPatch.size());
37                 forAll (isf, i)
38                 {
39                     isf[i] = masterPatch.start() + i;
40                 }
42                 fz[3*pairI] = new faceZone
43                 (
44                     mergeName + "MasterZone",
45                     isf,
46                     boolList(masterPatch.size(), false),
47                     0,
48                     mesh.faceZones()
49                 );
51                 // Slave patch
52                 const word slavePatchName(mergePatchPairs[pairI].second());
53                 const polyPatch& slavePatch =
54                     mesh.boundaryMesh()
55                     [
56                         mesh.boundaryMesh().findPatchID(slavePatchName)
57                     ];
59                 labelList osf(slavePatch.size());
61                 forAll (osf, i)
62                 {
63                     osf[i] = slavePatch.start() + i;
64                 }
66                 fz[3*pairI + 1] = new faceZone
67                 (
68                     mergeName + "SlaveZone",
69                     osf,
70                     boolList(slavePatch.size(), false),
71                     1,
72                     mesh.faceZones()
73                 );
75                 // Add empty zone for cut faces
76                 fz[3*pairI + 2] = new faceZone
77                 (
78                     mergeName + "CutFaceZone",
79                     labelList(0),
80                     boolList(0, false),
81                     2,
82                     mesh.faceZones()
83                 );
84             }  // end of all merge pairs
86             Info << "Adding point and face zones" << endl;
87             mesh.addZones(pz, fz, cz);
90             Info << "Creating attachPolyTopoChanger" << endl;
91             attachPolyTopoChanger polyMeshAttacher(mesh);
92             polyMeshAttacher.setSize(mergePatchPairs.size());
94             forAll (mergePatchPairs, pairI)
95             {
96                 const word mergeName
97                 (
98                     mergePatchPairs[pairI].first()
99                   + mergePatchPairs[pairI].second()
100                   + name(pairI)
101                 );
103                 // Add the sliding interface mesh modifier
104                 polyMeshAttacher.set
105                 (
106                     pairI,
107                     new slidingInterface
108                     (
109                         "couple" + name(pairI),
110                         pairI,
111                         polyMeshAttacher,
112                         mergeName + "MasterZone",
113                         mergeName + "SlaveZone",
114                         mergeName + "CutPointZone",
115                         mergeName + "CutFaceZone",
116                         mergePatchPairs[pairI].first(),
117                         mergePatchPairs[pairI].second(),
118                         slidingInterface::INTEGRAL, // always integral
119                         intersection::VISIBLE
120                     )
121                 );
122             }
124             polyMeshAttacher.attach(true);
125         }