Count regions per point
| 99 | |
| 100 | // Count regions per point |
| 101 | void Foam::localPointRegion::countPointRegions |
| 102 | ( |
| 103 | const polyMesh& mesh, |
| 104 | const boolList& candidatePoint, |
| 105 | const Map<label>& candidateFace, |
| 106 | faceList& minRegion |
| 107 | ) |
| 108 | { |
| 109 | // Almost all will have only one so only |
| 110 | // populate Map if more than one. |
| 111 | labelList minPointRegion(mesh.nPoints(), -1); |
| 112 | // From global point to local (multi-region) point numbering |
| 113 | meshPointMap_.resize(candidateFace.size()/100); |
| 114 | // From local (multi-region) point to regions |
| 115 | DynamicList<labelList> pointRegions(meshPointMap_.size()); |
| 116 | |
| 117 | // From faces with any duplicated point on it to local face |
| 118 | meshFaceMap_.resize(meshPointMap_.size()); |
| 119 | |
| 120 | forAllConstIter(Map<label>, candidateFace, iter) |
| 121 | { |
| 122 | label facei = iter.key(); |
| 123 | |
| 124 | if (!mesh.isInternalFace(facei)) |
| 125 | { |
| 126 | const face& f = mesh.faces()[facei]; |
| 127 | |
| 128 | if (minRegion[facei].empty()) |
| 129 | { |
| 130 | FatalErrorInFunction |
| 131 | << "Face from candidateFace without minRegion set." << endl |
| 132 | << "Face:" << facei << " fc:" << mesh.faceCentres()[facei] |
| 133 | << " verts:" << f << abort(FatalError); |
| 134 | } |
| 135 | |
| 136 | forAll(f, fp) |
| 137 | { |
| 138 | label pointi = f[fp]; |
| 139 | |
| 140 | // Even points which were not candidates for splitting might |
| 141 | // be on multiple baffles that are being split so check. |
| 142 | |
| 143 | if (candidatePoint[pointi]) |
| 144 | { |
| 145 | label region = minRegion[facei][fp]; |
| 146 | |
| 147 | if (minPointRegion[pointi] == -1) |
| 148 | { |
| 149 | minPointRegion[pointi] = region; |
| 150 | } |
| 151 | else if (minPointRegion[pointi] != region) |
| 152 | { |
| 153 | // Multiple regions for this point. Add. |
| 154 | Map<label>::iterator iter = meshPointMap_.find(pointi); |
| 155 | if (iter != meshPointMap_.end()) |
| 156 | { |
| 157 | labelList& regions = pointRegions[iter()]; |
| 158 | if (findIndex(regions, region) == -1) |
no test coverage detected