OpenFOAM: Updated all libraries, solvers and utilities to use the new const-safe tmp

The deprecated non-const tmp functionality is now on the compiler switch
NON_CONST_TMP which can be enabled by adding -DNON_CONST_TMP to EXE_INC
in the Make/options file.  However, it is recommended to upgrade all
code to the new safer tmp by using the '.ref()' member function rather
than the non-const '()' dereference operator when non-const access to
the temporary object is required.

Please report any problems on Mantis.

Henry G. Weller
CFD Direct.
This commit is contained in:
Henry Weller
2016-02-26 17:31:28 +00:00
parent 49c54e9070
commit 7859083246
169 changed files with 511 additions and 477 deletions

View File

@ -1150,7 +1150,7 @@ tmp<pointField> calcOffset
vectorField::subField fc = pp.faceCentres();
tmp<pointField> toffsets(new pointField(fc.size()));
pointField& offsets = toffsets();
pointField& offsets = toffsets.ref();
forAll(fc, i)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -280,7 +280,7 @@ Foam::tmp<Foam::pointField> Foam::DelaunayMeshTools::allPoints
)
{
tmp<pointField> tpts(new pointField(t.vertexCount(), point::max));
pointField& pts = tpts();
pointField& pts = tpts.ref();
for
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -262,7 +262,7 @@ Foam::label Foam::cellShapeControlMesh::removePoints()
Foam::tmp<Foam::pointField> Foam::cellShapeControlMesh::cellCentres() const
{
tmp<pointField> tcellCentres(new pointField(number_of_finite_cells()));
pointField& cellCentres = tcellCentres();
pointField& cellCentres = tcellCentres.ref();
label count = 0;
for

View File

@ -179,7 +179,7 @@ Foam::tmp<Foam::triadField> Foam::smoothAlignmentSolver::buildAlignmentField
(
new triadField(mesh.vertexCount(), triad::unset)
);
triadField& alignments = tAlignments();
triadField& alignments = tAlignments.ref();
for
(
@ -211,7 +211,7 @@ Foam::tmp<Foam::pointField> Foam::smoothAlignmentSolver::buildPointField
(
new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT))
);
pointField& points = tPoints();
pointField& points = tPoints.ref();
for
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,7 +152,7 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
)
);
triSurfacePointScalarField& pointCellSize = tPointCellSize();
triSurfacePointScalarField& pointCellSize = tPointCellSize.ref();
if (readCurvature_)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,7 +95,7 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::fieldFromFile::load()
)
);
pointCellSize() *= cellSizeMultipleCoeff_;
pointCellSize.ref() *= cellSizeMultipleCoeff_;
return pointCellSize;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,7 +105,7 @@ Foam::searchableBoxFeatures::features() const
edgeNormals[11][0] = 3; edgeNormals[11][1] = 0;
tmp<pointField> surfacePointsTmp(surface().points());
pointField& surfacePoints = surfacePointsTmp();
pointField& surfacePoints = surfacePointsTmp.ref();
forAll(edgeDirections, eI)
{

View File

@ -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
@ -84,7 +84,7 @@ tmp<volScalarField> createScalarField
zeroGradientFvPatchScalarField::typeName
)
);
volScalarField& fld = tfld();
volScalarField& fld = tfld.ref();
forAll(fld, cellI)
{

View File

@ -181,7 +181,7 @@ void subsetVolFields
{
if (addedPatches.found(patchI))
{
tSubFld().boundaryField()[patchI] ==
tSubFld.ref().boundaryField()[patchI] ==
pTraits<typename GeoField::value_type>::zero;
}
}
@ -233,7 +233,7 @@ void subsetSurfaceFields
{
if (addedPatches.found(patchI))
{
tSubFld().boundaryField()[patchI] ==
tSubFld.ref().boundaryField()[patchI] ==
pTraits<typename GeoField::value_type>::zero;
}
}