STYLE: more consistent use of dimensioned Zero

- when constructing dimensioned fields that are to be zero-initialized,
  it is preferrable to use a form such as

      dimensionedScalar(dims, Zero)
      dimensionedVector(dims, Zero)

  rather than

      dimensionedScalar("0", dims, 0)
      dimensionedVector("zero", dims, vector::zero)

  This reduces clutter and also avoids any suggestion that the name of
  the dimensioned quantity has any influence on the field's name.

  An even shorter version is possible. Eg,

      dimensionedScalar(dims)

  but reduces the clarity of meaning.

- NB: UniformDimensionedField is an exception to these style changes
  since it does use the name of the dimensioned type (instead of the
  regIOobject).
This commit is contained in:
Mark Olesen
2018-03-16 10:24:03 +01:00
parent 06035b8a30
commit 2f86cdc712
381 changed files with 1891 additions and 2730 deletions

View File

@ -278,7 +278,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE
),
fMesh,
dimensionedScalar("zero", dimless/dimTime, 0)
dimensionedScalar(dimless/dimTime, Zero)
);
// Set cell values

View File

@ -658,7 +658,7 @@ void Foam::cellShapeControlMesh::write() const
IOobject::AUTO_WRITE
),
pointMesh::New(mesh),
dimensionedScalar("zero", dimLength, scalar(0))
dimensionedScalar(dimLength, Zero)
);
triadIOField alignments

View File

@ -1113,7 +1113,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("cellSize", dimLength, 0),
dimensionedScalar(dimLength, Zero),
zeroGradientFvPatchScalarField::typeName
);
@ -1139,7 +1139,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// IOobject::AUTO_WRITE
// ),
// mesh,
// dimensionedScalar("cellVolume", dimLength, 0),
// dimensionedScalar(dimLength, Zero),
// zeroGradientFvPatchScalarField::typeName
// );
@ -1158,7 +1158,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// IOobject::AUTO_WRITE
// ),
// mesh,
// dimensionedScalar("cellVolume", dimVolume, 0),
// dimensionedScalar(dimVolume, Zero),
// zeroGradientFvPatchScalarField::typeName
// );
@ -1177,7 +1177,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// IOobject::AUTO_WRITE
// ),
// mesh,
// dimensionedScalar("cellSize", dimLength, 0),
// dimensionedScalar(dimLength, Zero),
// zeroGradientFvPatchScalarField::typeName
// );
@ -1223,7 +1223,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// IOobject::AUTO_WRITE
// ),
// ptMesh,
// dimensionedScalar("ptTargetCellSize", dimLength, 0),
// dimensionedScalar(dimLength, Zero),
// pointPatchVectorField::calculatedType()
// );

View File

@ -603,7 +603,7 @@ int main(int argc, char *argv[])
false
),
fvm,
dimensionedScalar("zero", dimLength, 0)
dimensionedScalar(dimLength, Zero)
);
const searchableSurfaces& geometry = geometryToConformTo.geometry();
@ -668,7 +668,7 @@ int main(int argc, char *argv[])
false
),
pointMesh::New(fvm),
dimensionedScalar("zero", dimLength, 0)
dimensionedScalar(dimLength, Zero)
);
{
scalarField pointDistSqr(fvm.nPoints(), -sqr(GREAT));

View File

@ -115,7 +115,7 @@ void Foam::writeFields
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("angle", dimless, 0),
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
);
//- Take max
@ -149,7 +149,7 @@ void Foam::writeFields
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("weight", dimless, 0),
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
);
//- Take min
@ -190,7 +190,7 @@ void Foam::writeFields
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("skewness", dimless, 0),
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
);
//- Take max
@ -217,7 +217,7 @@ void Foam::writeFields
false
),
mesh,
dimensionedScalar("cellDeterminant", dimless, 0),
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
cellDeterminant.primitiveFieldRef() =
@ -251,7 +251,7 @@ void Foam::writeFields
false
),
mesh,
dimensionedScalar("aspectRatio", dimless, 0),
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
@ -290,7 +290,7 @@ void Foam::writeFields
false
),
mesh,
dimensionedScalar("cellShapes", dimless, 0),
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
const cellShapeList& cellShapes = mesh.cellShapes();
@ -319,7 +319,7 @@ void Foam::writeFields
false
),
mesh,
dimensionedScalar("cellVolume", dimVolume, 0),
dimensionedScalar(dimVolume, Zero),
calculatedFvPatchScalarField::typeName
);
V.ref() = mesh.V();
@ -349,7 +349,7 @@ void Foam::writeFields
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("cellVolumeRatio", dimless, 0),
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
);
//- Take min
@ -438,7 +438,7 @@ void Foam::writeFields
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("cellRegion", dimless, 0),
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
);

View File

@ -85,7 +85,7 @@ tmp<volScalarField> createScalarField
false
),
mesh,
dimensionedScalar("zero", dimless, 0),
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
)
);

View File

@ -1396,7 +1396,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
false
),
mesh,
dimensionedScalar("zero", dimless, 0),
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
forAll(cellRegion, celli)