Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / deformingEngineMesh / addPistonFacesPointZonesDeformingEngineMesh.H
blob7279902ea580ac32b261bda8587206a9880ae33f
2     // Add the piston points zone
3     if (piston().patchID().active())
4     {
5         IOobject pistonCellsHeader
6         (
7             piston().pistonCellSetName(),
8             time().constant()+"/polyMesh/sets/",
9             *this,
10             IOobject::MUST_READ
11         );
13         if(!pistonCellsHeader.headerOk())
14         {
15             WarningIn
16             (
17                 "deformingEngineMesh::addZonesAndModifiers()"
18             )   << "cellSet called " << piston().pistonCellSetName()
19                 << " does not exist. Continuing mesh motion without piston points" << endl;
21             pz.append
22             (
23                 new pointZone
24                 (
25                     "movingPistonPoints",
26                     labelList(0),
27                     nPointZones,
28                     pointZones()
29                 )
30             );
32             nPointZones++;
34         }
35         else
36         {
37             cellSet movingPistonCells(*this, piston().pistonCellSetName());
39             labelList pistonCells = movingPistonCells.toc();
41             labelList movingPistonPoints;
43             const labelListList& cp = cellPoints();
45             boolList count(allPoints().size(), false);
47             forAll (pistonCells, cellI)
48             {
49                 const labelList& curCellPoints = cp[pistonCells[cellI]];
51                 forAll (curCellPoints, i)
52                 {
53                     count[curCellPoints[i]] = true;
54                 }
55             }
57             // Count the points
58             label nCounted = 0;
59             forAll (count, pointI)
60             {
61                 if (count[pointI] == true)
62                 {
63                     nCounted++;
64                 }
65             }
67             movingPistonPoints.setSize(nCounted);
69             // Collect the points
70             nCounted = 0;
71             forAll (count, pointI)
72             {
73                 if (count[pointI] == true)
74                 {
75                     movingPistonPoints[nCounted] = pointI;
76                     nCounted++;
77                 }
78             }
80             pz.append
81             (
82                 new pointZone
83                 (
84                     "movingPistonPoints",
85                     movingPistonPoints,
86                     nPointZones,
87                     pointZones()
88                 )
89             );
91             nPointZones++;
93         }
95     }
97     {
99         IOobject headCellsHeader
100         (
101             headCellSetName_,
102             time().constant()+"/polyMesh/sets/",
103             *this,
104             IOobject::MUST_READ
105         );
107         if(!headCellsHeader.headerOk())
108         {
109             WarningIn
110             (
111                 "deformingEngineMesh::addZonesAndModifiers()"
112             )   << "cellSet called " << headCellSetName_
113                 << " does not exist. Continuing mesh motion without head points" << endl;
114             pz.append
115             (
116                 new pointZone
117                 (
118                     "headPoints",
119                     labelList(0),
120                     nPointZones,
121                     pointZones()
122                 )
123             );
125             nPointZones++;
126         }
127         else
128         {
129             cellSet fixedHeadCells(*this, headCellSetName_);
131             labelList headCells = fixedHeadCells.toc();
133             labelList fixedHeadPoints;
135             const labelListList& cp = cellPoints();
137             boolList count(allPoints().size(), false);
139             forAll (fixedHeadCells, cellI)
140             {
141                 const labelList& curCellPoints = cp[headCells[cellI]];
143                 forAll (curCellPoints, i)
144                 {
145                     count[curCellPoints[i]] = true;
146                 }
147             }
149             // Count the points
150             label nCounted = 0;
151             forAll (count, pointI)
152             {
153                 if (count[pointI] == true)
154                 {
155                     nCounted++;
156                 }
157             }
159             fixedHeadPoints.setSize(nCounted);
161             // Collect the points
162             nCounted = 0;
163             forAll (count, pointI)
164             {
165                 if (count[pointI] == true)
166                 {
167                     fixedHeadPoints[nCounted] = pointI;
168                     nCounted++;
169                 }
170             }
172             pz.append
173             (
174                 new pointZone
175                 (
176                     "headPoints",
177                     fixedHeadPoints,
178                     nPointZones,
179                     pointZones()
180                 )
181             );
183             nPointZones++;
184         }
186     }