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:
@ -62,8 +62,8 @@ Foam::rigidBodyMeshMotion::bodyMesh::bodyMesh
|
||||
bodyID_(bodyID),
|
||||
patches_(dict.lookup("patches")),
|
||||
patchSet_(mesh.boundaryMesh().patchSet(patches_)),
|
||||
di_(readScalar(dict.lookup("innerDistance"))),
|
||||
do_(readScalar(dict.lookup("outerDistance"))),
|
||||
di_(dict.get<scalar>("innerDistance")),
|
||||
do_(dict.get<scalar>("outerDistance")),
|
||||
weight_
|
||||
(
|
||||
IOobject
|
||||
@ -248,7 +248,7 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
|
||||
if (test_)
|
||||
{
|
||||
label nIter(readLabel(coeffDict().lookup("nIter")));
|
||||
const label nIter(coeffDict().get<label>("nIter"));
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
@ -263,7 +263,7 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
}
|
||||
else
|
||||
{
|
||||
label nIter(coeffDict().lookupOrDefault("nIter", 1));
|
||||
const label nIter(coeffDict().lookupOrDefault("nIter", 1));
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
|
||||
@ -122,7 +122,7 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
|
||||
{
|
||||
if (rhoName_ == "rhoInf")
|
||||
{
|
||||
rhoInf_ = readScalar(coeffDict().lookup("rhoInf"));
|
||||
coeffDict().readEntry("rhoInf", rhoInf_);
|
||||
}
|
||||
|
||||
const dictionary& bodiesDict = coeffDict().subDict("bodies");
|
||||
@ -196,7 +196,7 @@ void Foam::rigidBodyMeshMotionSolver::solve()
|
||||
|
||||
if (test_)
|
||||
{
|
||||
label nIter(readLabel(coeffDict().lookup("nIter")));
|
||||
const label nIter(coeffDict().get<label>("nIter"));
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user