mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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_)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ volField
|
||||
(
|
||||
meshSubsetter.interpolate(vf)
|
||||
);
|
||||
tfld().checkOut();
|
||||
tfld().rename(vf.name());
|
||||
tfld.ref().checkOut();
|
||||
tfld.ref().rename(vf.name());
|
||||
return tfld;
|
||||
}
|
||||
else
|
||||
@ -729,7 +729,7 @@ void ensightField
|
||||
(
|
||||
volPointInterpolation::New(vf.mesh()).interpolate(vf)
|
||||
);
|
||||
pfld().rename(vf.name());
|
||||
pfld.ref().rename(vf.name());
|
||||
|
||||
ensightPointField<Type>
|
||||
(
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::tmp<Field<Type>> Foam::surfaceMeshWriter::getFaceField
|
||||
const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
|
||||
|
||||
tmp<Field<Type>> tfld(new Field<Type>(pp_.size()));
|
||||
Field<Type>& fld = tfld();
|
||||
Field<Type>& fld = tfld.ref();
|
||||
|
||||
forAll(pp_.addressing(), i)
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -157,7 +157,7 @@ public:
|
||||
if (useSubMesh())
|
||||
{
|
||||
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
||||
subFld().rename(fld.name());
|
||||
subFld.ref().rename(fld.name());
|
||||
return subFld;
|
||||
}
|
||||
else
|
||||
|
||||
@ -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
|
||||
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
// Calculate nut - reference nut is calculated by the turbulence model
|
||||
// on its construction
|
||||
tmp<volScalarField> tnut = turbulence->nut();
|
||||
volScalarField& nut = tnut();
|
||||
volScalarField& nut = tnut.ref();
|
||||
volScalarField S(mag(dev(symm(fvc::grad(U)))));
|
||||
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
||||
|
||||
@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Turbulence k
|
||||
tmp<volScalarField> tk = turbulence->k();
|
||||
volScalarField& k = tk();
|
||||
volScalarField& k = tk.ref();
|
||||
scalar ck0 = pow025(Cmu)*kappa;
|
||||
k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl)));
|
||||
|
||||
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Turbulence epsilon
|
||||
tmp<volScalarField> tepsilon = turbulence->epsilon();
|
||||
volScalarField& epsilon = tepsilon();
|
||||
volScalarField& epsilon = tepsilon.ref();
|
||||
scalar ce0 = ::pow(Cmu, 0.75)/kappa;
|
||||
epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl);
|
||||
|
||||
|
||||
@ -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
|
||||
@ -57,7 +57,7 @@ tmp<pointField> avg
|
||||
const labelListList& pointEdges = s.pointEdges();
|
||||
|
||||
tmp<pointField> tavg(new pointField(s.nPoints(), vector::zero));
|
||||
pointField& avg = tavg();
|
||||
pointField& avg = tavg.ref();
|
||||
|
||||
forAll(pointEdges, vertI)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user