| 124 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 125 | |
| 126 | bool Foam::primitiveMesh::calcPointOrder |
| 127 | ( |
| 128 | label& nInternalPoints, |
| 129 | labelList& oldToNew, |
| 130 | const faceList& faces, |
| 131 | const label nInternalFaces, |
| 132 | const label nPoints |
| 133 | ) |
| 134 | { |
| 135 | // Internal points are points that are not used by a boundary face. |
| 136 | |
| 137 | // Map from old to new position |
| 138 | oldToNew.setSize(nPoints); |
| 139 | oldToNew = -1; |
| 140 | |
| 141 | |
| 142 | // 1. Create compact addressing for boundary points. Start off by indexing |
| 143 | // from 0 inside oldToNew. (shifted up later on) |
| 144 | |
| 145 | label nBoundaryPoints = 0; |
| 146 | for (label facei = nInternalFaces; facei < faces.size(); facei++) |
| 147 | { |
| 148 | const face& f = faces[facei]; |
| 149 | |
| 150 | forAll(f, fp) |
| 151 | { |
| 152 | label pointi = f[fp]; |
| 153 | |
| 154 | if (oldToNew[pointi] == -1) |
| 155 | { |
| 156 | oldToNew[pointi] = nBoundaryPoints++; |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | // Now we know the number of boundary and internal points |
| 162 | |
| 163 | nInternalPoints = nPoints - nBoundaryPoints; |
| 164 | |
| 165 | // Move the boundary addressing up |
| 166 | forAll(oldToNew, pointi) |
| 167 | { |
| 168 | if (oldToNew[pointi] != -1) |
| 169 | { |
| 170 | oldToNew[pointi] += nInternalPoints; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | |
| 175 | // 2. Compact the internal points. Detect whether internal and boundary |
| 176 | // points are mixed. |
| 177 | |
| 178 | label internalPointi = 0; |
| 179 | |
| 180 | bool ordered = true; |
| 181 | |
| 182 | for (label facei = 0; facei < nInternalFaces; facei++) |
| 183 | { |