48 void Foam::patchCloudSet::calcSamples
50 DynamicList<point>& samplingPts,
51 DynamicList<label>& samplingCells,
52 DynamicList<label>& samplingFaces,
53 DynamicList<label>& samplingSegments,
54 DynamicList<scalar>& samplingCurveDist
59 Info<<
"patchCloudSet : sampling on patches :" <<
endl;
72 Info<<
" " << pp.name() <<
" size " << pp.size() <<
endl;
85 patchFaces[sz++] = pp.start()+i;
89 const boundBox patchBb(pp.localPoints(),
false);
91 bb.min() =
min(bb.min(), patchBb.min());
92 bb.max() =
max(bb.max(), patchBb.max());
96 Random rndGen(123456);
98 bb = bb.extend(rndGen, 1
E-4);
101 bb.min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
102 bb.max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
105 indexedOctree<treeDataFace> patchTree
122 List<directMappedPatchBase::nearInfo> nearest(sampleCoords_.
size());
124 forAll(sampleCoords_, sampleI)
126 const point& sample = sampleCoords_[sampleI];
131 if (patchFaces.size())
133 nearInfo = patchTree.findNearest(sample,
sqr(searchDist_));
144 nearest[sampleI].second().first() =
Foam::sqr(GREAT);
150 nearInfo.setIndex(patchFaces[nearInfo.index()]);
152 nearest[sampleI].second().first() =
magSqr
175 Info<<
"Dumping mapping as lines from supplied points to"
176 <<
" nearest patch face to file " << str.name() <<
endl;
182 if (nearest[i].first().hit())
188 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
203 label faceI = nearInfo.index();
205 samplingPts.append(nearInfo.hitPoint());
206 samplingCells.append(
mesh().faceOwner()[faceI]);
207 samplingFaces.append(faceI);
208 samplingSegments.append(0);
209 samplingCurveDist.append(1.0 * sampleI);
218 samplingPts.append(sampleCoords_[sampleI]);
219 samplingCells.append(-1);
220 samplingFaces.append(-1);
221 samplingSegments.append(0);
222 samplingCurveDist.append(1.0 * sampleI);
229 void Foam::patchCloudSet::genSamples()
232 DynamicList<point> samplingPts;
233 DynamicList<label> samplingCells;
234 DynamicList<label> samplingFaces;
235 DynamicList<label> samplingSegments;
236 DynamicList<scalar> samplingCurveDist;
247 samplingPts.shrink();
248 samplingCells.shrink();
249 samplingFaces.shrink();
250 samplingSegments.shrink();
251 samplingCurveDist.shrink();
274 const scalar searchDist
278 sampleCoords_(sampleCoords),
280 searchDist_(searchDist)
300 sampleCoords_(dict.
lookup(
"points")),