| 111 | |
| 112 | |
| 113 | void Foam::regionToFace::combine(topoSet& set, const bool add) const |
| 114 | { |
| 115 | Info<< " Loading subset " << setName_ << " to delimit search region." |
| 116 | << endl; |
| 117 | faceSet subSet(mesh_, setName_); |
| 118 | |
| 119 | indirectPrimitivePatch patch |
| 120 | ( |
| 121 | IndirectList<face>(mesh_.faces(), subSet.toc()), |
| 122 | mesh_.points() |
| 123 | ); |
| 124 | |
| 125 | mappedPatchBase::nearInfo ni |
| 126 | ( |
| 127 | pointIndexHit(false, Zero, -1), |
| 128 | Tuple2<scalar, label> |
| 129 | ( |
| 130 | sqr(GREAT), |
| 131 | Pstream::myProcNo() |
| 132 | ) |
| 133 | ); |
| 134 | |
| 135 | forAll(patch, i) |
| 136 | { |
| 137 | const point& fc = patch.faceCentres()[i]; |
| 138 | scalar d2 = magSqr(fc-nearPoint_); |
| 139 | |
| 140 | if (!ni.first().hit() || d2 < ni.second().first()) |
| 141 | { |
| 142 | ni.second().first() = d2; |
| 143 | ni.first().setHit(); |
| 144 | ni.first().setPoint(fc); |
| 145 | ni.first().setIndex(i); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // Globally reduce |
| 150 | combineReduce(ni, mappedPatchBase::nearestEqOp()); |
| 151 | |
| 152 | Info<< " Found nearest face at " << ni.first().rawPoint() |
| 153 | << " on processor " << ni.second().second() |
| 154 | << " face " << ni.first().index() |
| 155 | << " distance " << Foam::sqrt(ni.second().first()) << endl; |
| 156 | |
| 157 | labelList faceRegion(patch.size(), -1); |
| 158 | markZone |
| 159 | ( |
| 160 | patch, |
| 161 | ni.second().second(), // proci |
| 162 | ni.first().index(), // start face |
| 163 | 0, // currentZone |
| 164 | faceRegion |
| 165 | ); |
| 166 | |
| 167 | forAll(faceRegion, facei) |
| 168 | { |
| 169 | if (faceRegion[facei] == 0) |
| 170 | { |
no test coverage detected