- easier support for non-mandatory functions.
In some boundary conditions it can be desirable to support
additional functions, but not necessarily require them. Make this
easier to support with a Function1, PatchFunction1 NewIfPresent()
selector.
- support for compatibility lookups
- harmonize branching logic and error handling between Function1 and
PatchFunction1.
ENH: refactor a base class for Function1, PatchFunction1
- includes base characteristics, patch or scalar information
ENH: additional creation macros
- makeConcreteFunction1, makeConcretePatchFunction1Type for adding a
non-templated function into the correct templated selection table.
makeScalarPatchFunction1 for similarity with makeScalarFunction1
- use the dictionary 'get' methods instead of readScalar for
additional checking
Unchecked: readScalar(dict.lookup("key"));
Checked: dict.get<scalar>("key");
- In templated classes that also inherit from a dictionary, an additional
'template' keyword will be required. Eg,
this->coeffsDict().template get<scalar>("key");
For this common use case, the predefined getXXX shortcuts may be
useful. Eg,
this->coeffsDict().getScalar("key");
- Always used for optional dictionary entries, since these are individual
values, and not meant to be embedded in a larger stream of tokens.
Methods:
- lookupOrDefault, lookupOrAddDefault, lookupOrDefaultCompat
- readIfPresent, readIfPresentCompat
- Handling mandatory dictionary entries is slightly more complex,
since these may be part of larger stream of tokens, and are often
used in a constructor context. For example,
word modelType(dict.lookup("type"));
Or they are used without a definite context. For example,
dict.lookup("format") >> outputFormat;
Newly introduced methods for mandatory dictionary entries:
- get, getCompat
- read, readCompat
In a constructor or assignment context:
word modelType(dict.get<word>("type"));
outputFormat = dict.lookup("format");
without copy/move (similar to readIfPresent):
dict.read("format", outputFormat);
Description
Ramp function base class for the set of scalar functions starting from 0 and
increasing monotonically to 1 from \c start over the \c duration and
remaining at 1 thereafter.
Usage:
\verbatim
<entryName> <rampFunction>;
<entryName>Coeffs
{
start 10;
duration 20;
}
\endverbatim
or
\verbatim
<entryName>
{
type <rampFunction>;
start 10;
duration 20;
}
\endverbatim
Where:
\table
Property | Description | Required | Default value
start | Start time | no | 0
duration | Duration | yes |
\endtable
The following common ramp functions are provided: linear, quadratic, halfCosine,
quarterCosine and quaterSine, others can easily be added and registered to the run-time
selection system.