diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/orderedPhasePair/orderedPhasePair.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/orderedPhasePair/orderedPhasePair.C index 65a87f642b..21b6214b4c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/orderedPhasePair/orderedPhasePair.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/orderedPhasePair/orderedPhasePair.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2015 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,7 +86,7 @@ Foam::word Foam::orderedPhasePair::name() const Foam::tmp Foam::orderedPhasePair::E() const { - if (!aspectRatio_.valid()) + if (!aspectRatio_) { FatalErrorInFunction << "Aspect ratio model not specified for " << *this << "." diff --git a/applications/test/autoPtr/Test-autoPtr.C b/applications/test/autoPtr/Test-autoPtr.C index d0b18a0dad..ed621ea0f2 100644 --- a/applications/test/autoPtr/Test-autoPtr.C +++ b/applications/test/autoPtr/Test-autoPtr.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,7 +44,7 @@ void testTransfer1(autoPtr ap) // Passed in copy, so automatically removes content // 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 ap) void testTransfer2(autoPtr&& ap) { // 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)); - Info<<"now have valid=" << Switch::name(list.valid()); + Info<<"now have valid=" << Switch::name(bool(list)); if (list) { @@ -209,9 +209,9 @@ int main(int argc, char *argv[]) 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 << flatOutput(*list) << " @ " << name(list->cdata()) @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) auto ptr1 = autoPtr::New(); auto ptr2 = autoPtr::New(); - Info<<"ptr valid: " << ptr1.valid() << nl; + Info<<"ptr valid: " << bool(ptr1) << nl; // Refuses to compile (good!): ptr1 = new labelList(10); diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index a37ac14a39..b4591c7721 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -137,9 +137,9 @@ label mergePatchFaces // Faces in error. labelHashSet errorFaces; - if (qualDictPtr.valid()) + if (qualDictPtr) { - motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces); + motionSmoother::checkMesh(false, mesh, *qualDictPtr, errorFaces); } else { @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) ); // Merge points on straight edges and remove unused points - if (qualDict.valid()) + if (qualDict) { Info<< "Merging all 'loose' points on surface edges, " << "regardless of the angle they make." << endl; diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 6a08caed38..7d0909ba5b 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -731,9 +731,9 @@ int main(int argc, char *argv[]) ); // Update - if (refDataPtr.valid()) + if (refDataPtr) { - refDataPtr().updateMesh(map()); + refDataPtr->updateMesh(map()); } // Store added cells @@ -896,9 +896,9 @@ int main(int argc, char *argv[]) updateFaceLabels(map(), backPatchFaces); updateCellSet(map(), addedCellsSet); - if (refDataPtr.valid()) + if (refDataPtr) { - refDataPtr().updateMesh(map()); + refDataPtr->updateMesh(map()); } // Move mesh (if inflation used) @@ -1029,9 +1029,9 @@ int main(int argc, char *argv[]) // Update local data updateCellSet(map(), addedCellsSet); - if (refDataPtr.valid()) + if (refDataPtr) { - refDataPtr().updateMesh(map()); + refDataPtr->updateMesh(map()); } // Move mesh (if inflation used) @@ -1067,9 +1067,9 @@ int main(int argc, char *argv[]) } } - if (refDataPtr.valid()) + if (refDataPtr) { - refDataPtr().write(); + refDataPtr->write(); } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index f1a6b5ff3f..90268fdf4b 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -539,7 +539,7 @@ Foam::label Foam::checkGeometry << nonAlignedPoints.name() << endl; nonAlignedPoints.instance() = mesh.pointsInstance(); nonAlignedPoints.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, nonAlignedPoints); } @@ -573,7 +573,7 @@ Foam::label Foam::checkGeometry << " non closed cells to set " << cells.name() << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -589,7 +589,7 @@ Foam::label Foam::checkGeometry << aspectCells.name() << endl; aspectCells.instance() = mesh.pointsInstance(); aspectCells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, aspectCells); } @@ -610,7 +610,7 @@ Foam::label Foam::checkGeometry << " zero area faces to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -632,7 +632,7 @@ Foam::label Foam::checkGeometry << " zero volume cells to set " << cells.name() << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -655,7 +655,7 @@ Foam::label Foam::checkGeometry << " non-orthogonal faces to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -677,7 +677,7 @@ Foam::label Foam::checkGeometry << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -699,7 +699,7 @@ Foam::label Foam::checkGeometry << " skew faces to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -723,7 +723,7 @@ Foam::label Foam::checkGeometry << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -756,7 +756,7 @@ Foam::label Foam::checkGeometry << "decomposition tets to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -781,7 +781,7 @@ Foam::label Foam::checkGeometry << endl; points.instance() = mesh.pointsInstance(); points.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, points); } @@ -804,7 +804,7 @@ Foam::label Foam::checkGeometry << " apart) points to set " << nearPoints.name() << endl; nearPoints.instance() = mesh.pointsInstance(); nearPoints.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, nearPoints); } @@ -828,7 +828,7 @@ Foam::label Foam::checkGeometry << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -851,7 +851,7 @@ Foam::label Foam::checkGeometry << " warped faces to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -872,7 +872,7 @@ Foam::label Foam::checkGeometry << " under-determined cells to set " << cells.name() << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -892,7 +892,7 @@ Foam::label Foam::checkGeometry << " concave cells to set " << cells.name() << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -913,7 +913,7 @@ Foam::label Foam::checkGeometry << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -934,7 +934,7 @@ Foam::label Foam::checkGeometry << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -949,7 +949,7 @@ Foam::label Foam::checkGeometry const word procAndTime(Foam::name(Pstream::myProcNo()) + "_" + tmName); autoPtr patchWriter; - if (!surfWriter.valid()) + if (!surfWriter) { patchWriter.reset(new surfaceWriters::vtkWriter()); } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C b/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C index 26dfbb6d20..d97308d6ec 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C @@ -30,7 +30,7 @@ Foam::label Foam::checkMeshQuality faces.instance() = mesh.pointsInstance(); faces.write(); - if (writer.valid()) + if (writer) { mergeAndWrite(*writer, faces); } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index ebb2a62255..cfd0a579fa 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -202,7 +202,7 @@ Foam::label Foam::checkTopology << " illegal cells to set " << cells.name() << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -226,7 +226,7 @@ Foam::label Foam::checkTopology << " unused points to set " << points.name() << endl; points.instance() = mesh.pointsInstance(); points.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, points); } @@ -248,7 +248,7 @@ Foam::label Foam::checkTopology << " unordered faces to set " << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -268,7 +268,7 @@ Foam::label Foam::checkTopology << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -289,7 +289,7 @@ Foam::label Foam::checkTopology << endl; cells.instance() = mesh.pointsInstance(); cells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, cells); } @@ -313,7 +313,7 @@ Foam::label Foam::checkTopology << faces.name() << endl; faces.instance() = mesh.pointsInstance(); faces.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, faces); } @@ -368,7 +368,7 @@ Foam::label Foam::checkTopology << endl; oneCells.instance() = mesh.pointsInstance(); oneCells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, oneCells); } @@ -384,7 +384,7 @@ Foam::label Foam::checkTopology << endl; twoCells.instance() = mesh.pointsInstance(); twoCells.write(); - if (surfWriter.valid()) + if (surfWriter) { mergeAndWrite(*surfWriter, twoCells); } @@ -529,7 +529,7 @@ Foam::label Foam::checkTopology << " points that are in multiple regions to set " << points.name() << endl; points.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, points); } @@ -640,7 +640,7 @@ Foam::label Foam::checkTopology << " conflicting points to set " << points.name() << endl; points.instance() = mesh.pointsInstance(); points.write(); - if (setWriter.valid()) + if (setWriter) { mergeAndWrite(*setWriter, points); } diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index 18d47f32ff..0abc91fb28 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1035,9 +1036,9 @@ void Foam::meshDualiser::setRefinement -1, //masterCellID, -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 mesh_.cellZones().whichZone(pCells[pCelli]) //zoneID ); - if (dualCcStr.valid()) + if (dualCcStr) { meshTools::writeOBJ ( - dualCcStr(), + *dualCcStr, 0.5*(mesh_.points()[pointi]+cellCentres[pCells[pCelli]]) ); } @@ -1104,9 +1105,9 @@ void Foam::meshDualiser::setRefinement -1 //zoneID ); - if (dualCcStr.valid()) + if (dualCcStr) { - meshTools::writeOBJ(dualCcStr(), mesh_.points()[pointi]); + meshTools::writeOBJ(*dualCcStr, mesh_.points()[pointi]); } } } diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index e0e60be11c..1473bf293f 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2018 OpenFOAM Foundation - Copyright (C) 2017-2018 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -393,9 +393,9 @@ bool doCommand currentSet.resize(max(currentSet.size(), typSize)); } - if (currentSetPtr.valid()) + if (currentSetPtr) { - topoSet& currentSet = currentSetPtr(); + topoSet& currentSet = *currentSetPtr; Info<< " Set:" << currentSet.name() << " Size:" << returnReduce(currentSet.size(), sumOp