Skip to content
GitLab
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
34361493
Commit
34361493
authored
Mar 22, 2016
by
Henry Weller
Browse files
src/OpenFOAM: Use Zero rather than pTraits<Type>
parent
ce81b44d
Changes
28
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/Lists/BinSum/BinSum.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012
-2016
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -35,12 +35,12 @@ Foam::BinSum<IndexType, List, CombineOp>::BinSum
const
IndexType
delta
)
:
List
(
ceil
((
max
-
min
)
/
delta
),
pTraits
<
typename
List
::
value_type
>::
z
ero
),
List
(
ceil
((
max
-
min
)
/
delta
),
Z
ero
),
min_
(
min
),
max_
(
max
),
delta_
(
delta
),
lowSum_
(
pTraits
<
typename
List
::
value_type
>::
z
ero
),
highSum_
(
pTraits
<
typename
List
::
value_type
>::
z
ero
)
lowSum_
(
Z
ero
),
highSum_
(
Z
ero
)
{}
...
...
@@ -55,12 +55,12 @@ Foam::BinSum<IndexType, List, CombineOp>::BinSum
const
CombineOp
&
cop
)
:
List
(
ceil
((
max
-
min
)
/
delta
),
pTraits
<
typename
List
::
value_type
>::
z
ero
),
List
(
ceil
((
max
-
min
)
/
delta
),
Z
ero
),
min_
(
min
),
max_
(
max
),
delta_
(
delta
),
lowSum_
(
pTraits
<
typename
List
::
value_type
>::
z
ero
),
highSum_
(
pTraits
<
typename
List
::
value_type
>::
z
ero
)
lowSum_
(
Z
ero
),
highSum_
(
Z
ero
)
{
forAll
(
indexVals
,
i
)
{
...
...
src/OpenFOAM/containers/Lists/Distribution/Distribution.C
View file @
34361493
...
...
@@ -196,7 +196,7 @@ Foam::Pair<Foam::label> Foam::Distribution<Type>::validLimits
template
<
class
Type
>
Type
Foam
::
Distribution
<
Type
>::
mean
()
const
{
Type
meanValue
(
pTraits
<
Type
>::
z
ero
);
Type
meanValue
(
Z
ero
);
for
(
direction
cmpt
=
0
;
cmpt
<
pTraits
<
Type
>::
nComponents
;
cmpt
++
)
{
...
...
@@ -225,7 +225,7 @@ Type Foam::Distribution<Type>::mean() const
template
<
class
Type
>
Type
Foam
::
Distribution
<
Type
>::
median
()
const
{
Type
medianValue
(
pTraits
<
Type
>::
z
ero
);
Type
medianValue
(
Z
ero
);
List
<
List
<
Pair
<
scalar
>>>
normDistribution
=
normalised
();
...
...
src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
View file @
34361493
...
...
@@ -137,7 +137,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_
(
name
),
dimensions_
(
dimSet
),
value_
(
pTraits
<
Type
>::
z
ero
)
value_
(
Z
ero
)
{
initialize
(
is
);
}
...
...
@@ -153,7 +153,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_
(
name
),
dimensions_
(
dimSet
),
value_
(
pTraits
<
Type
>::
z
ero
)
value_
(
Z
ero
)
{
initialize
(
dict
.
lookup
(
name
));
}
...
...
@@ -165,7 +165,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_
(
"undefined"
),
dimensions_
(
dimless
),
value_
(
pTraits
<
Type
>::
z
ero
)
value_
(
Z
ero
)
{}
...
...
src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C
View file @
34361493
...
...
@@ -468,7 +468,7 @@ Type sum(const FieldField<Field, Type>& f)
{
if
(
f
.
size
())
{
Type
Sum
=
pTraits
<
Type
>::
z
ero
;
Type
Sum
=
Z
ero
;
forAll
(
f
,
i
)
{
...
...
@@ -479,7 +479,7 @@ Type sum(const FieldField<Field, Type>& f)
}
else
{
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -524,7 +524,7 @@ Type average(const FieldField<Field, Type>& f)
WarningInFunction
<<
"empty fieldField, returning zero"
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
Type
avrg
=
sum
(
f
)
/
n
;
...
...
@@ -536,7 +536,7 @@ Type average(const FieldField<Field, Type>& f)
WarningInFunction
<<
"empty fieldField, returning zero"
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -585,7 +585,7 @@ Type gAverage(const FieldField<Field, Type>& f)
WarningInFunction
<<
"empty fieldField, returning zero"
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
src/OpenFOAM/fields/Fields/Field/Field.C
View file @
34361493
...
...
@@ -406,7 +406,7 @@ void Foam::Field<Type>::map
const
labelList
&
localAddrs
=
mapAddressing
[
i
];
const
scalarList
&
localWeights
=
mapWeights
[
i
];
f
[
i
]
=
pTraits
<
Type
>::
z
ero
;
f
[
i
]
=
Z
ero
;
forAll
(
localAddrs
,
j
)
{
...
...
@@ -533,7 +533,7 @@ void Foam::Field<Type>::rmap
{
Field
<
Type
>&
f
=
*
this
;
f
=
pTraits
<
Type
>::
z
ero
;
f
=
Z
ero
;
forAll
(
mapF
,
i
)
{
...
...
src/OpenFOAM/fields/Fields/Field/FieldFunctions.C
View file @
34361493
...
...
@@ -346,13 +346,13 @@ Type sum(const UList<Type>& f)
{
if
(
f
.
size
())
{
Type
Sum
=
pTraits
<
Type
>::
z
ero
;
Type
Sum
=
Z
ero
;
TFOR_ALL_S_OP_F
(
Type
,
Sum
,
+=
,
Type
,
f
)
return
Sum
;
}
else
{
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -379,7 +379,7 @@ Type maxMagSqr(const UList<Type>& f)
}
else
{
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -417,13 +417,13 @@ scalar sumProd(const UList<Type>& f1, const UList<Type>& f2)
{
if
(
f1
.
size
()
&&
(
f1
.
size
()
==
f2
.
size
()))
{
scalar
SumProd
=
0
.
0
;
scalar
SumProd
=
0
;
TFOR_ALL_S_OP_F_OP_F
(
scalar
,
SumProd
,
+=
,
Type
,
f1
,
&&
,
Type
,
f2
)
return
SumProd
;
}
else
{
return
0
.
0
;
return
0
;
}
}
...
...
@@ -433,7 +433,7 @@ Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
{
if
(
f1
.
size
()
&&
(
f1
.
size
()
==
f2
.
size
()))
{
Type
SumProd
=
pTraits
<
Type
>::
z
ero
;
Type
SumProd
=
Z
ero
;
TFOR_ALL_S_OP_FUNC_F_F
(
Type
,
...
...
@@ -449,7 +449,7 @@ Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
}
else
{
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -459,13 +459,13 @@ scalar sumSqr(const UList<Type>& f)
{
if
(
f
.
size
())
{
scalar
SumSqr
=
0
.
0
;
scalar
SumSqr
=
0
;
TFOR_ALL_S_OP_FUNC_F
(
scalar
,
SumSqr
,
+=
,
sqr
,
Type
,
f
)
return
SumSqr
;
}
else
{
return
0
.
0
;
return
0
;
}
}
...
...
@@ -476,13 +476,13 @@ scalar sumMag(const UList<Type>& f)
{
if
(
f
.
size
())
{
scalar
SumMag
=
0
.
0
;
scalar
SumMag
=
0
;
TFOR_ALL_S_OP_FUNC_F
(
scalar
,
SumMag
,
+=
,
mag
,
Type
,
f
)
return
SumMag
;
}
else
{
return
0
.
0
;
return
0
;
}
}
...
...
@@ -494,13 +494,13 @@ Type sumCmptMag(const UList<Type>& f)
{
if
(
f
.
size
())
{
Type
SumMag
=
pTraits
<
Type
>::
z
ero
;
Type
SumMag
=
Z
ero
;
TFOR_ALL_S_OP_FUNC_F
(
scalar
,
SumMag
,
+=
,
cmptMag
,
Type
,
f
)
return
SumMag
;
}
else
{
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -520,7 +520,7 @@ Type average(const UList<Type>& f)
WarningInFunction
<<
"empty field, returning zero"
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
@@ -597,7 +597,7 @@ Type gAverage
WarningInFunction
<<
"empty field, returning zero."
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
}
...
...
src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -74,7 +74,7 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
)
:
regIOobject
(
io
),
dimensioned
<
Type
>
(
regIOobject
::
name
(),
dimless
,
pTraits
<
Type
>::
z
ero
)
dimensioned
<
Type
>
(
regIOobject
::
name
(),
dimless
,
Z
ero
)
{
dictionary
dict
(
readStream
(
typeName
));
scalar
multiplier
;
...
...
src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C
View file @
34361493
...
...
@@ -77,7 +77,7 @@ Foam::valuePointPatchField<Type>::valuePointPatchField
}
else
if
(
!
valueRequired
)
{
Field
<
Type
>::
operator
=
(
pTraits
<
Type
>::
z
ero
);
Field
<
Type
>::
operator
=
(
Z
ero
);
}
else
{
...
...
src/OpenFOAM/interpolations/interpolatePointToCell/interpolatePointToCell.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2016
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -40,7 +40,7 @@ Type Foam::interpolatePointToCell
labelHashSet
pointHad
(
10
*
cFaces
.
size
());
Type
sum
(
pTraits
<
Type
>::
z
ero
)
;
Type
sum
=
Z
ero
;
forAll
(
cFaces
,
i
)
{
...
...
src/OpenFOAM/interpolations/interpolation2DTable/interpolation2DTable.C
View file @
34361493
...
...
@@ -308,7 +308,7 @@ Type Foam::interpolation2DTable<Type>::operator()
WarningInFunction
<<
"cannot interpolate a zero-sized table - returning zero"
<<
endl
;
return
pTraits
<
Type
>::
z
ero
;
return
Z
ero
;
}
else
if
(
nX
==
1
)
{
...
...
src/OpenFOAM/interpolations/interpolationWeights/interpolationWeights/interpolationWeightsTemplates.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012
-2016
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -65,7 +65,7 @@ Foam::interpolationWeights::weightedSum
}
else
{
return
pTraits
<
returnType
>::
z
ero
;
return
Z
ero
;
}
}
...
...
src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolate.C
View file @
34361493
...
...
@@ -51,11 +51,7 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::pointInterpolate
tmp
<
Field
<
Type
>>
tresult
(
new
Field
<
Type
>
(
toPatch_
.
nPoints
(),
pTraits
<
Type
>::
zero
)
new
Field
<
Type
>
(
toPatch_
.
nPoints
(),
Zero
)
);
Field
<
Type
>&
result
=
tresult
();
...
...
@@ -119,11 +115,7 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::faceInterpolate
tmp
<
Field
<
Type
>>
tresult
(
new
Field
<
Type
>
(
toPatch_
.
size
(),
pTraits
<
Type
>::
zero
)
new
Field
<
Type
>
(
toPatch_
.
size
(),
Zero
)
);
Field
<
Type
>&
result
=
tresult
();
...
...
src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C
View file @
34361493
...
...
@@ -188,7 +188,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
(
new
Field
<
Type
>
(
patch_
.
nPoints
(),
pTraits
<
Type
>::
z
ero
patch_
.
nPoints
(),
Z
ero
)
);
...
...
@@ -245,7 +245,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
new
Field
<
Type
>
(
patch_
.
size
(),
pTraits
<
Type
>::
z
ero
Z
ero
)
);
...
...
@@ -300,7 +300,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
tmp
<
Field
<
Type
>>
tresult
(
new
Field
<
Type
>
(
patch_
.
nEdges
(),
pTraits
<
Type
>::
z
ero
)
new
Field
<
Type
>
(
patch_
.
nEdges
(),
Z
ero
)
);
Field
<
Type
>&
result
=
tresult
.
ref
();
...
...
src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
View file @
34361493
...
...
@@ -129,7 +129,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
nCells
+=
lduMatrices
[
i
].
size
();
}
scalarSquareMatrix
m
(
nCells
,
nCells
,
0
.
0
);
scalarSquareMatrix
m
(
nCells
,
0
.
0
);
transfer
(
m
);
convert
(
lduMatrices
);
}
...
...
@@ -137,7 +137,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
else
{
label
nCells
=
ldum
.
lduAddr
().
size
();
scalarSquareMatrix
m
(
nCells
,
nCells
,
0
.
0
);
scalarSquareMatrix
m
(
nCells
,
0
.
0
);
transfer
(
m
);
convert
(
ldum
,
interfaceCoeffs
,
interfaces
);
}
...
...
src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
View file @
34361493
...
...
@@ -191,7 +191,7 @@ Foam::Field<DType>& Foam::LduMatrix<Type, DType, LUType>::diag()
{
if
(
!
diagPtr_
)
{
diagPtr_
=
new
Field
<
DType
>
(
lduAddr
().
size
(),
pTraits
<
DType
>::
z
ero
);
diagPtr_
=
new
Field
<
DType
>
(
lduAddr
().
size
(),
Z
ero
);
}
return
*
diagPtr_
;
...
...
@@ -212,7 +212,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::upper()
upperPtr_
=
new
Field
<
LUType
>
(
lduAddr
().
lowerAddr
().
size
(),
pTraits
<
LUType
>::
z
ero
Z
ero
);
}
}
...
...
@@ -235,7 +235,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::lower()
lowerPtr_
=
new
Field
<
LUType
>
(
lduAddr
().
lowerAddr
().
size
(),
pTraits
<
LUType
>::
z
ero
Z
ero
);
}
}
...
...
@@ -249,7 +249,7 @@ Foam::Field<Type>& Foam::LduMatrix<Type, DType, LUType>::source()
{
if
(
!
sourcePtr_
)
{
sourcePtr_
=
new
Field
<
Type
>
(
lduAddr
().
size
(),
pTraits
<
Type
>::
z
ero
);
sourcePtr_
=
new
Field
<
Type
>
(
lduAddr
().
size
(),
Z
ero
);
}
return
*
sourcePtr_
;
...
...
src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C
View file @
34361493
...
...
@@ -89,7 +89,7 @@ Foam::LduMatrix<Type, DType, LUType>::H(const Field<Type>& psi) const
{
tmp
<
Field
<
Type
>>
tHpsi
(
new
Field
<
Type
>
(
lduAddr
().
size
(),
pTraits
<
Type
>::
z
ero
)
new
Field
<
Type
>
(
lduAddr
().
size
(),
Z
ero
)
);
if
(
lowerPtr_
||
upperPtr_
)
...
...
src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
5
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -131,7 +131,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::solver
maxIter_
(
1000
),
minIter_
(
0
),
tolerance_
(
1e-6
*
pTraits
<
Type
>::
one
),
relTol_
(
pTraits
<
Type
>::
z
ero
)
relTol_
(
Z
ero
)
{
readControls
();
}
...
...
src/OpenFOAM/matrices/LduMatrix/LduMatrix/SolverPerformance.H
View file @
34361493
...
...
@@ -110,8 +110,8 @@ public:
SolverPerformance
()
:
initialResidual_
(
pTraits
<
Type
>::
z
ero
),
finalResidual_
(
pTraits
<
Type
>::
z
ero
),
initialResidual_
(
Z
ero
),
finalResidual_
(
Z
ero
),
noIterations_
(
0
),
converged_
(
false
),
singular_
(
false
)
...
...
src/OpenFOAM/matrices/LduMatrix/Solvers/DiagonalSolver/DiagonalSolver.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -67,8 +67,8 @@ Foam::DiagonalSolver<Type, DType, LUType>::solve
(
typeName
,
this
->
fieldName_
,
pTraits
<
Type
>::
z
ero
,
pTraits
<
Type
>::
z
ero
,
Z
ero
,
Z
ero
,
0
,
true
,
false
...
...
src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C
View file @
34361493
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
5
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -69,7 +69,7 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
Field
<
Type
>
pA
(
nCells
);
Type
*
__restrict__
pAPtr
=
pA
.
begin
();
Field
<
Type
>
pT
(
nCells
,
pTraits
<
Type
>::
z
ero
);
Field
<
Type
>
pT
(
nCells
,
Z
ero
);
Type
*
__restrict__
pTPtr
=
pT
.
begin
();
Field
<
Type
>
wA
(
nCells
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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