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

@ -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;