STYLE: use 'is_sorted()' instead of 'sorted()' for readers, Pair, ...

- avoids naming ambiguity between querying sorted state vs returning a
  sorted list (for example)

ENH: add 'good()' method to a few more classes
This commit is contained in:
Mark Olesen
2023-07-17 09:53:44 +02:00
parent 8562f4d7a4
commit 779c3fe11e
37 changed files with 147 additions and 183 deletions

View File

@ -78,7 +78,7 @@ void Foam::conformalVoronoiMesh::timeCheck
memInfo m; memInfo m;
if (m.valid()) if (m.good())
{ {
PrintTable<word, label> memoryTable PrintTable<word, label> memoryTable
( (

View File

@ -212,7 +212,7 @@ void Foam::PDRmeshArrays::classify
{ {
const auto& limits = faceLimits[cmpt]; const auto& limits = faceLimits[cmpt];
if (!limits.valid()) if (!limits.good())
{ {
// This should be impossible // This should be impossible
FatalErrorInFunction FatalErrorInFunction

View File

@ -239,7 +239,7 @@ Foam::volumeType Foam::PDRobstacle::trim(const boundBox& bb)
{ {
volumeType::type vt = volumeType::UNKNOWN; volumeType::type vt = volumeType::UNKNOWN;
if (!bb.valid() || !typeId) if (!bb.good() || !typeId)
{ {
return vt; return vt;
} }

View File

@ -68,7 +68,7 @@ static triSurface pack
f[1] = pointMap[f[1]]; f[1] = pointMap[f[1]];
f[2] = pointMap[f[2]]; f[2] = pointMap[f[2]];
if (f.valid()) if (f.good())
{ {
newTriangles[nNewTris++] = f; newTriangles[nNewTris++] = f;
} }

View File

@ -117,7 +117,7 @@ int main(int argc, char *argv[])
zoneBb.min() = markedZone[0]; zoneBb.min() = markedZone[0];
zoneBb.max() = markedZone[1]; zoneBb.max() = markedZone[1];
if (!zoneBb.valid()) if (!zoneBb.good())
{ {
WarningInFunction WarningInFunction
<< "Defined zone is invalid: " << zoneBb << nl; << "Defined zone is invalid: " << zoneBb << nl;
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
// Faces with centre inside "zone" // Faces with centre inside "zone"
// //
if (zoneBb.valid()) if (zoneBb.good())
{ {
Info<< "Using zone " << zoneBb << endl; Info<< "Using zone " << zoneBb << endl;

View File

@ -94,7 +94,7 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::dynamicCodeContext::valid() const noexcept bool Foam::dynamicCodeContext::good() const noexcept
{ {
return &(dict_.get()) != &(dictionary::null); return &(dict_.get()) != &(dictionary::null);
} }

View File

@ -119,8 +119,11 @@ public:
// Member Functions // Member Functions
//- Considered valid if not using dictionary::null as the context //- Not using dummy code context (dictionary::null)
bool valid() const noexcept; bool good() const noexcept;
//- Same as good()
bool valid() const noexcept { return good(); }
//- Set code context from a dictionary //- Set code context from a dictionary
void setCodeContext(const dictionary& dict); void setCodeContext(const dictionary& dict);

View File

@ -124,10 +124,10 @@ public:
} }
//- Is there a valid inverse of the selected unit //- Is there a valid inverse of the selected unit
bool valid() const noexcept bool good() const noexcept { return valid_; }
{
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 //- (if valid) obtain set of coefficients of unitNames
void coefficients(scalarField& exponents) const; void coefficients(scalarField& exponents) const;

View File

@ -40,7 +40,7 @@ Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
{ {
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); const polyBoundaryMesh& pbm = mesh.boundaryMesh();
if (!valid()) if (!good())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Invalid coupleGroup patch group" << "Invalid coupleGroup patch group"

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coupleGroupIdentifier_H #ifndef Foam_coupleGroupIdentifier_H
#define coupleGroupIdentifier_H #define Foam_coupleGroupIdentifier_H
#include "word.H" #include "word.H"
#include "label.H" #include "label.H"
@ -97,16 +97,13 @@ public:
// Member Functions // Member Functions
//- Name of patchGroup //- Name of patchGroup
const word& name() const noexcept const word& name() const noexcept { return name_; }
{
return name_;
}
//- Is a valid patchGroup (non-empty) name //- The patchGroup has a non-empty name
bool valid() const noexcept bool good() const noexcept { return !name_.empty(); }
{
return !name_.empty(); //- The patchGroup has a non-empty name
} bool valid() const noexcept { return good(); }
//- Find other patch in same region. //- Find other patch in same region.
// \return index of patch or -1. // \return index of patch or -1.

View File

@ -426,7 +426,7 @@ void Foam::coordinateSystem::rotation(autoPtr<coordinateRotation>&& crot)
void Foam::coordinateSystem::write(Ostream& os) const void Foam::coordinateSystem::write(Ostream& os) const
{ {
if (!valid()) if (!good())
{ {
return; return;
} }
@ -450,7 +450,7 @@ void Foam::coordinateSystem::writeEntry(Ostream& os) const
void Foam::coordinateSystem::writeEntry(const word& keyword, Ostream& os) const void Foam::coordinateSystem::writeEntry(const word& keyword, Ostream& os) const
{ {
if (!valid()) if (!good())
{ {
return; return;
} }

View File

@ -558,17 +558,14 @@ public:
// Characteristics // Characteristics
//- Consider valid if it has a specification //- Consider good if it has a specification
virtual bool valid() const virtual bool good() const { return bool(spec_); }
{
return bool(spec_);
}
//- True if the rotation tensor is uniform for all locations //- True if the rotation tensor is uniform for all locations
virtual bool uniform() const virtual bool uniform() const { return true; }
{
return true; //- Same as good() - 2023-07
} virtual bool valid() const { return this->good(); }
// Access // Access

View File

@ -100,7 +100,7 @@ void Foam::coordSystem::indirect::writeEntry
Ostream& os Ostream& os
) const ) const
{ {
if (!valid()) if (!good())
{ {
return; return;
} }

View File

@ -161,18 +161,18 @@ public:
// Characteristics // Characteristics
//- Is coordinate system valid? //- Is coordinate system good/valid?
virtual bool valid() const virtual bool good() const { return backend_ && backend_->good(); }
{
return backend_ && backend_->valid();
}
//- True if the rotation tensor is uniform for all positions //- True if the rotation tensor is uniform for all positions
virtual bool uniform() const virtual bool uniform() const
{ {
return backend_->uniform(); return !backend_ || backend_->uniform();
} }
//- Same as good() - 2023-07
virtual bool valid() const { return this->good(); }
// Access // Access

View File

@ -132,8 +132,8 @@ public:
// Queries // Queries
//- True if first() is less-than second() //- True if first() is less-than-equal second()
inline bool sorted() const; inline bool is_sorted() const;
// Editing // 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(); }
}; };

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -148,7 +148,7 @@ inline void Foam::Pair<T>::flip()
template<class T> template<class T>
inline bool Foam::Pair<T>::sorted() const inline bool Foam::Pair<T>::is_sorted() const
{ {
return !(second() < first()); return !(second() < first());
} }

View File

@ -117,11 +117,14 @@ public:
} }
//- True if all internal ids are non-negative //- True if all internal ids are non-negative
bool valid() const bool good() const noexcept
{ {
return (id >= 0 && bnd0 >= 0 && bnd1 >= 0 && bnd0 != bnd1); return (id >= 0 && bnd0 >= 0 && bnd1 >= 0 && bnd0 != bnd1);
} }
//- Same as good()
bool valid() const noexcept { return good(); }
//- Canonical name for boundary 0 //- Canonical name for boundary 0
word canonicalName0() const word canonicalName0() const
@ -218,7 +221,7 @@ public:
//- Add (valid) interface entry //- Add (valid) interface entry
bool add(const interfaceEntry& entry) bool add(const interfaceEntry& entry)
{ {
return (entry.valid() && map().set(entry.id, entry)); return (entry.good() && map().set(entry.id, entry));
} }

View File

@ -50,7 +50,7 @@ Foam::glTF::sceneWriter::~sceneWriter()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::glTF::sceneWriter::valid() const noexcept bool Foam::glTF::sceneWriter::good() const noexcept
{ {
return (ofile_ && scene_); return (ofile_ && scene_);
} }

View File

@ -94,15 +94,15 @@ public:
// Member Functions // Member Functions
//- True if output file and scene exist //- 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 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; 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(); scene& getScene();
@ -111,6 +111,9 @@ public:
//- Write scene and close file //- Write scene and close file
void close(); void close();
//- Same as good()
bool valid() const noexcept { return good(); }
}; };

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef STLAsciiParse_H #ifndef Foam_STLAsciiParse_H
#define STLAsciiParse_H #define Foam_STLAsciiParse_H
#include "DynamicList.H" #include "DynamicList.H"
#include "HashTable.H" #include "HashTable.H"
@ -122,20 +122,20 @@ public:
inline void clear(); inline void clear();
//- Do all the solid groups appear in order? //- 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 //- A list of unstitched triangle points
inline DynamicList<STLpoint>& points(); DynamicList<STLpoint>& points() noexcept { return points_; }
//- A list of facet IDs (group IDs) //- A list of facet IDs (group IDs)
//- corresponds to the number of triangles //- corresponds to the number of triangles
inline DynamicList<label>& facets(); DynamicList<label>& facets() noexcept { return facets_; }
//- Solid names in the order of their appearance. //- Solid names in the order of their appearance.
inline DynamicList<word>& names(); DynamicList<word>& names() noexcept { return names_; }
//- Solid sizes in the order of their appearance. //- Solid sizes in the order of their appearance.
inline DynamicList<label>& sizes(); DynamicList<label>& sizes() noexcept { return sizes_; }
}; };

View File

@ -232,7 +232,7 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
normal.x() = strtof(YYText(), &endPtr); normal.x() = strtof(YYText(), &endPtr);
normal.y() = strtof(endPtr, &endPtr); normal.y() = strtof(endPtr, &endPtr);
normal.z() = strtof(endPtr, &endPtr); normal.z() = strtof(endPtr, &endPtr);
normals_.append(normal); normals_.push_back(normal);
*/ */
BEGIN(readFacet); BEGIN(readFacet);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,12 +48,13 @@ inline void Foam::Detail::STLAsciiParse::beginSolid(word solidName)
groupId_ = sizes_.size(); groupId_ = sizes_.size();
if (nameLookup_.insert(solidName, groupId_)) if (nameLookup_.insert(solidName, groupId_))
{ {
names_.append(solidName); names_.push_back(std::move(solidName));
sizes_.append(0); sizes_.push_back(0);
} }
else else
{ {
FatalErrorInFunction<< "Duplicate solid-name: " << solidName FatalErrorInFunction
<< "Duplicate solid-name: " << solidName << nl
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -79,7 +80,7 @@ inline bool Foam::Detail::STLAsciiParse::addVertexComponent(float val)
if (++nVertexCmpt_ == 3) if (++nVertexCmpt_ == 3)
{ {
points_.append(currVertex_); points_.push_back(currVertex_);
nVertexCmpt_ = 0; nVertexCmpt_ = 0;
++nFacetPoints_; ++nFacetPoints_;
} }
@ -95,7 +96,7 @@ inline bool Foam::Detail::STLAsciiParse::addVertexComponent(const char* text)
if (++nVertexCmpt_ == 3) if (++nVertexCmpt_ == 3)
{ {
points_.append(currVertex_); points_.push_back(currVertex_);
nVertexCmpt_ = 0; nVertexCmpt_ = 0;
++nFacetPoints_; ++nFacetPoints_;
} }
@ -108,8 +109,8 @@ inline void Foam::Detail::STLAsciiParse::endFacet()
{ {
if (nFacetPoints_ == 3) if (nFacetPoints_ == 3)
{ {
facets_.append(groupId_); facets_.push_back(groupId_);
sizes_[groupId_]++; ++sizes_[groupId_];
} }
else else
{ {
@ -161,34 +162,4 @@ inline void Foam::Detail::STLAsciiParse::clear()
} }
inline bool Foam::Detail::STLAsciiParse::sorted() const
{
return sorted_;
}
inline Foam::DynamicList<Foam::STLpoint>& Foam::Detail::STLAsciiParse::points()
{
return points_;
}
inline Foam::DynamicList<Foam::label>& Foam::Detail::STLAsciiParse::facets()
{
return facets_;
}
inline Foam::DynamicList<Foam::word>& Foam::Detail::STLAsciiParse::names()
{
return names_;
}
inline Foam::DynamicList<Foam::label>& Foam::Detail::STLAsciiParse::sizes()
{
return sizes_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -80,7 +80,7 @@ class STLAsciiParseManual
typedef std::pair<const char*, const char*> tokenType; typedef std::pair<const char*, const char*> tokenType;
// Tokenized line // Tokenized line
DynamicList<tokenType, 16> tokens_; DynamicList<tokenType> tokens_;
//- Tokenize //- Tokenize
inline std::string::size_type tokenize(const char *p, const char *pe) inline std::string::size_type tokenize(const char *p, const char *pe)
@ -107,7 +107,7 @@ class STLAsciiParseManual
{ {
++p; ++p;
} }
tokens_.append(tokenType(beg, p)); tokens_.emplace_back(beg, p);
// Find next // Find next
while (p < pe && isspace(*p)) while (p < pe && isspace(*p))
@ -250,7 +250,11 @@ void Foam::Detail::STLAsciiParseManual::execute(std::istream& is)
{ {
beginSolid beginSolid
( (
word::validate(tokens_[1].first, tokens_[1].second) word::validate
(
tokens_[1].first,
tokens_[1].second
)
); );
} }
@ -305,8 +309,8 @@ void Foam::Detail::STLAsciiParseManual::execute(std::istream& is)
{ {
if (tokens_.size() > 3) if (tokens_.size() > 3)
{ {
// Although tokens are not nul-terminated, // The tokens are space-delimited and thus okay
// they are space delimited and thus good enough for atof() // for atof()
addVertexComponent(tokens_[1].first); addVertexComponent(tokens_[1].first);
addVertexComponent(tokens_[2].first); addVertexComponent(tokens_[2].first);
addVertexComponent(tokens_[3].first); addVertexComponent(tokens_[3].first);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,7 +49,7 @@ void Foam::fileFormats::STLReader::transfer
Detail::STLAsciiParse& parsed Detail::STLAsciiParse& parsed
) )
{ {
sorted_ = parsed.sorted(); sorted_ = parsed.is_sorted();
points_.transfer(parsed.points()); points_.transfer(parsed.points());
zoneIds_.transfer(parsed.facets()); zoneIds_.transfer(parsed.facets());
@ -143,7 +143,7 @@ bool Foam::fileFormats::STLReader::readBINARY
{ {
zoneI = dynSizes.size(); zoneI = dynSizes.size();
lookup.insert(origId, zoneI); lookup.insert(origId, zoneI);
dynSizes.append(0); dynSizes.push_back(0);
} }
zoneIds_[facei] = zoneI; zoneIds_[facei] = zoneI;

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef STLReader_H #ifndef Foam_STLReader_H
#define STLReader_H #define Foam_STLReader_H
#include "STLCore.H" #include "STLCore.H"
#include "labelledTri.H" #include "labelledTri.H"
@ -132,7 +132,7 @@ public:
//- Read from file, filling in the information. //- Read from file, filling in the information.
// Auto-detect ASCII/BINARY format. // Auto-detect ASCII/BINARY format.
STLReader(const fileName& filename); explicit STLReader(const fileName& filename);
//- Read from file, filling in the information. //- Read from file, filling in the information.
// Manually selected choice of ASCII/BINARY/UNKNOWN(detect) formats. // Manually selected choice of ASCII/BINARY/UNKNOWN(detect) formats.
@ -158,40 +158,22 @@ public:
label mergePointsMap(const scalar mergeTol, labelList& pointMap) const; label mergePointsMap(const scalar mergeTol, labelList& pointMap) const;
//- File read was already sorted? //- File read was already sorted?
inline bool sorted() const bool is_sorted() const noexcept { return sorted_; }
{
return sorted_;
}
//- Return full access to the points //- Return full access to the points
inline List<STLpoint>& points() List<STLpoint>& points() noexcept { return points_; }
{
return points_;
}
//- Return full access to the zoneIds //- Return full access to the zoneIds
inline List<label>& zoneIds() List<label>& zoneIds() noexcept { return zoneIds_; }
{
return zoneIds_;
}
//- The list of solid names in the order of their first appearance //- The list of solid names in the order of their first appearance
inline List<word>& names() List<word>& names() noexcept { return names_; }
{
return names_;
}
//- The list of solid sizes in the order of their first appearance //- The list of solid sizes in the order of their first appearance
inline List<label>& sizes() List<label>& sizes() noexcept { return sizes_; }
{
return sizes_;
}
//- The STL format used (ASCII or BINARY) //- The STL format used (ASCII or BINARY)
inline enum STLFormat stlFormat() const enum STLFormat stlFormat() const noexcept { return format_; }
{
return format_;
}
}; };

View File

@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef lumpedPointInterpolator_H #ifndef Foam_lumpedPointInterpolator_H
#define lumpedPointInterpolator_H #define Foam_lumpedPointInterpolator_H
#include "Pair.H" #include "Pair.H"
#include "triFace.H" #include "triFace.H"
@ -90,19 +90,22 @@ public:
// Access // Access
//- Valid if there is an associated nearest point //- True if there is an associated nearest point
inline bool valid() const; inline bool good() const;
//- The nearest control point, or -1 if invalid //- Same as good()
bool valid() const { return good(); }
//- The nearest control point, or -1 if !good()
inline label nearest() const; inline label nearest() const;
//- The first neighbour control point - identical to next1() //- The first neighbour control point - identical to next1()
inline label next() const; inline label next() const;
//- The first neighbour control point, or -1 if invalid //- The first neighbour control point, or -1 if !good()
inline label next1() const; inline label next1() const;
//- The second neighbour control point, or -1 if invalid //- The second neighbour control point, or -1 if !good()
inline label next2() const; inline label next2() const;
//- The weighting for the nearest point //- The weighting for the nearest point

View File

@ -45,7 +45,7 @@ inline Foam::lumpedPointInterpolator::lumpedPointInterpolator(const label id)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::lumpedPointInterpolator::valid() const inline bool Foam::lumpedPointInterpolator::good() const
{ {
return nearest_ != -1; return nearest_ != -1;
} }

View File

@ -192,7 +192,7 @@ public:
// Member Functions // Member Functions
//- Has positions and consistent number of rotations? //- Has positions and consistent number of rotations?
inline bool valid() const; inline bool good() const;
//- If no points were specified //- If no points were specified
inline bool empty() const; inline bool empty() const;
@ -200,6 +200,9 @@ public:
//- The number of points //- The number of points
inline label size() const; inline label size() const;
//- Same as good()
bool valid() const { return good(); }
//- The points corresponding to mass centres //- The points corresponding to mass centres
inline const pointField& points() const; inline const pointField& points() const;

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
inline bool Foam::lumpedPointState::valid() const inline bool Foam::lumpedPointState::good() const
{ {
return points_.size() && points_.size() == angles_.size(); return points_.size() && points_.size() == angles_.size();
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -177,7 +177,7 @@ static Ostream& serializeProjectEdge
{ {
os << indent << projKeyword << token::SPACE; os << indent << projKeyword << token::SPACE;
if (e.sorted()) if (e.is_sorted())
{ {
os << e.first() << token::SPACE << e.second(); os << e.first() << token::SPACE << e.second();
} }

View File

@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef blockEdge_H #ifndef Foam_blockEdge_H
#define blockEdge_H #define Foam_blockEdge_H
#include "searchableSurfaces.H" #include "searchableSurfaces.H"
#include "edge.H" #include "edge.H"
@ -196,7 +196,10 @@ public:
// Member Functions // Member Functions
//- True if first/last indices are unique and non-negative. //- True if first/last indices are unique and non-negative.
inline bool valid() const noexcept; inline bool good() const noexcept;
//- Same as good()
bool valid() const noexcept { return good(); }
//- Index of start (first) point //- Index of start (first) point
inline label start() const noexcept; inline label start() const noexcept;

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::blockEdge::valid() const noexcept inline bool Foam::blockEdge::good() const noexcept
{ {
return (start_ != end_ && start_ >= 0 && end_ >= 0); return (start_ != end_ && start_ >= 0 && end_ >= 0);
} }

View File

@ -304,7 +304,7 @@ Foam::blockMesh::blockMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::blockMesh::valid() const noexcept bool Foam::blockMesh::good() const noexcept
{ {
return bool(topologyPtr_); return bool(topologyPtr_);
} }

View File

@ -315,7 +315,10 @@ public:
} }
//- True if the blockMesh topology exists //- True if the blockMesh topology exists
bool valid() const noexcept; bool good() const noexcept;
//- Same as good()
bool valid() const noexcept { return good(); }
//- Return the patch names //- Return the patch names
wordList patchNames() const; wordList patchNames() const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -148,7 +148,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
// Generate the (sorted) faces // Generate the (sorted) faces
List<Face> faceLst(zoneIds.size()); List<Face> faceLst(zoneIds.size());
if (reader.sorted()) if (reader.is_sorted())
{ {
// Already sorted - generate directly // Already sorted - generate directly
forAll(faceLst, facei) forAll(faceLst, facei)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,8 +41,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef TRIReader_H #ifndef Foam_TRIReader_H
#define TRIReader_H #define Foam_TRIReader_H
#include "STLpoint.H" #include "STLpoint.H"
#include "labelList.H" #include "labelList.H"
@ -90,7 +90,7 @@ public:
// Constructors // Constructors
//- Read from file, filling in the information //- Read from file, filling in the information
TRIReader(const fileName& filename); explicit TRIReader(const fileName& filename);
//- Destructor //- Destructor
@ -112,35 +112,20 @@ public:
label mergePointsMap(const scalar mergeTol, labelList& pointMap) const; label mergePointsMap(const scalar mergeTol, labelList& pointMap) const;
//- File read was already sorted //- File read was already in sorted order
bool sorted() const bool is_sorted() const noexcept { return sorted_; }
{
return sorted_;
}
//- Return full access to the points //- Return full access to the points
List<STLpoint>& points() List<STLpoint>& points() noexcept { return points_; }
{
return points_;
}
//- Return full access to the zones //- Return full access to the zones
List<label>& zoneIds() List<label>& zoneIds() noexcept { return zoneIds_; }
{
return zoneIds_;
}
//- The list of solid names in the order of their first appearance //- The list of solid names in the order of their first appearance
List<word>& names() List<word>& names() noexcept { return names_; }
{
return names_;
}
//- The list of zone sizes in the order of their first appearance //- The list of zone sizes in the order of their first appearance
List<label>& sizes() List<label>& sizes() noexcept { return sizes_; }
{
return sizes_;
}
}; };

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -108,7 +108,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
// Generate the (sorted) faces // Generate the (sorted) faces
List<Face> faceLst(zoneIds.size()); List<Face> faceLst(zoneIds.size());
if (reader.sorted()) if (reader.is_sorted())
{ {
// Already sorted - generate directly // Already sorted - generate directly
forAll(faceLst, facei) forAll(faceLst, facei)