diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index ce24d32602..79a571f7f8 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -78,7 +78,7 @@ void Foam::conformalVoronoiMesh::timeCheck memInfo m; - if (m.valid()) + if (m.good()) { PrintTable memoryTable ( diff --git a/applications/utilities/preProcessing/PDR/pdrFields/PDRmeshArrays.C b/applications/utilities/preProcessing/PDR/pdrFields/PDRmeshArrays.C index d09aa71f19..9908d574a1 100644 --- a/applications/utilities/preProcessing/PDR/pdrFields/PDRmeshArrays.C +++ b/applications/utilities/preProcessing/PDR/pdrFields/PDRmeshArrays.C @@ -212,7 +212,7 @@ void Foam::PDRmeshArrays::classify { const auto& limits = faceLimits[cmpt]; - if (!limits.valid()) + if (!limits.good()) { // This should be impossible FatalErrorInFunction diff --git a/applications/utilities/preProcessing/PDR/pdrFields/obstacles/PDRobstacle.C b/applications/utilities/preProcessing/PDR/pdrFields/obstacles/PDRobstacle.C index b416c08ed6..c1d369d7cf 100644 --- a/applications/utilities/preProcessing/PDR/pdrFields/obstacles/PDRobstacle.C +++ b/applications/utilities/preProcessing/PDR/pdrFields/obstacles/PDRobstacle.C @@ -239,7 +239,7 @@ Foam::volumeType Foam::PDRobstacle::trim(const boundBox& bb) { volumeType::type vt = volumeType::UNKNOWN; - if (!bb.valid() || !typeId) + if (!bb.good() || !typeId) { return vt; } diff --git a/applications/utilities/surface/surfaceClean/collapseEdge.C b/applications/utilities/surface/surfaceClean/collapseEdge.C index 89d0e95fea..126313c8a2 100644 --- a/applications/utilities/surface/surfaceClean/collapseEdge.C +++ b/applications/utilities/surface/surfaceClean/collapseEdge.C @@ -68,7 +68,7 @@ static triSurface pack f[1] = pointMap[f[1]]; f[2] = pointMap[f[2]]; - if (f.valid()) + if (f.good()) { newTriangles[nNewTris++] = f; } diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index 0f7b60e154..db1acfd3a8 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) zoneBb.min() = markedZone[0]; zoneBb.max() = markedZone[1]; - if (!zoneBb.valid()) + if (!zoneBb.good()) { WarningInFunction << "Defined zone is invalid: " << zoneBb << nl; @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) // Faces with centre inside "zone" // - if (zoneBb.valid()) + if (zoneBb.good()) { Info<< "Using zone " << zoneBb << endl; diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C index f83e260887..c5ee670639 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C @@ -94,7 +94,7 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict) // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -bool Foam::dynamicCodeContext::valid() const noexcept +bool Foam::dynamicCodeContext::good() const noexcept { return &(dict_.get()) != &(dictionary::null); } diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H index 105686513b..d1763242e5 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H @@ -119,8 +119,11 @@ public: // Member Functions - //- Considered valid if not using dictionary::null as the context - bool valid() const noexcept; + //- Not using dummy code context (dictionary::null) + bool good() const noexcept; + + //- Same as good() + bool valid() const noexcept { return good(); } //- Set code context from a dictionary void setCodeContext(const dictionary& dict); diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.H b/src/OpenFOAM/dimensionSet/dimensionSets.H index a4f9c63f62..b060738c6a 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSets.H +++ b/src/OpenFOAM/dimensionSet/dimensionSets.H @@ -124,10 +124,10 @@ public: } //- Is there a valid inverse of the selected unit - bool valid() const noexcept - { - return valid_; - } + bool good() const noexcept { return valid_; } + + //- Is there a valid inverse of the selected unit + bool valid() const noexcept { return valid_; } //- (if valid) obtain set of coefficients of unitNames void coefficients(scalarField& exponents) const; diff --git a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C index fd2f6828a1..4199fc52ba 100644 --- a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C +++ b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C @@ -40,7 +40,7 @@ Foam::label Foam::coupleGroupIdentifier::findOtherPatchID { const polyBoundaryMesh& pbm = mesh.boundaryMesh(); - if (!valid()) + if (!good()) { FatalErrorInFunction << "Invalid coupleGroup patch group" diff --git a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H index 9d7bed8ed2..17fbcaaa77 100644 --- a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H +++ b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef coupleGroupIdentifier_H -#define coupleGroupIdentifier_H +#ifndef Foam_coupleGroupIdentifier_H +#define Foam_coupleGroupIdentifier_H #include "word.H" #include "label.H" @@ -97,16 +97,13 @@ public: // Member Functions //- Name of patchGroup - const word& name() const noexcept - { - return name_; - } + const word& name() const noexcept { return name_; } - //- Is a valid patchGroup (non-empty) name - bool valid() const noexcept - { - return !name_.empty(); - } + //- The patchGroup has a non-empty name + bool good() const noexcept { return !name_.empty(); } + + //- The patchGroup has a non-empty name + bool valid() const noexcept { return good(); } //- Find other patch in same region. // \return index of patch or -1. diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.C b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.C index 1aac7a93e1..9bee9857e7 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.C +++ b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.C @@ -426,7 +426,7 @@ void Foam::coordinateSystem::rotation(autoPtr&& crot) void Foam::coordinateSystem::write(Ostream& os) const { - if (!valid()) + if (!good()) { return; } @@ -450,7 +450,7 @@ void Foam::coordinateSystem::writeEntry(Ostream& os) const void Foam::coordinateSystem::writeEntry(const word& keyword, Ostream& os) const { - if (!valid()) + if (!good()) { return; } diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H index c6879c2fde..7703525b1a 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H +++ b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H @@ -558,17 +558,14 @@ public: // Characteristics - //- Consider valid if it has a specification - virtual bool valid() const - { - return bool(spec_); - } + //- Consider good if it has a specification + virtual bool good() const { return bool(spec_); } //- True if the rotation tensor is uniform for all locations - virtual bool uniform() const - { - return true; - } + virtual bool uniform() const { return true; } + + //- Same as good() - 2023-07 + virtual bool valid() const { return this->good(); } // Access diff --git a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.C b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.C index 31d5619637..488d6b135d 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.C +++ b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.C @@ -100,7 +100,7 @@ void Foam::coordSystem::indirect::writeEntry Ostream& os ) const { - if (!valid()) + if (!good()) { return; } diff --git a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H index afc6b06888..26565d46f2 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H +++ b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H @@ -161,18 +161,18 @@ public: // Characteristics - //- Is coordinate system valid? - virtual bool valid() const - { - return backend_ && backend_->valid(); - } + //- Is coordinate system good/valid? + virtual bool good() const { return backend_ && backend_->good(); } //- True if the rotation tensor is uniform for all positions virtual bool uniform() const { - return backend_->uniform(); + return !backend_ || backend_->uniform(); } + //- Same as good() - 2023-07 + virtual bool valid() const { return this->good(); } + // Access diff --git a/src/OpenFOAM/primitives/tuples/Pair.H b/src/OpenFOAM/primitives/tuples/Pair.H index 48a8538205..c3845c9951 100644 --- a/src/OpenFOAM/primitives/tuples/Pair.H +++ b/src/OpenFOAM/primitives/tuples/Pair.H @@ -132,8 +132,8 @@ public: // Queries - //- True if first() is less-than second() - inline bool sorted() const; + //- True if first() is less-than-equal second() + inline bool is_sorted() const; // Editing @@ -174,6 +174,13 @@ public: } } }; + + + // Housekeeping + + //- Deprecated(2023-07) Use is_sorted() method + // \deprecated(2023-07) Use is_sorted() method + bool sorted() const { return is_sorted(); } }; diff --git a/src/OpenFOAM/primitives/tuples/PairI.H b/src/OpenFOAM/primitives/tuples/PairI.H index 841bf8c349..70471ac214 100644 --- a/src/OpenFOAM/primitives/tuples/PairI.H +++ b/src/OpenFOAM/primitives/tuples/PairI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -148,7 +148,7 @@ inline void Foam::Pair::flip() template -inline bool Foam::Pair::sorted() const +inline bool Foam::Pair::is_sorted() const { return !(second() < first()); } diff --git a/src/conversion/ccm/reader/ccmInterfaceDefinitions.H b/src/conversion/ccm/reader/ccmInterfaceDefinitions.H index fbd87b659f..577eee7025 100644 --- a/src/conversion/ccm/reader/ccmInterfaceDefinitions.H +++ b/src/conversion/ccm/reader/ccmInterfaceDefinitions.H @@ -117,11 +117,14 @@ public: } //- True if all internal ids are non-negative - bool valid() const + bool good() const noexcept { return (id >= 0 && bnd0 >= 0 && bnd1 >= 0 && bnd0 != bnd1); } + //- Same as good() + bool valid() const noexcept { return good(); } + //- Canonical name for boundary 0 word canonicalName0() const @@ -218,7 +221,7 @@ public: //- Add (valid) interface entry bool add(const interfaceEntry& entry) { - return (entry.valid() && map().set(entry.id, entry)); + return (entry.good() && map().set(entry.id, entry)); } diff --git a/src/fileFormats/gltf/foamGltfSceneWriter.C b/src/fileFormats/gltf/foamGltfSceneWriter.C index c36161cea3..8fdb27fee6 100644 --- a/src/fileFormats/gltf/foamGltfSceneWriter.C +++ b/src/fileFormats/gltf/foamGltfSceneWriter.C @@ -50,7 +50,7 @@ Foam::glTF::sceneWriter::~sceneWriter() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::glTF::sceneWriter::valid() const noexcept +bool Foam::glTF::sceneWriter::good() const noexcept { return (ofile_ && scene_); } diff --git a/src/fileFormats/gltf/foamGltfSceneWriter.H b/src/fileFormats/gltf/foamGltfSceneWriter.H index 41517a47f0..e1c731139e 100644 --- a/src/fileFormats/gltf/foamGltfSceneWriter.H +++ b/src/fileFormats/gltf/foamGltfSceneWriter.H @@ -94,15 +94,15 @@ public: // Member Functions //- True if output file and scene exist - bool valid() const noexcept; + bool good() const noexcept; - //- The json file name. Empty with !valid() + //- The json file name. Empty with !good() const fileName& path() const; - //- Const access to the scene. Error if valid() is not true! + //- Const access to the scene. Error if good() is not true! const scene& getScene() const; - //- Non-const access to the scene. Error if valid() is not true! + //- Non-const access to the scene. Error if good() is not true! scene& getScene(); @@ -111,6 +111,9 @@ public: //- Write scene and close file void close(); + + //- Same as good() + bool valid() const noexcept { return good(); } }; diff --git a/src/fileFormats/stl/STLAsciiParse.H b/src/fileFormats/stl/STLAsciiParse.H index 5aa2b66186..e585aa498d 100644 --- a/src/fileFormats/stl/STLAsciiParse.H +++ b/src/fileFormats/stl/STLAsciiParse.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef STLAsciiParse_H -#define STLAsciiParse_H +#ifndef Foam_STLAsciiParse_H +#define Foam_STLAsciiParse_H #include "DynamicList.H" #include "HashTable.H" @@ -122,20 +122,20 @@ public: inline void clear(); //- Do all the solid groups appear in order? - inline bool sorted() const; + bool is_sorted() const noexcept { return sorted_; } //- A list of unstitched triangle points - inline DynamicList& points(); + DynamicList& points() noexcept { return points_; } //- A list of facet IDs (group IDs) //- corresponds to the number of triangles - inline DynamicList