- 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:
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
// Create the pendulumAndSpring model from dictionary
|
||||
rigidBodyMotion pendulumAndSpring(runTime, pendulumAndSpringDict);
|
||||
|
||||
label nIter(readLabel(pendulumAndSpringDict.lookup("nIter")));
|
||||
label nIter(pendulumAndSpringDict.get<label>("nIter"));
|
||||
|
||||
Info<< pendulumAndSpring << endl;
|
||||
Info<< "// Joint state " << endl;
|
||||
|
||||
Reference in New Issue
Block a user