Merge commit 'd3b269b7c6ffa0cd68845adfecdfb849316dba71' into nextRelease
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / thoboisSliding / setThoboisSlidingConstraint.H
blob6f1ba237395d203cc109821b4ad68ce5ae68af94
2     // currently unused - commented out below
3     //const pointZoneMesh& pZones = pointZones();
5     label constraintSize = 0;
7     forAll(valves_, valveI)
8     {
9         vector valveVel =
10             valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
12         if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
13         {
14             valveVel = vector::zero;
15         }
17         {
19 //          label movingPtsIndex = pZones.findZoneID("movingPointsV"+Foam::name(valveI + 1));
20 //          const labelList& movingPointsV = pZones[movingPtsIndex];
22             labelList movingPointsV;
24             {
25                 label valveMovingCellsIndex = cellZones().findZoneID
26                 (
27                     "movingCellsZoneV" + Foam::name(valveI + 1)
28                 );
30                 if (valveMovingCellsIndex < 0)
31                 {
32                     FatalErrorIn("bool verticalValves::update()")
33                         << "movingCellsZoneV"+ Foam::name(valveI+1)
34                         << abort(FatalError);
35                 }
37                 const labelList& movingCellsZoneV =
38                     cellZones()[valveMovingCellsIndex];
40                 const labelListList& cp = cellPoints();
42                 boolList count(newPoints.size(), false);
44                 forAll (movingCellsZoneV, cellI)
45                 {
46                     const labelList& curCellPoints =
47                         cp[movingCellsZoneV[cellI]];
49                     forAll (curCellPoints, i)
50                     {
51                         count[curCellPoints[i]] = true;
52                     }
53                 }
55                 // Count the points
56                 label nCounted = 0;
57                 forAll (count, pointI)
58                 {
59                     if (count[pointI] == true)
60                     {
61                         nCounted++;
62                     }
63                 }
65                 movingPointsV.setSize(nCounted);
67                 // Collect the points
68                 nCounted = 0;
69                 forAll (count, pointI)
70                 {
71                     if (count[pointI] == true)
72                     {
73                         movingPointsV[nCounted] = pointI;
74                         nCounted++;
75                     }
76                 }
78             }
80             forAll(movingPointsV, mpI)
81             {
82                 constrainedPoints.append(movingPointsV[mpI]);
83                 constrainedVelocity.append(valveVel);
85                 constraintSize++;
86             }
88         }
90         {
92 //        label staticPtsIndex = pZones.findZoneID("staticPointsV"+Foam::name(valveI + 1));
93 //        const labelList& staticPointsV = pZones[staticPtsIndex];
95             labelList staticPointsV;
97             {
98                 label valveStaticCellsIndex = cellZones().findZoneID("staticCellsZoneV" + Foam::name(valveI + 1));
100                 if (valveStaticCellsIndex < 0)
101                 {
102                     FatalErrorIn("bool verticalValves::update()")
103                         << "staticCellsZoneV"+ Foam::name(valveI+1)
104                         << abort(FatalError);
105                 }
107                 const labelList& staticCellsZoneV = cellZones()[valveStaticCellsIndex];
109                 const labelListList& cp = cellPoints();
111                 boolList count(newPoints.size(), false);
113                 forAll (staticCellsZoneV, cellI)
114                 {
115                     const labelList& curCellPoints = cp[staticCellsZoneV[cellI]];
117                     forAll (curCellPoints, i)
118                     {
119                         count[curCellPoints[i]] = true;
120                     }
121                 }
123                 // Count the points
124                 label nCounted = 0;
125                 forAll (count, pointI)
126                 {
127                     if (count[pointI] == true)
128                     {
129                         nCounted++;
130                     }
131                 }
133                 staticPointsV.setSize(nCounted);
135                 // Collect the points
136                 nCounted = 0;
137                 forAll (count, pointI)
138                 {
139                     if (count[pointI] == true)
140                     {
141                         staticPointsV[nCounted] = pointI;
142                         nCounted++;
143                     }
144                 }
146             }
149             forAll(staticPointsV, spI)
150             {
151                 constrainedPoints.append(staticPointsV[spI]);
152                 constrainedVelocity.append(vector::zero);
153                 constraintSize++;
154             }
156         }
158     }