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

This commit is contained in:
Henry Weller 2016-03-22 10:38:30 +00:00
parent 983b3e2ca4
commit ffe2c2ac46
28 changed files with 78 additions and 86 deletions

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,12 +35,12 @@ Foam::BinSum<IndexType, List, CombineOp>::BinSum
const IndexType delta const IndexType delta
) )
: :
List(ceil((max-min)/delta), pTraits<typename List::value_type>::zero), List(ceil((max-min)/delta), Zero),
min_(min), min_(min),
max_(max), max_(max),
delta_(delta), delta_(delta),
lowSum_(pTraits<typename List::value_type>::zero), lowSum_(Zero),
highSum_(pTraits<typename List::value_type>::zero) highSum_(Zero)
{} {}
@ -55,12 +55,12 @@ Foam::BinSum<IndexType, List, CombineOp>::BinSum
const CombineOp& cop const CombineOp& cop
) )
: :
List(ceil((max-min)/delta), pTraits<typename List::value_type>::zero), List(ceil((max-min)/delta), Zero),
min_(min), min_(min),
max_(max), max_(max),
delta_(delta), delta_(delta),
lowSum_(pTraits<typename List::value_type>::zero), lowSum_(Zero),
highSum_(pTraits<typename List::value_type>::zero) highSum_(Zero)
{ {
forAll(indexVals, i) forAll(indexVals, i)
{ {

View file

@ -196,7 +196,7 @@ Foam::Pair<Foam::label> Foam::Distribution<Type>::validLimits
template<class Type> template<class Type>
Type Foam::Distribution<Type>::mean() const Type Foam::Distribution<Type>::mean() const
{ {
Type meanValue(pTraits<Type>::zero); Type meanValue(Zero);
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++) for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
{ {
@ -225,7 +225,7 @@ Type Foam::Distribution<Type>::mean() const
template<class Type> template<class Type>
Type Foam::Distribution<Type>::median() const Type Foam::Distribution<Type>::median() const
{ {
Type medianValue(pTraits<Type>::zero); Type medianValue(Zero);
List<List<Pair<scalar>>> normDistribution = normalised(); List<List<Pair<scalar>>> normDistribution = normalised();

View file

@ -137,7 +137,7 @@ Foam::dimensioned<Type>::dimensioned
: :
name_(name), name_(name),
dimensions_(dimSet), dimensions_(dimSet),
value_(pTraits<Type>::zero) value_(Zero)
{ {
initialize(is); initialize(is);
} }
@ -153,7 +153,7 @@ Foam::dimensioned<Type>::dimensioned
: :
name_(name), name_(name),
dimensions_(dimSet), dimensions_(dimSet),
value_(pTraits<Type>::zero) value_(Zero)
{ {
initialize(dict.lookup(name)); initialize(dict.lookup(name));
} }
@ -165,7 +165,7 @@ Foam::dimensioned<Type>::dimensioned
: :
name_("undefined"), name_("undefined"),
dimensions_(dimless), dimensions_(dimless),
value_(pTraits<Type>::zero) value_(Zero)
{} {}

View file

@ -468,7 +468,7 @@ Type sum(const FieldField<Field, Type>& f)
{ {
if (f.size()) if (f.size())
{ {
Type Sum = pTraits<Type>::zero; Type Sum = Zero;
forAll(f, i) forAll(f, i)
{ {
@ -479,7 +479,7 @@ Type sum(const FieldField<Field, Type>& f)
} }
else else
{ {
return pTraits<Type>::zero; return Zero;
} }
} }
@ -524,7 +524,7 @@ Type average(const FieldField<Field, Type>& f)
WarningInFunction WarningInFunction
<< "empty fieldField, returning zero" << endl; << "empty fieldField, returning zero" << endl;
return pTraits<Type>::zero; return Zero;
} }
Type avrg = sum(f)/n; Type avrg = sum(f)/n;
@ -536,7 +536,7 @@ Type average(const FieldField<Field, Type>& f)
WarningInFunction WarningInFunction
<< "empty fieldField, returning zero" << endl; << "empty fieldField, returning zero" << endl;
return pTraits<Type>::zero; return Zero;
} }
} }
@ -585,7 +585,7 @@ Type gAverage(const FieldField<Field, Type>& f)
WarningInFunction WarningInFunction
<< "empty fieldField, returning zero" << endl; << "empty fieldField, returning zero" << endl;
return pTraits<Type>::zero; return Zero;
} }
} }

View file

@ -406,7 +406,7 @@ void Foam::Field<Type>::map
const labelList& localAddrs = mapAddressing[i]; const labelList& localAddrs = mapAddressing[i];
const scalarList& localWeights = mapWeights[i]; const scalarList& localWeights = mapWeights[i];
f[i] = pTraits<Type>::zero; f[i] = Zero;
forAll(localAddrs, j) forAll(localAddrs, j)
{ {
@ -533,7 +533,7 @@ void Foam::Field<Type>::rmap
{ {
Field<Type>& f = *this; Field<Type>& f = *this;
f = pTraits<Type>::zero; f = Zero;
forAll(mapF, i) forAll(mapF, i)
{ {

View file

@ -346,13 +346,13 @@ Type sum(const UList<Type>& f)
{ {
if (f.size()) if (f.size())
{ {
Type Sum = pTraits<Type>::zero; Type Sum = Zero;
TFOR_ALL_S_OP_F(Type, Sum, +=, Type, f) TFOR_ALL_S_OP_F(Type, Sum, +=, Type, f)
return Sum; return Sum;
} }
else else
{ {
return pTraits<Type>::zero; return Zero;
} }
} }
@ -379,7 +379,7 @@ Type maxMagSqr(const UList<Type>& f)
} }
else 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())) 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) TFOR_ALL_S_OP_F_OP_F(scalar, SumProd, +=, Type, f1, &&, Type, f2)
return SumProd; return SumProd;
} }
else 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())) if (f1.size() && (f1.size() == f2.size()))
{ {
Type SumProd = pTraits<Type>::zero; Type SumProd = Zero;
TFOR_ALL_S_OP_FUNC_F_F TFOR_ALL_S_OP_FUNC_F_F
( (
Type, Type,
@ -449,7 +449,7 @@ Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
} }
else else
{ {
return pTraits<Type>::zero; return Zero;
} }
} }
@ -459,13 +459,13 @@ scalar sumSqr(const UList<Type>& f)
{ {
if (f.size()) if (f.size())
{ {
scalar SumSqr = 0.0; scalar SumSqr = 0;
TFOR_ALL_S_OP_FUNC_F(scalar, SumSqr, +=, sqr, Type, f) TFOR_ALL_S_OP_FUNC_F(scalar, SumSqr, +=, sqr, Type, f)
return SumSqr; return SumSqr;
} }
else else
{ {
return 0.0; return 0;
} }
} }
@ -476,13 +476,13 @@ scalar sumMag(const UList<Type>& f)
{ {
if (f.size()) if (f.size())
{ {
scalar SumMag = 0.0; scalar SumMag = 0;
TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, mag, Type, f) TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, mag, Type, f)
return SumMag; return SumMag;
} }
else else
{ {
return 0.0; return 0;
} }
} }
@ -494,13 +494,13 @@ Type sumCmptMag(const UList<Type>& f)
{ {
if (f.size()) if (f.size())
{ {
Type SumMag = pTraits<Type>::zero; Type SumMag = Zero;
TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, cmptMag, Type, f) TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, cmptMag, Type, f)
return SumMag; return SumMag;
} }
else else
{ {
return pTraits<Type>::zero; return Zero;
} }
} }
@ -520,7 +520,7 @@ Type average(const UList<Type>& f)
WarningInFunction WarningInFunction
<< "empty field, returning zero" << endl; << "empty field, returning zero" << endl;
return pTraits<Type>::zero; return Zero;
} }
} }
@ -597,7 +597,7 @@ Type gAverage
WarningInFunction WarningInFunction
<< "empty field, returning zero." << endl; << "empty field, returning zero." << endl;
return pTraits<Type>::zero; return Zero;
} }
} }

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,7 +74,7 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
) )
: :
regIOobject(io), regIOobject(io),
dimensioned<Type>(regIOobject::name(), dimless, pTraits<Type>::zero) dimensioned<Type>(regIOobject::name(), dimless, Zero)
{ {
dictionary dict(readStream(typeName)); dictionary dict(readStream(typeName));
scalar multiplier; scalar multiplier;

View file

@ -77,7 +77,7 @@ Foam::valuePointPatchField<Type>::valuePointPatchField
} }
else if (!valueRequired) else if (!valueRequired)
{ {
Field<Type>::operator=(pTraits<Type>::zero); Field<Type>::operator=(Zero);
} }
else else
{ {

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,7 +40,7 @@ Type Foam::interpolatePointToCell
labelHashSet pointHad(10*cFaces.size()); labelHashSet pointHad(10*cFaces.size());
Type sum(pTraits<Type>::zero); Type sum = Zero;
forAll(cFaces, i) forAll(cFaces, i)
{ {

View file

@ -308,7 +308,7 @@ Type Foam::interpolation2DTable<Type>::operator()
WarningInFunction WarningInFunction
<< "cannot interpolate a zero-sized table - returning zero" << endl; << "cannot interpolate a zero-sized table - returning zero" << endl;
return pTraits<Type>::zero; return Zero;
} }
else if (nX == 1) else if (nX == 1)
{ {

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ Foam::interpolationWeights::weightedSum
} }
else else
{ {
return pTraits<returnType>::zero; return Zero;
} }
} }

