From 16aaf5b54ea5ca7f93d4e4833b724d1c12c0891c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 10 Jan 2009 10:38:53 +0100 Subject: [PATCH] autoPtr gets "empty()" method that can be used instead of "! ...valid()" --- src/OpenFOAM/memory/Xfer/XferI.H | 17 ++++---- src/OpenFOAM/memory/autoPtr/autoPtr.H | 39 +++++++++++-------- src/OpenFOAM/memory/autoPtr/autoPtrI.H | 7 ++++ src/OpenFOAM/memory/tmp/refCount.H | 13 +++++-- src/OpenFOAM/memory/tmp/tmp.H | 12 ++++-- src/OpenFOAM/memory/tmp/tmpI.H | 14 ++++++- .../mapPolyMesh/mapDistribute/mapDistribute.C | 2 +- .../polyTopoChange/refinementHistory.C | 13 ++++--- .../repatchPolyTopoChanger.C | 2 +- src/edgeMesh/edgeMesh.C | 19 +++------ src/edgeMesh/edgeMeshI.H | 14 ++----- src/edgeMesh/edgeMeshIO.C | 16 ++------ .../fvMesh/fvMeshSubset/fvMeshSubset.C | 6 +-- ...aceSlipDisplacementPointPatchVectorField.C | 6 +-- .../directMappedPolyPatch.H | 6 +-- .../distributedTriSurfaceMesh.C | 2 +- .../searchableSurface/triSurfaceMesh.C | 4 +- .../functionObjects/forces/forces/forces.C | 2 +- .../minMaxFields/minMaxFields.C | 2 +- .../sampledSets/sampledSetsTemplates.C | 2 +- .../distanceSurface/distanceSurface.H | 2 +- .../isoSurface/sampledIsoSurface.C | 4 +- .../isoSurface/sampledIsoSurface.H | 2 +- .../isoSurface/sampledIsoSurfaceCell.H | 2 +- .../sampledSurfacesTemplates.C | 4 +- 25 files changed, 114 insertions(+), 98 deletions(-) diff --git a/src/OpenFOAM/memory/Xfer/XferI.H b/src/OpenFOAM/memory/Xfer/XferI.H index dc008bce9b..e255e28e7e 100644 --- a/src/OpenFOAM/memory/Xfer/XferI.H +++ b/src/OpenFOAM/memory/Xfer/XferI.H @@ -24,6 +24,16 @@ License \*---------------------------------------------------------------------------*/ +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + +template +inline const Foam::Xfer& Foam::Xfer::null() +{ + Xfer* nullPtr = reinterpret_cast*>(0); + return *nullPtr; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -79,13 +89,6 @@ inline Foam::Xfer::~Xfer() // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // -template -inline const Foam::Xfer& Foam::Xfer::null() -{ - Xfer* nullPtr = reinterpret_cast*>(0); - return *nullPtr; -} - // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index 04c2559537..c90898d055 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -77,37 +77,41 @@ public: // Member Functions - // Check + // Check - //- Is the autoPtr valid, i.e. is the pointer set - inline bool valid() const; + //- Return true if the autoPtr is empty (ie, no pointer set). + inline bool empty() const; + + //- Return true if the autoPtr valid (ie, the pointer is set). + inline bool valid() const; - // Edit + // Edit - //- Return object pointer for reuse - inline T* ptr(); + //- Return object pointer for reuse + inline T* ptr(); - //- Set pointer to that given. - // If object pointer already set issue a FatalError. - inline void set(T*); + //- Set pointer to that given. + // If object pointer already set issue a FatalError. + inline void set(T*); - //- If object pointer already set delete object and - // set pointer to that given - inline void reset(T* = 0); + //- If object pointer already set, delete object and set to given pointer + inline void reset(T* = 0); - //- If object pointer points to valid object: - // delete object and set pointer to NULL - inline void clear(); + //- Delete object and set pointer to NULL, if the pointer is valid. + inline void clear(); // Member operators + //- Return reference to the object data inline T& operator()(); + + //- Return const reference to the object data inline const T& operator()() const; - //inline Tref operator*(); - //inline const Tref operator*() const; + // inline T& operator*(); + // inline const T& operator*() const; inline operator const T&() const; @@ -117,6 +121,7 @@ public: //- Return const object pointer inline const T* operator->() const; + //- Take over object pointer from parameter inline void operator=(const autoPtr&); }; diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H index e27d99b894..218acfe91a 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H @@ -53,6 +53,13 @@ inline Foam::autoPtr::~autoPtr() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +inline bool Foam::autoPtr::empty() const +{ + return !ptr_; +} + + template inline bool Foam::autoPtr::valid() const { diff --git a/src/OpenFOAM/memory/tmp/refCount.H b/src/OpenFOAM/memory/tmp/refCount.H index 60f4e6205c..d297997cb4 100644 --- a/src/OpenFOAM/memory/tmp/refCount.H +++ b/src/OpenFOAM/memory/tmp/refCount.H @@ -41,7 +41,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class refCount Declaration + Class refCount Declaration \*---------------------------------------------------------------------------*/ class refCount @@ -63,6 +63,7 @@ public: // Constructors + //- Construct null with zero count refCount() : count_(0) @@ -71,18 +72,21 @@ public: // Member Functions + //- Return the reference count int count() const { return count_; } + //- Return true if the reference count is zero bool okToDelete() const { - return(count_ == 0); + return (count_ == 0); } + //- Reset the reference count to zero void resetRefCount() { count_ = 0; @@ -91,22 +95,25 @@ public: // Member Operators + //- Increment the reference count void operator++() { count_++; } + //- Increment the reference count void operator++(int) { count_++; } - + //- Decrement the reference count void operator--() { count_--; } + //- Decrement the reference count void operator--(int) { count_--; diff --git a/src/OpenFOAM/memory/tmp/tmp.H b/src/OpenFOAM/memory/tmp/tmp.H index 550217aaa0..a1aa88bec4 100644 --- a/src/OpenFOAM/memory/tmp/tmp.H +++ b/src/OpenFOAM/memory/tmp/tmp.H @@ -49,7 +49,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class tmp Declaration + Class tmp Declaration \*---------------------------------------------------------------------------*/ template @@ -91,11 +91,15 @@ public: // Access - //- Is this really a temporary object + //- Return true if this is really a temporary object inline bool isTmp() const; - //- Is this temporary object valid, i.e. is it a reference - // or a temporary that has been allocated + //- Return true if this temporary object empty, + // ie, a temporary without allocation + inline bool empty() const; + + //- Is this temporary object valid, + // ie, it is a reference or a temporary that has been allocated inline bool valid() const; // Edit diff --git a/src/OpenFOAM/memory/tmp/tmpI.H b/src/OpenFOAM/memory/tmp/tmpI.H index 723c5aff56..39bc90fa9b 100644 --- a/src/OpenFOAM/memory/tmp/tmpI.H +++ b/src/OpenFOAM/memory/tmp/tmpI.H @@ -96,6 +96,13 @@ inline bool Foam::tmp::isTmp() const } +template +inline bool Foam::tmp::empty() const +{ + return (isTmp_ && !ptr_); +} + + template inline bool Foam::tmp::valid() const { @@ -132,7 +139,7 @@ inline T* Foam::tmp::ptr() const template inline void Foam::tmp::clear() const { - if (isTmp_ && ptr_) // && ptr_->okToDelete()) + if (isTmp_ && ptr_) // skip this bit: && ptr_->okToDelete()) { delete ptr_; ptr_ = 0; @@ -161,8 +168,11 @@ inline T& Foam::tmp::operator()() // Note: const is cast away! // Perhaps there should be two refs, one for const and one for non const // and if the ref is actually const then you cannot return it here. + // // Another possibility would be to store a const ref and a flag to say - // wether the tmp was constructed with a const or a non-const argument. + // whether the tmp was constructed with a const or a non-const argument. + // + // eg, enum refType { POINTER = 0, REF = 1, CONSTREF = 2 }; return const_cast(ref_); } } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 841bc772fb..429b75b983 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -152,7 +152,7 @@ Foam::List Foam::mapDistribute::schedule const Foam::List& Foam::mapDistribute::schedule() const { - if (!schedulePtr_.valid()) + if (schedulePtr_.empty()) { schedulePtr_.reset ( diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C index fb3b354d1f..a4cce8716a 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C @@ -62,6 +62,7 @@ void Foam::refinementHistory::writeEntry << " no subcells" << endl; } + if (split.parent_ >= 0) { Pout<< "parent data:" << endl; @@ -234,7 +235,7 @@ Foam::label Foam::refinementHistory::allocateSplitCell { splitCell8& parentSplit = splitCells_[parent]; - if (!parentSplit.addedCellsPtr_.valid()) + if (parentSplit.addedCellsPtr_.empty()) { // Allocate storage on parent for the 8 subcells. parentSplit.addedCellsPtr_.reset(new FixedList(-1)); @@ -406,7 +407,7 @@ Foam::refinementHistory::refinementHistory ) { readStream(typeName) >> *this; - close(); + close(); } else { @@ -497,7 +498,7 @@ void Foam::refinementHistory::resize(const label size) } } - + void Foam::refinementHistory::updateMesh(const mapPolyMesh& map) { if (active()) @@ -514,7 +515,7 @@ void Foam::refinementHistory::updateMesh(const mapPolyMesh& map) { label index = visibleCells_[cellI]; - // Check + // Check not already set if (splitCells_[index].addedCellsPtr_.valid()) { FatalErrorIn @@ -974,7 +975,7 @@ void Foam::refinementHistory::compact() else if ( splitCells_[index].parent_ == -1 - && !splitCells_[index].addedCellsPtr_.valid() + && splitCells_[index].addedCellsPtr_.empty() ) { // recombined cell. No need to keep since no parent and no subsplits @@ -989,7 +990,7 @@ void Foam::refinementHistory::compact() // Now oldToNew is fully complete and compacted elements are in - // newSplitCells. + // newSplitCells. // Renumber contents of newSplitCells and visibleCells. forAll(newSplitCells, index) { diff --git a/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C b/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C index 69c798491a..2cb88d9f34 100644 --- a/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C @@ -40,7 +40,7 @@ Description Foam::polyTopoChange& Foam::repatchPolyTopoChanger::meshMod() { - if (!meshModPtr_.valid()) + if (meshModPtr_.empty()) { meshModPtr_.reset(new polyTopoChange(mesh_)); } diff --git a/src/edgeMesh/edgeMesh.C b/src/edgeMesh/edgeMesh.C index bfe83b5cba..576bfb1738 100644 --- a/src/edgeMesh/edgeMesh.C +++ b/src/edgeMesh/edgeMesh.C @@ -30,12 +30,9 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void edgeMesh::calcPointEdges() const +void Foam::edgeMesh::calcPointEdges() const { if (pointEdgesPtr_.valid()) { @@ -81,7 +78,7 @@ void edgeMesh::calcPointEdges() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // construct from components -edgeMesh::edgeMesh(const pointField& points, const edgeList& edges) +Foam::edgeMesh::edgeMesh(const pointField& points, const edgeList& edges) : points_(points), edges_(edges) @@ -89,7 +86,7 @@ edgeMesh::edgeMesh(const pointField& points, const edgeList& edges) // construct as copy -edgeMesh::edgeMesh(const edgeMesh& em) +Foam::edgeMesh::edgeMesh(const edgeMesh& em) : points_(em.points_), edges_(em.edges_), @@ -99,7 +96,7 @@ edgeMesh::edgeMesh(const edgeMesh& em) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -label edgeMesh::regions(labelList& edgeRegion) const +Foam::label Foam::edgeMesh::regions(labelList& edgeRegion) const { edgeRegion.setSize(edges_.size()); edgeRegion = -1; @@ -165,7 +162,7 @@ label edgeMesh::regions(labelList& edgeRegion) const } -void edgeMesh::mergePoints(const scalar mergeDist) +void Foam::edgeMesh::mergePoints(const scalar mergeDist) { pointField newPoints; labelList pointMap; @@ -245,7 +242,7 @@ void edgeMesh::mergePoints(const scalar mergeDist) // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void edgeMesh::operator=(const edgeMesh& rhs) +void Foam::edgeMesh::operator=(const edgeMesh& rhs) { points_ = rhs.points_; edges_ = rhs.edges_; @@ -253,8 +250,4 @@ void edgeMesh::operator=(const edgeMesh& rhs) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/edgeMesh/edgeMeshI.H b/src/edgeMesh/edgeMeshI.H index b5e8d36961..85951e8735 100644 --- a/src/edgeMesh/edgeMeshI.H +++ b/src/edgeMesh/edgeMeshI.H @@ -24,10 +24,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -40,21 +36,21 @@ namespace Foam // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const pointField& edgeMesh::points() const +inline const Foam::pointField& Foam::edgeMesh::points() const { return points_; } -inline const edgeList& edgeMesh::edges() const +inline const Foam::edgeList& Foam::edgeMesh::edges() const { return edges_; } -inline const labelListList& edgeMesh::pointEdges() const +inline const Foam::labelListList& Foam::edgeMesh::pointEdges() const { - if (!pointEdgesPtr_.valid()) + if (pointEdgesPtr_.empty()) { calcPointEdges(); } @@ -73,6 +69,4 @@ inline const labelListList& edgeMesh::pointEdges() const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam - // ************************************************************************* // diff --git a/src/edgeMesh/edgeMeshIO.C b/src/edgeMesh/edgeMeshIO.C index 66ca35dc78..e2dffb864b 100644 --- a/src/edgeMesh/edgeMeshIO.C +++ b/src/edgeMesh/edgeMeshIO.C @@ -27,15 +27,11 @@ License #include "edgeMesh.H" #include "IFstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // construct from file -edgeMesh::edgeMesh(const fileName& fname) +Foam::edgeMesh::edgeMesh(const fileName& fname) : points_(0), edges_(0), @@ -57,7 +53,7 @@ edgeMesh::edgeMesh(const fileName& fname) // construct from Istream -edgeMesh::edgeMesh(Istream& is) +Foam::edgeMesh::edgeMesh(Istream& is) : points_(is), edges_(is), @@ -70,7 +66,7 @@ edgeMesh::edgeMesh(Istream& is) // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Ostream& operator<<(Ostream& os, const edgeMesh& em) +Foam::Ostream& Foam::operator<<(Ostream& os, const edgeMesh& em) { os << em.points_ << nl << em.edges_ << endl; @@ -81,7 +77,7 @@ Ostream& operator<<(Ostream& os, const edgeMesh& em) } -Istream& operator>>(Istream& is, edgeMesh& em) +Foam::Istream& Foam::operator>>(Istream& is, edgeMesh& em) { is >> em.points_ >> em.edges_; @@ -92,8 +88,4 @@ Istream& operator>>(Istream& is, edgeMesh& em) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C index 14257a587a..78beb96df6 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C @@ -48,7 +48,7 @@ namespace Foam bool Foam::fvMeshSubset::checkCellSubset() const { - if (!fvMeshSubsetPtr_.valid()) + if (fvMeshSubsetPtr_.empty()) { FatalErrorIn("bool fvMeshSubset::checkCellSubset() const") << "Mesh subset not set. Please set the cell map using " @@ -161,11 +161,11 @@ void Foam::fvMeshSubset::doCoupledPatches nCellsUsingFace[pp.start()+i] = 3; nUncoupled++; } - } + } } } } - + // Do same for cyclics. forAll (oldPatches, oldPatchI) { diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index f6c4270d58..9e5c5eb595 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -136,10 +136,10 @@ surfaceSlipDisplacementPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const searchableSurfaces& surfaceSlipDisplacementPointPatchVectorField:: -surfaces() const +const searchableSurfaces& +surfaceSlipDisplacementPointPatchVectorField::surfaces() const { - if (!surfacesPtr_.valid()) + if (surfacesPtr_.empty()) { surfacesPtr_.reset ( diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H index 58c16ddd9c..413737aa80 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H @@ -292,7 +292,7 @@ public: //- Access to communication. const List& schedule() const { - if (!schedulePtr_.valid()) + if (schedulePtr_.empty()) { calcMapping(); } @@ -307,7 +307,7 @@ public: Pout<< "Asking for sendLabels." << endl; } - if (!sendLabelsPtr_.valid()) + if (sendLabelsPtr_.empty()) { if (debug) { @@ -326,7 +326,7 @@ public: Pout<< "Asking for receiveFaceLabels." << endl; } - if (!receiveFaceLabelsPtr_.valid()) + if (receiveFaceLabelsPtr_.empty()) { if (debug) { diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index dc5876f7c2..4b14609efa 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -1260,7 +1260,7 @@ void Foam::distributedTriSurfaceMesh::clearOut() const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const { - if (!globalTris_.valid()) + if (globalTris_.empty()) { globalTris_.reset(new globalIndex(triSurface::size())); } diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 633578faca..6803fb4def 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -229,7 +229,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints) const Foam::indexedOctree& Foam::triSurfaceMesh::tree() const { - if (!tree_.valid()) + if (tree_.empty()) { treeBoundBox bb(points(), meshPoints()); @@ -256,7 +256,7 @@ const Foam::indexedOctree& const Foam::indexedOctree& Foam::triSurfaceMesh::edgeTree() const { - if (!edgeTree_.valid()) + if (edgeTree_.empty()) { treeBoundBox bb(localPoints()); diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 03d8f73912..3ed12ef475 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -220,7 +220,7 @@ void Foam::forces::read(const dictionary& dict) void Foam::forces::makeFile() { // Create the forces file if not already created - if (!forcesFilePtr_.valid()) + if (forcesFilePtr_.empty()) { if (debug) { diff --git a/src/postProcessing/functionObjects/minMaxFields/minMaxFields.C b/src/postProcessing/functionObjects/minMaxFields/minMaxFields.C index ec3a4a5189..c8795d7251 100644 --- a/src/postProcessing/functionObjects/minMaxFields/minMaxFields.C +++ b/src/postProcessing/functionObjects/minMaxFields/minMaxFields.C @@ -93,7 +93,7 @@ void Foam::minMaxFields::read(const dictionary& dict) void Foam::minMaxFields::makeFile() { // Create the minMaxFields file if not already created - if (!minMaxFieldsFilePtr_.valid()) + if (minMaxFieldsFilePtr_.empty()) { if (debug) { diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C index 759e774ce9..3ec4fad1bd 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -227,7 +227,7 @@ void Foam::sampledSets::sampleAndWrite bool interpolate = interpolationScheme_ != "cell"; // Create or use existing writer - if (!fields.formatter.valid()) + if (fields.formatter.empty()) { fields.formatter = writer::New(writeFormat_); } diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index b76534e496..b46546abbf 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H @@ -151,7 +151,7 @@ public: //- Faces of surface virtual const faceList& faces() const { - if (!facesPtr_.valid()) + if (facesPtr_.empty()) { const triSurface& s = surface(); diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C index c3bfae31de..7ba7d852dc 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C @@ -73,7 +73,7 @@ void Foam::sampledIsoSurface::getIsoFields() const if ( - !storedVolFieldPtr_.valid() + storedVolFieldPtr_.empty() || (fvm.time().timeName() != storedVolFieldPtr_().instance()) ) { @@ -145,7 +145,7 @@ void Foam::sampledIsoSurface::getIsoFields() const if ( - !storedPointFieldPtr_.valid() + storedPointFieldPtr_.empty() || (fvm.time().timeName() != storedPointFieldPtr_().instance()) ) { diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index a403e85e4f..b0c5ff37b2 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -160,7 +160,7 @@ public: //- Faces of surface virtual const faceList& faces() const { - if (!facesPtr_.valid()) + if (facesPtr_.empty()) { const triSurface& s = surface(); diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index a0916cabd3..741958d49e 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -150,7 +150,7 @@ public: //- Faces of surface virtual const faceList& faces() const { - if (!facesPtr_.valid()) + if (facesPtr_.empty()) { const triSurface& s = *this; diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 7b2510a8f8..e93bb0bde7 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -80,7 +80,7 @@ void Foam::sampledSurfaces::sampleAndWrite if (s.interpolate()) { - if (!interpolator.valid()) + if (interpolator.empty()) { interpolator = interpolation::New ( @@ -170,7 +170,7 @@ void Foam::sampledSurfaces::sampleAndWrite if (fields.size()) { // create or use existing surfaceWriter - if (!fields.formatter.valid()) + if (fields.formatter.empty()) { fields.formatter = surfaceWriter::New(writeFormat_); }