Henry Weller 8611db460a functionEntries::calcEntry: Added support for #{...#} delimited verbatim string
Class
    Foam::functionEntries::calcEntry

Description
    Compiles and executes code string expressions,
    returning the result to the dictionary

Usage
    \verbatim
    a 1.1;
    b 3.2;
    c #calc "$a*$b";
    \endverbatim

    Special care is required for calc entries that include a division since
    "/" is also used as the scoping operator to identify keywords in
    sub-dictionaries. For example, "$a/b" expects a keyword "b" within a
    sub-dictionary named "a". A division can be correctly executed by using a
    space between a variables and "/", e.g.

    \verbatim
    c #calc "$a / $b";
    \endverbatim

    or bracketing the variable, e.g.

    \verbatim
    c #calc "($a)/$b";
    \endverbatim

    The code string can be delimited either by '"..."' in which newlines must be
    escaped or '#{...#}' which directly supports multi-line strings and is more
    convenient when evaluating string expressions by avoiding the need to
    escape the quotes, e.g.

    \verbatim
    c #calc #{ $a*sqrt($b) #};
    \endverbatim

    \verbatim
    s "field";
    fieldName #calc #{ $<string>s + "Name" #};
    \endverbatim

    Additional include files for the #calc code compilation can be specified
    using the #calcInclude entry, e.g. if functions from transform.H are used
    \verbatim
    angleOfAttack   5; // degs

    angle           #calc "-degToRad($angleOfAttack)";

    #calcInclude    "transform.H"
    liftDir         #calc "transform(Ry($angle), vector(0, 0, 1))";
    dragDir         #calc "transform(Ry($angle), vector(1, 0, 0))";
    \endverbatim

    Note:
        Internally this is just a wrapper around codeStream functionality - the
        #calc string is used to construct a dictionary for codeStream.

See also
    Foam::functionEntries::calcIncludeEntry
2023-06-28 10:58:57 +01:00
2021-07-15 15:35:22 +01:00

README for OpenFOAM-dev

#

About OpenFOAM

OpenFOAM is a free, open source computational fluid dynamics (CFD) software package released by the OpenFOAM Foundation. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics.

Copyright

OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the file COPYING in this directory or http://www.gnu.org/licenses/, for a description of the GNU General Public License terms under which you can copy the files.

Description
Description: OpenFOAM Foundation repository for OpenFOAM version 12
Readme 306 MiB
Languages
C++ 97.4%
Shell 1.8%
Lex 0.4%
Liquid 0.2%
C 0.1%