View file

@ -51,11 +51,7 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::pointInterpolate
tmp<Field<Type>> tresult tmp<Field<Type>> tresult
( (
new Field<Type> new Field<Type>(toPatch_.nPoints(), Zero)
(
toPatch_.nPoints(),
pTraits<Type>::zero
)
); );
Field<Type>& result = tresult(); Field<Type>& result = tresult();
@ -119,11 +115,7 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::faceInterpolate
tmp<Field<Type>> tresult tmp<Field<Type>> tresult
( (
new Field<Type> new Field<Type>(toPatch_.size(), Zero)
(
toPatch_.size(),
pTraits<Type>::zero
)
); );
Field<Type>& result = tresult(); Field<Type>& result = tresult();

View file

@ -188,7 +188,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToPointInterpolate
( (
new Field<Type> new Field<Type>
( (
patch_.nPoints(), pTraits<Type>::zero patch_.nPoints(), Zero
) )
); );
@ -245,7 +245,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
new Field<Type> new Field<Type>
( (
patch_.size(), patch_.size(),
pTraits<Type>::zero Zero
) )
); );
@ -300,7 +300,7 @@ tmp<Field<Type>> PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
tmp<Field<Type>> tresult tmp<Field<Type>> tresult
( (
new Field<Type>(patch_.nEdges(), pTraits<Type>::zero) new Field<Type>(patch_.nEdges(), Zero)
); );
Field<Type>& result = tresult.ref(); Field<Type>& result = tresult.ref();

