STYLE: check autoPtr as plain bool instead of valid()

- cleaner code, more similarity with unique_ptr

  Now
      if (ptr)
      if (!ptr)

  instead
      if (ptr.valid())
      if (!ptr.valid())
This commit is contained in:
Mark Olesen
2020-07-15 08:50:57 +02:00
parent 9af3f85cf9
commit 12c91b9472
144 changed files with 483 additions and 470 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,7 +86,7 @@ Foam::word Foam::orderedPhasePair::name() const
Foam::tmp<Foam::volScalarField> Foam::orderedPhasePair::E() const
{
if (!aspectRatio_.valid())
if (!aspectRatio_)
{
FatalErrorInFunction
<< "Aspect ratio model not specified for " << *this << "."

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,7 +44,7 @@ void testTransfer1(autoPtr<labelList> ap)
// Passed in copy, so automatically removes content
// Transfer would be nice, but not actually needed
Info<< "recv " << Switch::name(ap.valid()) << nl;
Info<< "recv " << Switch::name(bool(ap)) << nl;
}
@ -53,7 +53,7 @@ void testTransfer1(autoPtr<labelList> ap)
void testTransfer2(autoPtr<labelList>&& ap)
{
// As rvalue, so this time we actually get to manage content
Info<< "recv " << Switch::name(ap.valid()) << nl;
Info<< "recv " << Switch::name(bool(ap)) << nl;
}
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
testTransfer2(std::move(list));
Info<<"now have valid=" << Switch::name(list.valid());
Info<<"now have valid=" << Switch::name(bool(list));
if (list)
{
@ -209,9 +209,9 @@ int main(int argc, char *argv[])
testTransfer2(std::move(list));
Info<<"now have valid=" << Switch::name(list.valid());
Info<<"now have valid=" << Switch::name(bool(list));
if (list.valid())
if (list)
{
Info<< nl
<< flatOutput(*list) << " @ " << name(list->cdata())
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
auto ptr1 = autoPtr<labelList>::New();
auto ptr2 = autoPtr<labelList>::New();
Info<<"ptr valid: " << ptr1.valid() << nl;
Info<<"ptr valid: " << bool(ptr1) << nl;
// Refuses to compile (good!): ptr1 = new labelList(10);

View File

@ -137,9 +137,9 @@ label mergePatchFaces
// Faces in error.
labelHashSet errorFaces;
if (qualDictPtr.valid())
if (qualDictPtr)
{
motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces);
motionSmoother::checkMesh(false, mesh, *qualDictPtr, errorFaces);
}
else
{
@ -440,7 +440,7 @@ int main(int argc, char *argv[])
);
// Merge points on straight edges and remove unused points
if (qualDict.valid())
if (qualDict)
{
Info<< "Merging all 'loose' points on surface edges, "
<< "regardless of the angle they make." << endl;

View File

@ -731,9 +731,9 @@ int main(int argc, char *argv[])
);
// Update
if (refDataPtr.valid())
if (refDataPtr)
{
refDataPtr().updateMesh(map());
refDataPtr->updateMesh(map());
}
// Store added cells
@ -896,9 +896,9 @@ int main(int argc, char *argv[])
updateFaceLabels(map(), backPatchFaces);
updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid())
if (refDataPtr)
{
refDataPtr().updateMesh(map());
refDataPtr->updateMesh(map());
}
// Move mesh (if inflation used)
@ -1029,9 +1029,9 @@ int main(int argc, char *argv[])
// Update local data
updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid())
if (refDataPtr)
{
refDataPtr().updateMesh(map());
refDataPtr->updateMesh(map());
}
// Move mesh (if inflation used)
@ -1067,9 +1067,9 @@ int main(int argc, char *argv[])
}
}
if (refDataPtr.valid())
if (refDataPtr)
{
refDataPtr().write();
refDataPtr->write();
}

View File

@ -539,7 +539,7 @@ Foam::label Foam::checkGeometry
<< nonAlignedPoints.name() << endl;
nonAlignedPoints.instance() = mesh.pointsInstance();
nonAlignedPoints.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, nonAlignedPoints);
}
@ -573,7 +573,7 @@ Foam::label Foam::checkGeometry
<< " non closed cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -589,7 +589,7 @@ Foam::label Foam::checkGeometry
<< aspectCells.name() << endl;
aspectCells.instance() = mesh.pointsInstance();
aspectCells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, aspectCells);
}
@ -610,7 +610,7 @@ Foam::label Foam::checkGeometry
<< " zero area faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -632,7 +632,7 @@ Foam::label Foam::checkGeometry
<< " zero volume cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -655,7 +655,7 @@ Foam::label Foam::checkGeometry
<< " non-orthogonal faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -677,7 +677,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -699,7 +699,7 @@ Foam::label Foam::checkGeometry
<< " skew faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -723,7 +723,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -756,7 +756,7 @@ Foam::label Foam::checkGeometry
<< "decomposition tets to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -781,7 +781,7 @@ Foam::label Foam::checkGeometry
<< endl;
points.instance() = mesh.pointsInstance();
points.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, points);
}
@ -804,7 +804,7 @@ Foam::label Foam::checkGeometry
<< " apart) points to set " << nearPoints.name() << endl;
nearPoints.instance() = mesh.pointsInstance();
nearPoints.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, nearPoints);
}
@ -828,7 +828,7 @@ Foam::label Foam::checkGeometry
<< endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -851,7 +851,7 @@ Foam::label Foam::checkGeometry
<< " warped faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -872,7 +872,7 @@ Foam::label Foam::checkGeometry
<< " under-determined cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -892,7 +892,7 @@ Foam::label Foam::checkGeometry
<< " concave cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -913,7 +913,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -934,7 +934,7 @@ Foam::label Foam::checkGeometry
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -949,7 +949,7 @@ Foam::label Foam::checkGeometry
const word procAndTime(Foam::name(Pstream::myProcNo()) + "_" + tmName);
autoPtr<surfaceWriter> patchWriter;
if (!surfWriter.valid())
if (!surfWriter)
{
patchWriter.reset(new surfaceWriters::vtkWriter());
}

View File

