Commit ffe2c2ac authored by Henry Weller's avatar Henry Weller
Browse files

src/OpenFOAM: Use Zero rather than pTraits<Type>

parent 983b3e2c
......@@ -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>::zero),
List(ceil((max-min)/delta), Zero),
min_(min),
max_(max),
delta_(delta),
lowSum_(pTraits<typename List::value_type>::zero),
highSum_(pTraits<typename List::value_type>::zero)
lowSum_(Zero),
highSum_(Zero)
{}
......@@ -55,12 +55,12 @@ Foam::BinSum<IndexType, List, CombineOp>::BinSum
const CombineOp& cop
)
:
List(ceil((max-min)/delta), pTraits<typename List::value_type>::zero),
List(ceil((max-min)/delta), Zero),
min_(min),
max_(max),
delta_(delta),
lowSum_(pTraits<typename List::value_type>::zero),
highSum_(pTraits<typename List::value_type>::zero)
lowSum_(Zero),
highSum_(Zero)
{
forAll(indexVals, i)
{
......
......@@ -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>::zero);
Type meanValue(Zero);
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>::zero);
Type medianValue(Zero);
List<List<Pair<scalar>>> normDistribution = normalised();
......
......@@ -137,7 +137,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_(name),
dimensions_(dimSet),
value_(pTraits<Type>::zero)
value_(Zero)
{
initialize(is);
}
......@@ -153,7 +153,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_(name),
dimensions_(dimSet),
value_(pTraits<Type>::zero)
value_(Zero)
{
initialize(dict.lookup(name));
}
......@@ -165,7 +165,7 @@ Foam::dimensioned<Type>::dimensioned
:
name_("undefined"),
dimensions_(dimless),
value_(pTraits<Type>::zero)
value_(Zero)
{}
......
......@@ -468,7 +468,7 @@ Type sum(const FieldField<Field, Type>& f)
{
if (f.size())
{
Type Sum = pTraits<Type>::zero;
Type Sum = Zero;
forAll(f, i)
{
......@@ -479,7 +479,7 @@ Type sum(const FieldField<Field, Type>& f)
}
else
{
return pTraits<Type>::zero;
return Zero;
}
}
......@@ -524,7 +524,7 @@ Type average(const FieldField<Field, Type>& f)
WarningInFunction
<< "empty fieldField, returning zero" << endl;
return pTraits<Type>::zero;
return Zero;
}
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>::zero;
return Zero;
}
}
......@@ -585,7 +585,7 @@ Type gAverage(const FieldField<Field, Type>& f)
WarningInFunction
<< "empty fieldField, returning zero" << endl;
return pTraits<Type>::zero;
return Zero;
}
}
......
......@@ -406,7 +406,7 @@ void Foam::Field<Type>::map
const labelList& localAddrs = mapAddressing[i];
const scalarList& localWeights = mapWeights[i];
f[i] = pTraits<Type>::zero;
f[i] = Zero;
forAll(localAddrs, j)
{
......@@ -533,7 +533,7 @@ void Foam::Field<Type>::rmap
{
Field<Type>& f = *this;
f = pTraits<Type>::zero;
f = Zero;
forAll(mapF, i)
{
......
......@@ -346,13 +346,13 @@ Type sum(const UList<Type>& f)
{
if (f.size())
{
Type Sum = pTraits<Type>::zero;
Type Sum = Zero;
TFOR_ALL_S_OP_F(Type, Sum, +=, Type, f)
return Sum;
}
else
{
return pTraits<Type>::zero;
return Zero;
}
}
......@@ -379,7 +379,7 @@ Type maxMagSqr(const UList<Type>& f)
}
else
{
return pTraits<Type>::zero;
return Zero;
}
}
......@@ -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>::zero;
Type SumProd = Zero;
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>::zero;
return Zero;
}
}
......@@ -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>::zero;
Type SumMag = Zero;
TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, cmptMag, Type, f)
return SumMag;
}
else
{
return pTraits<Type>::zero;
return Zero;
}
}
......@@ -520,7 +520,7 @@ Type average(const UList<Type>& f)
WarningInFunction
<< "empty field, returning zero" << endl;
return pTraits<Type>::zero;
return Zero;
}
}
......@@ -597,7 +597,7 @@ Type gAverage
WarningInFunction
<< "empty field, returning zero." << endl;
return pTraits<Type>::zero;
return Zero;
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -74,7 +74,7 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
)
:
regIOobject(io),
dimensioned<Type>(regIOobject::name(), dimless, pTraits<Type>::zero)
dimensioned<Type>(regIOobject::name(), dimless, Zero)
{
dictionary dict(readStream(typeName));
scalar multiplier;
......
......@@ -77,7 +77,7 @@ Foam::valuePointPatchField<Type>::valuePointPatchField
}
else if (!valueRequired)
{
Field<Type>::operator=(pTraits<Type>::zero);
Field<Type>::operator=(Zero);
}
else
{
......
......@@ -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>::zero);
Type sum = Zero;
forAll(cFaces, i)
{
......
......@@ -308,7 +308,7 @@ Type Foam::interpolation2DTable<Type>::operator()
WarningInFunction
<< "cannot interpolate a zero-sized table - returning zero" << endl;
return pTraits<Type>::zero;
return Zero;
}
else if (nX == 1)
{
......
......@@ -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>::zero;
return Zero;
}
}
......
......@@ -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();
......
......@@ -188,7 +188,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
(
new Field<Type>
(
patch_.nPoints(), pTraits<Type>::zero
patch_.nPoints(), Zero
)
);
......@@ -245,7 +245,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
new Field<Type>
(
patch_.size(),
pTraits<Type>::zero
Zero
)
);
......@@ -300,7 +300,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
tmp<Field<Type>> tresult
(
new Field<Type>(patch_.nEdges(), pTraits<Type>::zero)
new Field<Type>(patch_.nEdges(), Zero)
);
Field<Type>& result = tresult.ref();
......
......@@ -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);
}
......
......@@ -191,7 +191,7 @@ Foam::Field<DType>& Foam::LduMatrix<Type, DType, LUType>::diag()
{
if (!diagPtr_)
{
diagPtr_ = new Field<DType>(lduAddr().size(), pTraits<DType>::zero);
diagPtr_ = new Field<DType>(lduAddr().size(), Zero);
}
return *diagPtr_;
......@@ -212,7 +212,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::upper()
upperPtr_ = new Field<LUType>
(
lduAddr().lowerAddr().size(),
pTraits<LUType>::zero
Zero
);
}
}
......@@ -235,7 +235,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::lower()
lowerPtr_ = new Field<LUType>
(
lduAddr().lowerAddr().size(),
pTraits<LUType>::zero
Zero
);
}
}
......@@ -249,7 +249,7 @@ Foam::Field<Type>& Foam::LduMatrix<Type, DType, LUType>::source()
{
if (!sourcePtr_)
{
sourcePtr_ = new Field<Type>(lduAddr().size(), pTraits<Type>::zero);
sourcePtr_ = new Field<Type>(lduAddr().size(), Zero);
}
return *sourcePtr_;
......
......@@ -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>::zero)
new Field<Type>(lduAddr().size(), Zero)
);
if (lowerPtr_ || upperPtr_)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 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>::zero)
relTol_(Zero)
{
readControls();
}
......
......@@ -110,8 +110,8 @@ public:
SolverPerformance()
:
initialResidual_(pTraits<Type>::zero),
finalResidual_(pTraits<Type>::zero),
initialResidual_(Zero),
finalResidual_(Zero),
noIterations_(0),
converged_(false),
singular_(false)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -67,8 +67,8 @@ Foam::DiagonalSolver<Type, DType, LUType>::solve
(
typeName,
this->fieldName_,
pTraits<Type>::zero,
pTraits<Type>::zero,
Zero,
Zero,
0,
true,
false
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 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>::zero);
Field<Type> pT(nCells, Zero);
Type* __restrict__ pTPtr = pT.begin();
Field<Type> wA(nCells);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment