From 12c91b9472eee094b36150f5d74ade19e485271f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Jul 2020 08:50:57 +0200 Subject: [PATCH] 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()) --- .../orderedPhasePair/orderedPhasePair.C | 3 +- applications/test/autoPtr/Test-autoPtr.C | 14 ++--- .../combinePatchFaces/combinePatchFaces.C | 6 +- .../extrude/extrudeMesh/extrudeMesh.C | 16 ++--- .../manipulation/checkMesh/checkGeometry.C | 38 ++++++------ .../manipulation/checkMesh/checkMeshQuality.C | 2 +- .../manipulation/checkMesh/checkTopology.C | 22 +++---- .../manipulation/polyDualMesh/meshDualiser.C | 13 +++-- .../mesh/manipulation/setSet/setSet.C | 10 ++-- .../mesh/manipulation/topoSet/topoSet.C | 4 +- .../foamFormatConvert/foamFormatConvert.C | 4 +- .../decomposePar/domainDecomposition.C | 6 +- .../redistributePar/redistributePar.C | 10 ++-- .../foamToVTK/convertProcessorPatches.H | 4 +- .../foamToVTK/convertVolumeFields.H | 6 +- .../dataConversion/foamToVTK/writeDimFields.H | 2 +- .../foamToVTK/writePointFields.H | 4 +- .../dataConversion/foamToVTK/writeVolFields.H | 2 +- .../lumpedPointZones/lumpedPointZones.C | 4 +- .../setExprFields/setExprFields.C | 6 +- .../surface/surfaceCheck/surfaceCheck.C | 14 ++--- .../surfaceFeatureExtract.C | 6 +- .../surfaceMeshExport/surfaceMeshExport.C | 4 +- src/OpenFOAM/db/IOobjectList/IOobjectList.C | 6 +- .../functionObjectList/functionObjectList.C | 12 ++-- .../db/functionObjects/writeFile/writeFile.C | 2 +- src/OpenFOAM/db/regIOobject/regIOobjectRead.C | 6 +- .../expressions/exprResult/exprResult.C | 4 +- .../expressions/exprResult/exprResultI.H | 4 +- .../codedFixedValuePointPatchField.C | 4 +- src/OpenFOAM/global/argList/argList.C | 2 +- .../interpolationTable/interpolationTable.C | 2 +- .../GAMGAgglomeration/GAMGAgglomeration.H | 4 +- .../procFacesGAMGProcAgglomeration.C | 6 +- .../polyMesh/globalMeshData/globalMeshData.C | 58 +++++++++---------- .../meshes/polyMesh/mapPolyMesh/mapPolyMesh.H | 3 +- .../polyBoundaryMesh/polyBoundaryMesh.C | 6 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 30 +++++----- src/OpenFOAM/meshes/polyMesh/polyMeshClear.C | 4 +- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 2 +- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 8 +-- .../constraint/processor/processorPolyPatch.C | 6 +- .../RAS/mixtureKEpsilon/mixtureKEpsilon.C | 2 +- .../codedFixedValueFvPatchField.C | 4 +- .../codedMixed/codedMixedFvPatchField.C | 4 +- .../fixedProfile/fixedProfileFvPatchField.C | 3 +- .../freestream/freestreamFvPatchField.C | 14 ++--- .../uniformFixedGradientFvPatchField.C | 2 +- .../surfaceFieldValue/surfaceFieldValue.C | 16 ++--- .../surfaceFieldValueTemplates.C | 8 +-- .../regionSizeDistribution.C | 2 +- .../codedFunctionObject/codedFunctionObject.C | 4 +- .../utilities/ensightWrite/ensightWrite.C | 2 +- .../ensightWrite/ensightWriteUpdate.C | 10 ++-- .../utilities/vtkWrite/vtkWrite.C | 6 +- .../utilities/vtkWrite/vtkWriteTemplates.C | 2 +- ...lacementComponentLaplacianFvMotionSolver.C | 2 +- .../displacementLaplacianFvMotionSolver.C | 6 +- ...dBodyDisplacementLaplacianFvMotionSolver.C | 6 +- ...meVaryingMappedFixedValuePointPatchField.C | 4 +- ...polatedDisplacementPointPatchVectorField.C | 4 +- .../interRegionOption/interRegionOptionI.H | 3 +- .../jouleHeatingSourceTemplates.C | 4 +- .../rotorDiskSourceTemplates.C | 4 +- .../sources/general/codedSource/CodedSource.C | 4 +- .../interRegionHeatTransferModelI.H | 3 +- .../tabulatedHeatTransfer.C | 4 +- .../tabulatedNTUHeatTransfer.C | 2 +- src/lagrangian/basic/Cloud/Cloud.C | 3 +- .../Templates/ReactingCloud/ReactingCloud.C | 4 +- .../ReactingMultiphaseCloud.C | 3 +- .../ThermoParcel/ThermoParcelTrackingDataI.H | 3 +- .../ParticleCollector/ParticleCollector.C | 2 +- .../ParticleErosion/ParticleErosion.C | 4 +- .../ParticleTracks/ParticleTracks.C | 8 +-- .../ParticleTrap/ParticleTrap.C | 4 +- .../VoidFraction/VoidFraction.C | 4 +- .../Lift/LiftForce/LiftForceI.H | 3 +- .../PressureGradient/PressureGradientForceI.H | 3 +- .../LocalInteraction/LocalInteraction.C | 4 +- .../projectCurveEdge/projectCurveEdge.C | 5 +- .../blockEdges/projectEdge/projectEdge.C | 5 +- .../blockFaces/projectFace/projectFace.C | 8 +-- .../displacementMeshMoverMotionSolver.C | 5 +- .../medialAxisMeshMover.C | 4 +- .../meshRefinement/meshRefinement.C | 2 +- .../meshRefinement/meshRefinementBaffles.C | 2 +- .../refinementFeatures/refinementFeatures.C | 2 +- .../snappyHexMeshDriver/snappyLayerDriver.C | 14 ++--- .../snappyHexMeshDriver/snappySnapDriver.C | 6 +- .../snappySnapDriverFeature.C | 14 ++--- .../AMIInterpolation/AMIInterpolation.C | 2 +- .../cyclicACMIPointPatchField.H | 7 ++- .../cyclicAMIPointPatchField.H | 7 ++- .../cyclicPeriodicAMIPolyPatch.C | 27 ++++----- .../mappedPolyPatch/mappedPatchBase.C | 2 +- src/meshTools/meshSearch/meshSearch.C | 8 +-- .../searchableSurfaces/searchableSurfaces.C | 2 +- .../objectiveIncompressible.C | 10 ++-- .../objectiveIncompressibleI.H | 26 ++++----- .../adjoint/objectives/objective/objective.C | 20 +++---- .../adjoint/objectives/objective/objectiveI.H | 26 ++++----- .../FIBase/FIBaseIncompressible.C | 2 +- .../adjointMeshMovementSolverIncompressible.C | 2 +- .../adjointSensitivityIncompressible.C | 2 +- .../sensitivitySurfaceIncompressible.C | 4 +- .../sensitivitySurfacePointsIncompressible.C | 4 +- .../sensitivity/sensitivity.C | 6 +- .../shapeSensitivitiesBase.C | 30 +++++----- .../steadyOptimisation/steadyOptimisation.C | 4 +- .../optimisationTypeIncompressible.C | 4 +- .../shapeOptimisationIncompressible.C | 2 +- .../NURBS3DVolume/NURBS3DVolume.C | 2 +- .../adjointRASModel/adjointRASModel.C | 12 ++-- .../cellVolumeWeightCellCellStencil.C | 10 ++-- .../cellVolumeWeightCellCellStencil.H | 2 +- .../inverseDistanceCellCellStencil.H | 4 +- .../decompose/decompose/decompositionModel.H | 4 +- .../distributedTriSurfaceMesh.C | 8 +-- .../exact/exactPatchDistMethod.C | 4 +- .../BlendedInterfacialModel.C | 6 +- ...terfaceCompositionPhaseChangePhaseSystem.C | 2 +- .../TwoResistanceHeatTransferPhaseSystem.C | 4 +- .../phaseSystem/phaseSystemTemplates.C | 4 +- .../regionModel/regionModel/regionModel.C | 2 +- .../regionModel/regionModel/regionModelI.H | 5 +- .../regionModel1D/regionModel1DI.H | 3 +- .../singleLayerRegion/singleLayerRegion.C | 5 +- .../sampledSet/patchSeed/patchSeedSet.C | 4 +- .../sampledSet/shortestPath/shortestPathSet.C | 7 +-- .../isoSurface/sampledIsoSurface.C | 8 +-- .../isoSurface/sampledIsoSurfaceTemplates.C | 6 +- .../readers/ensight/ensightSurfaceReader.C | 2 +- .../sampledCuttingPlaneTemplates.C | 6 +- .../sampledSurfacesTemplates.C | 2 +- .../SLGThermo/SLGThermo/SLGThermo.C | 9 +-- .../radiativeIntensityRay.C | 4 +- .../radiationModel/radiationModel.C | 6 +- .../dynamicMotionSolverTopoFvMesh.C | 4 +- .../linearValveFvMesh/linearValveFvMesh.C | 4 +- .../linearValveLayersFvMesh.C | 4 +- .../mixerFvMesh/mixerFvMesh.C | 2 +- .../movingConeTopoFvMesh.C | 2 +- .../rawTopoChangerFvMesh.C | 3 +- 144 files changed, 483 insertions(+), 470 deletions(-) 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