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

Function calcSamples

src/sampling/sampledSet/polyLine/polyLineSet.C:117–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116
117void Foam::polyLineSet::calcSamples
118(
119 DynamicList<point>& samplingPts,
120 DynamicList<label>& samplingCells,
121 DynamicList<label>& samplingFaces,
122 DynamicList<label>& samplingSegments,
123 DynamicList<scalar>& samplingCurveDist
124) const
125{
126 // Check sampling points
127 if (sampleCoords_.size() < 2)
128 {
129 FatalErrorInFunction
130 << "Incorrect sample specification. Too few points:"
131 << sampleCoords_ << exit(FatalError);
132 }
133 point oldPoint = sampleCoords_[0];
134 for (label sampleI = 1; sampleI < sampleCoords_.size(); sampleI++)
135 {
136 if (mag(sampleCoords_[sampleI] - oldPoint) < SMALL)
137 {
138 FatalErrorInFunction
139 << "Incorrect sample specification."
140 << " Point " << sampleCoords_[sampleI-1]
141 << " at position " << sampleI-1
142 << " and point " << sampleCoords_[sampleI]
143 << " at position " << sampleI
144 << " are too close" << exit(FatalError);
145 }
146 oldPoint = sampleCoords_[sampleI];
147 }
148
149 // Force calculation of cloud addressing on all processors
150 const bool oldMoving = const_cast<polyMesh&>(mesh()).moving(false);
151 passiveParticleCloud particleCloud(mesh());
152
153 // current segment number
154 label segmentI = 0;
155
156 // starting index of current segment in samplePts
157 label startSegmentI = 0;
158
159 label sampleI = 0;
160
161 point lastSample(GREAT, GREAT, GREAT);
162 while (true)
163 {
164 // Get boundary intersection
165 point trackPt;
166 label trackCelli = -1;
167 label trackFacei = -1;
168
169 do
170 {
171 const vector offset =
172 sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
173 const scalar smallDist = mag(tol*offset);
174

Callers 1

genSamplesFunction · 0.70

Calls 10

meshFunction · 0.85
getTrackingPointFunction · 0.85
movingMethod · 0.80
trackToBoundaryFunction · 0.70
exitFunction · 0.50
magClass · 0.50
sizeMethod · 0.45
indexMethod · 0.45
appendMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected