mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- 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");
This commit is contained in:
@ -209,12 +209,12 @@ Foam::Function1Types::CSV<Type>::CSV
|
||||
)
|
||||
:
|
||||
TableBase<Type>(entryName, dict),
|
||||
nHeaderLine_(readLabel(dict.lookup("nHeaderLine"))),
|
||||
refColumn_(readLabel(dict.lookup("refColumn"))),
|
||||
nHeaderLine_(dict.get<label>("nHeaderLine")),
|
||||
refColumn_(dict.get<label>("refColumn")),
|
||||
componentColumns_(dict.lookup("componentColumns")),
|
||||
separator_(dict.lookupOrDefault<string>("separator", string(","))[0]),
|
||||
mergeSeparators_(readBool(dict.lookup("mergeSeparators"))),
|
||||
fName_(fName != fileName::null ? fName : dict.lookup("file"))
|
||||
separator_(dict.lookupOrDefault<string>("separator", ",")[0]),
|
||||
mergeSeparators_(dict.get<bool>("mergeSeparators")),
|
||||
fName_(fName.empty() ? dict.get<fileName>("file") : fName)
|
||||
{
|
||||
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
||||
{
|
||||
start_ = coeffs.lookupOrDefault<scalar>("start", 0);
|
||||
duration_ = coeffs.get<scalar>("duration");
|
||||
coeffs.readEntry("duration", duration_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user