initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / conversion / kivaToFoam / checkPatch.H
blob451c6865cca35f44c2b32fded99afd8c55b2d1dc
1     if (bci != 0)
2     {
3         label bcIndex = bcIDs[bci];
4         label regionIndex = 0;
6         // Decompose moving faces into piston and valves using the idface array
7         if (bci == 1)
8         {
9             if (kivaVersion == kiva3v)
10             {
11                 regionIndex = max
12                 (
13                     max(idface[quadFace[0]], idface[quadFace[1]]),
14                     max(idface[quadFace[2]], idface[quadFace[3]])
15                 );
17                 if (regionIndex > 0)
18                 {
19                     bcIndex = VALVE;
20                     regionIndex--;
21                 }
22             }
23         }
25         // Decompose fixed wall faces into cylinder-head and liner using
26         // the fv array and split of the y=0 faces as a symmetry plane
27         if (bci == 2)
28         {
29             if
30             (
31                 fv[quadFace[0]] == 6
32              || fv[quadFace[1]] == 6
33              || fv[quadFace[2]] == 6
34              || fv[quadFace[3]] == 6
35             )
36             {
37                 bcIndex = CYLINDERHEAD;
38             }
40             if
41             (
42                    mag(points[quadFace[0]].y()) < SMALL
43                 && mag(points[quadFace[1]].y()) < SMALL
44                 && mag(points[quadFace[2]].y()) < SMALL
45                 && mag(points[quadFace[3]].y()) < SMALL
46             )
47             {
48                 bcIndex = SYMMETRYPLANE;
49             }
50         }
52         // Make the back part of the periodic boundary the second region
53         // of the front part
54         if (bci == 6)
55         {
56             bcIndex = WEDGE;
57             regionIndex = 1;
58         }
60         if (regionIndex >= pFaces[bcIndex].size())
61         {
62             pFaces[bcIndex].setSize(regionIndex + 1);
63         }
65         quadFace[0] = pointMap[quadFace[0]];
66         quadFace[1] = pointMap[quadFace[1]];
67         quadFace[2] = pointMap[quadFace[2]];
68         quadFace[3] = pointMap[quadFace[3]];
70         label ti = 0;
71         forAll (quadFace, i)
72         {
73             if (quadFace[i] != quadFace[(i+1)%4])
74             {
75                 triFace[(ti++)%3] = quadFace[i];
76             }
77         }
78         
79         if (ti == 4)
80         {
81             pFaces[bcIndex][regionIndex].append(quadFace);
82         }
83         else if (ti == 3)
84         {
85             pFaces[bcIndex][regionIndex].append(triFace);
86         }
87         // else the face has collapsed to an edge or point
88     }
89     else
90     {
91         FatalErrorIn(args.executable())
92             << "bc not defined for active cell = " << i
93             << exit(FatalError);
94     }