View file

@ -129,7 +129,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
nCells += lduMatrices[i].size(); nCells += lduMatrices[i].size();
} }
scalarSquareMatrix m(nCells, nCells, 0.0); scalarSquareMatrix m(nCells, 0.0);
transfer(m); transfer(m);
convert(lduMatrices); convert(lduMatrices);
} }
@ -137,7 +137,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
else else
{ {
label nCells = ldum.lduAddr().size(); label nCells = ldum.lduAddr().size();
scalarSquareMatrix m(nCells, nCells, 0.0); scalarSquareMatrix m(nCells, 0.0);
transfer(m); transfer(m);
convert(ldum, interfaceCoeffs, interfaces); convert(ldum, interfaceCoeffs, interfaces);
} }

View file

@ -191,7 +191,7 @@ Foam::Field<DType>& Foam::LduMatrix<Type, DType, LUType>::diag()
{ {
if (!diagPtr_) if (!diagPtr_)
{ {
diagPtr_ = new Field<DType>(lduAddr().size(), pTraits<DType>::zero); diagPtr_ = new Field<DType>(lduAddr().size(), Zero);
} }
return *diagPtr_; return *diagPtr_;
@ -212,7 +212,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::upper()
upperPtr_ = new Field<LUType> upperPtr_ = new Field<LUType>
( (
lduAddr().lowerAddr().size(), lduAddr().lowerAddr().size(),
pTraits<LUType>::zero Zero
); );
} }
} }
@ -235,7 +235,7 @@ Foam::Field<LUType>& Foam::LduMatrix<Type, DType, LUType>::lower()
lowerPtr_ = new Field<LUType> lowerPtr_ = new Field<LUType>
( (
lduAddr().lowerAddr().size(), lduAddr().lowerAddr().size(),
pTraits<LUType>::zero Zero
); );
} }
} }
@ -249,7 +249,7 @@ Foam::Field<Type>& Foam::LduMatrix<Type, DType, LUType>::source()
{ {
if (!sourcePtr_) if (!sourcePtr_)
{ {
sourcePtr_ = new Field<Type>(lduAddr().size(), pTraits<Type>::zero); sourcePtr_ = new Field<Type>(lduAddr().size(), Zero);
} }
return *sourcePtr_; return *sourcePtr_;

View file

@ -89,7 +89,7 @@ Foam::LduMatrix<Type, DType, LUType>::H(const Field<Type>& psi) const
{ {
tmp<Field<Type>> tHpsi tmp<Field<Type>> tHpsi
( (
new Field<Type>(lduAddr().size(), pTraits<Type>::zero) new Field<Type>(lduAddr().size(), Zero)
); );
if (lowerPtr_ || upperPtr_) if (lowerPtr_ || upperPtr_)

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -131,7 +131,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::solver
maxIter_(1000), maxIter_(1000),
minIter_(0), minIter_(0),
tolerance_(1e-6*pTraits<Type>::one), tolerance_(1e-6*pTraits<Type>::one),
relTol_(pTraits<Type>::zero) relTol_(Zero)
{ {
readControls(); readControls();
} }

View file

@ -110,8 +110,8 @@ public:
SolverPerformance() SolverPerformance()
: :
initialResidual_(pTraits<Type>::zero), initialResidual_(Zero),
finalResidual_(pTraits<Type>::zero), finalResidual_(Zero),
noIterations_(0), noIterations_(0),
converged_(false), converged_(false),
singular_(false) singular_(false)

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,8 +67,8 @@ Foam::DiagonalSolver<Type, DType, LUType>::solve
( (
typeName, typeName,
this->fieldName_, this->fieldName_,
pTraits<Type>::zero, Zero,
pTraits<Type>::zero, Zero,
0, 0,
true, true,
false false

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,7 +69,7 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
Field<Type> pA(nCells); Field<Type> pA(nCells);
Type* __restrict__ pAPtr = pA.begin(); Type* __restrict__ pAPtr = pA.begin();
Field<Type> pT(nCells, pTraits<Type>::zero); Field<Type> pT(nCells, Zero);
Type* __restrict__ pTPtr = pT.begin(); Type* __restrict__ pTPtr = pT.begin();
Field<Type> wA(nCells); Field<Type> wA(nCells);

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,7 +66,7 @@ Foam::PBiCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
Field<Type> pA(nCells); Field<Type> pA(nCells);
Type* __restrict__ pAPtr = pA.begin(); Type* __restrict__ pAPtr = pA.begin();
Field<Type> pT(nCells, pTraits<Type>::zero); Field<Type> pT(nCells, Zero);
Type* __restrict__ pTPtr = pT.begin(); Type* __restrict__ pTPtr = pT.begin();
Field<Type> wA(nCells); Field<Type> wA(nCells);

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -85,7 +85,7 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const
} }
else else
{ {
Type normFactor = pTraits<Type>::zero; Type normFactor = Zero;
{ {
Field<Type> Apsi(psi.size()); Field<Type> Apsi(psi.size());

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,7 @@ Type Foam::face::average
label nPoints = size(); label nPoints = size();
point centrePoint = point::zero; point centrePoint = point::zero;
Type cf = pTraits<Type>::zero; Type cf = Zero;
for (label pI=0; pI<nPoints; pI++) for (label pI=0; pI<nPoints; pI++)
{ {
@ -83,7 +83,7 @@ Type Foam::face::average
cf /= nPoints; cf /= nPoints;
scalar sumA = 0; scalar sumA = 0;
Type sumAf = pTraits<Type>::zero; Type sumAf = Zero;
for (label pI=0; pI<nPoints; pI++) for (label pI=0; pI<nPoints; pI++)
{ {

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,7 @@ Foam::demandDrivenEntry<Type>::demandDrivenEntry
: :
dict_(dict), dict_(dict),
keyword_(keyword), keyword_(keyword),
value_(pTraits<Type>::zero), value_(Zero),
stored_(false) stored_(false)
{} {}

View file

@ -35,7 +35,7 @@ Foam::Function1Types::Constant<Type>::Constant
) )
: :
Function1<Type>(entryName), Function1<Type>(entryName),
value_(pTraits<Type>::zero) value_(Zero)
{ {
Istream& is(dict.lookup(entryName)); Istream& is(dict.lookup(entryName));
word entryType(is); word entryType(is);

View file

@ -69,7 +69,7 @@ Type Foam::Function1<Type>::value(const scalar x) const
{ {
NotImplemented; NotImplemented;
return pTraits<Type>::zero; return Zero;
} }
@ -78,7 +78,7 @@ Type Foam::Function1<Type>::integrate(const scalar x1, const scalar x2) const
{ {
NotImplemented; NotImplemented;
return pTraits<Type>::zero; return Zero;
} }

View file

@ -146,7 +146,7 @@ void Foam::Function1Types::Polynomial<Type>::convertTimeBase(const Time& t)
template<class Type> template<class Type>
Type Foam::Function1Types::Polynomial<Type>::value(const scalar x) const Type Foam::Function1Types::Polynomial<Type>::value(const scalar x) const
{ {
Type y(pTraits<Type>::zero); Type y(Zero);
forAll(coeffs_, i) forAll(coeffs_, i)
{ {
y += cmptMultiply y += cmptMultiply
@ -167,7 +167,7 @@ Type Foam::Function1Types::Polynomial<Type>::integrate
const scalar x2 const scalar x2
) const ) const
{ {
Type intx(pTraits<Type>::zero); Type intx(Zero);
if (canIntegrate_) if (canIntegrate_)
{ {

View file

@ -394,7 +394,7 @@ Foam::tmp<Foam::scalarField> Foam::Function1Types::TableBase<Type>::x() const
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::Function1Types::TableBase<Type>::y() const Foam::tmp<Foam::Field<Type>> Foam::Function1Types::TableBase<Type>::y() const
{ {
tmp<Field<Type>> tfld(new Field<Type>(table_.size(), pTraits<Type>::zero)); tmp<Field<Type>> tfld(new Field<Type>(table_.size(), Zero));
Field<Type>& fld = tfld.ref(); Field<Type>& fld = tfld.ref();
forAll(table_, i) forAll(table_, i)