ENH: more consistent use of good() or direct testing instead valid()
This commit is contained in:
parent
76efcba4c7
commit
945e3e41b1
@ -17,7 +17,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate
|
||||
vf,
|
||||
dir,
|
||||
"reconstruct("
|
||||
+ (reconFieldName != word::null ? reconFieldName : vf.name())
|
||||
+ (reconFieldName.empty() ? vf.name() : reconFieldName)
|
||||
+ ')'
|
||||
)
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ void basicTests(const coordinateSystem& cs)
|
||||
|
||||
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
|
||||
{
|
||||
if (!cartptr->valid())
|
||||
if (!cartptr->good())
|
||||
{
|
||||
Info<< "invalid cartesian = " << (*cartptr)
|
||||
<< " with: " << (*cartptr).R() << nl;
|
||||
|
@ -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?
|
||||
|
||||
|
@ -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<extrudeModels::wedge>(model()))
|
||||
{
|
||||
|
@ -947,7 +947,7 @@ void addZoneSidePatches
|
||||
|
||||
forAll(zoneSidePatch, zoneI)
|
||||
{
|
||||
if (oneDPolyPatchType != word::null)
|
||||
if (!oneDPolyPatchType.empty())
|
||||
{
|
||||
// Reuse single empty patch.
|
||||
word patchName;
|
||||
|
@ -47,7 +47,7 @@ void Foam::DelaunayMesh<Triangulation>::timeCheck
|
||||
<< time().elapsedCpuTime() << " s, "
|
||||
<< "delta " << time().cpuTimeIncrement()<< " s";
|
||||
|
||||
if (description != word::null)
|
||||
if (!description.empty())
|
||||
{
|
||||
Info<< ", " << description << " ";
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ template<class KeyType, class DataType>
|
||||
Foam::PrintTable<KeyType, DataType>::PrintTable()
|
||||
:
|
||||
table_(),
|
||||
title_(string::null)
|
||||
title_()
|
||||
{}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ void Foam::conformalVoronoiMesh::timeCheck
|
||||
<< runTime.elapsedCpuTime() << " s, "
|
||||
<< "delta " << runTime.cpuTimeIncrement()<< " s";
|
||||
|
||||
if (description != word::null)
|
||||
if (!description.empty())
|
||||
{
|
||||
Info<< ", " << description << " ";
|
||||
}
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ void Foam::helpTypes::helpFunctionObject::execute
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word function(word::null);
|
||||
word function;
|
||||
|
||||
if (args.readIfPresent("browse", function))
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ void Foam::helpTypes::helpSolver::execute
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word solver(word::null);
|
||||
word solver;
|
||||
|
||||
if (args.readIfPresent("browse", solver))
|
||||
{
|
||||
|
@ -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_);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -184,7 +184,7 @@ Foam::PrimitivePatch<FaceList, PointField>::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();
|
||||
|
@ -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
|
||||
|
@ -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(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -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_;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -567,7 +567,7 @@ bool Foam::MRFZone::read(const dictionary& dict)
|
||||
omega_.reset(Function1<scalar>::New("omega", coeffs_, &mesh_));
|
||||
|
||||
const word oldCellZoneName = cellZoneName_;
|
||||
if (cellZoneName_ == word::null)
|
||||
if (cellZoneName_.empty())
|
||||
{
|
||||
coeffs_.readEntry("cellZone", cellZoneName_);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ Foam::expressions::fvExprDriver::getTopoSetLabels
|
||||
}
|
||||
|
||||
|
||||
if (selected.valid())
|
||||
if (selected.good())
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ Foam::mappedMixedFieldFvPatchField<Type>::mappedMixedFieldFvPatchField
|
||||
mixedFvPatchField<Type>(p, iF),
|
||||
mappedPatchBase(p.patch()),
|
||||
mappedPatchFieldBase<Type>(*this, *this),
|
||||
weightFieldName_(word::null)
|
||||
weightFieldName_()
|
||||
{
|
||||
this->refValue() = Zero;
|
||||
this->refGrad() = Zero;
|
||||
|
@ -45,7 +45,7 @@ Foam::mappedMixedFvPatchField<Type>::mappedMixedFvPatchField
|
||||
mappedFixedValueFvPatchField<Type>::mapper(p, iF),
|
||||
*this
|
||||
),
|
||||
weightFieldName_(word::null)
|
||||
weightFieldName_()
|
||||
{
|
||||
this->refValue() = Zero;
|
||||
this->refGrad() = Zero;
|
||||
|
@ -72,8 +72,8 @@ pressurePIDControlInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
upstreamName_(word::null),
|
||||
downstreamName_(word::null),
|
||||
upstreamName_(),
|
||||
downstreamName_(),
|
||||
deltaP_(1),
|
||||
shapeFactor_(0),
|
||||
pName_("p"),
|
||||
|
@ -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_(),
|
||||
|
@ -126,7 +126,7 @@ Foam::histogramModel::histogramModel
|
||||
:
|
||||
writeFile(mesh, name, "histogram", dict),
|
||||
mesh_(mesh),
|
||||
fieldName_(word::null)
|
||||
fieldName_()
|
||||
{}
|
||||
|
||||
|
||||
|
@ -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<word>("divisorField");
|
||||
|
||||
if (divisorFieldName_ == word::null)
|
||||
if (divisorFieldName_.empty())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "The norm 'field' needs the input entry 'divisorField'."
|
||||
|
@ -78,7 +78,7 @@ Foam::resolutionIndexModel::resolutionIndexModel
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
resultName_(word::null)
|
||||
resultName_()
|
||||
{}
|
||||
|
||||
|
||||
|
@ -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_());
|
||||
|
@ -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_());
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
@ -75,7 +75,7 @@ Foam::fv::limitTemperature::limitTemperature
|
||||
writeFile(mesh, name, typeName, dict, false),
|
||||
Tmin_(0),
|
||||
Tmax_(0),
|
||||
phase_(word::null)
|
||||
phase_()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ bool Foam::CloudSubModelBase<CloudType>::writeTime() const
|
||||
template<class CloudType>
|
||||
Foam::fileName Foam::CloudSubModelBase<CloudType>::localPath() const
|
||||
{
|
||||
if (modelName_ != word::null)
|
||||
if (!modelName_.empty())
|
||||
{
|
||||
return cloud::prefix/owner_.name()/modelName_;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -1951,10 +1951,10 @@ Foam::autoPtr<Foam::mapPolyMesh> 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"
|
||||
|
@ -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
|
||||
(
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
|
||||
transform,
|
||||
defaultAMIMethod
|
||||
),
|
||||
nonOverlapPatchName_(word::null),
|
||||
nonOverlapPatchName_(),
|
||||
nonOverlapPatchID_(-1),
|
||||
srcMask_(),
|
||||
tgtMask_(),
|
||||
|
@ -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_);
|
||||
}
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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"
|
||||
|
@ -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<nFaces; face++)
|
||||
{
|
||||
const label cell = lPtr[face];
|
||||
@ -96,9 +96,9 @@ void Foam::distributedDICPreconditioner::forwardInternal
|
||||
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<nFaces; face++)
|
||||
{
|
||||
const label cell = lPtr[face];
|
||||
|
@ -310,9 +310,9 @@ void Foam::distributedDILUPreconditioner::forwardInternalDiag
|
||||
const scalar* const __restrict__ lowerPtr = matrix.lower().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<nFaces; face++)
|
||||
{
|
||||
const label cell = lPtr[face];
|
||||
@ -375,9 +375,9 @@ void Foam::distributedDILUPreconditioner::forwardInternal
|
||||
const scalar* const __restrict__ lowerPtr = matrix.lower().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<nFaces; face++)
|
||||
{
|
||||
const label sface = losortPtr[face];
|
||||
@ -419,9 +419,9 @@ void Foam::distributedDILUPreconditioner::backwardInternal
|
||||
|
||||
const label nFacesM1 = matrix.upper().size() - 1;
|
||||
|
||||
if (cellColourPtr_.valid())
|
||||
if (cellColourPtr_)
|
||||
{
|
||||
const auto& cellColour = cellColourPtr_();
|
||||
const auto& cellColour = *cellColourPtr_;
|
||||
for (label face=nFacesM1; 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
|
||||
(
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 : "
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ bool objectiveManager::writeObjectives
|
||||
obj.writeMeanValue();
|
||||
}
|
||||
|
||||
if (weigthedObjectiveFile_.valid())
|
||||
if (weigthedObjectiveFile_)
|
||||
{
|
||||
unsigned int width = IOstream::defaultPrecision() + 5;
|
||||
weigthedObjectiveFile_()
|
||||
|
@ -128,7 +128,7 @@ Foam::shapeSensitivitiesBase::shapeSensitivitiesBase
|
||||
)
|
||||
:
|
||||
meshShape_(mesh),
|
||||
surfaceFieldSuffix_(word::null),
|
||||
surfaceFieldSuffix_(),
|
||||
writeAllSurfaceFiles_
|
||||
(
|
||||
dict.getOrDefault<bool>
|
||||
|
@ -194,7 +194,7 @@ void Foam::optMeshMovement::resetDesignVariables()
|
||||
|
||||
bool Foam::optMeshMovement::maxAllowedDisplacementSet() const
|
||||
{
|
||||
return maxAllowedDisplacement_.valid();
|
||||
return bool(maxAllowedDisplacement_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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."
|
||||
|
@ -409,7 +409,7 @@ void Foam::adjointSimple::clearSensitivities()
|
||||
|
||||
Foam::sensitivity& Foam::adjointSimple::getSensitivityBase()
|
||||
{
|
||||
if (!adjointSensitivity_.valid())
|
||||
if (!adjointSensitivity_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Sensitivity object not allocated" << nl
|
||||
|
@ -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();
|
||||
|
||||
|
@ -166,7 +166,7 @@ Foam::sampledPlane::sampledPlane
|
||||
<< " origin:" << origin()
|
||||
<< " normal:" << normal();
|
||||
|
||||
if (bounds_.valid())
|
||||
if (bounds_.good())
|
||||
{
|
||||
Info<< " bounds:" << bounds_;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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<label> trimTriMap;
|
||||
// Trimmed to original point
|
||||
labelList trimTriPointMap;
|
||||
if (getClipBounds().valid())
|
||||
if (getClipBounds().good())
|
||||
{
|
||||
isoSurfacePoint::trimToBox
|
||||
(
|
||||
@ -1332,7 +1332,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
||||
<< " merged triangles." << endl;
|
||||
}
|
||||
|
||||
if (getClipBounds().valid())
|
||||
if (getClipBounds().good())
|
||||
{
|
||||
// Adjust interpolatedPoints_
|
||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||
|
@ -933,7 +933,7 @@ Foam::triSurface Foam::isoSurfacePoint::stitchTriPoints
|
||||
);
|
||||
rawPointi += 3;
|
||||
|
||||
if (tri.valid())
|
||||
if (tri.good())
|
||||
{
|
||||
newToOldTri.append(oldTriI);
|
||||
dynTris.append(tri);
|
||||
@ -1603,7 +1603,7 @@ Foam::isoSurfacePoint::isoSurfacePoint
|
||||
DynamicList<label> trimTriMap;
|
||||
// Trimmed to original point
|
||||
labelList trimTriPointMap;
|
||||
if (getClipBounds().valid())
|
||||
if (getClipBounds().good())
|
||||
{
|
||||
trimToBox
|
||||
(
|
||||
@ -1636,7 +1636,7 @@ Foam::isoSurfacePoint::isoSurfacePoint
|
||||
}
|
||||
|
||||
|
||||
if (getClipBounds().valid())
|
||||
if (getClipBounds().good())
|
||||
{
|
||||
// Adjust interpolatedPoints_
|
||||
inplaceRenumber(triPointMergeMap_, interpolatedPoints_);
|
||||
|
@ -211,7 +211,7 @@ void Foam::triSurface::checkTriangles(const bool verbose)
|
||||
{
|
||||
const labelledTri& f = (*this)[facei];
|
||||
|
||||
if (!f.valid())
|
||||
if (!f.good())
|
||||
{
|
||||
// 'degenerate' triangle check
|
||||
valid.unset(facei);
|
||||
|
@ -65,7 +65,7 @@ bool Foam::triSurface::stitchTriangles
|
||||
tri.region()
|
||||
);
|
||||
|
||||
if (newTri.valid())
|
||||
if (newTri.good())
|
||||
{
|
||||
operator[](newTriangleI++) = newTri;
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ const Foam::meshedSurfRef& Foam::surfaceWriter::adjustSurface() const
|
||||
|
||||
tmp<pointField> tpts;
|
||||
|
||||
if (geometryTransform_.valid())
|
||||
if (geometryTransform_.good())
|
||||
{
|
||||
if (!geometryTransform_.R().is_identity())
|
||||
{
|
||||
@ -688,7 +688,7 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
|
||||
if
|
||||
(
|
||||
(pTraits<Type>::rank != 0 && pTraits<Type>::nComponents > 1)
|
||||
&& geometryTransform_.valid()
|
||||
&& geometryTransform_.good()
|
||||
&& !geometryTransform_.R().is_identity()
|
||||
)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ Foam::surfaceWriters::x3dWriter::x3dWriter
|
||||
{
|
||||
Info<< "X3D with colourMap '" << tableName << "' and range ";
|
||||
|
||||
if (range_.valid())
|
||||
if (range_.good())
|
||||
{
|
||||
Info<< range_;
|
||||
}
|
||||
@ -288,7 +288,7 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::writeTemplate
|
||||
|
||||
scalarMinMax range(range_);
|
||||
|
||||
if (!range.valid())
|
||||
if (!range.good())
|
||||
{
|
||||
range = minMaxMag(values);
|
||||
|
||||
|
@ -148,7 +148,7 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
|
||||
executionIndex_(0),
|
||||
thermalInertia_(false),
|
||||
verbose_(false),
|
||||
prefix_(word::null)
|
||||
prefix_()
|
||||
{
|
||||
this->refValue() = Zero;
|
||||
this->refGrad() = Zero;
|
||||
|
@ -108,19 +108,17 @@ Foam::moleFractions<ThermoType>::moleFractions
|
||||
}
|
||||
else
|
||||
{
|
||||
if (phaseName_ != word::null)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find thermodynamics model of type "
|
||||
<< ThermoType::typeName
|
||||
<< " for phase " << phaseName_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find thermodynamics model of type "
|
||||
<< ThermoType::typeName
|
||||
<< exit(FatalError);
|
||||
<< ThermoType::typeName;
|
||||
|
||||
if (!phaseName_.empty())
|
||||
{
|
||||
FatalError
|
||||
<< " for phase " << phaseName_;
|
||||
}
|
||||
|
||||
FatalError << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user