37 inline scalar
calcGexp(
const scalar expRatio,
const label nDiv)
39 return nDiv > 1 ?
pow(expRatio, 1.0/(nDiv - 1)) : 0.0;
57 divisions_[nDiv] = 1.0;
59 scalar secStart = divisions_[0];
63 if (nDiv >= gd.
size())
68 label sumSecnDivs = 0;
69 label secnMaxDivs = 0;
73 scalar nDivFrac = gd[sectioni].nDivFraction();
74 secnDivs[sectioni] = label(nDivFrac*nDiv + 0.5);
75 sumSecnDivs += secnDivs[sectioni];
78 if (nDivFrac > gd[secnMaxDivs].nDivFraction())
80 secnMaxDivs = sectioni;
86 if (sumSecnDivs != nDiv)
88 secnDivs[secnMaxDivs] += (nDiv - sumSecnDivs);
93 scalar blockFrac = gd[sectioni].blockFraction();
94 scalar expRatio = gd[sectioni].expansionRatio();
96 label secnDiv = secnDivs[sectioni];
97 label secnEnd = secnStart + secnDiv;
100 if (
equal(expRatio, 1))
102 for (label i = secnStart; i < secnEnd; i++)
106 + blockFrac*scalar(i - secnStart + 1)/secnDiv;
112 const scalar expFact =
calcGexp(expRatio, secnDiv);
114 for (label i = secnStart; i < secnEnd; i++)
118 + blockFrac*(1.0 -
pow(expFact, i - secnStart + 1))
119 /(1.0 -
pow(expFact, secnDiv));
123 secStart = divisions_[secnEnd - 1];
130 for (label i=1; i < nDiv; i++)
132 divisions_[i] = scalar(i)/nDiv;
137 points_ = cedge.
position(divisions_);
void size(const label n)
Older name for setAddressableSize.
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
virtual point position(const scalar lambda) const =0
The point position corresponding to the curve parameter.
List of gradingDescriptor for the sections of a block with additional IO functionality.
Divides a line into segments.
const pointField & points() const noexcept
The points.
const scalarList & lambdaDivisions() const noexcept
The list of lambda values.
scalar calcGexp(const scalar expRatio, const label nDiv)
Calculate the geometric expansion factor from the expansion ratio.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
bool equal(const T &s1, const T &s2)
Compare two values for equality.
#define forAll(list, i)
Loop across all elements in list.