| 45 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
| 46 | |
| 47 | void 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 |
no test coverage detected