STYLE: check autoPtr as plain bool instead of valid()

- cleaner code, more similarity with unique_ptr

  Now
      if (ptr)
      if (!ptr)

  instead
      if (ptr.valid())
      if (!ptr.valid())
This commit is contained in:
Mark Olesen
2020-07-15 08:50:57 +02:00
parent 9af3f85cf9
commit 12c91b9472
144 changed files with 483 additions and 470 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014-2015 OpenFOAM Foundation Copyright (C) 2014-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -85,7 +86,7 @@ Foam::word Foam::orderedPhasePair::name() const
Foam::tmp<Foam::volScalarField> Foam::orderedPhasePair::E() const Foam::tmp<Foam::volScalarField> Foam::orderedPhasePair::E() const
{ {
if (!aspectRatio_.valid()) if (!aspectRatio_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Aspect ratio model not specified for " << *this << "." << "Aspect ratio model not specified for " << *this << "."

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,7 +44,7 @@ void testTransfer1(autoPtr<labelList> ap)
// Passed in copy, so automatically removes content // Passed in copy, so automatically removes content
// Transfer would be nice, but not actually needed // Transfer would be nice, but not actually needed
Info<< "recv " << Switch::name(ap.valid()) << nl; Info<< "recv " << Switch::name(bool(ap)) << nl;
} }
@ -53,7 +53,7 @@ void testTransfer1(autoPtr<labelList> ap)
void testTransfer2(autoPtr<labelList>&& ap) void testTransfer2(autoPtr<labelList>&& ap)
{ {
// As rvalue, so this time we actually get to manage content // As rvalue, so this time we actually get to manage content
Info<< "recv " << Switch::name(ap.valid()) << nl; Info<< "recv " << Switch::name(bool(ap)) << nl;
} }
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
testTransfer2(std::move(list)); testTransfer2(std::move(list));
Info<<"now have valid=" << Switch::name(list.valid()); Info<<"now have valid=" << Switch::name(bool(list));
if (list) if (list)
{ {
@ -209,9 +209,9 @@ int main(int argc, char *argv[])
testTransfer2(std::move(list)); testTransfer2(std::move(list));
Info<<"now have valid=" << Switch::name(list.valid()); Info<<"now have valid=" << Switch::name(bool(list));
if (list.valid()) if (list)
{ {
Info<< nl Info<< nl
<< flatOutput(*list) << " @ " << name(list->cdata()) << flatOutput(*list) << " @ " << name(list->cdata())
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
auto ptr1 = autoPtr<labelList>::New(); auto ptr1 = autoPtr<labelList>::New();
auto ptr2 = autoPtr<labelList>::New(); auto ptr2 = autoPtr<labelList>::New();
Info<<"ptr valid: " << ptr1.valid() << nl; Info<<"ptr valid: " << bool(ptr1) << nl;
// Refuses to compile (good!): ptr1 = new labelList(10); // Refuses to compile (good!): ptr1 = new labelList(10);

View File

@ -137,9 +137,9 @@ label mergePatchFaces
// Faces in error. // Faces in error.
labelHashSet errorFaces; labelHashSet errorFaces;
if (qualDictPtr.valid()) if (qualDictPtr)
{ {
motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces); motionSmoother::checkMesh(false, mesh, *qualDictPtr, errorFaces);
} }
else else
{ {
@ -440,7 +440,7 @@ int main(int argc, char *argv[])
); );
// Merge points on straight edges and remove unused points // Merge points on straight edges and remove unused points
if (qualDict.valid()) if (qualDict)
{ {
Info<< "Merging all 'loose' points on surface edges, " Info<< "Merging all 'loose' points on surface edges, "
<< "regardless of the angle they make." << endl; << "regardless of the angle they make." << endl;

View File

@ -731,9 +731,9 @@ int main(int argc, char *argv[])
); );
// Update // Update
if (refDataPtr.valid()) if (refDataPtr)
{ {
refDataPtr().updateMesh(map()); refDataPtr->updateMesh(map());
} }
// Store added cells // Store added cells
@ -896,9 +896,9 @@ int main(int argc, char *argv[])
updateFaceLabels(map(), backPatchFaces); updateFaceLabels(map(), backPatchFaces);
updateCellSet(map(), addedCellsSet); updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid()) if (refDataPtr)
{ {
refDataPtr().updateMesh(map()); refDataPtr->updateMesh(map());
} }
// Move mesh (if inflation used) // Move mesh (if inflation used)
@ -1029,9 +1029,9 @@ int main(int argc, char *argv[])
// Update local data // Update local data
updateCellSet(map(), addedCellsSet); updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid()) if (refDataPtr)
{ {
refDataPtr().updateMesh(map()); refDataPtr->updateMesh(map());
} }
// Move mesh (if inflation used) // Move mesh (if inflation used)
@ -1067,9 +1067,9 @@ int main(int argc, char *argv[])
} }
} }
if (refDataPtr.valid()) if (refDataPtr)
{ {
refDataPtr().write(); refDataPtr->write();
} }

View File

@ -539,7 +539,7 @@ Foam::label Foam::checkGeometry
<< nonAlignedPoints.name() << endl; << nonAlignedPoints.name() << endl;
nonAlignedPoints.instance() = mesh.pointsInstance(); nonAlignedPoints.instance() = mesh.pointsInstance();
nonAlignedPoints.write(); nonAlignedPoints.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, nonAlignedPoints); mergeAndWrite(*setWriter, nonAlignedPoints);
} }
@ -573,7 +573,7 @@ Foam::label Foam::checkGeometry
<< " non closed cells to set " << cells.name() << endl; << " non closed cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -589,7 +589,7 @@ Foam::label Foam::checkGeometry
<< aspectCells.name() << endl; << aspectCells.name() << endl;
aspectCells.instance() = mesh.pointsInstance(); aspectCells.instance() = mesh.pointsInstance();
aspectCells.write(); aspectCells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, aspectCells); mergeAndWrite(*surfWriter, aspectCells);
} }
@ -610,7 +610,7 @@ Foam::label Foam::checkGeometry
<< " zero area faces to set " << faces.name() << endl; << " zero area faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -632,7 +632,7 @@ Foam::label Foam::checkGeometry
<< " zero volume cells to set " << cells.name() << endl; << " zero volume cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -655,7 +655,7 @@ Foam::label Foam::checkGeometry
<< " non-orthogonal faces to set " << faces.name() << endl; << " non-orthogonal faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -677,7 +677,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -699,7 +699,7 @@ Foam::label Foam::checkGeometry
<< " skew faces to set " << faces.name() << endl; << " skew faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -723,7 +723,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -756,7 +756,7 @@ Foam::label Foam::checkGeometry
<< "decomposition tets to set " << faces.name() << endl; << "decomposition tets to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -781,7 +781,7 @@ Foam::label Foam::checkGeometry
<< endl; << endl;
points.instance() = mesh.pointsInstance(); points.instance() = mesh.pointsInstance();
points.write(); points.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, points); mergeAndWrite(*setWriter, points);
} }
@ -804,7 +804,7 @@ Foam::label Foam::checkGeometry
<< " apart) points to set " << nearPoints.name() << endl; << " apart) points to set " << nearPoints.name() << endl;
nearPoints.instance() = mesh.pointsInstance(); nearPoints.instance() = mesh.pointsInstance();
nearPoints.write(); nearPoints.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, nearPoints); mergeAndWrite(*setWriter, nearPoints);
} }
@ -828,7 +828,7 @@ Foam::label Foam::checkGeometry
<< endl; << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -851,7 +851,7 @@ Foam::label Foam::checkGeometry
<< " warped faces to set " << faces.name() << endl; << " warped faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -872,7 +872,7 @@ Foam::label Foam::checkGeometry
<< " under-determined cells to set " << cells.name() << endl; << " under-determined cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -892,7 +892,7 @@ Foam::label Foam::checkGeometry
<< " concave cells to set " << cells.name() << endl; << " concave cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -913,7 +913,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -934,7 +934,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -949,7 +949,7 @@ Foam::label Foam::checkGeometry
const word procAndTime(Foam::name(Pstream::myProcNo()) + "_" + tmName); const word procAndTime(Foam::name(Pstream::myProcNo()) + "_" + tmName);
autoPtr<surfaceWriter> patchWriter; autoPtr<surfaceWriter> patchWriter;
if (!surfWriter.valid()) if (!surfWriter)
{ {
patchWriter.reset(new surfaceWriters::vtkWriter()); patchWriter.reset(new surfaceWriters::vtkWriter());
} }

View File

