50 void Foam::patchSeedSet::calcSamples
52 DynamicList<point>& samplingPts,
53 DynamicList<label>& samplingCells,
54 DynamicList<label>& samplingFaces,
55 DynamicList<label>& samplingSegments,
56 DynamicList<scalar>& samplingCurveDist
63 for (
const label patchi : patchSet_)
69 DebugInfo <<
" " << pp.name() <<
" size " << pp.size() <<
endl;
74 for (
const label patchi : patchSet_)
79 patchFaces[sz++] = pp.start()+i;
86 rndGenPtr_.reset(
new Random(0));
88 Random&
rndGen = *rndGenPtr_;
91 if (selectedLocations_.size())
93 DynamicList<label> newPatchFaces(patchFaces.size());
101 List<mappedPatchBase::nearInfo> nearest(selectedLocations_.size());
105 IndirectList<face>(
mesh().
faces(), patchFaces),
111 treeBoundBox(pp.points(), pp.meshPoints()).extend
120 indexedOctree<treeDataFace> boundaryTree
136 const scalar globalDistSqr
150 forAll(selectedLocations_, sampleI)
155 nearInfo = boundaryTree.findNearest
163 nearest[sampleI].second().first() =
Foam::sqr(GREAT);
164 nearest[sampleI].second().second() =
169 point fc(pp[nearInfo.index()].centre(pp.points()));
170 nearInfo.setPoint(fc);
172 nearest[sampleI].second().second() =
189 if (nearest[sampleI].first().hit())
191 label procI = nearest[sampleI].second().second();
192 label index = nearest[sampleI].first().index();
196 newPatchFaces.append(pp.addressing()[index]);
204 Pout<<
"Found " << newPatchFaces.size()
205 <<
" out of " << selectedLocations_.size()
206 <<
" on local processor" <<
endl;
209 patchFaces.transfer(newPatchFaces);
214 label totalSize =
returnReduce(patchFaces.size(), sumOp<label>());
216 if (maxPoints_ < totalSize)
220 label(scalar(patchFaces.size())/totalSize*maxPoints_);
223 for (label iter = 0; iter < 4; ++iter)
239 Pout<<
"In random mode : selected " << patchFaces.size()
240 <<
" faces out of " << patchFaces.size() <<
endl;
246 globalIndex globalSampleNumbers(patchFaces.size());
248 samplingPts.setCapacity(patchFaces.size());
249 samplingCells.setCapacity(patchFaces.size());
250 samplingFaces.setCapacity(patchFaces.size());
251 samplingSegments.setCapacity(patchFaces.size());
252 samplingCurveDist.setCapacity(patchFaces.size());
259 label facei = patchFaces[i];
277 info.hitPoint() + 1
e-1*(cc-info.hitPoint())
282 samplingPts.append(info.rawPoint());
284 samplingCells.append(celli);
285 samplingFaces.append(facei);
286 samplingSegments.append(0);
287 samplingCurveDist.append(globalSampleNumbers.toGlobal(i));
292 void Foam::patchSeedSet::genSamples()
295 DynamicList<point> samplingPts;
296 DynamicList<label> samplingCells;
297 DynamicList<label> samplingFaces;
298 DynamicList<label> samplingSegments;
299 DynamicList<scalar> samplingCurveDist;
310 samplingPts.shrink();
311 samplingCells.shrink();
312 samplingFaces.shrink();
313 samplingSegments.shrink();
314 samplingCurveDist.shrink();
319 std::move(samplingPts),
320 std::move(samplingCells),
321 std::move(samplingFaces),
322 std::move(samplingSegments),
323 std::move(samplingCurveDist)
338 const polyMesh&
mesh,
339 const meshSearch& searchEngine,
340 const dictionary&
dict
346 mesh.boundaryMesh().patchSet(
dict.
get<wordRes>(
"patches"))
348 maxPoints_(
dict.
get<label>(
"maxPoints")),