| 44 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
| 45 | |
| 46 | void Foam::arraySet::calcSamples |
| 47 | ( |
| 48 | DynamicList<point>& samplingPts, |
| 49 | DynamicList<label>& samplingCells, |
| 50 | DynamicList<label>& samplingFaces, |
| 51 | DynamicList<label>& samplingSegments, |
| 52 | DynamicList<scalar>& samplingCurveDist |
| 53 | ) const |
| 54 | { |
| 55 | const meshSearch& queryMesh = searchEngine(); |
| 56 | |
| 57 | label nTotalSamples |
| 58 | ( |
| 59 | pointsDensity_.x() |
| 60 | *pointsDensity_.y() |
| 61 | *pointsDensity_.z() |
| 62 | ); |
| 63 | |
| 64 | List<point> sampleCoords(nTotalSamples); |
| 65 | |
| 66 | const scalar deltax = spanBox_.x()/(pointsDensity_.x() + 1); |
| 67 | const scalar deltay = spanBox_.y()/(pointsDensity_.y() + 1); |
| 68 | const scalar deltaz = spanBox_.z()/(pointsDensity_.z() + 1); |
| 69 | |
| 70 | label p(0); |
| 71 | for (label k=1; k<=pointsDensity_.z(); k++) |
| 72 | { |
| 73 | for (label j=1; j<=pointsDensity_.y(); j++) |
| 74 | { |
| 75 | for (label i=1; i<=pointsDensity_.x(); i++) |
| 76 | { |
| 77 | vector t(deltax*i , deltay*j, deltaz*k); |
| 78 | sampleCoords[p] = coordSys_.origin() + t; |
| 79 | p++; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | forAll(sampleCoords, i) |
| 85 | { |
| 86 | sampleCoords[i] = transform(coordSys_.R().R(), sampleCoords[i]); |
| 87 | } |
| 88 | |
| 89 | forAll(sampleCoords, sampleI) |
| 90 | { |
| 91 | label celli = queryMesh.findCell(sampleCoords[sampleI]); |
| 92 | |
| 93 | if (celli != -1) |
| 94 | { |
| 95 | samplingPts.append(sampleCoords[sampleI]); |
| 96 | samplingCells.append(celli); |
| 97 | samplingFaces.append(-1); |
| 98 | samplingSegments.append(0); |
| 99 | samplingCurveDist.append(1.0 * sampleI); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |