Use Zero rather than pTraits<Type>::zero unless a static typed '0' is required

This commit is contained in:
Henry Weller
2016-03-22 17:46:52 +00:00
parent aa89254c79
commit 730f89dc9d
82 changed files with 224 additions and 224 deletions

View File

@ -111,7 +111,7 @@ void Foam::meshToMesh::mapSrcToTgt
if (srcAddress.size())
{
// result[cellI] = pTraits<Type>::zero;
// result[cellI] = Zero;
result[cellI] *= (1.0 - sum(srcWeight));
forAll(srcAddress, i)
{
@ -131,7 +131,7 @@ void Foam::meshToMesh::mapSrcToTgt
if (srcAddress.size())
{
// result[cellI] = pTraits<Type>::zero;
// result[cellI] = Zero;
result[cellI] *= (1.0 - sum(srcWeight));
forAll(srcAddress, i)
{
@ -157,7 +157,7 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapSrcToTgt
new Field<Type>
(
tgtToSrcCellAddr_.size(),
pTraits<Type>::zero
Zero
)
);
@ -276,7 +276,7 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapTgtToSrc
new Field<Type>
(
srcToTgtCellAddr_.size(),
pTraits<Type>::zero
Zero
)
);
@ -362,7 +362,7 @@ void Foam::meshToMesh::mapSrcToTgt
tgtField.rmap(tnewTgt(), identity(tgtField.size()));
}
tgtField == pTraits<Type>::zero;
tgtField == Type(Zero);
AMIList[i].interpolateToTarget
(
@ -461,7 +461,7 @@ Foam::meshToMesh::mapSrcToTgt
),
tgtMesh,
field.dimensions(),
Field<Type>(tgtMesh.nCells(), pTraits<Type>::zero),
Field<Type>(tgtMesh.nCells(), Zero),
tgtPatchFields
)
);
@ -551,7 +551,7 @@ void Foam::meshToMesh::mapTgtToSrc
srcField.rmap(tnewSrc(), identity(srcField.size()));
}
srcField == pTraits<Type>::zero;
srcField == Type(Zero);
AMIList[i].interpolateToSource
(
@ -650,7 +650,7 @@ Foam::meshToMesh::mapTgtToSrc
),
srcMesh,
field.dimensions(),
Field<Type>(srcMesh.nCells(), pTraits<Type>::zero),
Field<Type>(srcMesh.nCells(), Zero),
srcPatchFields
)
);

View File

@ -70,7 +70,7 @@ void Foam::meshToMesh0::interpolateField
const labelList& overlapCells = adr[celli];
const scalarList& w = weights[celli];
Type f = pTraits<Type>::zero;
Type f = Zero;
forAll(overlapCells, i)
{
label fromCelli = overlapCells[i];

View File

@ -468,7 +468,7 @@ Foam::label Foam::isoSurface::generateFaceTriPoints
(
snappedPoint[pointI] != -1
? snappedPoints[snappedPoint[pointI]]
: pTraits<Type>::zero
: Type(Zero)
),
pVals[nextPointI],
@ -477,7 +477,7 @@ Foam::label Foam::isoSurface::generateFaceTriPoints
(
snappedPoint[nextPointI] != -1
? snappedPoints[snappedPoint[nextPointI]]
: pTraits<Type>::zero
: Type(Zero)
),
cVals[own],
@ -486,7 +486,7 @@ Foam::label Foam::isoSurface::generateFaceTriPoints
(
snappedCc[own] != -1
? snappedPoints[snappedCc[own]]
: pTraits<Type>::zero
: Type(Zero)
),
neiVal,
@ -582,7 +582,7 @@ void Foam::isoSurface::generateTriPoints
(
snappedCc[nei[faceI]] != -1
? snappedPoints[snappedCc[nei[faceI]]]
: pTraits<Type>::zero
: Type(Zero)
),
triPoints,
@ -594,7 +594,7 @@ void Foam::isoSurface::generateTriPoints
// Determine neighbouring snap status
boolList neiSnapped(mesh_.nFaces()-mesh_.nInternalFaces(), false);
List<Type> neiSnappedPoint(neiSnapped.size(), pTraits<Type>::zero);
List<Type> neiSnappedPoint(neiSnapped.size(), Type(Zero));
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
@ -680,7 +680,7 @@ void Foam::isoSurface::generateTriPoints
cVals.boundaryField()[patchI][i],
cCoords.boundaryField()[patchI][i],
false,
pTraits<Type>::zero,
Type(Zero),
triPoints,
triMeshCells
@ -713,7 +713,7 @@ void Foam::isoSurface::generateTriPoints
cVals.boundaryField()[patchI][i],
cCoords.boundaryField()[patchI][i],
false, // fc not snapped
pTraits<Type>::zero,
Type(Zero),
triPoints,
triMeshCells
@ -739,7 +739,7 @@ Foam::isoSurface::interpolate
)
{
// One value per point
tmp<Field<Type> > tvalues(new Field<Type>(nPoints, pTraits<Type>::zero));
tmp<Field<Type> > tvalues(new Field<Type>(nPoints, Type(Zero)));
Field<Type>& values = tvalues.ref();
labelList nValues(values.size(), 0);

View File

@ -49,7 +49,7 @@ bool Foam::sampledSurface::checkFieldSize(const Field<Type>& field) const
template<class Type>
Type Foam::sampledSurface::integrate(const Field<Type>& field) const
{
Type value = pTraits<Type>::zero;
Type value = Zero;
if (checkFieldSize(field))
{
@ -73,7 +73,7 @@ Type Foam::sampledSurface::integrate(const tmp<Field<Type>>& field) const
template<class Type>
Type Foam::sampledSurface::average(const Field<Type>& field) const
{
Type value = pTraits<Type>::zero;
Type value = Zero;
if (checkFieldSize(field))
{
@ -89,7 +89,7 @@ Type Foam::sampledSurface::average(const Field<Type>& field) const
}
else
{
return pTraits<Type>::zero;
return Zero;
}
}
@ -174,7 +174,7 @@ Foam::sampledSurface::pointAverage
false
),
mesh,
dimensioned<Type>("zero", dimless, pTraits<Type>::zero)
dimensioned<Type>("zero", dimless, Zero)
)
);
GeometricField<Type, fvPatchField, volMesh>& cellAvg = tcellAvg.ref();

View File

@ -56,7 +56,7 @@ Foam::sampledTriSurfaceMesh::sampleField
// Create flat boundary field
Field<Type> bVals(nBnd, pTraits<Type>::zero);
Field<Type> bVals(nBnd, Zero);
forAll(vField.boundaryField(), patchI)
{

View File

@ -181,7 +181,7 @@ void Foam::nastranSurfaceWriter::writeTemplate
const DynamicList<face>& dFaces = decomposedFaces[i];
forAll(dFaces, faceI)
{
Type v = pTraits<Type>::zero;
Type v = Zero;
const face& f = dFaces[faceI];
forAll(f, fptI)