@ -30,7 +30,7 @@ Foam::label Foam::checkMeshQuality
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (writer.valid()) if (writer)
{ {
mergeAndWrite(*writer, faces); mergeAndWrite(*writer, faces);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -202,7 +202,7 @@ Foam::label Foam::checkTopology
<< " illegal cells to set " << cells.name() << endl; << " illegal cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -226,7 +226,7 @@ Foam::label Foam::checkTopology
<< " unused points to set " << points.name() << endl; << " unused points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance(); points.instance() = mesh.pointsInstance();
points.write(); points.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, points); mergeAndWrite(*setWriter, points);
} }
@ -248,7 +248,7 @@ Foam::label Foam::checkTopology
<< " unordered faces to set " << faces.name() << endl; << " unordered faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -268,7 +268,7 @@ Foam::label Foam::checkTopology
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -289,7 +289,7 @@ Foam::label Foam::checkTopology
<< endl; << endl;
cells.instance() = mesh.pointsInstance(); cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, cells); mergeAndWrite(*surfWriter, cells);
} }
@ -313,7 +313,7 @@ Foam::label Foam::checkTopology
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, faces); mergeAndWrite(*surfWriter, faces);
} }
@ -368,7 +368,7 @@ Foam::label Foam::checkTopology
<< endl; << endl;
oneCells.instance() = mesh.pointsInstance(); oneCells.instance() = mesh.pointsInstance();
oneCells.write(); oneCells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, oneCells); mergeAndWrite(*surfWriter, oneCells);
} }
@ -384,7 +384,7 @@ Foam::label Foam::checkTopology
<< endl; << endl;
twoCells.instance() = mesh.pointsInstance(); twoCells.instance() = mesh.pointsInstance();
twoCells.write(); twoCells.write();
if (surfWriter.valid()) if (surfWriter)
{ {
mergeAndWrite(*surfWriter, twoCells); mergeAndWrite(*surfWriter, twoCells);
} }
@ -529,7 +529,7 @@ Foam::label Foam::checkTopology
<< " points that are in multiple regions to set " << " points that are in multiple regions to set "
<< points.name() << endl; << points.name() << endl;
points.write(); points.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, points); mergeAndWrite(*setWriter, points);
} }
@ -640,7 +640,7 @@ Foam::label Foam::checkTopology
<< " conflicting points to set " << points.name() << endl; << " conflicting points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance(); points.instance() = mesh.pointsInstance();
points.write(); points.write();
if (setWriter.valid()) if (setWriter)
{ {
mergeAndWrite(*setWriter, points); mergeAndWrite(*setWriter, points);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1035,9 +1036,9 @@ void Foam::meshDualiser::setRefinement
-1, //masterCellID, -1, //masterCellID,
-1 //zoneID -1 //zoneID
); );
if (dualCcStr.valid()) if (dualCcStr)
{ {
meshTools::writeOBJ(dualCcStr(), mesh_.points()[pointi]); meshTools::writeOBJ(*dualCcStr, mesh_.points()[pointi]);
} }
} }
@ -1079,11 +1080,11 @@ void Foam::meshDualiser::setRefinement
-1, //masterCellID -1, //masterCellID
mesh_.cellZones().whichZone(pCells[pCelli]) //zoneID mesh_.cellZones().whichZone(pCells[pCelli]) //zoneID
); );
if (dualCcStr.valid()) if (dualCcStr)
{ {
meshTools::writeOBJ meshTools::writeOBJ
( (
dualCcStr(), *dualCcStr,
0.5*(mesh_.points()[pointi]+cellCentres[pCells[pCelli]]) 0.5*(mesh_.points()[pointi]+cellCentres[pCells[pCelli]])
); );
} }
@ -1104,9 +1105,9 @@ void Foam::meshDualiser::setRefinement
-1 //zoneID -1 //zoneID
); );
if (dualCcStr.valid()) if (dualCcStr)
{ {
meshTools::writeOBJ(dualCcStr(), mesh_.points()[pointi]); meshTools::writeOBJ(*dualCcStr, mesh_.points()[pointi]);
} }
} }
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -393,9 +393,9 @@ bool doCommand
currentSet.resize(max(currentSet.size(), typSize)); currentSet.resize(max(currentSet.size(), typSize));
} }
if (currentSetPtr.valid()) if (currentSetPtr)
{ {
topoSet& currentSet = currentSetPtr(); topoSet& currentSet = *currentSetPtr;
Info<< " Set:" << currentSet.name() Info<< " Set:" << currentSet.name()
<< " Size:" << returnReduce(currentSet.size(), sumOp<label>()) << " Size:" << returnReduce(currentSet.size(), sumOp<label>())
@ -829,9 +829,9 @@ int main(int argc, char *argv[])
commandStatus stat = INVALID; commandStatus stat = INVALID;
if (fileStreamPtr.valid()) if (fileStreamPtr)
{ {
if (!fileStreamPtr().good()) if (!fileStreamPtr->good())
{ {
Info<< "End of batch file" << endl; Info<< "End of batch file" << endl;
// No error. // No error.

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -394,7 +394,7 @@ int main(int argc, char *argv[])
break; break;
} }
if (currentSet.valid()) if (currentSet)
{ {
Info<< " " Info<< " "
<< currentSet().type() << ' ' << currentSet().type() << ' '

View File

@ -426,9 +426,9 @@ int main(int argc, char *argv[])
if (!lagrangianDirs.empty()) if (!lagrangianDirs.empty())
{ {
if (meshPtr.valid()) if (meshPtr)
{ {
meshPtr().readUpdate(); meshPtr->readUpdate();
} }
else else
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -334,7 +334,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
autoPtr<polyMesh> procMeshPtr; autoPtr<polyMesh> procMeshPtr;
if (facesInstancePointsPtr_.valid()) if (facesInstancePointsPtr_)
{ {
// Construct mesh from facesInstance. // Construct mesh from facesInstance.
pointField facesInstancePoints pointField facesInstancePoints
@ -738,7 +738,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.write(); procMesh.write();
// Write points if pointsInstance differing from facesInstance // Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid()) if (facesInstancePointsPtr_)
{ {
pointIOField pointsInstancePoints pointIOField pointsInstancePoints
( (

View File

@ -672,9 +672,9 @@ void readFields
// Load field (but not oldTime) // Load field (but not oldTime)
readField(io, mesh, i, fields); readField(io, mesh, i, fields);
// Create zero sized field and send // Create zero sized field and send
if (subsetterPtr.valid()) if (subsetterPtr)
{ {
tmp<GeoField> tsubfld = subsetterPtr().interpolate(fields[i]); tmp<GeoField> tsubfld = subsetterPtr->interpolate(fields[i]);
// Send to all processors that don't have a mesh // Send to all processors that don't have a mesh
for (label procI = 1; procI < Pstream::nProcs(); ++procI) for (label procI = 1; procI < Pstream::nProcs(); ++procI)
@ -1803,7 +1803,7 @@ void reconstructLagrangian
if (cloudNames.size()) if (cloudNames.size())
{ {
if (!lagrangianReconstructorPtr.valid()) if (!lagrangianReconstructorPtr)
{ {
lagrangianReconstructorPtr.reset lagrangianReconstructorPtr.reset
( (
@ -2116,7 +2116,7 @@ void redistributeLagrangian
{ {
if (clouds.size()) if (clouds.size())
{ {
if (!lagrangianReconstructorPtr.valid()) if (!lagrangianReconstructorPtr)
{ {
lagrangianReconstructorPtr.reset lagrangianReconstructorPtr.reset
( (
@ -2804,7 +2804,7 @@ int main(int argc, char *argv[])
Info<< " Detected topology change;" Info<< " Detected topology change;"
<< " reconstructing addressing" << nl << endl; << " reconstructing addressing" << nl << endl;
if (baseMeshPtr.valid()) if (baseMeshPtr)
{ {
// Cannot do a baseMesh::readUpdate() since not all // Cannot do a baseMesh::readUpdate() since not all
// processors will have mesh files. So instead just // processors will have mesh files. So instead just

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -153,7 +153,7 @@ Description
// Finish writers // Finish writers
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->close(); internalWriter->close();
} }

View File

@ -262,7 +262,7 @@ Description
// CellData // CellData
{ {
// Begin CellData // Begin CellData
if (internalWriter.valid()) if (internalWriter)
{ {
// Optionally with cellID and procID fields // Optionally with cellID and procID fields
internalWriter->beginCellData internalWriter->beginCellData
@ -323,7 +323,7 @@ Description
if (doPointValues) if (doPointValues)
{ {
// Begin PointData // Begin PointData
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->beginPointData internalWriter->beginPointData
( (
@ -386,7 +386,7 @@ Description
// Finish writers // Finish writers
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->close(); internalWriter->close();
} }

View File

@ -60,7 +60,7 @@ bool writeDimField
const auto& field = tfield(); const auto& field = tfield();
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->write(field); internalWriter->write(field);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,7 +83,7 @@ bool writePointField
const auto& field = tproxied(); const auto& field = tproxied();
// Internal // Internal
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->write(field); internalWriter->write(field);
} }

View File

@ -63,7 +63,7 @@ bool writeVolField
const auto& field = tfield(); const auto& field = tfield();
// Internal // Internal
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->write(field); internalWriter->write(field);
} }

View File

@ -99,7 +99,7 @@ int main(int argc, char *argv[])
autoPtr<lumpedPointIOMovement> movement = autoPtr<lumpedPointIOMovement> movement =
lumpedPointIOMovement::New(runTime); lumpedPointIOMovement::New(runTime);
if (!movement.valid()) if (!movement)
{ {
Info<< "No valid movement found" << endl; Info<< "No valid movement found" << endl;
return 1; return 1;
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New(mesh); autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New(mesh);
if (!movement.valid()) if (!movement)
{ {
Info<< "No valid movement found" << endl; Info<< "No valid movement found" << endl;
return 1; return 1;

View File

@ -802,9 +802,9 @@ int main(int argc, char *argv[])
ctrl ctrl
); );
} }
else if (exprDictPtr.valid()) else if (exprDictPtr)
{ {
const dictionary& exprDict = exprDictPtr(); const dictionary& exprDict = *exprDictPtr;
// Read set construct info from dictionary // Read set construct info from dictionary
PtrList<entry> actions(exprDict.lookup("expressions")); PtrList<entry> actions(exprDict.lookup("expressions"));
@ -898,7 +898,7 @@ int main(int argc, char *argv[])
); );
} }
} }
else if (exprDictPtr.valid()) else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "No command-line or dictionary??" << nl << endl << "No command-line or dictionary??" << nl << endl

View File

@ -469,7 +469,7 @@ int main(int argc, char *argv[])
Info<< "Surface has " << illegalFaces.size() Info<< "Surface has " << illegalFaces.size()
<< " illegal triangles." << endl; << " illegal triangles." << endl;
if (surfWriter.valid()) if (surfWriter)
{ {
boolList isIllegalFace(surf.size(), false); boolList isIllegalFace(surf.size(), false);
UIndirectList<bool>(isIllegalFace, illegalFaces) = true; UIndirectList<bool>(isIllegalFace, illegalFaces) = true;
@ -598,7 +598,7 @@ int main(int argc, char *argv[])
} }
// Dump for subsetting // Dump for subsetting
if (surfWriter.valid()) if (surfWriter)
{ {
// Transcribe faces // Transcribe faces
faceList faces(surf.size()); faceList faces(surf.size());
@ -867,7 +867,7 @@ int main(int argc, char *argv[])
{ {
Info<< "Splitting surface into parts ..." << endl << endl; Info<< "Splitting surface into parts ..." << endl << endl;
if (!surfWriter.valid()) if (!surfWriter)
{ {
surfWriter.reset(new surfaceWriters::vtkWriter()); surfWriter.reset(new surfaceWriters::vtkWriter());
} }
@ -933,7 +933,7 @@ int main(int argc, char *argv[])
if (outputThreshold > 0) if (outputThreshold > 0)
{ {
if (!surfWriter.valid()) if (!surfWriter)
{ {
surfWriter.reset(new surfaceWriters::vtkWriter()); surfWriter.reset(new surfaceWriters::vtkWriter());
} }
@ -1001,7 +1001,7 @@ int main(int argc, char *argv[])
{ {
nInt++; nInt++;
if (intStreamPtr.valid()) if (intStreamPtr)
{ {
intStreamPtr().write(hitInfo.hitPoint()); intStreamPtr().write(hitInfo.hitPoint());
} }
@ -1013,7 +1013,7 @@ int main(int argc, char *argv[])
{ {
nInt++; nInt++;
if (intStreamPtr.valid()) if (intStreamPtr)
{ {
intStreamPtr().write(hitInfo2.hitPoint()); intStreamPtr().write(hitInfo2.hitPoint());
} }
@ -1070,7 +1070,7 @@ int main(int argc, char *argv[])
Info<< "Surface is self-intersecting at " << nInt Info<< "Surface is self-intersecting at " << nInt
<< " locations." << endl; << " locations." << endl;
if (intStreamPtr.valid()) if (intStreamPtr)
{ {
Info<< "Writing intersection points to " Info<< "Writing intersection points to "
<< intStreamPtr().name() << endl; << intStreamPtr().name() << endl;

View File

@ -711,7 +711,7 @@ int main(int argc, char *argv[])
10 // externalAngleTolerance 10 // externalAngleTolerance
); );
if (vtkWriter.valid()) if (vtkWriter)
{ {
vtkWriter->beginCellData(); vtkWriter->beginCellData();
vtkWriter->write("internalCloseness", tcloseness[0]()); vtkWriter->write("internalCloseness", tcloseness[0]());
@ -735,7 +735,7 @@ int main(int argc, char *argv[])
maxProximity maxProximity
); );
if (vtkWriter.valid()) if (vtkWriter)
{ {
vtkWriter->beginCellData(); vtkWriter->beginCellData();
vtkWriter->write("featureProximity", tproximity()); vtkWriter->write("featureProximity", tproximity());
@ -753,7 +753,7 @@ int main(int argc, char *argv[])
surf surf
); );
if (vtkWriter.valid()) if (vtkWriter)
{ {
vtkWriter->beginPointData(); vtkWriter->beginPointData();
vtkWriter->write("curvature", tcurvature()); vtkWriter->write("curvature", tcurvature());

View File

@ -277,7 +277,7 @@ int main(int argc, char *argv[])
surf.cleanup(true); surf.cleanup(true);
} }
if (fromCsys.valid()) if (fromCsys)
{ {
Info<< "move points from coordinate system: " Info<< "move points from coordinate system: "
<< fromCsys->name() << endl; << fromCsys->name() << endl;
@ -285,7 +285,7 @@ int main(int argc, char *argv[])
surf.movePoints(tpf()); surf.movePoints(tpf());
} }
if (toCsys.valid()) if (toCsys)
{ {
Info<< "move points to coordinate system: " Info<< "move points to coordinate system: "
<< toCsys->name() << endl; << toCsys->name() << endl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -163,7 +163,7 @@ Foam::IOobjectList::IOobjectList
bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr) bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
{ {
if (objectPtr.valid()) if (objectPtr)
{ {
return insert(objectPtr->name(), objectPtr); return insert(objectPtr->name(), objectPtr);
} }
@ -174,7 +174,7 @@ bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr) bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr)
{ {
if (objectPtr.valid()) if (objectPtr)
{ {
return insert(objectPtr->name(), objectPtr); return insert(objectPtr->name(), objectPtr);
} }

View File

@ -495,7 +495,7 @@ void Foam::functionObjectList::resetState()
Foam::IOdictionary& Foam::functionObjectList::stateDict() Foam::IOdictionary& Foam::functionObjectList::stateDict()
{ {
if (!stateDictPtr_.valid()) if (!stateDictPtr_)
{ {
createStateDict(); createStateDict();
} }
@ -506,7 +506,7 @@ Foam::IOdictionary& Foam::functionObjectList::stateDict()
const Foam::IOdictionary& Foam::functionObjectList::stateDict() const const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
{ {
if (!stateDictPtr_.valid()) if (!stateDictPtr_)
{ {
createStateDict(); createStateDict();
} }
@ -517,7 +517,7 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
Foam::objectRegistry& Foam::functionObjectList::storedObjects() Foam::objectRegistry& Foam::functionObjectList::storedObjects()
{ {
if (!objectsRegistryPtr_.valid()) if (!objectsRegistryPtr_)
{ {
createOutputRegistry(); createOutputRegistry();
} }
@ -528,7 +528,7 @@ Foam::objectRegistry& Foam::functionObjectList::storedObjects()
const Foam::objectRegistry& Foam::functionObjectList::storedObjects() const const Foam::objectRegistry& Foam::functionObjectList::storedObjects() const
{ {
if (!objectsRegistryPtr_.valid()) if (!objectsRegistryPtr_)
{ {
createOutputRegistry(); createOutputRegistry();
} }
@ -727,7 +727,7 @@ bool Foam::functionObjectList::adjustTimeStep()
bool Foam::functionObjectList::read() bool Foam::functionObjectList::read()
{ {
if (!stateDictPtr_.valid()) if (!stateDictPtr_)
{ {
createStateDict(); createStateDict();
} }
@ -903,7 +903,7 @@ bool Foam::functionObjectList::read()
FatalIOError.throwExceptions(throwingIOerr); FatalIOError.throwExceptions(throwingIOerr);
// Required functionObject to be valid on all processors // Required functionObject to be valid on all processors
if (returnReduce(foPtr.valid(), andOp<bool>())) if (returnReduce(bool(foPtr), andOp<bool>()))
{ {
objPtr.reset(foPtr.release()); objPtr.reset(foPtr.release());
} }

View File

@ -241,7 +241,7 @@ Foam::OFstream& Foam::functionObjects::writeFile::file()
return Snull; return Snull;
} }
if (!filePtr_.valid()) if (!filePtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "File pointer not allocated\n"; << "File pointer not allocated\n";

View File

@ -106,7 +106,7 @@ Foam::Istream& Foam::regIOobject::readStream(const bool valid)
} }
// Construct object stream and read header if not already constructed // Construct object stream and read header if not already constructed
if (!isPtr_.valid()) if (!isPtr_)
{ {
fileName objPath; fileName objPath;
if (watchIndices_.size()) if (watchIndices_.size())
@ -152,7 +152,7 @@ Foam::Istream& Foam::regIOobject::readStream
} }
// Construct IFstream if not already constructed // Construct IFstream if not already constructed
if (!isPtr_.valid()) if (!isPtr_)
{ {
readStream(valid); readStream(valid);
@ -189,7 +189,7 @@ void Foam::regIOobject::close()
<< endl; << endl;
} }
isPtr_.clear(); isPtr_.reset(nullptr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com> Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -518,7 +518,7 @@ void Foam::expressions::exprResult::operator=(const exprResult& rhs)
<< exit(FatalError); << exit(FatalError);
} }
} }
else if (objectPtr_.valid()) else if (objectPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Assignment with general content not possible" << nl << "Assignment with general content not possible" << nl

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com> Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -283,7 +283,7 @@ inline bool Foam::expressions::exprResult::isBool() const
inline bool Foam::expressions::exprResult::isObject() const inline bool Foam::expressions::exprResult::isObject() const
{ {
return objectPtr_.valid(); return bool(objectPtr_);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -228,7 +228,7 @@ template<class Type>
const Foam::pointPatchField<Type>& const Foam::pointPatchField<Type>&
Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
{ {
if (!redirectPatchFieldPtr_.valid()) if (!redirectPatchFieldPtr_)
{ {
// Construct a patch // Construct a patch
// Make sure to construct the patchfield with up-to-date value // Make sure to construct the patchfield with up-to-date value

View File

@ -1262,7 +1262,7 @@ void Foam::argList::parse
fileHandler().NewIFstream(source) fileHandler().NewIFstream(source)
); );
if (!decompDictStream.valid() || !decompDictStream->good()) if (!decompDictStream || !decompDictStream->good())
{ {
FatalError FatalError
<< "Cannot read decomposeParDict from " << "Cannot read decomposeParDict from "

View File

@ -161,7 +161,7 @@ void Foam::interpolationTable<Type>::write(Ostream& os) const
{ {
os.writeEntry("file", fileName_); os.writeEntry("file", fileName_);
os.writeEntry("outOfBounds", bounds::repeatableBoundingNames[bounding_]); os.writeEntry("outOfBounds", bounds::repeatableBoundingNames[bounding_]);
if (reader_.valid()) if (reader_)
{ {
reader_->write(os); reader_->write(os);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -447,7 +447,7 @@ public:
//- Whether to agglomerate across processors //- Whether to agglomerate across processors
bool processorAgglomerate() const bool processorAgglomerate() const
{ {
return procAgglomeratorPtr_.valid(); return bool(procAgglomeratorPtr_);
} }
//- Mapping from processor to agglomerated processor (global, all //- Mapping from processor to agglomerated processor (global, all

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -170,10 +170,10 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
tmp<labelField> tfineToCoarse(new labelField(0)); tmp<labelField> tfineToCoarse(new labelField(0));
labelField& fineToCoarse = tfineToCoarse.ref(); labelField& fineToCoarse = tfineToCoarse.ref();
if (singleCellMeshPtr.valid()) if (singleCellMeshPtr)
{ {
// On master call the agglomerator // On master call the agglomerator
const lduPrimitiveMesh& singleCellMesh = singleCellMeshPtr(); const lduPrimitiveMesh& singleCellMesh = *singleCellMeshPtr;
label nCoarseProcs; label nCoarseProcs;
fineToCoarse = pairGAMGAgglomeration::agglomerate fineToCoarse = pairGAMGAgglomeration::agglomerate

View File

@ -1837,7 +1837,7 @@ void Foam::globalMeshData::clearOut()
const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
{ {
if (!sharedPointGlobalLabelsPtr_.valid()) if (!sharedPointGlobalLabelsPtr_)
{ {
sharedPointGlobalLabelsPtr_.reset sharedPointGlobalLabelsPtr_.reset
( (
@ -2015,7 +2015,7 @@ Foam::label Foam::globalMeshData::nGlobalPoints() const
const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
{ {
if (!sharedPointLabelsPtr_.valid()) if (!sharedPointLabelsPtr_)
{ {
calcSharedPoints(); calcSharedPoints();
} }
@ -2025,7 +2025,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const
{ {
if (!sharedPointAddrPtr_.valid()) if (!sharedPointAddrPtr_)
{ {
calcSharedPoints(); calcSharedPoints();
} }
@ -2045,7 +2045,7 @@ Foam::label Foam::globalMeshData::nGlobalEdges() const
const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
{ {
if (!sharedEdgeLabelsPtr_.valid()) if (!sharedEdgeLabelsPtr_)
{ {
calcSharedEdges(); calcSharedEdges();
} }
@ -2055,7 +2055,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
{ {
if (!sharedEdgeAddrPtr_.valid()) if (!sharedEdgeAddrPtr_)
{ {
calcSharedEdges(); calcSharedEdges();
} }
@ -2065,7 +2065,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
{ {
if (!coupledPatchPtr_.valid()) if (!coupledPatchPtr_)
{ {
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh(); const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
@ -2126,7 +2126,7 @@ const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const
{ {
if (!coupledPatchMeshEdgesPtr_.valid()) if (!coupledPatchMeshEdgesPtr_)
{ {
coupledPatchMeshEdgesPtr_.reset coupledPatchMeshEdgesPtr_.reset
( (
@ -2147,7 +2147,7 @@ const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const
const Foam::Map<Foam::label>& Foam::globalMeshData::coupledPatchMeshEdgeMap() const Foam::Map<Foam::label>& Foam::globalMeshData::coupledPatchMeshEdgeMap()
const const
{ {
if (!coupledPatchMeshEdgeMapPtr_.valid()) if (!coupledPatchMeshEdgeMapPtr_)
{ {
const labelList& me = coupledPatchMeshEdges(); const labelList& me = coupledPatchMeshEdges();
@ -2165,7 +2165,7 @@ const
const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
{ {
if (!globalPointNumberingPtr_.valid()) if (!globalPointNumberingPtr_)
{ {
globalPointNumberingPtr_.reset globalPointNumberingPtr_.reset
( (
@ -2179,7 +2179,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
const Foam::globalIndexAndTransform& const Foam::globalIndexAndTransform&
Foam::globalMeshData::globalTransforms() const Foam::globalMeshData::globalTransforms() const
{ {
if (!globalTransformsPtr_.valid()) if (!globalTransformsPtr_)
{ {
globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_)); globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_));
} }
@ -2189,7 +2189,7 @@ Foam::globalMeshData::globalTransforms() const
const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
{ {
if (!globalPointSlavesPtr_.valid()) if (!globalPointSlavesPtr_)
{ {
calcGlobalPointSlaves(); calcGlobalPointSlaves();
} }
@ -2200,7 +2200,7 @@ const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
const Foam::labelListList& Foam::globalMeshData::globalPointTransformedSlaves() const Foam::labelListList& Foam::globalMeshData::globalPointTransformedSlaves()
const const
{ {
if (!globalPointTransformedSlavesPtr_.valid()) if (!globalPointTransformedSlavesPtr_)
{ {
calcGlobalPointSlaves(); calcGlobalPointSlaves();
} }
@ -2210,7 +2210,7 @@ const
const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
{ {
if (!globalPointSlavesMapPtr_.valid()) if (!globalPointSlavesMapPtr_)
{ {
calcGlobalPointSlaves(); calcGlobalPointSlaves();
} }
@ -2220,7 +2220,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
{ {
if (!globalEdgeNumberingPtr_.valid()) if (!globalEdgeNumberingPtr_)
{ {
globalEdgeNumberingPtr_.reset globalEdgeNumberingPtr_.reset
( (
@ -2233,7 +2233,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
{ {
if (!globalEdgeSlavesPtr_.valid()) if (!globalEdgeSlavesPtr_)
{ {
calcGlobalEdgeSlaves(); calcGlobalEdgeSlaves();
} }
@ -2244,7 +2244,7 @@ const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
const Foam::labelListList& Foam::globalMeshData::globalEdgeTransformedSlaves() const Foam::labelListList& Foam::globalMeshData::globalEdgeTransformedSlaves()
const const
{ {
if (!globalEdgeTransformedSlavesPtr_.valid()) if (!globalEdgeTransformedSlavesPtr_)
{ {
calcGlobalEdgeSlaves(); calcGlobalEdgeSlaves();
} }
@ -2254,7 +2254,7 @@ const
const Foam::bitSet& Foam::globalMeshData::globalEdgeOrientation() const const Foam::bitSet& Foam::globalMeshData::globalEdgeOrientation() const
{ {
if (!globalEdgeOrientationPtr_.valid()) if (!globalEdgeOrientationPtr_)
{ {
calcGlobalEdgeOrientation(); calcGlobalEdgeOrientation();
} }
@ -2264,7 +2264,7 @@ const Foam::bitSet& Foam::globalMeshData::globalEdgeOrientation() const
const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
{ {
if (!globalEdgeSlavesMapPtr_.valid()) if (!globalEdgeSlavesMapPtr_)
{ {
calcGlobalEdgeSlaves(); calcGlobalEdgeSlaves();
} }
@ -2275,7 +2275,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryFaceNumbering() const Foam::globalIndex& Foam::globalMeshData::globalBoundaryFaceNumbering()
const const
{ {
if (!globalBoundaryFaceNumberingPtr_.valid()) if (!globalBoundaryFaceNumberingPtr_)
{ {
calcGlobalPointBoundaryFaces(); calcGlobalPointBoundaryFaces();
} }
@ -2286,7 +2286,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryFaces() const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryFaces()
const const
{ {
if (!globalPointBoundaryFacesPtr_.valid()) if (!globalPointBoundaryFacesPtr_)
{ {
calcGlobalPointBoundaryFaces(); calcGlobalPointBoundaryFaces();
} }
@ -2297,7 +2297,7 @@ const
const Foam::labelListList& const Foam::labelListList&
Foam::globalMeshData::globalPointTransformedBoundaryFaces() const Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
{ {
if (!globalPointTransformedBoundaryFacesPtr_.valid()) if (!globalPointTransformedBoundaryFacesPtr_)
{ {
calcGlobalPointBoundaryFaces(); calcGlobalPointBoundaryFaces();
} }
@ -2308,7 +2308,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryFacesMap() const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryFacesMap()
const const
{ {
if (!globalPointBoundaryFacesMapPtr_.valid()) if (!globalPointBoundaryFacesMapPtr_)
{ {
calcGlobalPointBoundaryFaces(); calcGlobalPointBoundaryFaces();
} }
@ -2318,7 +2318,7 @@ const
const Foam::labelList& Foam::globalMeshData::boundaryCells() const const Foam::labelList& Foam::globalMeshData::boundaryCells() const
{ {
if (!boundaryCellsPtr_.valid()) if (!boundaryCellsPtr_)
{ {
calcGlobalPointBoundaryCells(); calcGlobalPointBoundaryCells();
} }
@ -2329,7 +2329,7 @@ const Foam::labelList& Foam::globalMeshData::boundaryCells() const
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryCellNumbering() const Foam::globalIndex& Foam::globalMeshData::globalBoundaryCellNumbering()
const const
{ {
if (!globalBoundaryCellNumberingPtr_.valid()) if (!globalBoundaryCellNumberingPtr_)
{ {
calcGlobalPointBoundaryCells(); calcGlobalPointBoundaryCells();
} }
@ -2340,7 +2340,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryCells() const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryCells()
const const
{ {
if (!globalPointBoundaryCellsPtr_.valid()) if (!globalPointBoundaryCellsPtr_)
{ {
calcGlobalPointBoundaryCells(); calcGlobalPointBoundaryCells();
} }
@ -2351,7 +2351,7 @@ const
const Foam::labelListList& const Foam::labelListList&
Foam::globalMeshData::globalPointTransformedBoundaryCells() const Foam::globalMeshData::globalPointTransformedBoundaryCells() const
{ {
if (!globalPointTransformedBoundaryCellsPtr_.valid()) if (!globalPointTransformedBoundaryCellsPtr_)
{ {
calcGlobalPointBoundaryCells(); calcGlobalPointBoundaryCells();
} }
@ -2362,7 +2362,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryCells() const
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryCellsMap() const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryCellsMap()
const const
{ {
if (!globalPointBoundaryCellsMapPtr_.valid()) if (!globalPointBoundaryCellsMapPtr_)
{ {
calcGlobalPointBoundaryCells(); calcGlobalPointBoundaryCells();
} }
@ -2372,7 +2372,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
{ {
if (!globalCoPointSlavesPtr_.valid()) if (!globalCoPointSlavesPtr_)
{ {
calcGlobalCoPointSlaves(); calcGlobalCoPointSlaves();
} }
@ -2382,7 +2382,7 @@ const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const
{ {
if (!globalCoPointSlavesMapPtr_.valid()) if (!globalCoPointSlavesMapPtr_)
{ {
calcGlobalCoPointSlaves(); calcGlobalCoPointSlaves();
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -645,7 +646,7 @@ public:
bool hasOldCellVolumes() const bool hasOldCellVolumes() const
{ {
return oldCellVolumesPtr_.valid(); return bool(oldCellVolumesPtr_);
} }
const scalarField& oldCellVolumes() const const scalarField& oldCellVolumes() const

View File

@ -329,7 +329,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
<< " boundaries." << endl; << " boundaries." << endl;
} }
if (!neighbourEdgesPtr_.valid()) if (!neighbourEdgesPtr_)
{ {
neighbourEdgesPtr_.reset(new List<labelPairList>(size())); neighbourEdgesPtr_.reset(new List<labelPairList>(size()));
List<labelPairList>& neighbourEdges = neighbourEdgesPtr_(); List<labelPairList>& neighbourEdges = neighbourEdgesPtr_();
@ -451,7 +451,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
const Foam::labelList& Foam::polyBoundaryMesh::patchID() const const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
{ {
if (!patchIDPtr_.valid()) if (!patchIDPtr_)
{ {
patchIDPtr_.reset(new labelList(mesh_.nBoundaryFaces())); patchIDPtr_.reset(new labelList(mesh_.nBoundaryFaces()));
labelList& list = *patchIDPtr_; labelList& list = *patchIDPtr_;
@ -476,7 +476,7 @@ const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
const Foam::HashTable<Foam::labelList>& const Foam::HashTable<Foam::labelList>&
Foam::polyBoundaryMesh::groupPatchIDs() const Foam::polyBoundaryMesh::groupPatchIDs() const
{ {
if (!groupPatchIDsPtr_.valid()) if (!groupPatchIDsPtr_)
{ {
groupPatchIDsPtr_.reset(new HashTable<labelList>(16)); groupPatchIDsPtr_.reset(new HashTable<labelList>(16));
auto& groupPatchIDs = *groupPatchIDsPtr_; auto& groupPatchIDs = *groupPatchIDsPtr_;

View File

@ -699,25 +699,25 @@ void Foam::polyMesh::resetPrimitives
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (points.valid()) if (points)
{ {
points_.transfer(points()); points_.transfer(*points);
bounds_ = boundBox(points_, validBoundary); bounds_ = boundBox(points_, validBoundary);
} }
if (faces.valid()) if (faces)
{ {
faces_.transfer(faces()); faces_.transfer(*faces);
} }
if (owner.valid()) if (owner)
{ {
owner_.transfer(owner()); owner_.transfer(*owner);
} }
if (neighbour.valid()) if (neighbour)
{ {
neighbour_.transfer(neighbour()); neighbour_.transfer(*neighbour);
} }
@ -922,7 +922,7 @@ Foam::polyMesh::cellTree() const
); );
} }
return cellTreePtr_(); return *cellTreePtr_;
} }
@ -1160,11 +1160,11 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
points_.instance() = time().timeName(); points_.instance() = time().timeName();
points_.eventNo() = getEvent(); points_.eventNo() = getEvent();
if (tetBasePtIsPtr_.valid()) if (tetBasePtIsPtr_)
{ {
tetBasePtIsPtr_().writeOpt() = IOobject::AUTO_WRITE; tetBasePtIsPtr_->writeOpt() = IOobject::AUTO_WRITE;
tetBasePtIsPtr_().instance() = time().timeName(); tetBasePtIsPtr_->instance() = time().timeName();
tetBasePtIsPtr_().eventNo() = getEvent(); tetBasePtIsPtr_->eventNo() = getEvent();
} }
tmp<scalarField> sweptVols = primitiveMesh::movePoints tmp<scalarField> sweptVols = primitiveMesh::movePoints
@ -1174,9 +1174,9 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
); );
// Adjust parallel shared points // Adjust parallel shared points
if (globalMeshDataPtr_.valid()) if (globalMeshDataPtr_)
{ {
globalMeshDataPtr_().movePoints(points_); globalMeshDataPtr_->movePoints(points_);
} }
// Force recalculation of all geometric data with new points // Force recalculation of all geometric data with new points

View File

@ -80,7 +80,7 @@ void Foam::polyMesh::updateGeom
DebugInFunction DebugInFunction
<< "Updating geometric data with newPoints:" << "Updating geometric data with newPoints:"
<< newPoints.size() << " newTetBasePtIs:" << newPoints.size() << " newTetBasePtIs:"
<< newTetBasePtIsPtr.valid() << endl; << bool(newTetBasePtIsPtr) << endl;
if (points_.size() != 0 && points_.size() != newPoints.size()) if (points_.size() != 0 && points_.size() != newPoints.size())
{ {
@ -128,7 +128,7 @@ void Foam::polyMesh::updateGeom
points_.transfer(newPoints); points_.transfer(newPoints);
// Optional new tet base points // Optional new tet base points
if (newTetBasePtIsPtr.valid()) if (newTetBasePtIsPtr)
{ {
tetBasePtIsPtr_ = std::move(newTetBasePtIsPtr); tetBasePtIsPtr_ = std::move(newTetBasePtIsPtr);
} }

View File

@ -64,7 +64,7 @@ void Foam::polyMesh::setInstance
cellZones_.writeOpt() = wOpt; cellZones_.writeOpt() = wOpt;
cellZones_.instance() = inst; cellZones_.instance() = inst;
if (tetBasePtIsPtr_.valid()) if (tetBasePtIsPtr_)
{ {
tetBasePtIsPtr_->writeOpt() = wOpt; tetBasePtIsPtr_->writeOpt() = wOpt;
tetBasePtIsPtr_->instance() = inst; tetBasePtIsPtr_->instance() = inst;

View File

@ -59,7 +59,7 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
cellTreePtr_.clear(); cellTreePtr_.clear();
// Update parallel data // Update parallel data
if (globalMeshDataPtr_.valid()) if (globalMeshDataPtr_)
{ {
globalMeshDataPtr_->updateMesh(); globalMeshDataPtr_->updateMesh();
} }
@ -67,12 +67,12 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
setInstance(time().timeName()); setInstance(time().timeName());
// Map the old motion points if present // Map the old motion points if present
if (oldPointsPtr_.valid()) if (oldPointsPtr_)
{ {
// Make a copy of the original points // Make a copy of the original points
pointField oldMotionPoints = oldPointsPtr_(); pointField oldMotionPoints = *oldPointsPtr_;
pointField& newMotionPoints = oldPointsPtr_(); pointField& newMotionPoints = *oldPointsPtr_;
// Resize the list to new size // Resize the list to new size
newMotionPoints.setSize(points_.size()); newMotionPoints.setSize(points_.size());

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -528,7 +528,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
{ {
if (!neighbPointsPtr_.valid()) if (!neighbPointsPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "No extended addressing calculated for patch " << name() << "No extended addressing calculated for patch " << name()
@ -540,7 +540,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
{ {
if (!neighbEdgesPtr_.valid()) if (!neighbEdgesPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "No extended addressing calculated for patch " << name() << "No extended addressing calculated for patch " << name()

View File

@ -224,7 +224,7 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correctInletOutlet
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
void mixtureKEpsilon<BasicTurbulenceModel>::initMixtureFields() void mixtureKEpsilon<BasicTurbulenceModel>::initMixtureFields()
{ {
if (rhom_.valid()) return; if (rhom_) return;
// Local references to gas-phase properties // Local references to gas-phase properties
const volScalarField& kg = this->k_; const volScalarField& kg = this->k_;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -227,7 +227,7 @@ template<class Type>
const Foam::fvPatchField<Type>& const Foam::fvPatchField<Type>&
Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
{ {
if (!redirectPatchFieldPtr_.valid()) if (!redirectPatchFieldPtr_)
{ {
// Construct a patch // Construct a patch
// Make sure to construct the patchfield with up-to-date value // Make sure to construct the patchfield with up-to-date value

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -226,7 +226,7 @@ template<class Type>
const Foam::mixedFvPatchField<Type>& const Foam::mixedFvPatchField<Type>&
Foam::codedMixedFvPatchField<Type>::redirectPatchField() const Foam::codedMixedFvPatchField<Type>::redirectPatchField() const
{ {
if (!redirectPatchFieldPtr_.valid()) if (!redirectPatchFieldPtr_)
{ {
// Construct a patch // Construct a patch
// Make sure to construct the patchfield with up-to-date value // Make sure to construct the patchfield with up-to-date value

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenFOAM Foundation Copyright (C) 2015-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -131,7 +132,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField
origin_(ptf.origin_) origin_(ptf.origin_)
{ {
// Evaluate the profile if defined // Evaluate the profile if defined
if (ptf.profile_.valid()) if (ptf.profile_)
{ {
this->evaluate(); this->evaluate();
} }

View File

@ -102,7 +102,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf, p, iF, mapper), inletOutletFvPatchField<Type>(ptf, p, iF, mapper),
freestreamBCPtr_() freestreamBCPtr_()
{ {
if (ptf.freestreamBCPtr_.valid()) if (ptf.freestreamBCPtr_)
{ {
freestreamBCPtr_ = freestreamBCPtr_ =
fvPatchField<Type>::New(ptf.freestreamBCPtr_(), p, iF, mapper); fvPatchField<Type>::New(ptf.freestreamBCPtr_(), p, iF, mapper);
@ -119,7 +119,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf), inletOutletFvPatchField<Type>(ptf),
freestreamBCPtr_() freestreamBCPtr_()
{ {
if (ptf.freestreamBCPtr_.valid()) if (ptf.freestreamBCPtr_)
{ {
freestreamBCPtr_ = ptf.freestreamBCPtr_->clone(); freestreamBCPtr_ = ptf.freestreamBCPtr_->clone();
} }
@ -136,7 +136,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf, iF), inletOutletFvPatchField<Type>(ptf, iF),
freestreamBCPtr_() freestreamBCPtr_()
{ {
if (ptf.freestreamBCPtr_.valid()) if (ptf.freestreamBCPtr_)
{ {
freestreamBCPtr_ = ptf.freestreamBCPtr_->clone(); freestreamBCPtr_ = ptf.freestreamBCPtr_->clone();
} }
@ -149,7 +149,7 @@ template<class Type>
void Foam::freestreamFvPatchField<Type>::autoMap(const fvPatchFieldMapper& m) void Foam::freestreamFvPatchField<Type>::autoMap(const fvPatchFieldMapper& m)
{ {
inletOutletFvPatchField<Type>::autoMap(m); inletOutletFvPatchField<Type>::autoMap(m);
if (freestreamBCPtr_.valid()) if (freestreamBCPtr_)
{ {
freestreamBCPtr_->autoMap(m); freestreamBCPtr_->autoMap(m);
} }
@ -167,7 +167,7 @@ void Foam::freestreamFvPatchField<Type>::rmap
const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf); const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf);
if (fsptf.freestreamBCPtr_.valid()) if (fsptf.freestreamBCPtr_)
{ {
freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr); freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr);
} }
@ -182,7 +182,7 @@ void Foam::freestreamFvPatchField<Type>::updateCoeffs()
return; return;
} }
if (freestreamBCPtr_.valid()) if (freestreamBCPtr_)
{ {
freestreamBCPtr_->evaluate(); freestreamBCPtr_->evaluate();
freestreamValue() = freestreamBCPtr_(); freestreamValue() = freestreamBCPtr_();
@ -198,7 +198,7 @@ void Foam::freestreamFvPatchField<Type>::write(Ostream& os) const
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", this->phiName_); os.writeEntryIfDifferent<word>("phi", "phi", this->phiName_);
if (freestreamBCPtr_.valid()) if (freestreamBCPtr_)
{ {
os.beginBlock("freestreamBC"); os.beginBlock("freestreamBC");
freestreamBCPtr_->write(os); freestreamBCPtr_->write(os);

View File

@ -107,7 +107,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
uniformGradient_(ptf.uniformGradient_.clone()) uniformGradient_(ptf.uniformGradient_.clone())
{ {
// Evaluate the profile if defined // Evaluate the profile if defined
if (ptf.uniformGradient_.valid()) if (ptf.uniformGradient_)
{ {
this->evaluate(); this->evaluate();
} }

View File

@ -399,9 +399,9 @@ combineSurfaceGeometry
points = s.points(); points = s.points();
} }
} }
else if (sampledPtr_.valid()) else if (sampledPtr_)
{ {
const sampledSurface& s = sampledPtr_(); const sampledSurface& s = *sampledPtr_;
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -443,9 +443,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
totalArea = gSum(s.magSf()); totalArea = gSum(s.magSf());
} }
else if (sampledPtr_.valid()) else if (sampledPtr_)
{ {
totalArea = gSum(sampledPtr_().magSf()); totalArea = gSum(sampledPtr_->magSf());
} }
else else
{ {
@ -482,7 +482,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::usesSf() const
bool Foam::functionObjects::fieldValues::surfaceFieldValue::update() bool Foam::functionObjects::fieldValues::surfaceFieldValue::update()
{ {
if (sampledPtr_.valid()) if (sampledPtr_)
{ {
sampledPtr_->update(); sampledPtr_->update();
} }
@ -1022,9 +1022,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
const polySurface& s = dynamicCast<const polySurface>(obr()); const polySurface& s = dynamicCast<const polySurface>(obr());
Sf = s.Sf(); Sf = s.Sf();
} }
else if (sampledPtr_.valid()) else if (sampledPtr_)
{ {
Sf = sampledPtr_().Sf(); Sf = sampledPtr_->Sf();
} }
else else
{ {
@ -1036,7 +1036,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
faceList faces; faceList faces;
pointField points; pointField points;
if (surfaceWriterPtr_.valid()) if (surfaceWriterPtr_)
{ {
if (withTopologicalMerge()) if (withTopologicalMerge())
{ {

View File

@ -94,19 +94,19 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
{ {
const vf& fld = lookupObject<vf>(fieldName); const vf& fld = lookupObject<vf>(fieldName);
if (sampledPtr_.valid()) if (sampledPtr_)
{ {
if (sampledPtr_().interpolate()) if (sampledPtr_->interpolate())
{ {
const interpolationCellPoint<Type> interp(fld); const interpolationCellPoint<Type> interp(fld);
return sampledPtr_().interpolate(interp); return sampledPtr_->interpolate(interp);
} }
else else
{ {
const interpolationCell<Type> interp(fld); const interpolationCell<Type> interp(fld);
return sampledPtr_().sample(interp); return sampledPtr_->sample(interp);
} }
} }
else else

View File

@ -903,7 +903,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
volVectorField volVectorField
>(fldName).primitiveField(); >(fldName).primitiveField();
if (csysPtr_.valid()) if (csysPtr_)
{ {
Log << "Transforming vector field " << fldName Log << "Transforming vector field " << fldName
<< " with coordinate system " << " with coordinate system "

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -144,7 +144,7 @@ Foam::functionObjects::codedFunctionObject::codedFunctionObject
Foam::functionObject& Foam::functionObject&
Foam::functionObjects::codedFunctionObject::redirectFunctionObject() const Foam::functionObjects::codedFunctionObject::redirectFunctionObject() const
{ {
if (!redirectFunctionObjectPtr_.valid()) if (!redirectFunctionObjectPtr_)
{ {
dictionary constructDict(dict_); dictionary constructDict(dict_);
constructDict.set("type", name_); constructDict.set("type", name_);

View File

@ -189,7 +189,7 @@ bool Foam::functionObjects::ensightWrite::execute()
bool Foam::functionObjects::ensightWrite::write() bool Foam::functionObjects::ensightWrite::write()
{ {
if (!ensCase_.valid()) if (!ensCase_)
{ {
ensCase_.reset ensCase_.reset
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -146,7 +146,7 @@ bool Foam::functionObjects::ensightWrite::update()
// ensMesh_.clear(); // ensMesh_.clear();
// meshSubset_.clear(); // meshSubset_.clear();
// } // }
// else if (ensMesh_.valid()) // else if (ensMesh_)
// { // {
// ensMesh_->expire(); // ensMesh_->expire();
// } // }
@ -157,13 +157,13 @@ bool Foam::functionObjects::ensightWrite::update()
meshState_ = polyMesh::UNCHANGED; meshState_ = polyMesh::UNCHANGED;
if (!ensMesh_.valid()) if (!ensMesh_)
{ {
ensMesh_.reset(new ensightMesh(meshSubset_.mesh(), writeOpts_)); ensMesh_.reset(new ensightMesh(meshSubset_.mesh(), writeOpts_));
} }
else if (ensMesh_().needsUpdate()) else if (ensMesh_->needsUpdate())
{ {
ensMesh_().correct(); ensMesh_->correct();
} }
return true; return true;

View File

@ -521,7 +521,7 @@ bool Foam::functionObjects::vtkWrite::write()
// CellData // CellData
{ {
if (internalWriter.valid()) if (internalWriter)
{ {
// Optionally with cellID and procID fields // Optionally with cellID and procID fields
internalWriter->beginCellData internalWriter->beginCellData
@ -580,7 +580,7 @@ bool Foam::functionObjects::vtkWrite::write()
if (interpolate_) if (interpolate_)
{ {
// Begin PointData // Begin PointData
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->beginPointData internalWriter->beginPointData
( (
@ -631,7 +631,7 @@ bool Foam::functionObjects::vtkWrite::write()
// Finish writers // Finish writers
if (internalWriter.valid()) if (internalWriter)
{ {
internalWriter->close(); internalWriter->close();
} }

View File

@ -54,7 +54,7 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFields
const auto& field = tfield(); const auto& field = tfield();
// Internal // Internal
if (internalWriter.valid()) if (internalWriter)
{ {
ok = true; ok = true;
internalWriter->write(field); internalWriter->write(field);

View File

@ -145,7 +145,7 @@ Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const
pointDisplacement_ pointDisplacement_
); );
if (pointLocation_.valid()) if (pointLocation_)
{ {
if (debug) if (debug)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2016 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -245,7 +245,7 @@ Foam::displacementLaplacianFvMotionSolver::
Foam::motionDiffusivity& Foam::motionDiffusivity&
Foam::displacementLaplacianFvMotionSolver::diffusivity() Foam::displacementLaplacianFvMotionSolver::diffusivity()
{ {
if (!diffusivityPtr_.valid()) if (!diffusivityPtr_)
{ {
diffusivityPtr_ = motionDiffusivity::New diffusivityPtr_ = motionDiffusivity::New
( (
@ -267,7 +267,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
pointDisplacement_ pointDisplacement_
); );
if (pointLocation_.valid()) if (pointLocation_)
{ {
if (debug) if (debug)
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -249,7 +249,7 @@ Foam::solidBodyDisplacementLaplacianFvMotionSolver::
Foam::motionDiffusivity& Foam::motionDiffusivity&
Foam::solidBodyDisplacementLaplacianFvMotionSolver::diffusivity() Foam::solidBodyDisplacementLaplacianFvMotionSolver::diffusivity()
{ {
if (!diffusivityPtr_.valid()) if (!diffusivityPtr_)
{ {
diffusivityPtr_ = motionDiffusivity::New diffusivityPtr_ = motionDiffusivity::New
( (
@ -277,7 +277,7 @@ Foam::solidBodyDisplacementLaplacianFvMotionSolver::curPoints() const
); );
const pointField& newPoints = tnewPoints(); const pointField& newPoints = tnewPoints();
if (pointLocation_.valid()) if (pointLocation_)
{ {
if (debug) if (debug)
{ {

View File

@ -591,7 +591,7 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::updateCoeffs()
} }
// Apply offset to mapped values // Apply offset to mapped values
if (offset_.valid()) if (offset_)
{ {
const scalar t = this->db().time().timeOutputValue(); const scalar t = this->db().time().timeOutputValue();
this->operator==(*this + offset_->value(t)); this->operator==(*this + offset_->value(t));
@ -633,7 +633,7 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::write
mapMethod_ mapMethod_
); );
if (offset_.valid()) if (offset_)
{ {
offset_->writeData(os); offset_->writeData(os);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -155,7 +155,7 @@ void uniformInterpolatedDisplacementPointPatchVectorField::updateCoeffs()
return; return;
} }
if (!interpolatorPtr_.valid()) if (!interpolatorPtr_)
{ {
interpolatorPtr_ = interpolationWeights::New interpolatorPtr_ = interpolationWeights::New
( (

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::fv::interRegionOption::nbrRegionName() const
inline const Foam::meshToMesh& inline const Foam::meshToMesh&
Foam::fv::interRegionOption::meshInterp() const Foam::fv::interRegionOption::meshInterp() const
{ {
if (!meshInterpPtr_.valid()) if (!meshInterpPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Interpolation object not set" << "Interpolation object not set"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -95,7 +95,7 @@ Foam::fv::jouleHeatingSource::updateSigma
VolFieldType& sigma = VolFieldType& sigma =
mesh_.lookupObjectRef<VolFieldType>(typeName + ":sigma"); mesh_.lookupObjectRef<VolFieldType>(typeName + ":sigma");
if (!sigmaVsTPtr.valid()) if (!sigmaVsTPtr)
{ {
// Electrical conductivity field, sigma, was specified by the user // Electrical conductivity field, sigma, was specified by the user
return sigma; return sigma;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +54,7 @@ void Foam::fv::rotorDiskSource::calculate
scalar AOAmax = -GREAT; scalar AOAmax = -GREAT;
// Cached position-dependent rotations available? // Cached position-dependent rotations available?
const bool hasCache = Rcyl_.valid(); const bool hasCache = bool(Rcyl_);
forAll(cells_, i) forAll(cells_, i)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -134,7 +134,7 @@ Foam::fv::CodedSource<Type>::CodedSource
template<class Type> template<class Type>
Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const
{ {
if (!redirectFvOptionPtr_.valid()) if (!redirectFvOptionPtr_)
{ {
dictionary constructDict(dict_); dictionary constructDict(dict_);
constructDict.set("type", name_); constructDict.set("type", name_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::fv::interRegionHeatTransferModel::nbrRegionName() const
inline const Foam::meshToMesh& inline const Foam::meshToMesh&
Foam::fv::interRegionHeatTransferModel::meshInterp() const Foam::fv::interRegionHeatTransferModel::meshInterp() const
{ {
if (!meshInterpPtr_.valid()) if (!meshInterpPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Interpolation object not set" << "Interpolation object not set"

View File

@ -51,7 +51,7 @@ namespace fv
const Foam::interpolation2DTable<Foam::scalar>& const Foam::interpolation2DTable<Foam::scalar>&
Foam::fv::tabulatedHeatTransfer::hTable() Foam::fv::tabulatedHeatTransfer::hTable()
{ {
if (!hTable_.valid()) if (!hTable_)
{ {
hTable_.reset(new interpolation2DTable<scalar>(coeffs_)); hTable_.reset(new interpolation2DTable<scalar>(coeffs_));
} }
@ -62,7 +62,7 @@ Foam::fv::tabulatedHeatTransfer::hTable()
const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV() const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV()
{ {
if (!AoV_.valid()) if (!AoV_)
{ {
AoV_.reset AoV_.reset
( (

View File

@ -61,7 +61,7 @@ Foam::fv::tabulatedNTUHeatTransfer::geometryModelNames_
const Foam::interpolation2DTable<Foam::scalar>& const Foam::interpolation2DTable<Foam::scalar>&
Foam::fv::tabulatedNTUHeatTransfer::ntuTable() Foam::fv::tabulatedNTUHeatTransfer::ntuTable()
{ {
if (!ntuTable_.valid()) if (!ntuTable_)
{ {
ntuTable_.reset(new interpolation2DTable<scalar>(coeffs_)); ntuTable_.reset(new interpolation2DTable<scalar>(coeffs_));
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -343,7 +344,7 @@ void Foam::Cloud<ParticleType>::move
template<class ParticleType> template<class ParticleType>
void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper) void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
{ {
if (!globalPositionsPtr_.valid()) if (!globalPositionsPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Global positions are not available. " << "Global positions are not available. "

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -343,7 +343,7 @@ void Foam::ReactingCloud<CloudType>::info()
template<class CloudType> template<class CloudType>
void Foam::ReactingCloud<CloudType>::writeFields() const void Foam::ReactingCloud<CloudType>::writeFields() const
{ {
if (compositionModel_.valid()) if (compositionModel_)
{ {
CloudType::particleType::writeFields(*this, this->composition()); CloudType::particleType::writeFields(*this, this->composition());
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -279,7 +280,7 @@ void Foam::ReactingMultiphaseCloud<CloudType>::info()
template<class CloudType> template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::writeFields() const void Foam::ReactingMultiphaseCloud<CloudType>::writeFields() const
{ {
if (this->compositionModel_.valid()) if (this->compositionModel_)
{ {
CloudType::particleType::writeFields(*this, this->composition()); CloudType::particleType::writeFields(*this, this->composition());
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -123,7 +124,7 @@ template<class ParcelType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const
{ {
if (!GInterp_.valid()) if (!GInterp_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Radiation G interpolation object not set" << "Radiation G interpolation object not set"

View File

@ -447,7 +447,7 @@ void Foam::ParticleCollector<CloudType>::write()
sumTotalMass += faceMassTotal[facei]; sumTotalMass += faceMassTotal[facei];
sumAverageMFR += faceMassFlowRate[facei]; sumAverageMFR += faceMassFlowRate[facei];
if (outputFilePtr_.valid()) if (outputFilePtr_)
{ {
outputFilePtr_() outputFilePtr_()
<< time.timeName() << time.timeName()

View File

@ -33,7 +33,7 @@ License
template<class CloudType> template<class CloudType>
void Foam::ParticleErosion<CloudType>::resetQ() void Foam::ParticleErosion<CloudType>::resetQ()
{ {
if (QPtr_.valid()) if (QPtr_)
{ {
QPtr_->primitiveFieldRef() = 0.0; QPtr_->primitiveFieldRef() = 0.0;
} }
@ -82,7 +82,7 @@ Foam::label Foam::ParticleErosion<CloudType>::applyToPatch
template<class CloudType> template<class CloudType>
void Foam::ParticleErosion<CloudType>::write() void Foam::ParticleErosion<CloudType>::write()
{ {
if (QPtr_.valid()) if (QPtr_)
{ {
QPtr_->write(); QPtr_->write();
} }

View File

@ -36,7 +36,7 @@ License
template<class CloudType> template<class CloudType>
void Foam::ParticleTracks<CloudType>::write() void Foam::ParticleTracks<CloudType>::write()
{ {
if (cloudPtr_.valid()) if (cloudPtr_)
{ {
cloudPtr_->write(); cloudPtr_->write();
@ -94,7 +94,7 @@ void Foam::ParticleTracks<CloudType>::preEvolve
const typename parcelType::trackingData& td const typename parcelType::trackingData& td
) )
{ {
if (!cloudPtr_.valid()) if (!cloudPtr_)
{ {
cloudPtr_.reset cloudPtr_.reset
( (
@ -113,7 +113,7 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
|| this->owner().solution().transient() || this->owner().solution().transient()
) )
{ {
if (!cloudPtr_.valid()) if (!cloudPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cloud storage not allocated" << abort(FatalError); << "Cloud storage not allocated" << abort(FatalError);

View File

@ -81,9 +81,9 @@ void Foam::ParticleTrap<CloudType>::preEvolve
alphaPtr_ = &alpha; alphaPtr_ = &alpha;
} }
if (gradAlphaPtr_.valid()) if (gradAlphaPtr_)
{ {
gradAlphaPtr_() == fvc::grad(*alphaPtr_); *gradAlphaPtr_ == fvc::grad(*alphaPtr_);
} }
else else
{ {

View File

@ -33,7 +33,7 @@ License
template<class CloudType> template<class CloudType>
void Foam::VoidFraction<CloudType>::write() void Foam::VoidFraction<CloudType>::write()
{ {
if (thetaPtr_.valid()) if (thetaPtr_)
{ {
thetaPtr_->write(); thetaPtr_->write();
} }
@ -79,7 +79,7 @@ void Foam::VoidFraction<CloudType>::preEvolve
const typename parcelType::trackingData& td const typename parcelType::trackingData& td
) )
{ {
if (thetaPtr_.valid()) if (thetaPtr_)
{ {
thetaPtr_->primitiveFieldRef() = 0.0; thetaPtr_->primitiveFieldRef() = 0.0;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,7 @@ template<class CloudType>
inline const Foam::interpolation<Foam::vector>& inline const Foam::interpolation<Foam::vector>&
Foam::LiftForce<CloudType>::curlUcInterp() const Foam::LiftForce<CloudType>::curlUcInterp() const
{ {
if (!curlUcInterpPtr_.valid()) if (!curlUcInterpPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Carrier phase curlUc interpolation object not set" << "Carrier phase curlUc interpolation object not set"

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,7 @@ template<class CloudType>
inline const Foam::interpolation<Foam::vector>& inline const Foam::interpolation<Foam::vector>&
Foam::PressureGradientForce<CloudType>::DUcDtInterp() const Foam::PressureGradientForce<CloudType>::DUcDtInterp() const
{ {
if (!DUcDtInterpPtr_.valid()) if (!DUcDtInterpPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Carrier phase DUcDt interpolation object not set" << "Carrier phase DUcDt interpolation object not set"

View File

@ -154,7 +154,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
template<class CloudType> template<class CloudType>
Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape() Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
{ {
if (!massEscapePtr_.valid()) if (!massEscapePtr_)
{ {
const fvMesh& mesh = this->owner().mesh(); const fvMesh& mesh = this->owner().mesh();
@ -183,7 +183,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
template<class CloudType> template<class CloudType>
Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick() Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick()
{ {
if (!massStickPtr_.valid()) if (!massStickPtr_)
{ {
const fvMesh& mesh = this->owner().mesh(); const fvMesh& mesh = this->owner().mesh();

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -181,7 +182,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
points.last() = endPt; points.last() = endPt;
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {
@ -241,7 +242,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -193,7 +194,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
points.last() = endPt; points.last() = endPt;
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {
@ -253,7 +254,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -231,7 +231,7 @@ void Foam::blockFaces::projectFace::project
if (hits[i].hit()) if (hits[i].hit())
{ {
const point& hitPt = hits[i].hitPoint(); const point& hitPt = hits[i].hitPoint();
if (debugStr.valid()) if (debugStr)
{ {
debugStr().write(linePointRef(points[i], hitPt)); debugStr().write(linePointRef(points[i], hitPt));
} }
@ -299,7 +299,7 @@ void Foam::blockFaces::projectFace::project
} }
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {
@ -351,7 +351,7 @@ void Foam::blockFaces::projectFace::project
} }
} }
if (debugStr.valid()) if (debugStr)
{ {
forAll(points, i) forAll(points, i)
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -69,7 +70,7 @@ Foam::displacementMeshMoverMotionSolver::
Foam::externalDisplacementMeshMover& Foam::externalDisplacementMeshMover&
Foam::displacementMeshMoverMotionSolver::meshMover() const Foam::displacementMeshMoverMotionSolver::meshMover() const
{ {
if (!meshMoverPtr_.valid()) if (!meshMoverPtr_)
{ {
const word moverType(coeffDict().get<word>("meshMover")); const word moverType(coeffDict().get<word>("meshMover"));
@ -122,7 +123,7 @@ void Foam::displacementMeshMoverMotionSolver::movePoints(const pointField& p)
displacementMotionSolver::movePoints(p); displacementMotionSolver::movePoints(p);
// Update meshMover for new geometry // Update meshMover for new geometry
if (meshMoverPtr_.valid()) if (meshMoverPtr_)
{ {
meshMover().movePoints(p); meshMover().movePoints(p);
} }

View File

@ -1555,12 +1555,12 @@ void Foam::medialAxisMeshMover::calculateDisplacement
numThicknessRatioExclude++; numThicknessRatioExclude++;
} }
if (str.valid()) if (str)
{ {
const point& pt = mesh().points()[pointI]; const point& pt = mesh().points()[pointI];
str().write(linePointRef(pt, pt+patchDisp[patchPointI])); str().write(linePointRef(pt, pt+patchDisp[patchPointI]));
} }
if (medialVecStr.valid()) if (medialVecStr)
{ {
const point& pt = mesh().points()[pointI]; const point& pt = mesh().points()[pointI];
medialVecStr().write medialVecStr().write

View File

@ -2926,7 +2926,7 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
pointMap pointMap
); );
if (faceMap.valid()) if (faceMap)
{ {
// (ab)use the instance() to signal current modification time // (ab)use the instance() to signal current modification time
geometry[i].instance() = geometry[i].time().timeName(); geometry[i].instance() = geometry[i].time().timeName();

View File

@ -257,7 +257,7 @@ void Foam::meshRefinement::getIntersections
if (hit1[i].hit() && hit2[i].hit()) if (hit1[i].hit() && hit2[i].hit())
{ {
if (str.valid()) if (str)
{ {
str().write(linePointRef(start[i], hit1[i].rawPoint())); str().write(linePointRef(start[i], hit1[i].rawPoint()));
str().write str().write

View File

@ -416,7 +416,7 @@ void Foam::refinementFeatures::findHigherLevel
const Foam::PtrList<Foam::indexedOctree<Foam::treeDataEdge>>& const Foam::PtrList<Foam::indexedOctree<Foam::treeDataEdge>>&
Foam::refinementFeatures::regionEdgeTrees() const Foam::refinementFeatures::regionEdgeTrees() const
{ {
if (!regionEdgeTreesPtr_.valid()) if (!regionEdgeTreesPtr_)
{ {
regionEdgeTreesPtr_.reset regionEdgeTreesPtr_.reset
( (

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -834,7 +834,7 @@ void Foam::snappyLayerDriver::handleFeatureAngle
nFeats++; nFeats++;
if (str.valid()) if (str)
{ {
const point& p0 = pp.localPoints()[e[0]]; const point& p0 = pp.localPoints()[e[0]];
const point& p1 = pp.localPoints()[e[1]]; const point& p1 = pp.localPoints()[e[1]];
@ -3341,9 +3341,9 @@ void Foam::snappyLayerDriver::addLayers
// be done by snapping phase // be done by snapping phase
{ {
autoPtr<mapPolyMesh> map = meshRefiner_.dupNonManifoldBoundaryPoints(); autoPtr<mapPolyMesh> map = meshRefiner_.dupNonManifoldBoundaryPoints();
if (map.valid()) if (map)
{ {
const labelList& reverseFaceMap = map().reverseFaceMap(); const labelList& reverseFaceMap = map->reverseFaceMap();
forAll(baffles, i) forAll(baffles, i)
{ {
label f0 = reverseFaceMap[baffles[i].first()]; label f0 = reverseFaceMap[baffles[i].first()];
@ -3538,7 +3538,7 @@ void Foam::snappyLayerDriver::addLayers
regionSide regionSide
); );
if (map.valid()) if (map)
{ {
// Store point duplication // Store point duplication
pointToMaster.setSize(mesh.nPoints(), -1); pointToMaster.setSize(mesh.nPoints(), -1);
@ -4530,7 +4530,7 @@ void Foam::snappyLayerDriver::addLayers
autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster); autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster);
if (map.valid()) if (map)
{ {
inplaceReorder(map().reverseCellMap(), cellNLayers); inplaceReorder(map().reverseCellMap(), cellNLayers);
@ -4554,7 +4554,7 @@ void Foam::snappyLayerDriver::addLayers
true, // internal zones true, // internal zones
false // baffle zones false // baffle zones
); );
if (map.valid()) if (map)
{ {
inplaceReorder(map().reverseCellMap(), cellNLayers); inplaceReorder(map().reverseCellMap(), cellNLayers);

View File

@ -1478,7 +1478,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
// TBD: check if the attraction (to nearest) would attract // TBD: check if the attraction (to nearest) would attract
// good enough and not override attraction // good enough and not override attraction
if (gapStr.valid()) if (gapStr)
{ {
const point& intPt = hit2[pointi].hitPoint(); const point& intPt = hit2[pointi].hitPoint();
gapStr().write(linePointRef(pt, intPt)); gapStr().write(linePointRef(pt, intPt));
@ -1620,7 +1620,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
) )
) )
{ {
if (gapStr.valid()) if (gapStr)
{ {
const point& intPt = hit2[i].hitPoint(); const point& intPt = hit2[i].hitPoint();
gapStr().write(linePointRef(pt, intPt)); gapStr().write(linePointRef(pt, intPt));
@ -2982,7 +2982,7 @@ void Foam::snappySnapDriver::doSnap
false // baffle zones false // baffle zones
); );
if (mapPtr.valid()) if (mapPtr)
{ {
if (debug & meshRefinement::MESH) if (debug & meshRefinement::MESH)
{ {

View File

@ -1518,7 +1518,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
patchAttraction[pointi] = rawPatchAttraction[pointi]; patchAttraction[pointi] = rawPatchAttraction[pointi];
patchConstraints[pointi] = rawPatchConstraints[pointi]; patchConstraints[pointi] = rawPatchConstraints[pointi];
//if (multiPatchStr.valid()) //if (multiPatchStr)
//{ //{
// Pout<< "Adding constraint on multiPatchPoint:" // Pout<< "Adding constraint on multiPatchPoint:"
// << pp.localPoints()[pointi] // << pp.localPoints()[pointi]
@ -1571,7 +1571,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
patchConstraints[pointi] = pointConstraint(); patchConstraints[pointi] = pointConstraint();
nChanged++; nChanged++;
if (multiPatchStr.valid()) if (multiPatchStr)
{ {
multiPatchStr().write(pp.localPoints()[pointi]); multiPatchStr().write(pp.localPoints()[pointi]);
} }
@ -2514,7 +2514,7 @@ void Foam::snappySnapDriver::determineFeatures
if (info.hit()) if (info.hit())
{ {
// Dump // Dump
if (featureEdgeStr.valid()) if (featureEdgeStr)
{ {
featureEdgeStr().write featureEdgeStr().write
( (
@ -2524,7 +2524,7 @@ void Foam::snappySnapDriver::determineFeatures
} }
else else
{ {
if (missedEdgeStr.valid()) if (missedEdgeStr)
{ {
missedEdgeStr().write missedEdgeStr().write
( (
@ -2708,7 +2708,7 @@ void Foam::snappySnapDriver::determineFeatures
} }
else else
{ {
if (missedEdgeStr.valid()) if (missedEdgeStr)
{ {
missedEdgeStr().write missedEdgeStr().write
( (
@ -2927,7 +2927,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
pointStatus[e[0]] = 0; pointStatus[e[0]] = 0;
pointStatus[e[1]] = 0; pointStatus[e[1]] = 0;
if (baffleEdgeStr.valid()) if (baffleEdgeStr)
{ {
const point& p0 = pp.localPoints()[e[0]]; const point& p0 = pp.localPoints()[e[0]];
const point& p1 = pp.localPoints()[e[1]]; const point& p1 = pp.localPoints()[e[1]];
@ -3823,7 +3823,7 @@ void Foam::snappySnapDriver::preventFaceSqueeze
patchAttraction[pointi] = nearestAttraction[pointi]; patchAttraction[pointi] = nearestAttraction[pointi];
if (strPtr.valid()) if (strPtr)
{ {
strPtr().write strPtr().write
( (

View File

@ -286,7 +286,7 @@ void Foam::AMIInterpolation::agglomerate
} }
// Agglomerate weights and indices // Agglomerate weights and indices
if (targetMapPtr.valid()) if (targetMapPtr)
{ {
const mapDistribute& map = targetMapPtr(); const mapDistribute& map = targetMapPtr();

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +56,7 @@ class cyclicACMIPointPatchField
: :
public coupledPointPatchField<Type> public coupledPointPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclicACMI patch //- Local reference cast into the cyclicACMI patch
const cyclicACMIPointPatch& cyclicACMIPatch_; const cyclicACMIPointPatch& cyclicACMIPatch_;
@ -73,7 +74,7 @@ class cyclicACMIPointPatchField
//- Owner side patch interpolation //- Owner side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& ppi() const const PrimitivePatchInterpolation<primitivePatch>& ppi() const
{ {
if (!ppiPtr_.valid()) if (!ppiPtr_)
{ {
ppiPtr_.reset ppiPtr_.reset
( (
@ -90,7 +91,7 @@ class cyclicACMIPointPatchField
//- Neighbour side patch interpolation //- Neighbour side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
{ {
if (!nbrPpiPtr_.valid()) if (!nbrPpiPtr_)
{ {
nbrPpiPtr_.reset nbrPpiPtr_.reset
( (

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +56,7 @@ class cyclicAMIPointPatchField
: :
public coupledPointPatchField<Type> public coupledPointPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclicAMI patch //- Local reference cast into the cyclicAMI patch
const cyclicAMIPointPatch& cyclicAMIPatch_; const cyclicAMIPointPatch& cyclicAMIPatch_;
@ -73,7 +74,7 @@ class cyclicAMIPointPatchField
//- Owner side patch interpolation //- Owner side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& ppi() const const PrimitivePatchInterpolation<primitivePatch>& ppi() const
{ {
if (!ppiPtr_.valid()) if (!ppiPtr_)
{ {
ppiPtr_.reset ppiPtr_.reset
( (
@ -90,7 +91,7 @@ class cyclicAMIPointPatchField
//- Neighbour side patch interpolation //- Neighbour side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
{ {
if (!nbrPpiPtr_.valid()) if (!nbrPpiPtr_)
{ {
nbrPpiPtr_.reset nbrPpiPtr_.reset
( (

View File

@ -331,13 +331,13 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
label iter(0); label iter(0);
label nTransformsOld(nTransforms_); label nTransformsOld(nTransforms_);
if (ownStr.valid()) if (ownStr)
{ {
writeOBJ(thisPatch0, ownStr()); writeOBJ(thisPatch0, *ownStr);
} }
if (neiStr.valid()) if (neiStr)
{ {
writeOBJ(nbrPatch0, neiStr()); writeOBJ(nbrPatch0, *neiStr);
} }
@ -392,9 +392,9 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
AMIPtr_->append(thisPatch, nbrPatch0); AMIPtr_->append(thisPatch, nbrPatch0);
if (ownStr.valid()) if (ownStr)
{ {
writeOBJ(thisPatch, ownStr()); writeOBJ(thisPatch, *ownStr);
} }
} }
else else
@ -411,9 +411,9 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
AMIPtr_->append(thisPatch0, nbrPatch); AMIPtr_->append(thisPatch0, nbrPatch);
if (neiStr.valid()) if (neiStr)
{ {
writeOBJ(nbrPatch, neiStr()); writeOBJ(nbrPatch, *neiStr);
} }
} }
@ -445,15 +445,8 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
// Close debug streams // Close debug streams
if (ownStr.valid()) ownStr.reset(nullptr);
{ neiStr.reset(nullptr);
ownStr.clear();
}
if (neiStr.valid())
{
neiStr.clear();
}
// Average the number of transformations // Average the number of transformations

View File

@ -517,7 +517,7 @@ void Foam::mappedPatchBase::findSamples
void Foam::mappedPatchBase::calcMapping() const void Foam::mappedPatchBase::calcMapping() const
{ {
static bool hasWarned = false; static bool hasWarned = false;
if (mapPtr_.valid()) if (mapPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Mapping already calculated" << exit(FatalError); << "Mapping already calculated" << exit(FatalError);

View File

@ -605,7 +605,7 @@ Foam::meshSearch::~meshSearch()
const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const
{ {
if (!overallBbPtr_.valid()) if (!overallBbPtr_)
{ {
Random rndGen(261782); Random rndGen(261782);
overallBbPtr_.reset overallBbPtr_.reset
@ -628,7 +628,7 @@ const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const
const Foam::indexedOctree<Foam::treeDataFace>& const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::boundaryTree() const Foam::meshSearch::boundaryTree() const
{ {
if (!boundaryTreePtr_.valid()) if (!boundaryTreePtr_)
{ {
// All boundary faces (not just walls) // All boundary faces (not just walls)
labelList bndFaces labelList bndFaces
@ -662,7 +662,7 @@ Foam::meshSearch::boundaryTree() const
const Foam::indexedOctree<Foam::treeDataFace>& const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::nonCoupledBoundaryTree() const Foam::meshSearch::nonCoupledBoundaryTree() const
{ {
if (!nonCoupledBoundaryTreePtr_.valid()) if (!nonCoupledBoundaryTreePtr_)
{ {
// All non-coupled boundary faces (not just walls) // All non-coupled boundary faces (not just walls)
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -707,7 +707,7 @@ Foam::meshSearch::nonCoupledBoundaryTree() const
const Foam::indexedOctree<Foam::treeDataCell>& const Foam::indexedOctree<Foam::treeDataCell>&
Foam::meshSearch::cellTree() const Foam::meshSearch::cellTree() const
{ {
if (!cellTreePtr_.valid()) if (!cellTreePtr_)
{ {
cellTreePtr_.reset cellTreePtr_.reset
( (

View File

@ -697,7 +697,7 @@ bool Foam::searchableSurfaces::checkIntersection
<< " locations." << " locations."
<< endl; << endl;
if (setWriter.valid()) if (setWriter)
{ {
scalarField dist(mag(intersections)); scalarField dist(mag(intersections));
coordSet track coordSet track

View File

@ -204,7 +204,7 @@ const volVectorField& objectiveIncompressible::dJdv()
) )
); );
} }
return dJdvPtr_(); return *dJdvPtr_;
} }
@ -223,7 +223,7 @@ const volScalarField& objectiveIncompressible::dJdp()
) )
); );
} }
return dJdpPtr_(); return *dJdpPtr_;
} }
@ -242,7 +242,7 @@ const volScalarField& objectiveIncompressible::dJdT()
) )
); );
} }
return dJdTPtr_(); return *dJdTPtr_;
} }
@ -261,7 +261,7 @@ const volScalarField& objectiveIncompressible::dJdTMvar1()
) )
); );
} }
return dJdTMvar1Ptr_(); return *dJdTMvar1Ptr_;
} }
@ -280,7 +280,7 @@ const volScalarField& objectiveIncompressible::dJdTMvar2()
) )
); );
} }
return dJdTMvar2Ptr_(); return *dJdTMvar2Ptr_;
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,73 +32,73 @@ License
inline bool Foam::objectiveIncompressible::hasdJdv() const inline bool Foam::objectiveIncompressible::hasdJdv() const
{ {
return dJdvPtr_.valid(); return bool(dJdvPtr_);
} }
inline bool Foam::objectiveIncompressible::hasdJdp() const inline bool Foam::objectiveIncompressible::hasdJdp() const
{ {
return dJdpPtr_.valid(); return bool(dJdpPtr_);
} }
inline bool Foam::objectiveIncompressible::hasdJdT() const inline bool Foam::objectiveIncompressible::hasdJdT() const
{ {
return dJdTPtr_.valid(); return bool(dJdTPtr_);
} }
inline bool Foam::objectiveIncompressible::hasdJdTMVar1() const inline bool Foam::objectiveIncompressible::hasdJdTMVar1() const
{ {
return dJdTMvar1Ptr_.valid(); return bool(dJdTMvar1Ptr_);
} }
inline bool Foam::objectiveIncompressible::hasdJdTMVar2() const inline bool Foam::objectiveIncompressible::hasdJdTMVar2() const
{ {
return dJdTMvar2Ptr_.valid(); return bool(dJdTMvar2Ptr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdv() const inline bool Foam::objectiveIncompressible::hasBoundarydJdv() const
{ {
return bdJdvPtr_.valid(); return bool(bdJdvPtr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdvn() const inline bool Foam::objectiveIncompressible::hasBoundarydJdvn() const
{ {
return bdJdvnPtr_.valid(); return bool(bdJdvnPtr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdvt() const inline bool Foam::objectiveIncompressible::hasBoundarydJdvt() const
{ {
return bdJdvtPtr_.valid(); return bool(bdJdvtPtr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdp() const inline bool Foam::objectiveIncompressible::hasBoundarydJdp() const
{ {
return bdJdpPtr_.valid(); return bool(bdJdpPtr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdT() const inline bool Foam::objectiveIncompressible::hasBoundarydJdT() const
{ {
return bdJdTPtr_.valid(); return bool(bdJdTPtr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar1() const inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar1() const
{ {
return bdJdTMvar1Ptr_.valid(); return bool(bdJdTMvar1Ptr_);
} }
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar2() const inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar2() const
{ {
return bdJdTMvar2Ptr_.valid(); return bool(bdJdTMvar2Ptr_);
} }

Some files were not shown because too many files have changed in this diff Show More