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

Function round

src/OpenFOAM/dimensionSet/dimensionSetIO.C:217–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216
217void Foam::dimensionSet::round(const scalar tol)
218{
219 for (int i=0; i < dimensionSet::nDimensions; ++i)
220 {
221 scalar integralPart;
222 scalar fractionalPart = std::modf(exponents_[i], &integralPart);
223
224 if (mag(fractionalPart-1.0) <= tol)
225 {
226 exponents_[i] = 1.0+integralPart;
227 }
228 else if (mag(fractionalPart+1.0) <= tol)
229 {
230 exponents_[i] = -1.0+integralPart;
231 }
232 else if (mag(fractionalPart) <= tol)
233 {
234 exponents_[i] = integralPart;
235 }
236 }
237}
238
239
240Foam::dimensionedScalar Foam::dimensionSet::parse

Callers 8

sizeCoeffToRefinementFunction · 0.85
sample01Function · 0.85
GaussNormalFunction · 0.85
positionFunction · 0.85
globalSample01Function · 0.85
globalGaussNormalFunction · 0.85
globalPositionFunction · 0.85

Calls 1

magFunction · 0.50

Tested by

no test coverage detected