Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
9525d57d
Commit
9525d57d
authored
May 20, 2010
by
Mark Olesen
Browse files
STYLE: use readIfPresent instead of found/lookup combination
parent
22763174
Changes
18
Hide whitespace changes
Inline
Side-by-side
applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C
View file @
9525d57d
...
...
@@ -29,14 +29,9 @@ License
#include
"volFields.H"
#include
"mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
...
...
@@ -52,7 +47,8 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
valueFraction
()
=
0
.
0
;
}
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
ptf
,
const
fvPatch
&
p
,
...
...
@@ -67,7 +63,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
{}
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
,
...
...
@@ -118,7 +114,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
}
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
ptpsf
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
...
...
@@ -134,7 +130,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Map from self
void
smoluchowskiJumpTFvPatchScalarField
::
autoMap
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
autoMap
(
const
fvPatchFieldMapper
&
m
)
...
...
@@ -144,7 +140,7 @@ void smoluchowskiJumpTFvPatchScalarField::autoMap
// Reverse-map the given fvPatchField onto this fvPatchField
void
smoluchowskiJumpTFvPatchScalarField
::
rmap
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
rmap
(
const
fvPatchField
<
scalar
>&
ptf
,
const
labelList
&
addr
...
...
@@ -155,7 +151,7 @@ void smoluchowskiJumpTFvPatchScalarField::rmap
// Update the coefficients associated with the patch field
void
smoluchowskiJumpTFvPatchScalarField
::
updateCoeffs
()
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
updateCoeffs
()
{
if
(
updated
())
{
...
...
@@ -174,11 +170,16 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
// Prandtl number reading consistent with rhoCentralFoam
const
dictionary
&
thermophysicalProperties
=
db
().
lookupObject
<
IOdictionary
>
(
"thermophysicalProperties"
);
dimensionedScalar
Pr
=
dimensionedScalar
(
"Pr"
,
dimless
,
1
.
0
);
if
(
thermophysicalProperties
.
found
(
"Pr"
))
{
Pr
=
thermophysicalProperties
.
lookup
(
"Pr"
);
}
dimensionedScalar
Pr
(
dimensionedScalar
::
lookupOrDefault
(
"Pr"
,
thermophysicalProperties
,
1
.
0
)
);
Field
<
scalar
>
C2
=
pmu
/
prho
*
sqrt
(
ppsi
*
constant
::
mathematical
::
piByTwo
)
...
...
@@ -197,7 +198,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
// Write
void
smoluchowskiJumpTFvPatchScalarField
::
write
(
Ostream
&
os
)
const
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
write
(
Ostream
&
os
)
const
{
fvPatchScalarField
::
write
(
os
);
os
.
writeKeyword
(
"accommodationCoeff"
)
...
...
@@ -211,10 +212,12 @@ void smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
makePatchTypeField
(
fvPatchScalarField
,
smoluchowskiJumpTFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
}
// End namespace Foam
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H
View file @
9525d57d
word
fluxScheme
(
"Kurganov"
);
if
(
mesh
.
schemesDict
().
found
(
"fluxScheme"
))
if
(
mesh
.
schemesDict
().
readIfPresent
(
"fluxScheme"
,
fluxScheme
))
{
fluxScheme
=
word
(
mesh
.
schemesDict
().
lookup
(
"fluxScheme"
));
if
((
fluxScheme
==
"Tadmor"
)
||
(
fluxScheme
==
"Kurganov"
))
{
Info
<<
"fluxScheme: "
<<
fluxScheme
<<
endl
;
...
...
applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H
View file @
9525d57d
...
...
@@ -14,9 +14,13 @@ IOdictionary thermophysicalProperties
)
);
dimensionedScalar
Pr
=
dimensionedScalar
(
"Pr"
,
dimless
,
1
.
0
);
dimensionedScalar
Pr
(
dimensionedScalar
::
lookupOrDefault
(
"Pr"
,
thermophysicalProperties
,
1
.
0
)
);
if
(
thermophysicalProperties
.
found
(
"Pr"
))
{
Pr
=
thermophysicalProperties
.
lookup
(
"Pr"
);
}
applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H
View file @
9525d57d
...
...
@@ -26,8 +26,13 @@
dimensionedScalar
gamma
=
Cp
/
Cv
;
dimensionedScalar
Pr
=
dimensionedScalar
(
"Pr"
,
dimless
,
1
.
0
);
if
(
thermodynamicProperties
.
found
(
"Pr"
))
{
Pr
=
thermodynamicProperties
.
lookup
(
"Pr"
);
}
dimensionedScalar
Pr
(
dimensionedScalar
::
lookupOrDefault
(
"Pr"
,
thermodynamicProperties
,
1
.
0
)
);
applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H
View file @
9525d57d
...
...
@@ -175,10 +175,8 @@
);
word
dragPhase
(
"blended"
);
if
(
interfacialProperties
.
found
(
"dragPhase"
))
if
(
interfacialProperties
.
readIfPresent
(
"dragPhase"
,
dragPhase
))
{
dragPhase
=
word
(
interfacialProperties
.
lookup
(
"dragPhase"
));
bool
validDrag
=
dragPhase
==
"a"
||
dragPhase
==
"b"
||
dragPhase
==
"blended"
;
...
...
applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
View file @
9525d57d
...
...
@@ -110,11 +110,7 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
procProcessorPatchStartIndex_
(
nProcs_
),
cyclicParallel_
(
false
)
{
if
(
decompositionDict_
.
found
(
"distributed"
))
{
Switch
distributed
(
decompositionDict_
.
lookup
(
"distributed"
));
distributed_
=
distributed
;
}
decompositionDict_
.
readIfPresent
(
"distributed"
,
distributed_
);
}
...
...
src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
View file @
9525d57d
...
...
@@ -43,10 +43,10 @@ namespace Foam
addToRunTimeSelectionTable
(
polyPatch
,
cyclicPolyPatch
,
word
);
addToRunTimeSelectionTable
(
polyPatch
,
cyclicPolyPatch
,
dictionary
);
}
template
<>
const
char
*
NamedEnum
<
cyclicPolyPatch
::
transformType
,
4
>::
names
[]
=
const
char
*
Foam
::
NamedEnum
<
Foam
::
cyclicPolyPatch
::
transformType
,
4
>::
names
[]
=
{
"unknown"
,
"rotational"
,
...
...
@@ -54,9 +54,8 @@ const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] =
"noOrdering"
};
const
NamedEnum
<
cyclicPolyPatch
::
transformType
,
4
>
cyclicPolyPatch
::
transformTypeNames
;
}
const
Foam
::
NamedEnum
<
Foam
::
cyclicPolyPatch
::
transformType
,
4
>
Foam
::
cyclicPolyPatch
::
transformTypeNames
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C
View file @
9525d57d
...
...
@@ -45,10 +45,7 @@ Foam::fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
pistonLayers_
(
"pistonLayers"
,
dimLength
,
0
.
0
),
motionSolver_
(
*
this
,
engineDB_
.
engineDict
().
lookup
(
"motionSolver"
))
{
if
(
engineDB_
.
engineDict
().
found
(
"pistonLayers"
))
{
engineDB_
.
engineDict
().
lookup
(
"pistonLayers"
)
>>
pistonLayers_
;
}
engineDB_
.
engineDict
().
readIfPresent
(
"pistonLayers"
,
pistonLayers_
);
}
...
...
src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C
View file @
9525d57d
...
...
@@ -44,10 +44,7 @@ Foam::layeredEngineMesh::layeredEngineMesh(const IOobject& io)
engineMesh
(
io
),
pistonLayers_
(
"pistonLayers"
,
dimLength
,
0
.
0
)
{
if
(
engineDB_
.
engineDict
().
found
(
"pistonLayers"
))
{
engineDB_
.
engineDict
().
lookup
(
"pistonLayers"
)
>>
pistonLayers_
;
}
engineDB_
.
engineDict
().
readIfPresent
(
"pistonLayers"
,
pistonLayers_
);
}
...
...
src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C
View file @
9525d57d
...
...
@@ -80,10 +80,7 @@ freestreamFvPatchField<Type>::freestreamFvPatchField
fvPatchField
<
Type
>::
operator
=
(
freestreamValue
());
}
if
(
dict
.
found
(
"phi"
))
{
dict
.
lookup
(
"phi"
)
>>
this
->
phiName_
;
}
dict
.
readIfPresent
(
"phi"
,
this
->
phiName_
);
}
...
...
src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C
View file @
9525d57d
...
...
@@ -130,10 +130,7 @@ timeVaryingMappedFixedValueFvPatchField
<<
endl
;
}
if
(
dict
.
found
(
"fieldTableName"
))
{
dict
.
lookup
(
"fieldTableName"
)
>>
fieldTableName_
;
}
dict
.
readIfPresent
(
"fieldTableName"
,
fieldTableName_
);
if
(
dict
.
found
(
"value"
))
{
...
...
src/lagrangian/molecularDynamics/potential/potential/potential.C
View file @
9525d57d
...
...
@@ -229,18 +229,12 @@ void Foam::potential::potential::readPotentialDict()
if
(
potentialDict
.
found
(
"external"
))
{
Info
<<
nl
<<
"Reading external forces:"
<<
endl
;
const
dictionary
&
externalDict
=
potentialDict
.
subDict
(
"external"
);
// *********************************************************************
// gravity
if
(
externalDict
.
found
(
"gravity"
))
{
gravity_
=
externalDict
.
lookup
(
"gravity"
);
}
externalDict
.
readIfPresent
(
"gravity"
,
gravity_
);
}
Info
<<
nl
<<
tab
<<
"gravity = "
<<
gravity_
<<
endl
;
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
View file @
9525d57d
...
...
@@ -218,10 +218,7 @@ Foam::layerParameters::layerParameters
<<
endl
;
}
if
(
dict
.
found
(
"nRelaxedIter"
))
{
dict
.
lookup
(
"nRelaxedIter"
)
>>
nRelaxedIter_
;
}
dict
.
readIfPresent
(
"nRelaxedIter"
,
nRelaxedIter_
);
if
(
nLayerIter_
<
0
||
nRelaxedIter_
<
0
)
{
...
...
@@ -303,10 +300,8 @@ Foam::layerParameters::layerParameters
<<
endl
;
}
if
(
dict
.
found
(
"nRelaxedIter"
))
{
dict
.
lookup
(
"nRelaxedIter"
)
>>
nRelaxedIter_
;
}
dict
.
readIfPresent
(
"nRelaxedIter"
,
nRelaxedIter_
);
if
(
nLayerIter_
<
0
||
nRelaxedIter_
<
0
)
{
FatalErrorIn
(
"layerParameters::layerParameters(..)"
)
...
...
src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
View file @
9525d57d
...
...
@@ -522,11 +522,9 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Collapse checking parameters
scalar
volFraction
=
-
1
;
if
(
motionDict
.
found
(
"minVolCollapseRatio"
))
{
volFraction
=
readScalar
(
motionDict
.
lookup
(
"minVolCollapseRatio"
));
}
const
scalar
volFraction
=
motionDict
.
lookupOrDefault
<
scalar
>
(
"minVolCollapseRatio"
,
-
1
);
const
bool
checkCollapse
=
(
volFraction
>
0
);
scalar
minArea
=
-
1
;
scalar
maxNonOrtho
=
-
1
;
...
...
src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
View file @
9525d57d
...
...
@@ -151,17 +151,10 @@ Foam::refinementSurfaces::refinementSurfaces
}
// Global perpendicular angle
if
(
dict
.
found
(
"perpendicularAngle"
))
{
globalAngle
[
surfI
]
=
readScalar
(
dict
.
lookup
(
"perpendicularAngle"
));
}
dict
.
readIfPresent
(
"perpendicularAngle"
,
globalAngle
[
surfI
]);
//// Global patch name per surface
//if (dict.found("patchType"))
//{
// dict.lookup("patchType") >> globalPatchType[surfI];
//}
//dict.readIfPresent("patchType", globalPatchType[surfI]);
if
(
dict
.
found
(
"regions"
))
{
...
...
@@ -446,13 +439,7 @@ Foam::refinementSurfaces::refinementSurfaces
}
// Global perpendicular angle
if
(
dict
.
found
(
"perpendicularAngle"
))
{
globalAngle
[
surfI
]
=
readScalar
(
dict
.
lookup
(
"perpendicularAngle"
)
);
}
dict
.
readIfPresent
(
"perpendicularAngle"
,
globalAngle
[
surfI
]);
if
(
dict
.
found
(
"regions"
))
{
...
...
src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C
View file @
9525d57d
...
...
@@ -22,8 +22,8 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
From scotch forum:
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:
...
...
@@ -178,45 +178,39 @@ Foam::label Foam::ptscotchDecomp::decompose
// const dictionary& scotchCoeffs =
// decompositionDict_.subDict("ptscotchCoeffs");
//
// if (scotchCoeffs.
found
("writeGraph"))
// if (scotchCoeffs.
lookupOrDefault
("writeGraph"
, false
))
// {
//
Switch writeGraph(scotchCoeffs.lookup("writeGraph")
);
//
OFstream str(mesh_.time().path() / mesh_.name() + ".grf"
);
//
// if (writeGraph)
// {
// OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
// Info<< "Dumping Scotch graph file to " << str.name() << endl
// << "Use this in combination with gpart." << endl;
//
// Info<< "Dumping Scotch graph file to " << str.name() << endl
// << "Use this in combination with gpart." << endl;
// label version = 0;
// str << version << nl;
// // Numer of vertices
// str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// // Numbering starts from 0
// label baseval = 0;
// // Has weights?
// label hasEdgeWeights = 0;
// label hasVertexWeights = 0;
// label numericflag = 10*hasEdgeWeights+hasVertexWeights;
// str << baseval << ' ' << numericflag << nl;
// for (label cellI = 0; cellI < xadj.size()-1; cellI++)
// {
// label start = xadj[cellI];
// label end = xadj[cellI+1];
// str << end-start;
//
// label version = 0;
// str << version << nl;
// // Numer of vertices
// str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// // Numbering starts from 0
// label baseval = 0;
// // Has weights?
// label hasEdgeWeights = 0;
// label hasVertexWeights = 0;
// label numericflag = 10*hasEdgeWeights+hasVertexWeights;
// str << baseval << ' ' << numericflag << nl;
// for (label cellI = 0; cellI < xadj.size()-1; cellI++)
// for (label i = start; i < end; i++)
// {
// label start = xadj[cellI];
// label end = xadj[cellI+1];
// str << end-start;
//
// for (label i = start; i < end; i++)
// {
// str << ' ' << adjncy[i];
// }
// str << nl;
// str << ' ' << adjncy[i];
// }
// str << nl;
// }
// }
// }
// Strategy
// ~~~~~~~~
...
...
src/parallel/decompose/scotchDecomp/scotchDecomp.C
View file @
9525d57d
...
...
@@ -22,8 +22,8 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
From scotch forum:
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:
...
...
@@ -178,40 +178,35 @@ Foam::label Foam::scotchDecomp::decompose
const
dictionary
&
scotchCoeffs
=
decompositionDict_
.
subDict
(
"scotchCoeffs"
);
if
(
scotchCoeffs
.
found
(
"writeGraph"
))
if
(
scotchCoeffs
.
lookupOrDefault
(
"writeGraph"
,
false
))
{
Switch
writeGraph
(
scotchCoeffs
.
lookup
(
"writeGraph"
));
if
(
writeGraph
)
OFstream
str
(
mesh_
.
time
().
path
()
/
mesh_
.
name
()
+
".grf"
);
Info
<<
"Dumping Scotch graph file to "
<<
str
.
name
()
<<
endl
<<
"Use this in combination with gpart."
<<
endl
;
label
version
=
0
;
str
<<
version
<<
nl
;
// Numer of vertices
str
<<
xadj
.
size
()
-
1
<<
' '
<<
adjncy
.
size
()
<<
nl
;
// Numbering starts from 0
label
baseval
=
0
;
// Has weights?
label
hasEdgeWeights
=
0
;
label
hasVertexWeights
=
0
;
label
numericflag
=
10
*
hasEdgeWeights
+
hasVertexWeights
;
str
<<
baseval
<<
' '
<<
numericflag
<<
nl
;
for
(
label
cellI
=
0
;
cellI
<
xadj
.
size
()
-
1
;
cellI
++
)
{
OFstream
str
(
mesh_
.
time
().
path
()
/
mesh_
.
name
()
+
".grf"
);
Info
<<
"Dumping Scotch graph file to "
<<
str
.
name
()
<<
endl
<<
"Use this in combination with gpart."
<<
endl
;
label
version
=
0
;
str
<<
version
<<
nl
;
// Numer of vertices
str
<<
xadj
.
size
()
-
1
<<
' '
<<
adjncy
.
size
()
<<
nl
;
// Numbering starts from 0
label
baseval
=
0
;
// Has weights?
label
hasEdgeWeights
=
0
;
label
hasVertexWeights
=
0
;
label
numericflag
=
10
*
hasEdgeWeights
+
hasVertexWeights
;
str
<<
baseval
<<
' '
<<
numericflag
<<
nl
;
for
(
label
cellI
=
0
;
cellI
<
xadj
.
size
()
-
1
;
cellI
++
)
label
start
=
xadj
[
cellI
];
label
end
=
xadj
[
cellI
+
1
];
str
<<
end
-
start
;
for
(
label
i
=
start
;
i
<
end
;
i
++
)
{
label
start
=
xadj
[
cellI
];
label
end
=
xadj
[
cellI
+
1
];
str
<<
end
-
start
;
for
(
label
i
=
start
;
i
<
end
;
i
++
)
{
str
<<
' '
<<
adjncy
[
i
];
}
str
<<
nl
;
str
<<
' '
<<
adjncy
[
i
];
}
str
<<
nl
;
}
}
}
...
...
@@ -229,7 +224,6 @@ Foam::label Foam::scotchDecomp::decompose
const
dictionary
&
scotchCoeffs
=
decompositionDict_
.
subDict
(
"scotchCoeffs"
);
string
strategy
;
if
(
scotchCoeffs
.
readIfPresent
(
"strategy"
,
strategy
))
{
...
...
src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
View file @
9525d57d
...
...
@@ -76,11 +76,9 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
rhoInf_
=
readScalar
(
dict
.
lookup
(
"rhoInf"
));
}
if
(
dict
.
found
(
"g"
))
if
(
dict
.
readIfPresent
(
"g"
,
g_
))
{
lookupGravity_
=
-
2
;
g_
=
dict
.
lookup
(
"g"
);
}
if
(
!
dict
.
found
(
"value"
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment