Files
OpenFOAM-12/test
Henry Weller 441b60c70d functionEntries::calcEntry: Extended the functionality of multi-statement/multi-line #calc
If the code string is delimited by '#{...#}' multiple lines and multiple code
statements can be used to generate the entry using 'os << ...;'.  This is
equivalent to #codeStream but with a more compact syntax, e.g.

maxAngle        30;
nAngles         7;
Us              #calc
    const vector U($<vector>testCalc2!U);
    const int nAngles = $nAngles;
    const scalar angleStep = ($<scalar>maxAngle)/(nAngles - 1);
    List<vector> Us(nAngles);
    for(int i=0; i<nAngles; i++)
    {
        const scalar angle = degToRad(i*angleStep);
        Us[i] = transform(Ry(angle), U);
    }
    os << Us;

Note the 'os << Us;' statement which writes the data to the dictionary entry in
the same manner as #codeStream, this provides flexibility on how the data is
created and written.
2023-07-06 23:11:36 +01:00
..