From 945e3e41b174bcdbdac0ec772d141be176878dfa Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 19 Jul 2023 13:47:19 +0200 Subject: [PATCH] ENH: more consistent use of good() or direct testing instead valid() --- .../rhoCentralFoam/directionInterpolate.H | 2 +- .../coordinateSystem/Test-coordinateSystem.C | 2 +- .../mesh/generation/blockMesh/blockMesh.C | 2 +- .../extrude/extrudeMesh/extrudeMesh.C | 2 +- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 2 +- .../DelaunayMesh/DelaunayMeshI.H | 2 +- .../PrintTable/PrintTable.C | 2 +- .../conformalVoronoiMeshIO.C | 2 +- .../helpTypes/helpBoundary/helpBoundary.C | 4 +-- .../helpFunctionObject/helpFunctionObject.C | 2 +- .../helpTypes/helpSolver/helpSolver.C | 2 +- .../db/dynamicLibrary/codedBase/codedBase.C | 2 +- src/OpenFOAM/dimensionSet/dimensionSetIO.C | 2 +- src/OpenFOAM/meshes/polyMesh/polyMesh.H | 2 +- .../constraint/cyclic/cyclicPolyPatch.C | 4 +-- .../PrimitivePatch/PrimitivePatchMeshEdges.C | 2 +- .../primitives/ranges/IntRange/IntRange.H | 7 +++-- .../primitives/ranges/labelRange/labelRange.H | 6 ++-- .../primitives/subModelBase/subModelBase.C | 4 +-- .../nutWallFunctionFvPatchScalarField.C | 4 +-- .../jouleHeatingSourceTemplates.C | 2 +- .../cfdTools/general/MRF/MRFZone.C | 2 +- .../expressions/base/fvExprDriverIO.C | 2 +- .../mappedMixedFieldFvPatchField.C | 2 +- .../mappedMixed/mappedMixedFvPatchField.C | 2 +- ...IDControlInletVelocityFvPatchVectorField.C | 4 +-- .../extractEulerianParticles.C | 2 +- .../histogramModel/histogramModel.C | 2 +- src/functionObjects/field/norm/norm.C | 4 +-- .../resolutionIndexModel.C | 2 +- .../forces/forceCoeffs/forceCoeffs.C | 2 +- src/functionObjects/forces/forces/forces.C | 4 +-- .../sizeDistribution/sizeDistribution.C | 2 +- .../minMaxCondition/minMaxCondition.C | 2 +- .../limitTemperature/limitTemperature.C | 2 +- .../submodels/CloudSubModelBase.C | 2 +- src/mesh/blockMesh/PDRblockMesh/PDRblock.H | 6 ++-- src/mesh/blockMesh/PDRblockMesh/PDRblockI.H | 6 ++-- .../blockDescriptor/blockDescriptorEdges.C | 4 +-- src/mesh/blockMesh/blockMesh/blockMeshCheck.C | 2 +- .../meshRefinement/meshRefinementBaffles.C | 8 +++--- .../meshRefinement/meshRefinementBlock.C | 4 +-- .../refinementSurfaces/surfaceZonesInfo.C | 2 +- .../refinementParameters.C | 16 +++-------- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 2 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 10 +++---- .../mappedPolyPatch/mappedPatchBase.C | 4 +-- .../mappedPolyPatch/mappedPatchBaseI.H | 4 +-- .../distributedDICPreconditioner.C | 8 +++--- .../distributedDILUPreconditioner.C | 28 +++++++++---------- .../multiWorld/multiWorldConnectionsObject.C | 10 +++---- .../searchableBox/searchableBox.C | 4 +-- .../searchableSphere/searchableSphere.C | 2 +- .../triSurfaceTools/triSurfaceTools.C | 4 +-- .../objectiveManager/objectiveManager.C | 2 +- .../shapeSensitivitiesBase.C | 2 +- .../optMeshMovement/optMeshMovement.C | 2 +- .../NURBS/NURBS3DSurface/NURBS3DSurface.C | 2 +- .../adjointSimple/adjointSimple.C | 2 +- .../sampledCuttingPlane/sampledCuttingPlane.C | 4 +-- .../sampledPlane/sampledPlane.C | 2 +- .../surface/cutting/cuttingPlaneSelection.C | 2 +- .../cutting/cuttingSurfaceBaseSelection.C | 2 +- .../surface/isoSurface/isoSurfaceBase.C | 2 +- .../surface/isoSurface/isoSurfaceCell.C | 6 ++-- .../surface/isoSurface/isoSurfacePoint.C | 6 ++-- src/surfMesh/triSurface/triSurface.C | 2 +- src/surfMesh/triSurface/triSurfaceStitch.C | 2 +- src/surfMesh/writers/common/surfaceWriter.C | 4 +-- src/surfMesh/writers/x3d/x3dSurfaceWriter.C | 4 +-- ...eratureRadCoupledMixedFvPatchScalarField.C | 2 +- .../moleFractions/moleFractions.C | 20 ++++++------- 72 files changed, 139 insertions(+), 148 deletions(-) diff --git a/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H b/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H index bc94840d1f..1fdd9e56f0 100644 --- a/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H +++ b/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H @@ -17,7 +17,7 @@ tmp> interpolate vf, dir, "reconstruct(" - + (reconFieldName != word::null ? reconFieldName : vf.name()) + + (reconFieldName.empty() ? vf.name() : reconFieldName) + ')' ) ); diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C index 87de9f270b..afbd693601 100644 --- a/applications/test/coordinateSystem/Test-coordinateSystem.C +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -61,7 +61,7 @@ void basicTests(const coordinateSystem& cs) if (const auto* cartptr = isA(cs)) { - if (!cartptr->valid()) + if (!cartptr->good()) { Info<< "invalid cartesian = " << (*cartptr) << " with: " << (*cartptr).R() << nl; diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index 52942def33..a033155052 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) blockMesh blocks(meshDict, regionName, strategy, args.verbose()); - if (!blocks.valid()) + if (!blocks.good()) { // Could/should be Fatal? diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 05e0748824..06823eb738 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -979,7 +979,7 @@ int main(int argc, char *argv[]) // Change the front and back patch types as required // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - word frontBackType(word::null); + word frontBackType; if (isType(model())) { diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 320a1127f0..ab9b2657aa 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -947,7 +947,7 @@ void addZoneSidePatches forAll(zoneSidePatch, zoneI) { - if (oneDPolyPatchType != word::null) + if (!oneDPolyPatchType.empty()) { // Reuse single empty patch. word patchName; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H index e93afa3904..18e74bf34e 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H @@ -47,7 +47,7 @@ void Foam::DelaunayMesh::timeCheck << time().elapsedCpuTime() << " s, " << "delta " << time().cpuTimeIncrement()<< " s"; - if (description != word::null) + if (!description.empty()) { Info<< ", " << description << " "; } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/PrintTable/PrintTable.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/PrintTable/PrintTable.C index c04202eee5..366273ca64 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/PrintTable/PrintTable.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/PrintTable/PrintTable.C @@ -33,7 +33,7 @@ template Foam::PrintTable::PrintTable() : table_(), - title_(string::null) + title_() {} diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 79a571f7f8..d312a57f43 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -65,7 +65,7 @@ void Foam::conformalVoronoiMesh::timeCheck << runTime.elapsedCpuTime() << " s, " << "delta " << runTime.cpuTimeIncrement()<< " s"; - if (description != word::null) + if (!description.empty()) { Info<< ", " << description << " "; } diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C index 37451b1f83..c532211f0f 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C @@ -92,8 +92,8 @@ void Foam::helpTypes::helpBoundary::execute { setEnv("FOAM_ABORT", "", true); - word condition(word::null); - word fieldName(word::null); + word condition; + word fieldName; if (args.readIfPresent("browse", condition)) { diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C index 6f71ec9648..feba05f4bf 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C @@ -72,7 +72,7 @@ void Foam::helpTypes::helpFunctionObject::execute const fvMesh& mesh ) { - word function(word::null); + word function; if (args.readIfPresent("browse", function)) { diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C index 7dfd6a57e8..cd5b11e2c5 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C @@ -80,7 +80,7 @@ void Foam::helpTypes::helpSolver::execute const fvMesh& mesh ) { - word solver(word::null); + word solver; if (args.readIfPresent("browse", solver)) { diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C index 69a71fcedb..7d57638c0d 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C @@ -348,7 +348,7 @@ void Foam::codedBase::updateLibrary void Foam::codedBase::updateLibrary(const word& name) const { - if (context_.valid()) + if (context_.good()) { updateLibrary(name, context_); } diff --git a/src/OpenFOAM/dimensionSet/dimensionSetIO.C b/src/OpenFOAM/dimensionSet/dimensionSetIO.C index 4e3301a21a..ec258be631 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSetIO.C +++ b/src/OpenFOAM/dimensionSet/dimensionSetIO.C @@ -671,7 +671,7 @@ Foam::Ostream& Foam::dimensionSet::write os << token::BEGIN_SQR; - if (writeUnits.valid() && os.format() == IOstreamOption::ASCII) + if (writeUnits.good() && os.format() == IOstreamOption::ASCII) { scalarField exponents(dimensionSet::nDimensions); for (int d=0; d < dimensionSet::nDimensions; ++d) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index b9968d7b4f..1d5a9ed081 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -639,7 +639,7 @@ public: // (so does e.g. parallel communication). If not use // validBoundary=false // - // \note Only autoPtr parameters that test as valid() are used + // \note Only autoPtr parameters that test as good() are used // for resetting, otherwise the existing entries are left // untouched. void resetPrimitives diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index b64c0b6ee4..b2e912e00f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -601,7 +601,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch ) : coupledPolyPatch(name, size, start, index, bm, patchType, transform), - neighbPatchName_(word::null), + neighbPatchName_(), neighbPatchID_(-1), rotationAxis_(Zero), rotationCentre_(Zero), @@ -661,7 +661,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch coupledPointsPtr_(nullptr), coupledEdgesPtr_(nullptr) { - if (neighbPatchName_ == word::null && !coupleGroup_.valid()) + if (neighbPatchName_.empty() && !coupleGroup_.good()) { FatalIOErrorInFunction(dict) << "No \"neighbourPatch\" provided." << endl diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C index 95ead63f5c..5c91803d2a 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C @@ -184,7 +184,7 @@ Foam::PrimitivePatch::findEdge const edge& e ) const { - if (e.valid() && e.first() < nPoints() && e.second() < nPoints()) + if (e.good() && e.first() < nPoints() && e.second() < nPoints()) { // Get pointEdges from the starting point and search all the candidates const edgeList& myEdges = this->edges(); diff --git a/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H b/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H index 1ff6ca1cc3..7b6de4b07c 100644 --- a/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H +++ b/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H @@ -160,6 +160,9 @@ public: //- True if range is empty (zero-sized) bool empty() const noexcept { return !size_; } + //- True if range has size greater than zero + bool good() const noexcept { return (size_ > 0); } + //- The size of the range IntType size() const noexcept { return size_; } @@ -243,8 +246,8 @@ public: //- Decrease the size by n, but never below 0. inline IntType operator-=(const IntType n) noexcept; - //- True if range is non-empty - explicit operator bool() const noexcept { return bool(size_); } + //- True if range has size greater than zero. Same as good() + explicit operator bool() const noexcept { return (size_ > 0); } // Iterator ranges diff --git a/src/OpenFOAM/primitives/ranges/labelRange/labelRange.H b/src/OpenFOAM/primitives/ranges/labelRange/labelRange.H index c162839034..585458166f 100644 --- a/src/OpenFOAM/primitives/ranges/labelRange/labelRange.H +++ b/src/OpenFOAM/primitives/ranges/labelRange/labelRange.H @@ -162,10 +162,10 @@ public: // Housekeeping - //- Deprecated(2020-09) True if range is non-empty + //- Deprecated(2020-09) True if range has size greater than zero // - // \deprecated(2020-09) - use bool operator - bool valid() const noexcept { return !empty(); } + // \deprecated(2020-09) - use bool operator - or good() + bool valid() const noexcept { return good(); } }; diff --git a/src/OpenFOAM/primitives/subModelBase/subModelBase.C b/src/OpenFOAM/primitives/subModelBase/subModelBase.C index 913192339f..eb0aa4b74f 100644 --- a/src/OpenFOAM/primitives/subModelBase/subModelBase.C +++ b/src/OpenFOAM/primitives/subModelBase/subModelBase.C @@ -32,7 +32,7 @@ License bool Foam::subModelBase::subModelBase::inLine() const { - return (modelName_ != word::null); + return (!modelName_.empty()); } @@ -171,7 +171,7 @@ bool Foam::subModelBase::writeTime() const Foam::fileName Foam::subModelBase::localPath() const { - if (modelName_ != word::null) + if (!modelName_.empty()) { return modelName_; } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C index 57fe187189..fbb581652a 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C @@ -61,7 +61,7 @@ const Foam::volVectorField& Foam::nutWallFunctionFvPatchScalarField::U const turbulenceModel& turb ) const { - if (UName_ == word::null) + if (UName_.empty()) { return turb.U(); } @@ -89,7 +89,7 @@ Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - UName_(word::null), + UName_(), wallCoeffs_() { checkType(); diff --git a/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C b/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C index 405453f521..2216b0b6a3 100644 --- a/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C +++ b/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C @@ -100,7 +100,7 @@ Foam::fa::jouleHeatingSource::updateSigma typeName + ":sigma_" + regionName_ ); - if (!sigmaVsTPtr.valid()) + if (!sigmaVsTPtr) { // Electrical conductivity field, sigma, was specified by the user return sigma; diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 4244ee7f79..6536c1b0c8 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -567,7 +567,7 @@ bool Foam::MRFZone::read(const dictionary& dict) omega_.reset(Function1::New("omega", coeffs_, &mesh_)); const word oldCellZoneName = cellZoneName_; - if (cellZoneName_ == word::null) + if (cellZoneName_.empty()) { coeffs_.readEntry("cellZone", cellZoneName_); } diff --git a/src/finiteVolume/expressions/base/fvExprDriverIO.C b/src/finiteVolume/expressions/base/fvExprDriverIO.C index 69badfa7a6..9a8cc7fd9f 100644 --- a/src/finiteVolume/expressions/base/fvExprDriverIO.C +++ b/src/finiteVolume/expressions/base/fvExprDriverIO.C @@ -107,7 +107,7 @@ Foam::expressions::fvExprDriver::getTopoSetLabels } - if (selected.valid()) + if (selected.good()) { return selected; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C index 884cddd15f..d0a225f0e4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C @@ -41,7 +41,7 @@ Foam::mappedMixedFieldFvPatchField::mappedMixedFieldFvPatchField mixedFvPatchField(p, iF), mappedPatchBase(p.patch()), mappedPatchFieldBase(*this, *this), - weightFieldName_(word::null) + weightFieldName_() { this->refValue() = Zero; this->refGrad() = Zero; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C index 4249c7d443..f3d9870e0d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C @@ -45,7 +45,7 @@ Foam::mappedMixedFvPatchField::mappedMixedFvPatchField mappedFixedValueFvPatchField::mapper(p, iF), *this ), - weightFieldName_(word::null) + weightFieldName_() { this->refValue() = Zero; this->refGrad() = Zero; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressurePIDControlInletVelocity/pressurePIDControlInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressurePIDControlInletVelocity/pressurePIDControlInletVelocityFvPatchVectorField.C index 46e5bce753..84c265f990 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressurePIDControlInletVelocity/pressurePIDControlInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressurePIDControlInletVelocity/pressurePIDControlInletVelocityFvPatchVectorField.C @@ -72,8 +72,8 @@ pressurePIDControlInletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF), - upstreamName_(word::null), - downstreamName_(word::null), + upstreamName_(), + downstreamName_(), deltaP_(1), shapeFactor_(0), pName_("p"), diff --git a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C index e7c86f2b12..3829d78322 100644 --- a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C +++ b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C @@ -453,7 +453,7 @@ Foam::functionObjects::extractEulerianParticles::extractEulerianParticles fvMeshFunctionObject(name, runTime, dict), writeFile(runTime, name), cloud_(mesh_, "eulerianParticleCloud"), - faceZoneName_(word::null), + faceZoneName_(), zoneID_(-1), patchIDs_(), patchFaceIDs_(), diff --git a/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C b/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C index 4e57b40e34..790f5c2348 100644 --- a/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C +++ b/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C @@ -126,7 +126,7 @@ Foam::histogramModel::histogramModel : writeFile(mesh, name, "histogram", dict), mesh_(mesh), - fieldName_(word::null) + fieldName_() {} diff --git a/src/functionObjects/field/norm/norm.C b/src/functionObjects/field/norm/norm.C index af0b208ce0..fd371682bb 100644 --- a/src/functionObjects/field/norm/norm.C +++ b/src/functionObjects/field/norm/norm.C @@ -88,7 +88,7 @@ Foam::functionObjects::norm::norm fieldExpression(name, runTime, dict), norm_(normType::L1), divisorPtr_(nullptr), - divisorFieldName_(word::null), + divisorFieldName_(), p_(-1) { read(dict); @@ -127,7 +127,7 @@ bool Foam::functionObjects::norm::read(const dictionary& dict) { divisorFieldName_ = dict.get("divisorField"); - if (divisorFieldName_ == word::null) + if (divisorFieldName_.empty()) { FatalIOErrorInFunction(dict) << "The norm 'field' needs the input entry 'divisorField'." diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C index bf21e27a23..fb86bca1ef 100644 --- a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C +++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C @@ -78,7 +78,7 @@ Foam::resolutionIndexModel::resolutionIndexModel ) : mesh_(mesh), - resultName_(word::null) + resultName_() {} diff --git a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C index 39234240fa..a80062e501 100644 --- a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -206,7 +206,7 @@ void Foam::functionObjects::forceCoeffs::calcMomentCoeffs() void Foam::functionObjects::forceCoeffs::createIntegratedDataFile() { - if (!coeffFilePtr_.valid()) + if (!coeffFilePtr_) { coeffFilePtr_ = newFileAtStartTime("coefficient"); writeIntegratedDataFileHeader("Coefficients", coeffFilePtr_()); diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index 4870f5a50c..5f8c48479c 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -412,13 +412,13 @@ void Foam::functionObjects::forces::addToInternalField void Foam::functionObjects::forces::createIntegratedDataFiles() { - if (!forceFilePtr_.valid()) + if (!forceFilePtr_) { forceFilePtr_ = newFileAtStartTime("force"); writeIntegratedDataFileHeader("Force", forceFilePtr_()); } - if (!momentFilePtr_.valid()) + if (!momentFilePtr_) { momentFilePtr_ = newFileAtStartTime("moment"); writeIntegratedDataFileHeader("Moment", momentFilePtr_()); diff --git a/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C b/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C index 41d0c784b8..a3d4588ec7 100644 --- a/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C +++ b/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C @@ -356,7 +356,7 @@ Foam::functionObjects::sizeDistribution::sizeDistribution ( selectionModeTypeNames_.get("selectionMode", dict) ), - selectionModeTypeName_(word::null), + selectionModeTypeName_(), functionType_(functionTypeNames_.get("functionType", dict)), abszissaType_(abszissaTypeNames_.get("abszissaType", dict)), nCells_(0), diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C index e6f29de99a..22aec893b7 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C @@ -109,7 +109,7 @@ bool Foam::functionObjects::runTimeControls::minMaxCondition::apply() const word valueType = state_.objectResultType(functionObjectName_, fieldName); - if (valueType == word::null) + if (valueType.empty()) { WarningInFunction << "Unable to find entry " << fieldName diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.C b/src/fvOptions/corrections/limitTemperature/limitTemperature.C index 610413f529..a20234f1a2 100644 --- a/src/fvOptions/corrections/limitTemperature/limitTemperature.C +++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.C @@ -75,7 +75,7 @@ Foam::fv::limitTemperature::limitTemperature writeFile(mesh, name, typeName, dict, false), Tmin_(0), Tmax_(0), - phase_(word::null) + phase_() { if (isActive()) { diff --git a/src/lagrangian/intermediate/submodels/CloudSubModelBase.C b/src/lagrangian/intermediate/submodels/CloudSubModelBase.C index b2d2face2c..558b1850fc 100644 --- a/src/lagrangian/intermediate/submodels/CloudSubModelBase.C +++ b/src/lagrangian/intermediate/submodels/CloudSubModelBase.C @@ -131,7 +131,7 @@ bool Foam::CloudSubModelBase::writeTime() const template Foam::fileName Foam::CloudSubModelBase::localPath() const { - if (modelName_ != word::null) + if (!modelName_.empty()) { return cloud::prefix/owner_.name()/modelName_; } diff --git a/src/mesh/blockMesh/PDRblockMesh/PDRblock.H b/src/mesh/blockMesh/PDRblockMesh/PDRblock.H index a9096929f8..8df077c4f4 100644 --- a/src/mesh/blockMesh/PDRblockMesh/PDRblock.H +++ b/src/mesh/blockMesh/PDRblockMesh/PDRblock.H @@ -126,13 +126,13 @@ public: void reset(const scalar low, const scalar upp, const label nCells); //- The location list is valid if it contains 2 or more points - inline bool valid() const; + inline bool good() const noexcept; //- The number of cells in this direction. - inline label nCells() const; + inline label nCells() const noexcept; //- The number of points in this direction. - inline label nPoints() const; + inline label nPoints() const noexcept; //- True if the location is within the range inline bool contains(const scalar p) const; diff --git a/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H b/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H index 22dc919fe1..8e34c6ddd4 100644 --- a/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H +++ b/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H @@ -28,19 +28,19 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Location -inline bool Foam::PDRblock::location::valid() const +inline bool Foam::PDRblock::location::good() const noexcept { return (scalarList::size() > 1); } -inline Foam::label Foam::PDRblock::location::nCells() const +inline Foam::label Foam::PDRblock::location::nCells() const noexcept { return (scalarList::size()-1); } -inline Foam::label Foam::PDRblock::location::nPoints() const +inline Foam::label Foam::PDRblock::location::nPoints() const noexcept { return scalarList::size(); } diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C index f296a4c8ef..faa19f78b9 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C @@ -45,9 +45,7 @@ int Foam::blockDescriptor::calcEdgePointsWeights // The topological edge on the block const Foam::edge thisEdge(blockShape_, cellModelEdge); - const bool isCollapsedEdge = !thisEdge.valid(); - - if (blockEdge::debug && isCollapsedEdge) + if (blockEdge::debug && !thisEdge.good()) { Info<< "Collapsed edge:" << thisEdge; if (index_ >= 0) diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C index 922aaa331c..519beb03e4 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C @@ -47,7 +47,7 @@ bool Foam::blockMesh::checkDegenerate() const { edge e(shape.edge(edgei)); - if (!e.valid()) + if (!e.good()) { return true; // Looks like a collapsed edge } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 24fcc02398..2c99fecf15 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -2956,12 +2956,12 @@ void Foam::meshRefinement::zonify { Pout<< "meshRefinement::zonify : found wall closure faces:" << unnamedClosureFaces.size() - << " map:" << unnamedMapPtr.valid() << endl; + << " map:" << bool(unnamedMapPtr) << endl; } // Add to unnamedRegion1, unnamedRegion2 - if (unnamedMapPtr.valid()) + if (unnamedMapPtr) { // Dump leak path if (leakPathFormatter) @@ -3097,11 +3097,11 @@ void Foam::meshRefinement::zonify // Pout<< "meshRefinement::zonify :" // << " found faceZone closure faces:" // << namedClosureFaces.size() - // << " map:" << namedMapPtr.valid() << endl; + // << " map:" << bool(namedMapPtr) << endl; // } // // // Add to namedSurfaceRegion, posOrientation - // if (namedMapPtr.valid()) + // if (namedMapPtr) // { // WarningInFunction // << "Detected and closed leak path" diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C index 09b975548b..fc27ab08af 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBlock.C @@ -1951,10 +1951,10 @@ Foam::autoPtr Foam::meshRefinement::blockLeakFaces { Pout<< "meshRefinement::blockLeakFaces :" << " found closure faces:" << closureFaces.size() - << " map:" << closureMapPtr.valid() << endl; + << " map:" << bool(closureMapPtr) << endl; } - if (!closureMapPtr.valid()) + if (!closureMapPtr) { FatalErrorInFunction << "have leak but did not find any closure faces" diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C index 3493d5509f..70e267c95f 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C +++ b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C @@ -466,7 +466,7 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh const word& cellZoneName = surfList[surfI].cellZoneName(); - if (cellZoneName != word::null) + if (!cellZoneName.empty()) { label zoneI = addCellZone ( diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.C index ffe72e5d0e..bc3ebe947c 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.C @@ -129,7 +129,7 @@ Foam::refinementParameters::refinementParameters { locationsInMesh_[nZones] = pointsToZone[i].first(); zonesInMesh_[nZones] = pointsToZone[i].second(); - if (zonesInMesh_[nZones] == word::null) + if (zonesInMesh_[nZones].empty()) { zonesInMesh_[nZones] = "none"; } @@ -199,7 +199,7 @@ Foam::labelList Foam::refinementParameters::addCellZonesToMesh labelList zoneIDs(zonesInMesh_.size(), -1); forAll(zonesInMesh_, i) { - if (zonesInMesh_[i] != word::null && zonesInMesh_[i] != "none") + if (!zonesInMesh_[i].empty() && zonesInMesh_[i] != "none") { zoneIDs[i] = surfaceZonesInfo::addCellZone ( @@ -282,11 +282,7 @@ Foam::labelList Foam::refinementParameters::zonedLocations forAll(zonesInMesh, i) { - if - ( - zonesInMesh[i] != word::null - && zonesInMesh[i] != "none" - ) + if (!zonesInMesh[i].empty() && zonesInMesh[i] != "none") { indices.append(i); } @@ -304,11 +300,7 @@ Foam::labelList Foam::refinementParameters::unzonedLocations forAll(zonesInMesh, i) { - if - ( - zonesInMesh[i] == word::null - || zonesInMesh[i] == "none" - ) + if (zonesInMesh[i].empty() || zonesInMesh[i] == "none") { indices.append(i); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C index 49d2cb4231..4a7452e93a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C @@ -562,7 +562,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch transform, defaultAMIMethod ), - nonOverlapPatchName_(word::null), + nonOverlapPatchName_(), nonOverlapPatchID_(-1), srcMask_(), tgtMask_(), diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 89aa2fc668..226cf694b9 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -616,7 +616,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch ) : coupledPolyPatch(name, size, start, index, bm, patchType, transform), - nbrPatchName_(word::null), + nbrPatchName_(), nbrPatchID_(-1), fraction_(Zero), rotationAxis_(Zero), @@ -624,7 +624,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch rotationAngleDefined_(false), rotationAngle_(0.0), separationVector_(Zero), - periodicPatchName_(word::null), + periodicPatchName_(), periodicPatchID_(-1), AMIPtr_(AMIInterpolation::New(defaultAMIMethod)), surfDict_(fileName("surface")), @@ -683,7 +683,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch faceAreas0_(), faceCentres0_() { - if (nbrPatchName_ == word::null && !coupleGroup_.valid()) + if (nbrPatchName_.empty() && !coupleGroup_.good()) { FatalIOErrorInFunction(dict) << "No \"neighbourPatch\" or \"coupleGroup\" provided." @@ -938,7 +938,7 @@ Foam::label Foam::cyclicAMIPolyPatch::neighbPatchID() const Foam::label Foam::cyclicAMIPolyPatch::periodicPatchID() const { - if (periodicPatchName_ == word::null) + if (periodicPatchName_.empty()) { return -1; } @@ -1261,7 +1261,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const } } - if (periodicPatchName_ != word::null) + if (!periodicPatchName_.empty()) { os.writeEntry("periodicPatch", periodicPatchName_); } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 00acc4587a..eed22bd473 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -1361,7 +1361,7 @@ Foam::mappedPatchBase::mappedPatchBase { addWorldConnection(); - if (!coupleGroup_.valid()) + if (!coupleGroup_.good()) { if (sampleWorld_.empty() && sampleRegion_.empty()) { @@ -1474,7 +1474,7 @@ Foam::mappedPatchBase::mappedPatchBase << exit(FatalIOError); } - if (!coupleGroup_.valid()) + if (!coupleGroup_.good()) { if (sampleWorld_.empty() && sampleRegion_.empty()) { diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H index 88551e4a90..b2ebe51e9f 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H @@ -43,7 +43,7 @@ inline const Foam::word& Foam::mappedPatchBase::sampleRegion() const { if (sampleRegion_.empty()) { - if (!coupleGroup_.valid()) + if (!coupleGroup_.good()) { FatalErrorInFunction << "Supply either a regionName or a coupleGroup" @@ -69,7 +69,7 @@ inline const Foam::word& Foam::mappedPatchBase::samplePatch() const { if (samplePatch_.empty()) { - if (!coupleGroup_.valid()) + if (!coupleGroup_.good()) { FatalErrorInFunction << "Supply either a patchName or a coupleGroup" diff --git a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDICPreconditioner.C b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDICPreconditioner.C index 64a0bd6210..6d2e30bc0e 100644 --- a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDICPreconditioner.C +++ b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDICPreconditioner.C @@ -57,9 +57,9 @@ void Foam::distributedDICPreconditioner::forwardInternalDiag const scalar* const __restrict__ upperPtr = matrix.upper().begin(); const label nFaces = matrix.upper().size(); - if (cellColourPtr_.valid()) + if (cellColourPtr_) { - const auto& cellColour = cellColourPtr_(); + const auto& cellColour = *cellColourPtr_; for (label face=0; face=0; face--) { const label cell = uPtr[face]; @@ -486,7 +486,7 @@ void Foam::distributedDILUPreconditioner::calcReciprocalD for (label colouri = 0; colouri < nColours_; colouri++) { - if (cellColourPtr_.valid())// && colourBufs_.set(colouri)) + if (cellColourPtr_) // && colourBufs_.set(colouri)) { for (const label inti : lowerGlobalRecv_[colouri]) { @@ -497,7 +497,7 @@ void Foam::distributedDILUPreconditioner::calcReciprocalD forwardInternalDiag(rD, colouri); // Store effect of exchanging rD to higher interfaces in colourBufs_ - if (cellColourPtr_.valid()) + if (cellColourPtr_) { sendGlobal(higherGlobalSend_[colouri], rD, higherColour_[colouri]); } @@ -645,7 +645,7 @@ Foam::distributedDILUPreconditioner::distributedDILUPreconditioner // Start off with all cells colour 0 nColours_ = 1; - cellColourPtr_.clear(); + cellColourPtr_.reset(); if (coupled_ && haveGlobalCoupled) { labelList patchToColour; @@ -653,7 +653,7 @@ Foam::distributedDILUPreconditioner::distributedDILUPreconditioner //if (haveDistributedAMI) //{ // nColours_ = 1; - // cellColourPtr_() = 0; + // *cellColourPtr_ = 0; // patchToColour = labelList(interfaces.size(), 0); //} //else @@ -826,7 +826,7 @@ void Foam::distributedDILUPreconditioner::precondition for (label colouri = 0; colouri < nColours_; colouri++) { // Do non-processor boundaries for this colour - if (cellColourPtr_.valid())// && colourBufs_.set(colouri)) + if (cellColourPtr_) // && colourBufs_.set(colouri)) { for (const label inti : lowerGlobalRecv_[colouri]) { @@ -838,7 +838,7 @@ void Foam::distributedDILUPreconditioner::precondition // Store effect of exchanging rD to higher interfaces // in colourBufs_ - if (cellColourPtr_.valid()) + if (cellColourPtr_) { sendGlobal ( @@ -878,7 +878,7 @@ void Foam::distributedDILUPreconditioner::precondition for (label colouri = nColours_-1; colouri >= 0; colouri--) { // Do non-processor boundaries for this colour - if (cellColourPtr_.valid())// && colourBufs_.set(colouri)) + if (cellColourPtr_) // && colourBufs_.set(colouri)) { for (const label inti : higherGlobalRecv_[colouri]) { @@ -890,7 +890,7 @@ void Foam::distributedDILUPreconditioner::precondition // Store effect of exchanging rD to higher interfaces // in colourBufs_ - if (cellColourPtr_.valid()) + if (cellColourPtr_) { sendGlobal ( diff --git a/src/meshTools/multiWorld/multiWorldConnectionsObject.C b/src/meshTools/multiWorld/multiWorldConnectionsObject.C index 420f00aaa9..0e5c9e14b3 100644 --- a/src/meshTools/multiWorld/multiWorldConnectionsObject.C +++ b/src/meshTools/multiWorld/multiWorldConnectionsObject.C @@ -145,7 +145,7 @@ Foam::label Foam::multiWorldConnections::createCommunicator(const edge& worlds) // Fallback: do not create, just use local world label comm = UPstream::worldComm; - if (!worlds.valid()) + if (!worlds.good()) { return comm; } @@ -299,7 +299,7 @@ bool Foam::multiWorldConnections::addConnectionById(const label otherWorld) // The worlds (sorted) edge worlds(worldPair(otherWorld)); - if (!worlds.valid()) + if (!worlds.good()) { return false; } @@ -318,7 +318,7 @@ bool Foam::multiWorldConnections::addConnectionByName(const word& otherWorld) // The worlds (sorted) edge worlds(worldPair(otherWorld)); - if (!worlds.valid()) + if (!worlds.good()) { return false; } @@ -343,7 +343,7 @@ Foam::label Foam::multiWorldConnections::getCommById // The communication worlds (sorted) edge worlds(worldPair(otherWorldID)); - if (!worlds.valid()) + if (!worlds.good()) { return comm; } @@ -384,7 +384,7 @@ Foam::label Foam::multiWorldConnections::getCommByName // The communication worlds (sorted) edge worlds(worldPair(otherWorld)); - if (!worlds.valid()) + if (!worlds.good()) { return comm; } diff --git a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C index c27a0ef221..bbb45d232a 100644 --- a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C +++ b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.C @@ -206,7 +206,7 @@ Foam::searchableBox::searchableBox searchableSurface(io), treeBoundBox(bb) { - if (!treeBoundBox::valid()) + if (!treeBoundBox::good()) { FatalErrorInFunction << "Illegal bounding box specification : " @@ -229,7 +229,7 @@ Foam::searchableBox::searchableBox { readBoxDim(dict, *this); - if (!treeBoundBox::valid()) + if (!treeBoundBox::good()) { FatalErrorInFunction << "Illegal bounding box specification : " diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C index ddd66897b8..e0bb72f83d 100644 --- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C +++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C @@ -860,7 +860,7 @@ bool Foam::searchableSphere::overlaps(const boundBox& bb) const return bb.overlaps(origin_, sqr(radius())); } - if (!bb.valid()) + if (!bb.good()) { return false; } diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C index 7d0645cbd4..ac7636832a 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C @@ -1695,7 +1695,7 @@ Foam::triSurface Foam::triSurfaceTools::collapseEdges f[1] = pointMap[f[1]]; f[2] = pointMap[f[2]]; - if (f.valid()) + if (f.good()) { newTriangles[nNewTris++] = f; } @@ -1910,7 +1910,7 @@ Foam::triSurface Foam::triSurfaceTools::mergePoints f[1] = pointMap[f[1]]; f[2] = pointMap[f[2]]; - if (f.valid()) + if (f.good()) { newTriangles[nNewTris++] = f; } diff --git a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C index 75354d66c0..f3d2819ba5 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C +++ b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.C @@ -265,7 +265,7 @@ bool objectiveManager::writeObjectives obj.writeMeanValue(); } - if (weigthedObjectiveFile_.valid()) + if (weigthedObjectiveFile_) { unsigned int width = IOstream::defaultPrecision() + 5; weigthedObjectiveFile_() diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/shapeSensitivitiesBase/shapeSensitivitiesBase.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/shapeSensitivitiesBase/shapeSensitivitiesBase.C index 84de7ea3d4..4206d7b787 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/shapeSensitivitiesBase/shapeSensitivitiesBase.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/adjointSensitivity/shapeSensitivitiesBase/shapeSensitivitiesBase.C @@ -128,7 +128,7 @@ Foam::shapeSensitivitiesBase::shapeSensitivitiesBase ) : meshShape_(mesh), - surfaceFieldSuffix_(word::null), + surfaceFieldSuffix_(), writeAllSurfaceFiles_ ( dict.getOrDefault diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C index 42465983eb..f4e156f457 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/optMeshMovement/optMeshMovement/optMeshMovement.C @@ -194,7 +194,7 @@ void Foam::optMeshMovement::resetDesignVariables() bool Foam::optMeshMovement::maxAllowedDisplacementSet() const { - return maxAllowedDisplacement_.valid(); + return bool(maxAllowedDisplacement_); } diff --git a/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DSurface/NURBS3DSurface.C b/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DSurface/NURBS3DSurface.C index 9b6554fa90..5e602bd3ab 100644 --- a/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DSurface/NURBS3DSurface.C +++ b/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DSurface/NURBS3DSurface.C @@ -2347,7 +2347,7 @@ void NURBS3DSurface::writeVTK { if (Pstream::master()) { - if (vtkFileName.ext() != word::null) + if (vtkFileName.has_ext()) { FatalErrorInFunction << "Do not supply a file extension." diff --git a/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolvers/incompressible/adjointSimple/adjointSimple.C b/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolvers/incompressible/adjointSimple/adjointSimple.C index 5fa4603e8c..926071a5b6 100644 --- a/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolvers/incompressible/adjointSimple/adjointSimple.C +++ b/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolvers/incompressible/adjointSimple/adjointSimple.C @@ -409,7 +409,7 @@ void Foam::adjointSimple::clearSensitivities() Foam::sensitivity& Foam::adjointSimple::getSensitivityBase() { - if (!adjointSensitivity_.valid()) + if (!adjointSensitivity_) { FatalErrorInFunction << "Sensitivity object not allocated" << nl diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C index 79f74e001f..17cb45fb9e 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C @@ -103,7 +103,7 @@ void Foam::sampledCuttingPlane::checkBoundsIntersection // Verify specified bounding box const boundBox& clipBb = isoParams_.getClipBounds(); - if (clipBb.valid()) + if (clipBb.good()) { // Bounding box does not overlap with (global) mesh! if (!clipBb.overlaps(meshBb)) @@ -419,7 +419,7 @@ void Foam::sampledCuttingPlane::createGeometry() // the initial selection smaller. const boundBox& clipBb = isoParams_.getClipBounds(); - if (clipBb.valid() && cellsToSelect.any()) + if (clipBb.good() && cellsToSelect.any()) { const auto& cellCentres = fvm.C(); diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index 238299e02c..d794d73c01 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -166,7 +166,7 @@ Foam::sampledPlane::sampledPlane << " origin:" << origin() << " normal:" << normal(); - if (bounds_.valid()) + if (bounds_.good()) { Info<< " bounds:" << bounds_; } diff --git a/src/sampling/surface/cutting/cuttingPlaneSelection.C b/src/sampling/surface/cutting/cuttingPlaneSelection.C index 8577ada23b..416cc64aef 100644 --- a/src/sampling/surface/cutting/cuttingPlaneSelection.C +++ b/src/sampling/surface/cutting/cuttingPlaneSelection.C @@ -42,7 +42,7 @@ void Foam::cuttingPlane::checkOverlap const plane& pln = *this; // Plane does not intersect the user bounding box - if (userBounds.valid() && !userBounds.intersects(pln)) + if (userBounds.good() && !userBounds.intersects(pln)) { WarningInFunction << nl << callerName diff --git a/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C b/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C index 819f55cf2d..a5167e7563 100644 --- a/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C +++ b/src/sampling/surface/cutting/cuttingSurfaceBaseSelection.C @@ -38,7 +38,7 @@ void Foam::cuttingSurfaceBase::checkOverlap ) { // User bounding-box does not overlap with (global) mesh! - if (userBounds.valid() && !userBounds.overlaps(meshBounds)) + if (userBounds.good() && !userBounds.overlaps(meshBounds)) { WarningInFunction << nl << callerName diff --git a/src/sampling/surface/isoSurface/isoSurfaceBase.C b/src/sampling/surface/isoSurface/isoSurfaceBase.C index d317bc74dd..ca6d885a2a 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceBase.C +++ b/src/sampling/surface/isoSurface/isoSurfaceBase.C @@ -183,7 +183,7 @@ Foam::label Foam::isoSurfaceBase::blockCells { // Could warn about invalid... } - else if (bb.valid()) + else if (bb.good()) { const pointField& cc = mesh_.cellCentres(); diff --git a/src/sampling/surface/isoSurface/isoSurfaceCell.C b/src/sampling/surface/isoSurface/isoSurfaceCell.C index 0504896d9f..a8694c47b9 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/surface/isoSurface/isoSurfaceCell.C @@ -815,7 +815,7 @@ Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints triPointReverseMap[rawPointi+2], 0 ); - if (tri.valid()) + if (tri.good()) { newToOldTri.append(oldTriI); dynTris.append(tri); @@ -1300,7 +1300,7 @@ Foam::isoSurfaceCell::isoSurfaceCell DynamicList