@ -30,7 +30,7 @@ Foam::label Foam::checkMeshQuality
faces.instance() = mesh.pointsInstance();
faces.write();
if (writer.valid())
if (writer)
{
mergeAndWrite(*writer, faces);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -202,7 +202,7 @@ Foam::label Foam::checkTopology
<< " illegal cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -226,7 +226,7 @@ Foam::label Foam::checkTopology
<< " unused points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, points);
}
@ -248,7 +248,7 @@ Foam::label Foam::checkTopology
<< " unordered faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -268,7 +268,7 @@ Foam::label Foam::checkTopology
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -289,7 +289,7 @@ Foam::label Foam::checkTopology
<< endl;
cells.instance() = mesh.pointsInstance();
cells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, cells);
}
@ -313,7 +313,7 @@ Foam::label Foam::checkTopology
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, faces);
}
@ -368,7 +368,7 @@ Foam::label Foam::checkTopology
<< endl;
oneCells.instance() = mesh.pointsInstance();
oneCells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, oneCells);
}
@ -384,7 +384,7 @@ Foam::label Foam::checkTopology
<< endl;
twoCells.instance() = mesh.pointsInstance();
twoCells.write();
if (surfWriter.valid())
if (surfWriter)
{
mergeAndWrite(*surfWriter, twoCells);
}
@ -529,7 +529,7 @@ Foam::label Foam::checkTopology
<< " points that are in multiple regions to set "
<< points.name() << endl;
points.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, points);
}
@ -640,7 +640,7 @@ Foam::label Foam::checkTopology
<< " conflicting points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write();
if (setWriter.valid())
if (setWriter)
{
mergeAndWrite(*setWriter, points);
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1035,9 +1036,9 @@ void Foam::meshDualiser::setRefinement
-1, //masterCellID,
-1 //zoneID
);
if (dualCcStr.valid())
if (dualCcStr)
{
meshTools::writeOBJ(dualCcStr(), mesh_.points()[pointi]);
meshTools::writeOBJ(*dualCcStr, mesh_.points()[pointi]);
}
}
@ -1079,11 +1080,11 @@ void Foam::meshDualiser::setRefinement
-1, //masterCellID
mesh_.cellZones().whichZone(pCells[pCelli]) //zoneID
);
if (dualCcStr.valid())
if (dualCcStr)
{
meshTools::writeOBJ
(
dualCcStr(),
*dualCcStr,
0.5*(mesh_.points()[pointi]+cellCentres[pCells[pCelli]])
);
}
@ -1104,9 +1105,9 @@ void Foam::meshDualiser::setRefinement
-1 //zoneID
);
if (dualCcStr.valid())
if (dualCcStr)
{
meshTools::writeOBJ(dualCcStr(), mesh_.points()[pointi]);
meshTools::writeOBJ(*dualCcStr, mesh_.points()[pointi]);
}
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -393,9 +393,9 @@ bool doCommand
currentSet.resize(max(currentSet.size(), typSize));
}
if (currentSetPtr.valid())
if (currentSetPtr)
{
topoSet& currentSet = currentSetPtr();
topoSet& currentSet = *currentSetPtr;
Info<< " Set:" << currentSet.name()
<< " Size:" << returnReduce(currentSet.size(), sumOp<label>())
@ -829,9 +829,9 @@ int main(int argc, char *argv[])
commandStatus stat = INVALID;
if (fileStreamPtr.valid())
if (fileStreamPtr)
{
if (!fileStreamPtr().good())
if (!fileStreamPtr->good())
{
Info<< "End of batch file" << endl;
// No error.

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -394,7 +394,7 @@ int main(int argc, char *argv[])
break;
}
if (currentSet.valid())
if (currentSet)
{
Info<< " "
<< currentSet().type() << ' '

View File

@ -426,9 +426,9 @@ int main(int argc, char *argv[])
if (!lagrangianDirs.empty())
{
if (meshPtr.valid())
if (meshPtr)
{
meshPtr().readUpdate();
meshPtr->readUpdate();
}
else
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -334,7 +334,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
autoPtr<polyMesh> procMeshPtr;
if (facesInstancePointsPtr_.valid())
if (facesInstancePointsPtr_)
{
// Construct mesh from facesInstance.
pointField facesInstancePoints
@ -738,7 +738,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.write();
// Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid())
if (facesInstancePointsPtr_)
{
pointIOField pointsInstancePoints
(

View File

@ -672,9 +672,9 @@ void readFields
// Load field (but not oldTime)
readField(io, mesh, i, fields);
// Create zero sized field and send
if (subsetterPtr.valid())
if (subsetterPtr)
{
tmp<GeoField> tsubfld = subsetterPtr().interpolate(fields[i]);
tmp<GeoField> tsubfld = subsetterPtr->interpolate(fields[i]);
// Send to all processors that don't have a mesh
for (label procI = 1; procI < Pstream::nProcs(); ++procI)
@ -1803,7 +1803,7 @@ void reconstructLagrangian
if (cloudNames.size())
{
if (!lagrangianReconstructorPtr.valid())
if (!lagrangianReconstructorPtr)
{
lagrangianReconstructorPtr.reset
(
@ -2116,7 +2116,7 @@ void redistributeLagrangian
{
if (clouds.size())
{
if (!lagrangianReconstructorPtr.valid())
if (!lagrangianReconstructorPtr)
{
lagrangianReconstructorPtr.reset
(
@ -2804,7 +2804,7 @@ int main(int argc, char *argv[])
Info<< " Detected topology change;"
<< " reconstructing addressing" << nl << endl;
if (baseMeshPtr.valid())
if (baseMeshPtr)
{
// Cannot do a baseMesh::readUpdate() since not all
// processors will have mesh files. So instead just

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -153,7 +153,7 @@ Description
// Finish writers
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->close();
}

View File

@ -262,7 +262,7 @@ Description
// CellData
{
// Begin CellData
if (internalWriter.valid())
if (internalWriter)
{
// Optionally with cellID and procID fields
internalWriter->beginCellData
@ -323,7 +323,7 @@ Description
if (doPointValues)
{
// Begin PointData
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->beginPointData
(
@ -386,7 +386,7 @@ Description
// Finish writers
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->close();
}

View File

@ -60,7 +60,7 @@ bool writeDimField
const auto& field = tfield();
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->write(field);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -83,7 +83,7 @@ bool writePointField
const auto& field = tproxied();
// Internal
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->write(field);
}

View File

@ -63,7 +63,7 @@ bool writeVolField
const auto& field = tfield();
// Internal
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->write(field);
}

View File

@ -99,7 +99,7 @@ int main(int argc, char *argv[])
autoPtr<lumpedPointIOMovement> movement =
lumpedPointIOMovement::New(runTime);
if (!movement.valid())
if (!movement)
{
Info<< "No valid movement found" << endl;
return 1;
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New(mesh);
if (!movement.valid())
if (!movement)
{
Info<< "No valid movement found" << endl;
return 1;

View File

@ -802,9 +802,9 @@ int main(int argc, char *argv[])
ctrl
);
}
else if (exprDictPtr.valid())
else if (exprDictPtr)
{
const dictionary& exprDict = exprDictPtr();
const dictionary& exprDict = *exprDictPtr;
// Read set construct info from dictionary
PtrList<entry> actions(exprDict.lookup("expressions"));
@ -898,7 +898,7 @@ int main(int argc, char *argv[])
);
}
}
else if (exprDictPtr.valid())
else
{
FatalErrorInFunction
<< "No command-line or dictionary??" << nl << endl

View File

@ -469,7 +469,7 @@ int main(int argc, char *argv[])
Info<< "Surface has " << illegalFaces.size()
<< " illegal triangles." << endl;
if (surfWriter.valid())
if (surfWriter)
{
boolList isIllegalFace(surf.size(), false);
UIndirectList<bool>(isIllegalFace, illegalFaces) = true;
@ -598,7 +598,7 @@ int main(int argc, char *argv[])
}
// Dump for subsetting
if (surfWriter.valid())
if (surfWriter)
{
// Transcribe faces
faceList faces(surf.size());
@ -867,7 +867,7 @@ int main(int argc, char *argv[])
{
Info<< "Splitting surface into parts ..." << endl << endl;
if (!surfWriter.valid())
if (!surfWriter)
{
surfWriter.reset(new surfaceWriters::vtkWriter());
}
@ -933,7 +933,7 @@ int main(int argc, char *argv[])
if (outputThreshold > 0)
{
if (!surfWriter.valid())
if (!surfWriter)
{
surfWriter.reset(new surfaceWriters::vtkWriter());
}
@ -1001,7 +1001,7 @@ int main(int argc, char *argv[])
{
nInt++;
if (intStreamPtr.valid())
if (intStreamPtr)
{
intStreamPtr().write(hitInfo.hitPoint());
}
@ -1013,7 +1013,7 @@ int main(int argc, char *argv[])
{
nInt++;
if (intStreamPtr.valid())
if (intStreamPtr)
{
intStreamPtr().write(hitInfo2.hitPoint());
}
@ -1070,7 +1070,7 @@ int main(int argc, char *argv[])
Info<< "Surface is self-intersecting at " << nInt
<< " locations." << endl;
if (intStreamPtr.valid())
if (intStreamPtr)
{
Info<< "Writing intersection points to "
<< intStreamPtr().name() << endl;

View File

@ -711,7 +711,7 @@ int main(int argc, char *argv[])
10 // externalAngleTolerance
);
if (vtkWriter.valid())
if (vtkWriter)
{
vtkWriter->beginCellData();
vtkWriter->write("internalCloseness", tcloseness[0]());
@ -735,7 +735,7 @@ int main(int argc, char *argv[])
maxProximity
);
if (vtkWriter.valid())
if (vtkWriter)
{
vtkWriter->beginCellData();
vtkWriter->write("featureProximity", tproximity());
@ -753,7 +753,7 @@ int main(int argc, char *argv[])
surf
);
if (vtkWriter.valid())
if (vtkWriter)
{
vtkWriter->beginPointData();
vtkWriter->write("curvature", tcurvature());

View File

@ -277,7 +277,7 @@ int main(int argc, char *argv[])
surf.cleanup(true);
}
if (fromCsys.valid())
if (fromCsys)
{
Info<< "move points from coordinate system: "
<< fromCsys->name() << endl;
@ -285,7 +285,7 @@ int main(int argc, char *argv[])
surf.movePoints(tpf());
}
if (toCsys.valid())
if (toCsys)
{
Info<< "move points to coordinate system: "
<< toCsys->name() << endl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -163,7 +163,7 @@ Foam::IOobjectList::IOobjectList
bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
{
if (objectPtr.valid())
if (objectPtr)
{
return insert(objectPtr->name(), objectPtr);
}
@ -174,7 +174,7 @@ bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr)
{
if (objectPtr.valid())
if (objectPtr)
{
return insert(objectPtr->name(), objectPtr);
}

View File

@ -495,7 +495,7 @@ void Foam::functionObjectList::resetState()
Foam::IOdictionary& Foam::functionObjectList::stateDict()
{
if (!stateDictPtr_.valid())
if (!stateDictPtr_)
{
createStateDict();
}
@ -506,7 +506,7 @@ Foam::IOdictionary& Foam::functionObjectList::stateDict()
const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
{
if (!stateDictPtr_.valid())
if (!stateDictPtr_)
{
createStateDict();
}
@ -517,7 +517,7 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
Foam::objectRegistry& Foam::functionObjectList::storedObjects()
{
if (!objectsRegistryPtr_.valid())
if (!objectsRegistryPtr_)
{
createOutputRegistry();
}
@ -528,7 +528,7 @@ Foam::objectRegistry& Foam::functionObjectList::storedObjects()
const Foam::objectRegistry& Foam::functionObjectList::storedObjects() const
{
if (!objectsRegistryPtr_.valid())
if (!objectsRegistryPtr_)
{
createOutputRegistry();
}
@ -727,7 +727,7 @@ bool Foam::functionObjectList::adjustTimeStep()
bool Foam::functionObjectList::read()
{
if (!stateDictPtr_.valid())
if (!stateDictPtr_)
{
createStateDict();
}
@ -903,7 +903,7 @@ bool Foam::functionObjectList::read()
FatalIOError.throwExceptions(throwingIOerr);
// Required functionObject to be valid on all processors
if (returnReduce(foPtr.valid(), andOp<bool>()))
if (returnReduce(bool(foPtr), andOp<bool>()))
{
objPtr.reset(foPtr.release());
}

View File

@ -241,7 +241,7 @@ Foam::OFstream& Foam::functionObjects::writeFile::file()
return Snull;
}
if (!filePtr_.valid())
if (!filePtr_)
{
FatalErrorInFunction
<< "File pointer not allocated\n";

View File

@ -106,7 +106,7 @@ Foam::Istream& Foam::regIOobject::readStream(const bool valid)
}
// Construct object stream and read header if not already constructed
if (!isPtr_.valid())
if (!isPtr_)
{
fileName objPath;
if (watchIndices_.size())
@ -152,7 +152,7 @@ Foam::Istream& Foam::regIOobject::readStream
}
// Construct IFstream if not already constructed
if (!isPtr_.valid())
if (!isPtr_)
{
readStream(valid);
@ -189,7 +189,7 @@ void Foam::regIOobject::close()
<< endl;
}
isPtr_.clear();
isPtr_.reset(nullptr);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -518,7 +518,7 @@ void Foam::expressions::exprResult::operator=(const exprResult& rhs)
<< exit(FatalError);
}
}
else if (objectPtr_.valid())
else if (objectPtr_)
{
FatalErrorInFunction
<< "Assignment with general content not possible" << nl

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -283,7 +283,7 @@ inline bool Foam::expressions::exprResult::isBool() const
inline bool Foam::expressions::exprResult::isObject() const
{
return objectPtr_.valid();
return bool(objectPtr_);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -228,7 +228,7 @@ template<class Type>
const Foam::pointPatchField<Type>&
Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
{
if (!redirectPatchFieldPtr_.valid())
if (!redirectPatchFieldPtr_)
{
// Construct a patch
// Make sure to construct the patchfield with up-to-date value

View File

@ -1262,7 +1262,7 @@ void Foam::argList::parse
fileHandler().NewIFstream(source)
);
if (!decompDictStream.valid() || !decompDictStream->good())
if (!decompDictStream || !decompDictStream->good())
{
FatalError
<< "Cannot read decomposeParDict from "

View File

@ -161,7 +161,7 @@ void Foam::interpolationTable<Type>::write(Ostream& os) const
{
os.writeEntry("file", fileName_);
os.writeEntry("outOfBounds", bounds::repeatableBoundingNames[bounding_]);
if (reader_.valid())
if (reader_)
{
reader_->write(os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -447,7 +447,7 @@ public:
//- Whether to agglomerate across processors
bool processorAgglomerate() const
{
return procAgglomeratorPtr_.valid();
return bool(procAgglomeratorPtr_);
}
//- Mapping from processor to agglomerated processor (global, all

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -170,10 +170,10 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
tmp<labelField> tfineToCoarse(new labelField(0));
labelField& fineToCoarse = tfineToCoarse.ref();
if (singleCellMeshPtr.valid())
if (singleCellMeshPtr)
{
// On master call the agglomerator
const lduPrimitiveMesh& singleCellMesh = singleCellMeshPtr();
const lduPrimitiveMesh& singleCellMesh = *singleCellMeshPtr;
label nCoarseProcs;
fineToCoarse = pairGAMGAgglomeration::agglomerate

View File

@ -1837,7 +1837,7 @@ void Foam::globalMeshData::clearOut()
const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
{
if (!sharedPointGlobalLabelsPtr_.valid())
if (!sharedPointGlobalLabelsPtr_)
{
sharedPointGlobalLabelsPtr_.reset
(
@ -2015,7 +2015,7 @@ Foam::label Foam::globalMeshData::nGlobalPoints() const
const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
{
if (!sharedPointLabelsPtr_.valid())
if (!sharedPointLabelsPtr_)
{
calcSharedPoints();
}
@ -2025,7 +2025,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointLabels() const
const Foam::labelList& Foam::globalMeshData::sharedPointAddr() const
{
if (!sharedPointAddrPtr_.valid())
if (!sharedPointAddrPtr_)
{
calcSharedPoints();
}
@ -2045,7 +2045,7 @@ Foam::label Foam::globalMeshData::nGlobalEdges() const
const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
{
if (!sharedEdgeLabelsPtr_.valid())
if (!sharedEdgeLabelsPtr_)
{
calcSharedEdges();
}
@ -2055,7 +2055,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
{
if (!sharedEdgeAddrPtr_.valid())
if (!sharedEdgeAddrPtr_)
{
calcSharedEdges();
}
@ -2065,7 +2065,7 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
{
if (!coupledPatchPtr_.valid())
if (!coupledPatchPtr_)
{
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
@ -2126,7 +2126,7 @@ const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const
{
if (!coupledPatchMeshEdgesPtr_.valid())
if (!coupledPatchMeshEdgesPtr_)
{
coupledPatchMeshEdgesPtr_.reset
(
@ -2147,7 +2147,7 @@ const Foam::labelList& Foam::globalMeshData::coupledPatchMeshEdges() const
const Foam::Map<Foam::label>& Foam::globalMeshData::coupledPatchMeshEdgeMap()
const
{
if (!coupledPatchMeshEdgeMapPtr_.valid())
if (!coupledPatchMeshEdgeMapPtr_)
{
const labelList& me = coupledPatchMeshEdges();
@ -2165,7 +2165,7 @@ const
const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
{
if (!globalPointNumberingPtr_.valid())
if (!globalPointNumberingPtr_)
{
globalPointNumberingPtr_.reset
(
@ -2179,7 +2179,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
const Foam::globalIndexAndTransform&
Foam::globalMeshData::globalTransforms() const
{
if (!globalTransformsPtr_.valid())
if (!globalTransformsPtr_)
{
globalTransformsPtr_.reset(new globalIndexAndTransform(mesh_));
}
@ -2189,7 +2189,7 @@ Foam::globalMeshData::globalTransforms() const
const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
{
if (!globalPointSlavesPtr_.valid())
if (!globalPointSlavesPtr_)
{
calcGlobalPointSlaves();
}
@ -2200,7 +2200,7 @@ const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
const Foam::labelListList& Foam::globalMeshData::globalPointTransformedSlaves()
const
{
if (!globalPointTransformedSlavesPtr_.valid())
if (!globalPointTransformedSlavesPtr_)
{
calcGlobalPointSlaves();
}
@ -2210,7 +2210,7 @@ const
const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
{
if (!globalPointSlavesMapPtr_.valid())
if (!globalPointSlavesMapPtr_)
{
calcGlobalPointSlaves();
}
@ -2220,7 +2220,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
{
if (!globalEdgeNumberingPtr_.valid())
if (!globalEdgeNumberingPtr_)
{
globalEdgeNumberingPtr_.reset
(
@ -2233,7 +2233,7 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
{
if (!globalEdgeSlavesPtr_.valid())
if (!globalEdgeSlavesPtr_)
{
calcGlobalEdgeSlaves();
}
@ -2244,7 +2244,7 @@ const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
const Foam::labelListList& Foam::globalMeshData::globalEdgeTransformedSlaves()
const
{
if (!globalEdgeTransformedSlavesPtr_.valid())
if (!globalEdgeTransformedSlavesPtr_)
{
calcGlobalEdgeSlaves();
}
@ -2254,7 +2254,7 @@ const
const Foam::bitSet& Foam::globalMeshData::globalEdgeOrientation() const
{
if (!globalEdgeOrientationPtr_.valid())
if (!globalEdgeOrientationPtr_)
{
calcGlobalEdgeOrientation();
}
@ -2264,7 +2264,7 @@ const Foam::bitSet& Foam::globalMeshData::globalEdgeOrientation() const
const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
{
if (!globalEdgeSlavesMapPtr_.valid())
if (!globalEdgeSlavesMapPtr_)
{
calcGlobalEdgeSlaves();
}
@ -2275,7 +2275,7 @@ const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryFaceNumbering()
const
{
if (!globalBoundaryFaceNumberingPtr_.valid())
if (!globalBoundaryFaceNumberingPtr_)
{
calcGlobalPointBoundaryFaces();
}
@ -2286,7 +2286,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryFaces()
const
{
if (!globalPointBoundaryFacesPtr_.valid())
if (!globalPointBoundaryFacesPtr_)
{
calcGlobalPointBoundaryFaces();
}
@ -2297,7 +2297,7 @@ const
const Foam::labelListList&
Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
{
if (!globalPointTransformedBoundaryFacesPtr_.valid())
if (!globalPointTransformedBoundaryFacesPtr_)
{
calcGlobalPointBoundaryFaces();
}
@ -2308,7 +2308,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryFaces() const
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryFacesMap()
const
{
if (!globalPointBoundaryFacesMapPtr_.valid())
if (!globalPointBoundaryFacesMapPtr_)
{
calcGlobalPointBoundaryFaces();
}
@ -2318,7 +2318,7 @@ const
const Foam::labelList& Foam::globalMeshData::boundaryCells() const
{
if (!boundaryCellsPtr_.valid())
if (!boundaryCellsPtr_)
{
calcGlobalPointBoundaryCells();
}
@ -2329,7 +2329,7 @@ const Foam::labelList& Foam::globalMeshData::boundaryCells() const
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryCellNumbering()
const
{
if (!globalBoundaryCellNumberingPtr_.valid())
if (!globalBoundaryCellNumberingPtr_)
{
calcGlobalPointBoundaryCells();
}
@ -2340,7 +2340,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryCells()
const
{
if (!globalPointBoundaryCellsPtr_.valid())
if (!globalPointBoundaryCellsPtr_)
{
calcGlobalPointBoundaryCells();
}
@ -2351,7 +2351,7 @@ const
const Foam::labelListList&
Foam::globalMeshData::globalPointTransformedBoundaryCells() const
{
if (!globalPointTransformedBoundaryCellsPtr_.valid())
if (!globalPointTransformedBoundaryCellsPtr_)
{
calcGlobalPointBoundaryCells();
}
@ -2362,7 +2362,7 @@ Foam::globalMeshData::globalPointTransformedBoundaryCells() const
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryCellsMap()
const
{
if (!globalPointBoundaryCellsMapPtr_.valid())
if (!globalPointBoundaryCellsMapPtr_)
{
calcGlobalPointBoundaryCells();
}
@ -2372,7 +2372,7 @@ const
const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
{
if (!globalCoPointSlavesPtr_.valid())
if (!globalCoPointSlavesPtr_)
{
calcGlobalCoPointSlaves();
}
@ -2382,7 +2382,7 @@ const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const
{
if (!globalCoPointSlavesMapPtr_.valid())
if (!globalCoPointSlavesMapPtr_)
{
calcGlobalCoPointSlaves();
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -645,7 +646,7 @@ public:
bool hasOldCellVolumes() const
{
return oldCellVolumesPtr_.valid();
return bool(oldCellVolumesPtr_);
}
const scalarField& oldCellVolumes() const

View File

@ -329,7 +329,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
<< " boundaries." << endl;
}
if (!neighbourEdgesPtr_.valid())
if (!neighbourEdgesPtr_)
{
neighbourEdgesPtr_.reset(new List<labelPairList>(size()));
List<labelPairList>& neighbourEdges = neighbourEdgesPtr_();
@ -451,7 +451,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
{
if (!patchIDPtr_.valid())
if (!patchIDPtr_)
{
patchIDPtr_.reset(new labelList(mesh_.nBoundaryFaces()));
labelList& list = *patchIDPtr_;
@ -476,7 +476,7 @@ const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
const Foam::HashTable<Foam::labelList>&
Foam::polyBoundaryMesh::groupPatchIDs() const
{
if (!groupPatchIDsPtr_.valid())
if (!groupPatchIDsPtr_)
{
groupPatchIDsPtr_.reset(new HashTable<labelList>(16));
auto& groupPatchIDs = *groupPatchIDsPtr_;

View File

@ -699,25 +699,25 @@ void Foam::polyMesh::resetPrimitives
// Take over new primitive data.
// Optimized to avoid overwriting data at all
if (points.valid())
if (points)
{
points_.transfer(points());
points_.transfer(*points);
bounds_ = boundBox(points_, validBoundary);
}
if (faces.valid())
if (faces)
{
faces_.transfer(faces());
faces_.transfer(*faces);
}
if (owner.valid())
if (owner)
{
owner_.transfer(owner());
owner_.transfer(*owner);
}
if (neighbour.valid())
if (neighbour)
{
neighbour_.transfer(neighbour());
neighbour_.transfer(*neighbour);
}
@ -922,7 +922,7 @@ Foam::polyMesh::cellTree() const
);
}
return cellTreePtr_();
return *cellTreePtr_;
}
@ -1160,11 +1160,11 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
points_.instance() = time().timeName();
points_.eventNo() = getEvent();
if (tetBasePtIsPtr_.valid())
if (tetBasePtIsPtr_)
{
tetBasePtIsPtr_().writeOpt() = IOobject::AUTO_WRITE;
tetBasePtIsPtr_().instance() = time().timeName();
tetBasePtIsPtr_().eventNo() = getEvent();
tetBasePtIsPtr_->writeOpt() = IOobject::AUTO_WRITE;
tetBasePtIsPtr_->instance() = time().timeName();
tetBasePtIsPtr_->eventNo() = getEvent();
}
tmp<scalarField> sweptVols = primitiveMesh::movePoints
@ -1174,9 +1174,9 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
);
// Adjust parallel shared points
if (globalMeshDataPtr_.valid())
if (globalMeshDataPtr_)
{
globalMeshDataPtr_().movePoints(points_);
globalMeshDataPtr_->movePoints(points_);
}
// Force recalculation of all geometric data with new points

View File

@ -80,7 +80,7 @@ void Foam::polyMesh::updateGeom
DebugInFunction
<< "Updating geometric data with newPoints:"
<< newPoints.size() << " newTetBasePtIs:"
<< newTetBasePtIsPtr.valid() << endl;
<< bool(newTetBasePtIsPtr) << endl;
if (points_.size() != 0 && points_.size() != newPoints.size())
{
@ -128,7 +128,7 @@ void Foam::polyMesh::updateGeom
points_.transfer(newPoints);
// Optional new tet base points
if (newTetBasePtIsPtr.valid())
if (newTetBasePtIsPtr)
{
tetBasePtIsPtr_ = std::move(newTetBasePtIsPtr);
}

View File

@ -64,7 +64,7 @@ void Foam::polyMesh::setInstance
cellZones_.writeOpt() = wOpt;
cellZones_.instance() = inst;
if (tetBasePtIsPtr_.valid())
if (tetBasePtIsPtr_)
{
tetBasePtIsPtr_->writeOpt() = wOpt;
tetBasePtIsPtr_->instance() = inst;

View File

@ -59,7 +59,7 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
cellTreePtr_.clear();
// Update parallel data
if (globalMeshDataPtr_.valid())
if (globalMeshDataPtr_)
{
globalMeshDataPtr_->updateMesh();
}
@ -67,12 +67,12 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
setInstance(time().timeName());
// Map the old motion points if present
if (oldPointsPtr_.valid())
if (oldPointsPtr_)
{
// Make a copy of the original points
pointField oldMotionPoints = oldPointsPtr_();
pointField oldMotionPoints = *oldPointsPtr_;
pointField& newMotionPoints = oldPointsPtr_();
pointField& newMotionPoints = *oldPointsPtr_;
// Resize the list to new size
newMotionPoints.setSize(points_.size());

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -528,7 +528,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
{
if (!neighbPointsPtr_.valid())
if (!neighbPointsPtr_)
{
FatalErrorInFunction
<< "No extended addressing calculated for patch " << name()
@ -540,7 +540,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
{
if (!neighbEdgesPtr_.valid())
if (!neighbEdgesPtr_)
{
FatalErrorInFunction
<< "No extended addressing calculated for patch " << name()

View File

@ -224,7 +224,7 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correctInletOutlet
template<class BasicTurbulenceModel>
void mixtureKEpsilon<BasicTurbulenceModel>::initMixtureFields()
{
if (rhom_.valid()) return;
if (rhom_) return;
// Local references to gas-phase properties
const volScalarField& kg = this->k_;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -227,7 +227,7 @@ template<class Type>
const Foam::fvPatchField<Type>&
Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
{
if (!redirectPatchFieldPtr_.valid())
if (!redirectPatchFieldPtr_)
{
// Construct a patch
// Make sure to construct the patchfield with up-to-date value

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -226,7 +226,7 @@ template<class Type>
const Foam::mixedFvPatchField<Type>&
Foam::codedMixedFvPatchField<Type>::redirectPatchField() const
{
if (!redirectPatchFieldPtr_.valid())
if (!redirectPatchFieldPtr_)
{
// Construct a patch
// Make sure to construct the patchfield with up-to-date value

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -131,7 +132,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField
origin_(ptf.origin_)
{
// Evaluate the profile if defined
if (ptf.profile_.valid())
if (ptf.profile_)
{
this->evaluate();
}

View File

@ -102,7 +102,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf, p, iF, mapper),
freestreamBCPtr_()
{
if (ptf.freestreamBCPtr_.valid())
if (ptf.freestreamBCPtr_)
{
freestreamBCPtr_ =
fvPatchField<Type>::New(ptf.freestreamBCPtr_(), p, iF, mapper);
@ -119,7 +119,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf),
freestreamBCPtr_()
{
if (ptf.freestreamBCPtr_.valid())
if (ptf.freestreamBCPtr_)
{
freestreamBCPtr_ = ptf.freestreamBCPtr_->clone();
}
@ -136,7 +136,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
inletOutletFvPatchField<Type>(ptf, iF),
freestreamBCPtr_()
{
if (ptf.freestreamBCPtr_.valid())
if (ptf.freestreamBCPtr_)
{
freestreamBCPtr_ = ptf.freestreamBCPtr_->clone();
}
@ -149,7 +149,7 @@ template<class Type>
void Foam::freestreamFvPatchField<Type>::autoMap(const fvPatchFieldMapper& m)
{
inletOutletFvPatchField<Type>::autoMap(m);
if (freestreamBCPtr_.valid())
if (freestreamBCPtr_)
{
freestreamBCPtr_->autoMap(m);
}
@ -167,7 +167,7 @@ void Foam::freestreamFvPatchField<Type>::rmap
const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf);
if (fsptf.freestreamBCPtr_.valid())
if (fsptf.freestreamBCPtr_)
{
freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr);
}
@ -182,7 +182,7 @@ void Foam::freestreamFvPatchField<Type>::updateCoeffs()
return;
}
if (freestreamBCPtr_.valid())
if (freestreamBCPtr_)
{
freestreamBCPtr_->evaluate();
freestreamValue() = freestreamBCPtr_();
@ -198,7 +198,7 @@ void Foam::freestreamFvPatchField<Type>::write(Ostream& os) const
fvPatchField<Type>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", this->phiName_);
if (freestreamBCPtr_.valid())
if (freestreamBCPtr_)
{
os.beginBlock("freestreamBC");
freestreamBCPtr_->write(os);

View File

@ -107,7 +107,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
uniformGradient_(ptf.uniformGradient_.clone())
{
// Evaluate the profile if defined
if (ptf.uniformGradient_.valid())
if (ptf.uniformGradient_)
{
this->evaluate();
}

View File

@ -399,9 +399,9 @@ combineSurfaceGeometry
points = s.points();
}
}
else if (sampledPtr_.valid())
else if (sampledPtr_)
{
const sampledSurface& s = sampledPtr_();
const sampledSurface& s = *sampledPtr_;
if (Pstream::parRun())
{
@ -443,9 +443,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
totalArea = gSum(s.magSf());
}
else if (sampledPtr_.valid())
else if (sampledPtr_)
{
totalArea = gSum(sampledPtr_().magSf());
totalArea = gSum(sampledPtr_->magSf());
}
else
{
@ -482,7 +482,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::usesSf() const
bool Foam::functionObjects::fieldValues::surfaceFieldValue::update()
{
if (sampledPtr_.valid())
if (sampledPtr_)
{
sampledPtr_->update();
}
@ -1022,9 +1022,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
const polySurface& s = dynamicCast<const polySurface>(obr());
Sf = s.Sf();
}
else if (sampledPtr_.valid())
else if (sampledPtr_)
{
Sf = sampledPtr_().Sf();
Sf = sampledPtr_->Sf();
}
else
{
@ -1036,7 +1036,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
faceList faces;
pointField points;
if (surfaceWriterPtr_.valid())
if (surfaceWriterPtr_)
{
if (withTopologicalMerge())
{

View File

@ -94,19 +94,19 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
{
const vf& fld = lookupObject<vf>(fieldName);
if (sampledPtr_.valid())
if (sampledPtr_)
{
if (sampledPtr_().interpolate())
if (sampledPtr_->interpolate())
{
const interpolationCellPoint<Type> interp(fld);
return sampledPtr_().interpolate(interp);
return sampledPtr_->interpolate(interp);
}
else
{
const interpolationCell<Type> interp(fld);
return sampledPtr_().sample(interp);
return sampledPtr_->sample(interp);
}
}
else

View File

@ -903,7 +903,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
volVectorField
>(fldName).primitiveField();
if (csysPtr_.valid())
if (csysPtr_)
{
Log << "Transforming vector field " << fldName
<< " with coordinate system "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -144,7 +144,7 @@ Foam::functionObjects::codedFunctionObject::codedFunctionObject
Foam::functionObject&
Foam::functionObjects::codedFunctionObject::redirectFunctionObject() const
{
if (!redirectFunctionObjectPtr_.valid())
if (!redirectFunctionObjectPtr_)
{
dictionary constructDict(dict_);
constructDict.set("type", name_);

View File

@ -189,7 +189,7 @@ bool Foam::functionObjects::ensightWrite::execute()
bool Foam::functionObjects::ensightWrite::write()
{
if (!ensCase_.valid())
if (!ensCase_)
{
ensCase_.reset
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -146,7 +146,7 @@ bool Foam::functionObjects::ensightWrite::update()
// ensMesh_.clear();
// meshSubset_.clear();
// }
// else if (ensMesh_.valid())
// else if (ensMesh_)
// {
// ensMesh_->expire();
// }
@ -157,13 +157,13 @@ bool Foam::functionObjects::ensightWrite::update()
meshState_ = polyMesh::UNCHANGED;
if (!ensMesh_.valid())
if (!ensMesh_)
{
ensMesh_.reset(new ensightMesh(meshSubset_.mesh(), writeOpts_));
}
else if (ensMesh_().needsUpdate())
else if (ensMesh_->needsUpdate())
{
ensMesh_().correct();
ensMesh_->correct();
}
return true;

View File

@ -521,7 +521,7 @@ bool Foam::functionObjects::vtkWrite::write()
// CellData
{
if (internalWriter.valid())
if (internalWriter)
{
// Optionally with cellID and procID fields
internalWriter->beginCellData
@ -580,7 +580,7 @@ bool Foam::functionObjects::vtkWrite::write()
if (interpolate_)
{
// Begin PointData
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->beginPointData
(
@ -631,7 +631,7 @@ bool Foam::functionObjects::vtkWrite::write()
// Finish writers
if (internalWriter.valid())
if (internalWriter)
{
internalWriter->close();
}

View File

@ -54,7 +54,7 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFields
const auto& field = tfield();
// Internal
if (internalWriter.valid())
if (internalWriter)
{
ok = true;
internalWriter->write(field);

View File

@ -145,7 +145,7 @@ Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const
pointDisplacement_
);
if (pointLocation_.valid())
if (pointLocation_)
{
if (debug)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2016 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -245,7 +245,7 @@ Foam::displacementLaplacianFvMotionSolver::
Foam::motionDiffusivity&
Foam::displacementLaplacianFvMotionSolver::diffusivity()
{
if (!diffusivityPtr_.valid())
if (!diffusivityPtr_)
{
diffusivityPtr_ = motionDiffusivity::New
(
@ -267,7 +267,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
pointDisplacement_
);
if (pointLocation_.valid())
if (pointLocation_)
{
if (debug)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -249,7 +249,7 @@ Foam::solidBodyDisplacementLaplacianFvMotionSolver::
Foam::motionDiffusivity&
Foam::solidBodyDisplacementLaplacianFvMotionSolver::diffusivity()
{
if (!diffusivityPtr_.valid())
if (!diffusivityPtr_)
{
diffusivityPtr_ = motionDiffusivity::New
(
@ -277,7 +277,7 @@ Foam::solidBodyDisplacementLaplacianFvMotionSolver::curPoints() const
);
const pointField& newPoints = tnewPoints();
if (pointLocation_.valid())
if (pointLocation_)
{
if (debug)
{

View File

@ -591,7 +591,7 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::updateCoeffs()
}
// Apply offset to mapped values
if (offset_.valid())
if (offset_)
{
const scalar t = this->db().time().timeOutputValue();
this->operator==(*this + offset_->value(t));
@ -633,7 +633,7 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::write
mapMethod_
);
if (offset_.valid())
if (offset_)
{
offset_->writeData(os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -155,7 +155,7 @@ void uniformInterpolatedDisplacementPointPatchVectorField::updateCoeffs()
return;
}
if (!interpolatorPtr_.valid())
if (!interpolatorPtr_)
{
interpolatorPtr_ = interpolationWeights::New
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::fv::interRegionOption::nbrRegionName() const
inline const Foam::meshToMesh&
Foam::fv::interRegionOption::meshInterp() const
{
if (!meshInterpPtr_.valid())
if (!meshInterpPtr_)
{
FatalErrorInFunction
<< "Interpolation object not set"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -95,7 +95,7 @@ Foam::fv::jouleHeatingSource::updateSigma
VolFieldType& sigma =
mesh_.lookupObjectRef<VolFieldType>(typeName + ":sigma");
if (!sigmaVsTPtr.valid())
if (!sigmaVsTPtr)
{
// Electrical conductivity field, sigma, was specified by the user
return sigma;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -54,7 +54,7 @@ void Foam::fv::rotorDiskSource::calculate
scalar AOAmax = -GREAT;
// Cached position-dependent rotations available?
const bool hasCache = Rcyl_.valid();
const bool hasCache = bool(Rcyl_);
forAll(cells_, i)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -134,7 +134,7 @@ Foam::fv::CodedSource<Type>::CodedSource
template<class Type>
Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const
{
if (!redirectFvOptionPtr_.valid())
if (!redirectFvOptionPtr_)
{
dictionary constructDict(dict_);
constructDict.set("type", name_);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::fv::interRegionHeatTransferModel::nbrRegionName() const
inline const Foam::meshToMesh&
Foam::fv::interRegionHeatTransferModel::meshInterp() const
{
if (!meshInterpPtr_.valid())
if (!meshInterpPtr_)
{
FatalErrorInFunction
<< "Interpolation object not set"

View File

@ -51,7 +51,7 @@ namespace fv
const Foam::interpolation2DTable<Foam::scalar>&
Foam::fv::tabulatedHeatTransfer::hTable()
{
if (!hTable_.valid())
if (!hTable_)
{
hTable_.reset(new interpolation2DTable<scalar>(coeffs_));
}
@ -62,7 +62,7 @@ Foam::fv::tabulatedHeatTransfer::hTable()
const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV()
{
if (!AoV_.valid())
if (!AoV_)
{
AoV_.reset
(

View File

@ -61,7 +61,7 @@ Foam::fv::tabulatedNTUHeatTransfer::geometryModelNames_
const Foam::interpolation2DTable<Foam::scalar>&
Foam::fv::tabulatedNTUHeatTransfer::ntuTable()
{
if (!ntuTable_.valid())
if (!ntuTable_)
{
ntuTable_.reset(new interpolation2DTable<scalar>(coeffs_));
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -343,7 +344,7 @@ void Foam::Cloud<ParticleType>::move
template<class ParticleType>
void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
{
if (!globalPositionsPtr_.valid())
if (!globalPositionsPtr_)
{
FatalErrorInFunction
<< "Global positions are not available. "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -343,7 +343,7 @@ void Foam::ReactingCloud<CloudType>::info()
template<class CloudType>
void Foam::ReactingCloud<CloudType>::writeFields() const
{
if (compositionModel_.valid())
if (compositionModel_)
{
CloudType::particleType::writeFields(*this, this->composition());
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -279,7 +280,7 @@ void Foam::ReactingMultiphaseCloud<CloudType>::info()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::writeFields() const
{
if (this->compositionModel_.valid())
if (this->compositionModel_)
{
CloudType::particleType::writeFields(*this, this->composition());
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -123,7 +124,7 @@ template<class ParcelType>
inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const
{
if (!GInterp_.valid())
if (!GInterp_)
{
FatalErrorInFunction
<< "Radiation G interpolation object not set"

View File

@ -447,7 +447,7 @@ void Foam::ParticleCollector<CloudType>::write()
sumTotalMass += faceMassTotal[facei];
sumAverageMFR += faceMassFlowRate[facei];
if (outputFilePtr_.valid())
if (outputFilePtr_)
{
outputFilePtr_()
<< time.timeName()

View File

@ -33,7 +33,7 @@ License
template<class CloudType>
void Foam::ParticleErosion<CloudType>::resetQ()
{
if (QPtr_.valid())
if (QPtr_)
{
QPtr_->primitiveFieldRef() = 0.0;
}
@ -82,7 +82,7 @@ Foam::label Foam::ParticleErosion<CloudType>::applyToPatch
template<class CloudType>
void Foam::ParticleErosion<CloudType>::write()
{
if (QPtr_.valid())
if (QPtr_)
{
QPtr_->write();
}

View File

@ -36,7 +36,7 @@ License
template<class CloudType>
void Foam::ParticleTracks<CloudType>::write()
{
if (cloudPtr_.valid())
if (cloudPtr_)
{
cloudPtr_->write();
@ -94,7 +94,7 @@ void Foam::ParticleTracks<CloudType>::preEvolve
const typename parcelType::trackingData& td
)
{
if (!cloudPtr_.valid())
if (!cloudPtr_)
{
cloudPtr_.reset
(
@ -113,7 +113,7 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
|| this->owner().solution().transient()
)
{
if (!cloudPtr_.valid())
if (!cloudPtr_)
{
FatalErrorInFunction
<< "Cloud storage not allocated" << abort(FatalError);

View File

@ -81,9 +81,9 @@ void Foam::ParticleTrap<CloudType>::preEvolve
alphaPtr_ = &alpha;
}
if (gradAlphaPtr_.valid())
if (gradAlphaPtr_)
{
gradAlphaPtr_() == fvc::grad(*alphaPtr_);
*gradAlphaPtr_ == fvc::grad(*alphaPtr_);
}
else
{

View File

@ -33,7 +33,7 @@ License
template<class CloudType>
void Foam::VoidFraction<CloudType>::write()
{
if (thetaPtr_.valid())
if (thetaPtr_)
{
thetaPtr_->write();
}
@ -79,7 +79,7 @@ void Foam::VoidFraction<CloudType>::preEvolve
const typename parcelType::trackingData& td
)
{
if (thetaPtr_.valid())
if (thetaPtr_)
{
thetaPtr_->primitiveFieldRef() = 0.0;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +32,7 @@ template<class CloudType>
inline const Foam::interpolation<Foam::vector>&
Foam::LiftForce<CloudType>::curlUcInterp() const
{
if (!curlUcInterpPtr_.valid())
if (!curlUcInterpPtr_)
{
FatalErrorInFunction
<< "Carrier phase curlUc interpolation object not set"

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +32,7 @@ template<class CloudType>
inline const Foam::interpolation<Foam::vector>&
Foam::PressureGradientForce<CloudType>::DUcDtInterp() const
{
if (!DUcDtInterpPtr_.valid())
if (!DUcDtInterpPtr_)
{
FatalErrorInFunction
<< "Carrier phase DUcDt interpolation object not set"

View File

@ -154,7 +154,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
template<class CloudType>
Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
{
if (!massEscapePtr_.valid())
if (!massEscapePtr_)
{
const fvMesh& mesh = this->owner().mesh();
@ -183,7 +183,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
template<class CloudType>
Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick()
{
if (!massStickPtr_.valid())
if (!massStickPtr_)
{
const fvMesh& mesh = this->owner().mesh();

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -181,7 +182,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
points.last() = endPt;
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{
@ -241,7 +242,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -193,7 +194,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
points.last() = endPt;
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{
@ -253,7 +254,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -231,7 +231,7 @@ void Foam::blockFaces::projectFace::project
if (hits[i].hit())
{
const point& hitPt = hits[i].hitPoint();
if (debugStr.valid())
if (debugStr)
{
debugStr().write(linePointRef(points[i], hitPt));
}
@ -299,7 +299,7 @@ void Foam::blockFaces::projectFace::project
}
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{
@ -351,7 +351,7 @@ void Foam::blockFaces::projectFace::project
}
}
if (debugStr.valid())
if (debugStr)
{
forAll(points, i)
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,7 +70,7 @@ Foam::displacementMeshMoverMotionSolver::
Foam::externalDisplacementMeshMover&
Foam::displacementMeshMoverMotionSolver::meshMover() const
{
if (!meshMoverPtr_.valid())
if (!meshMoverPtr_)
{
const word moverType(coeffDict().get<word>("meshMover"));
@ -122,7 +123,7 @@ void Foam::displacementMeshMoverMotionSolver::movePoints(const pointField& p)
displacementMotionSolver::movePoints(p);
// Update meshMover for new geometry
if (meshMoverPtr_.valid())
if (meshMoverPtr_)
{
meshMover().movePoints(p);
}

View File

@ -1555,12 +1555,12 @@ void Foam::medialAxisMeshMover::calculateDisplacement
numThicknessRatioExclude++;
}
if (str.valid())
if (str)
{
const point& pt = mesh().points()[pointI];
str().write(linePointRef(pt, pt+patchDisp[patchPointI]));
}
if (medialVecStr.valid())
if (medialVecStr)
{
const point& pt = mesh().points()[pointI];
medialVecStr().write

View File

@ -2926,7 +2926,7 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
pointMap
);
if (faceMap.valid())
if (faceMap)
{
// (ab)use the instance() to signal current modification time
geometry[i].instance() = geometry[i].time().timeName();

View File

@ -257,7 +257,7 @@ void Foam::meshRefinement::getIntersections
if (hit1[i].hit() && hit2[i].hit())
{
if (str.valid())
if (str)
{
str().write(linePointRef(start[i], hit1[i].rawPoint()));
str().write

View File

@ -416,7 +416,7 @@ void Foam::refinementFeatures::findHigherLevel
const Foam::PtrList<Foam::indexedOctree<Foam::treeDataEdge>>&
Foam::refinementFeatures::regionEdgeTrees() const
{
if (!regionEdgeTreesPtr_.valid())
if (!regionEdgeTreesPtr_)
{
regionEdgeTreesPtr_.reset
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -834,7 +834,7 @@ void Foam::snappyLayerDriver::handleFeatureAngle
nFeats++;
if (str.valid())
if (str)
{
const point& p0 = pp.localPoints()[e[0]];
const point& p1 = pp.localPoints()[e[1]];
@ -3341,9 +3341,9 @@ void Foam::snappyLayerDriver::addLayers
// be done by snapping phase
{
autoPtr<mapPolyMesh> map = meshRefiner_.dupNonManifoldBoundaryPoints();
if (map.valid())
if (map)
{
const labelList& reverseFaceMap = map().reverseFaceMap();
const labelList& reverseFaceMap = map->reverseFaceMap();
forAll(baffles, i)
{
label f0 = reverseFaceMap[baffles[i].first()];
@ -3538,7 +3538,7 @@ void Foam::snappyLayerDriver::addLayers
regionSide
);
if (map.valid())
if (map)
{
// Store point duplication
pointToMaster.setSize(mesh.nPoints(), -1);
@ -4530,7 +4530,7 @@ void Foam::snappyLayerDriver::addLayers
autoPtr<mapPolyMesh> map = meshRefiner_.mergePoints(pointToMaster);
if (map.valid())
if (map)
{
inplaceReorder(map().reverseCellMap(), cellNLayers);
@ -4554,7 +4554,7 @@ void Foam::snappyLayerDriver::addLayers
true, // internal zones
false // baffle zones
);
if (map.valid())
if (map)
{
inplaceReorder(map().reverseCellMap(), cellNLayers);

View File

@ -1478,7 +1478,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
// TBD: check if the attraction (to nearest) would attract
// good enough and not override attraction
if (gapStr.valid())
if (gapStr)
{
const point& intPt = hit2[pointi].hitPoint();
gapStr().write(linePointRef(pt, intPt));
@ -1620,7 +1620,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
)
)
{
if (gapStr.valid())
if (gapStr)
{
const point& intPt = hit2[i].hitPoint();
gapStr().write(linePointRef(pt, intPt));
@ -2982,7 +2982,7 @@ void Foam::snappySnapDriver::doSnap
false // baffle zones
);
if (mapPtr.valid())
if (mapPtr)
{
if (debug & meshRefinement::MESH)
{

View File

@ -1518,7 +1518,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
patchAttraction[pointi] = rawPatchAttraction[pointi];
patchConstraints[pointi] = rawPatchConstraints[pointi];
//if (multiPatchStr.valid())
//if (multiPatchStr)
//{
// Pout<< "Adding constraint on multiPatchPoint:"
// << pp.localPoints()[pointi]
@ -1571,7 +1571,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
patchConstraints[pointi] = pointConstraint();
nChanged++;
if (multiPatchStr.valid())
if (multiPatchStr)
{
multiPatchStr().write(pp.localPoints()[pointi]);
}
@ -2514,7 +2514,7 @@ void Foam::snappySnapDriver::determineFeatures
if (info.hit())
{
// Dump
if (featureEdgeStr.valid())
if (featureEdgeStr)
{
featureEdgeStr().write
(
@ -2524,7 +2524,7 @@ void Foam::snappySnapDriver::determineFeatures
}
else
{
if (missedEdgeStr.valid())
if (missedEdgeStr)
{
missedEdgeStr().write
(
@ -2708,7 +2708,7 @@ void Foam::snappySnapDriver::determineFeatures
}
else
{
if (missedEdgeStr.valid())
if (missedEdgeStr)
{
missedEdgeStr().write
(
@ -2927,7 +2927,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
pointStatus[e[0]] = 0;
pointStatus[e[1]] = 0;
if (baffleEdgeStr.valid())
if (baffleEdgeStr)
{
const point& p0 = pp.localPoints()[e[0]];
const point& p1 = pp.localPoints()[e[1]];
@ -3823,7 +3823,7 @@ void Foam::snappySnapDriver::preventFaceSqueeze
patchAttraction[pointi] = nearestAttraction[pointi];
if (strPtr.valid())
if (strPtr)
{
strPtr().write
(

View File

@ -286,7 +286,7 @@ void Foam::AMIInterpolation::agglomerate
}
// Agglomerate weights and indices
if (targetMapPtr.valid())
if (targetMapPtr)
{
const mapDistribute& map = targetMapPtr();

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,7 +56,7 @@ class cyclicACMIPointPatchField
:
public coupledPointPatchField<Type>
{
// Private data
// Private Data
//- Local reference cast into the cyclicACMI patch
const cyclicACMIPointPatch& cyclicACMIPatch_;
@ -73,7 +74,7 @@ class cyclicACMIPointPatchField
//- Owner side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& ppi() const
{
if (!ppiPtr_.valid())
if (!ppiPtr_)
{
ppiPtr_.reset
(
@ -90,7 +91,7 @@ class cyclicACMIPointPatchField
//- Neighbour side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
{
if (!nbrPpiPtr_.valid())
if (!nbrPpiPtr_)
{
nbrPpiPtr_.reset
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,7 +56,7 @@ class cyclicAMIPointPatchField
:
public coupledPointPatchField<Type>
{
// Private data
// Private Data
//- Local reference cast into the cyclicAMI patch
const cyclicAMIPointPatch& cyclicAMIPatch_;
@ -73,7 +74,7 @@ class cyclicAMIPointPatchField
//- Owner side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& ppi() const
{
if (!ppiPtr_.valid())
if (!ppiPtr_)
{
ppiPtr_.reset
(
@ -90,7 +91,7 @@ class cyclicAMIPointPatchField
//- Neighbour side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
{
if (!nbrPpiPtr_.valid())
if (!nbrPpiPtr_)
{
nbrPpiPtr_.reset
(

View File

@ -331,13 +331,13 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
label iter(0);
label nTransformsOld(nTransforms_);
if (ownStr.valid())
if (ownStr)
{
writeOBJ(thisPatch0, ownStr());
writeOBJ(thisPatch0, *ownStr);
}
if (neiStr.valid())
if (neiStr)
{
writeOBJ(nbrPatch0, neiStr());
writeOBJ(nbrPatch0, *neiStr);
}
@ -392,9 +392,9 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
AMIPtr_->append(thisPatch, nbrPatch0);
if (ownStr.valid())
if (ownStr)
{
writeOBJ(thisPatch, ownStr());
writeOBJ(thisPatch, *ownStr);
}
}
else
@ -411,9 +411,9 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
AMIPtr_->append(thisPatch0, nbrPatch);
if (neiStr.valid())
if (neiStr)
{
writeOBJ(nbrPatch, neiStr());
writeOBJ(nbrPatch, *neiStr);
}
}
@ -445,15 +445,8 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const
// Close debug streams
if (ownStr.valid())
{
ownStr.clear();
}
if (neiStr.valid())
{
neiStr.clear();
}
ownStr.reset(nullptr);
neiStr.reset(nullptr);
// Average the number of transformations

View File

@ -517,7 +517,7 @@ void Foam::mappedPatchBase::findSamples
void Foam::mappedPatchBase::calcMapping() const
{
static bool hasWarned = false;
if (mapPtr_.valid())
if (mapPtr_)
{
FatalErrorInFunction
<< "Mapping already calculated" << exit(FatalError);

View File

@ -605,7 +605,7 @@ Foam::meshSearch::~meshSearch()
const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const
{
if (!overallBbPtr_.valid())
if (!overallBbPtr_)
{
Random rndGen(261782);
overallBbPtr_.reset
@ -628,7 +628,7 @@ const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::boundaryTree() const
{
if (!boundaryTreePtr_.valid())
if (!boundaryTreePtr_)
{
// All boundary faces (not just walls)
labelList bndFaces
@ -662,7 +662,7 @@ Foam::meshSearch::boundaryTree() const
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::nonCoupledBoundaryTree() const
{
if (!nonCoupledBoundaryTreePtr_.valid())
if (!nonCoupledBoundaryTreePtr_)
{
// All non-coupled boundary faces (not just walls)
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -707,7 +707,7 @@ Foam::meshSearch::nonCoupledBoundaryTree() const
const Foam::indexedOctree<Foam::treeDataCell>&
Foam::meshSearch::cellTree() const
{
if (!cellTreePtr_.valid())
if (!cellTreePtr_)
{
cellTreePtr_.reset
(

View File

@ -697,7 +697,7 @@ bool Foam::searchableSurfaces::checkIntersection
<< " locations."
<< endl;
if (setWriter.valid())
if (setWriter)
{
scalarField dist(mag(intersections));
coordSet track

View File

@ -204,7 +204,7 @@ const volVectorField& objectiveIncompressible::dJdv()
)
);
}
return dJdvPtr_();
return *dJdvPtr_;
}
@ -223,7 +223,7 @@ const volScalarField& objectiveIncompressible::dJdp()
)
);
}
return dJdpPtr_();
return *dJdpPtr_;
}
@ -242,7 +242,7 @@ const volScalarField& objectiveIncompressible::dJdT()
)
);
}
return dJdTPtr_();
return *dJdTPtr_;
}
@ -261,7 +261,7 @@ const volScalarField& objectiveIncompressible::dJdTMvar1()
)
);
}
return dJdTMvar1Ptr_();
return *dJdTMvar1Ptr_;
}
@ -280,7 +280,7 @@ const volScalarField& objectiveIncompressible::dJdTMvar2()
)
);
}
return dJdTMvar2Ptr_();
return *dJdTMvar2Ptr_;
}

View File

@ -7,7 +7,7 @@
-------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,73 +32,73 @@ License
inline bool Foam::objectiveIncompressible::hasdJdv() const
{
return dJdvPtr_.valid();
return bool(dJdvPtr_);
}
inline bool Foam::objectiveIncompressible::hasdJdp() const
{
return dJdpPtr_.valid();
return bool(dJdpPtr_);
}
inline bool Foam::objectiveIncompressible::hasdJdT() const
{
return dJdTPtr_.valid();
return bool(dJdTPtr_);
}
inline bool Foam::objectiveIncompressible::hasdJdTMVar1() const
{
return dJdTMvar1Ptr_.valid();
return bool(dJdTMvar1Ptr_);
}
inline bool Foam::objectiveIncompressible::hasdJdTMVar2() const
{
return dJdTMvar2Ptr_.valid();
return bool(dJdTMvar2Ptr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdv() const
{
return bdJdvPtr_.valid();
return bool(bdJdvPtr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdvn() const
{
return bdJdvnPtr_.valid();
return bool(bdJdvnPtr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdvt() const
{
return bdJdvtPtr_.valid();
return bool(bdJdvtPtr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdp() const
{
return bdJdpPtr_.valid();
return bool(bdJdpPtr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdT() const
{
return bdJdTPtr_.valid();
return bool(bdJdTPtr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar1() const
{
return bdJdTMvar1Ptr_.valid();
return bool(bdJdTMvar1Ptr_);
}
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar2() const
{
return bdJdTMvar2Ptr_.valid();
return bool(bdJdTMvar2Ptr_);
}

Some files were not shown because too many files have changed in this diff Show More