MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / calcSamples

Function calcSamples

src/sampling/sampledSet/patchCloud/patchCloudSet.C:47–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46
47void Foam::patchCloudSet::calcSamples
48(
49 DynamicList<point>& samplingPts,
50 DynamicList<label>& samplingCells,
51 DynamicList<label>& samplingFaces,
52 DynamicList<label>& samplingSegments,
53 DynamicList<scalar>& samplingCurveDist
54) const
55{
56 if (debug)
57 {
58 Info<< "patchCloudSet : sampling on patches :" << endl;
59 }
60
61 // Construct search tree for all patch faces.
62 label sz = 0;
63 forAllConstIter(labelHashSet, patchSet_, iter)
64 {
65 const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
66
67 sz += pp.size();
68
69 if (debug)
70 {
71 Info<< " " << pp.name() << " size " << pp.size() << endl;
72 }
73 }
74
75 labelList patchFaces(sz);
76 sz = 0;
77 treeBoundBox bb(point::max, point::min);
78 forAllConstIter(labelHashSet, patchSet_, iter)
79 {
80 const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
81
82 forAll(pp, i)
83 {
84 patchFaces[sz++] = pp.start()+i;
85 }
86
87 // Do not do reduction.
88 const boundBox patchBb(pp.points(), pp.meshPoints(), false);
89
90 bb.min() = min(bb.min(), patchBb.min());
91 bb.max() = max(bb.max(), patchBb.max());
92 }
93
94 // Not very random
95 Random rndGen(123456);
96 // Make bb asymetric just to avoid problems on symmetric meshes
97 bb = bb.extend(rndGen, 1e-4);
98
99 // Make sure bb is 3D.
100 bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
101 bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
102
103
104 indexedOctree<treeDataFace> patchTree

Callers 1

genSamplesFunction · 0.70

Calls 15

meshFunction · 0.85
minFunction · 0.85
maxFunction · 0.85
pointClass · 0.85
nearestEqOpClass · 0.85
maxMethod · 0.80
extendMethod · 0.80
setIndexMethod · 0.80
forAllConstIterFunction · 0.50
forAllFunction · 0.50
treeDataFaceClass · 0.50
sqrFunction · 0.50

Tested by

no test coverage detected