mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
autoPtr gets "empty()" method that can be used instead of "! ...valid()"
This commit is contained in:
@ -24,6 +24,16 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline const Foam::Xfer<T>& Foam::Xfer<T>::null()
|
||||||
|
{
|
||||||
|
Xfer<T>* nullPtr = reinterpret_cast<Xfer<T>*>(0);
|
||||||
|
return *nullPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -79,13 +89,6 @@ inline Foam::Xfer<T>::~Xfer()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline const Foam::Xfer<T>& Foam::Xfer<T>::null()
|
|
||||||
{
|
|
||||||
Xfer<T>* nullPtr = reinterpret_cast<Xfer<T>*>(0);
|
|
||||||
return *nullPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,10 @@ public:
|
|||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Is the autoPtr valid, i.e. is the pointer set
|
//- 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;
|
inline bool valid() const;
|
||||||
|
|
||||||
|
|
||||||
@ -92,22 +95,23 @@ public:
|
|||||||
// If object pointer already set issue a FatalError.
|
// If object pointer already set issue a FatalError.
|
||||||
inline void set(T*);
|
inline void set(T*);
|
||||||
|
|
||||||
//- If object pointer already set delete object and
|
//- If object pointer already set, delete object and set to given pointer
|
||||||
// set pointer to that given
|
|
||||||
inline void reset(T* = 0);
|
inline void reset(T* = 0);
|
||||||
|
|
||||||
//- If object pointer points to valid object:
|
//- Delete object and set pointer to NULL, if the pointer is valid.
|
||||||
// delete object and set pointer to NULL
|
|
||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
//- Return reference to the object data
|
||||||
inline T& operator()();
|
inline T& operator()();
|
||||||
|
|
||||||
|
//- Return const reference to the object data
|
||||||
inline const T& operator()() const;
|
inline const T& operator()() const;
|
||||||
|
|
||||||
//inline Tref operator*();
|
// inline T& operator*();
|
||||||
//inline const Tref operator*() const;
|
// inline const T& operator*() const;
|
||||||
|
|
||||||
inline operator const T&() const;
|
inline operator const T&() const;
|
||||||
|
|
||||||
@ -117,6 +121,7 @@ public:
|
|||||||
//- Return const object pointer
|
//- Return const object pointer
|
||||||
inline const T* operator->() const;
|
inline const T* operator->() const;
|
||||||
|
|
||||||
|
//- Take over object pointer from parameter
|
||||||
inline void operator=(const autoPtr<T>&);
|
inline void operator=(const autoPtr<T>&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,13 @@ inline Foam::autoPtr<T>::~autoPtr()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool Foam::autoPtr<T>::empty() const
|
||||||
|
{
|
||||||
|
return !ptr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool Foam::autoPtr<T>::valid() const
|
inline bool Foam::autoPtr<T>::valid() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,6 +63,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null with zero count
|
||||||
refCount()
|
refCount()
|
||||||
:
|
:
|
||||||
count_(0)
|
count_(0)
|
||||||
@ -71,18 +72,21 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the reference count
|
||||||
int count() const
|
int count() const
|
||||||
{
|
{
|
||||||
return count_;
|
return count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return true if the reference count is zero
|
||||||
bool okToDelete() const
|
bool okToDelete() const
|
||||||
{
|
{
|
||||||
return(count_ == 0);
|
return (count_ == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Reset the reference count to zero
|
||||||
void resetRefCount()
|
void resetRefCount()
|
||||||
{
|
{
|
||||||
count_ = 0;
|
count_ = 0;
|
||||||
@ -91,22 +95,25 @@ public:
|
|||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
//- Increment the reference count
|
||||||
void operator++()
|
void operator++()
|
||||||
{
|
{
|
||||||
count_++;
|
count_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Increment the reference count
|
||||||
void operator++(int)
|
void operator++(int)
|
||||||
{
|
{
|
||||||
count_++;
|
count_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Decrement the reference count
|
||||||
void operator--()
|
void operator--()
|
||||||
{
|
{
|
||||||
count_--;
|
count_--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Decrement the reference count
|
||||||
void operator--(int)
|
void operator--(int)
|
||||||
{
|
{
|
||||||
count_--;
|
count_--;
|
||||||
|
|||||||
@ -91,11 +91,15 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Is this really a temporary object
|
//- Return true if this is really a temporary object
|
||||||
inline bool isTmp() const;
|
inline bool isTmp() const;
|
||||||
|
|
||||||
//- Is this temporary object valid, i.e. is it a reference
|
//- Return true if this temporary object empty,
|
||||||
// or a temporary that has been allocated
|
// 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;
|
inline bool valid() const;
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|||||||
@ -96,6 +96,13 @@ inline bool Foam::tmp<T>::isTmp() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool Foam::tmp<T>::empty() const
|
||||||
|
{
|
||||||
|
return (isTmp_ && !ptr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline bool Foam::tmp<T>::valid() const
|
inline bool Foam::tmp<T>::valid() const
|
||||||
{
|
{
|
||||||
@ -132,7 +139,7 @@ inline T* Foam::tmp<T>::ptr() const
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::tmp<T>::clear() const
|
inline void Foam::tmp<T>::clear() const
|
||||||
{
|
{
|
||||||
if (isTmp_ && ptr_) // && ptr_->okToDelete())
|
if (isTmp_ && ptr_) // skip this bit: && ptr_->okToDelete())
|
||||||
{
|
{
|
||||||
delete ptr_;
|
delete ptr_;
|
||||||
ptr_ = 0;
|
ptr_ = 0;
|
||||||
@ -161,8 +168,11 @@ inline T& Foam::tmp<T>::operator()()
|
|||||||
// Note: const is cast away!
|
// Note: const is cast away!
|
||||||
// Perhaps there should be two refs, one for const and one for non const
|
// 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.
|
// 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
|
// 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<T&>(ref_);
|
return const_cast<T&>(ref_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,7 +152,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
|
|||||||
|
|
||||||
const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
|
const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
|
||||||
{
|
{
|
||||||
if (!schedulePtr_.valid())
|
if (schedulePtr_.empty())
|
||||||
{
|
{
|
||||||
schedulePtr_.reset
|
schedulePtr_.reset
|
||||||
(
|
(
|
||||||
|
|||||||
@ -62,6 +62,7 @@ void Foam::refinementHistory::writeEntry
|
|||||||
<< " no subcells"
|
<< " no subcells"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (split.parent_ >= 0)
|
if (split.parent_ >= 0)
|
||||||
{
|
{
|
||||||
Pout<< "parent data:" << endl;
|
Pout<< "parent data:" << endl;
|
||||||
@ -234,7 +235,7 @@ Foam::label Foam::refinementHistory::allocateSplitCell
|
|||||||
{
|
{
|
||||||
splitCell8& parentSplit = splitCells_[parent];
|
splitCell8& parentSplit = splitCells_[parent];
|
||||||
|
|
||||||
if (!parentSplit.addedCellsPtr_.valid())
|
if (parentSplit.addedCellsPtr_.empty())
|
||||||
{
|
{
|
||||||
// Allocate storage on parent for the 8 subcells.
|
// Allocate storage on parent for the 8 subcells.
|
||||||
parentSplit.addedCellsPtr_.reset(new FixedList<label, 8>(-1));
|
parentSplit.addedCellsPtr_.reset(new FixedList<label, 8>(-1));
|
||||||
@ -514,7 +515,7 @@ void Foam::refinementHistory::updateMesh(const mapPolyMesh& map)
|
|||||||
{
|
{
|
||||||
label index = visibleCells_[cellI];
|
label index = visibleCells_[cellI];
|
||||||
|
|
||||||
// Check
|
// Check not already set
|
||||||
if (splitCells_[index].addedCellsPtr_.valid())
|
if (splitCells_[index].addedCellsPtr_.valid())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
@ -974,7 +975,7 @@ void Foam::refinementHistory::compact()
|
|||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
splitCells_[index].parent_ == -1
|
splitCells_[index].parent_ == -1
|
||||||
&& !splitCells_[index].addedCellsPtr_.valid()
|
&& splitCells_[index].addedCellsPtr_.empty()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// recombined cell. No need to keep since no parent and no subsplits
|
// recombined cell. No need to keep since no parent and no subsplits
|
||||||
|
|||||||
@ -40,7 +40,7 @@ Description
|
|||||||
|
|
||||||
Foam::polyTopoChange& Foam::repatchPolyTopoChanger::meshMod()
|
Foam::polyTopoChange& Foam::repatchPolyTopoChanger::meshMod()
|
||||||
{
|
{
|
||||||
if (!meshModPtr_.valid())
|
if (meshModPtr_.empty())
|
||||||
{
|
{
|
||||||
meshModPtr_.reset(new polyTopoChange(mesh_));
|
meshModPtr_.reset(new polyTopoChange(mesh_));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,12 +30,9 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void edgeMesh::calcPointEdges() const
|
void Foam::edgeMesh::calcPointEdges() const
|
||||||
{
|
{
|
||||||
if (pointEdgesPtr_.valid())
|
if (pointEdgesPtr_.valid())
|
||||||
{
|
{
|
||||||
@ -81,7 +78,7 @@ void edgeMesh::calcPointEdges() const
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// construct from components
|
// construct from components
|
||||||
edgeMesh::edgeMesh(const pointField& points, const edgeList& edges)
|
Foam::edgeMesh::edgeMesh(const pointField& points, const edgeList& edges)
|
||||||
:
|
:
|
||||||
points_(points),
|
points_(points),
|
||||||
edges_(edges)
|
edges_(edges)
|
||||||
@ -89,7 +86,7 @@ edgeMesh::edgeMesh(const pointField& points, const edgeList& edges)
|
|||||||
|
|
||||||
|
|
||||||
// construct as copy
|
// construct as copy
|
||||||
edgeMesh::edgeMesh(const edgeMesh& em)
|
Foam::edgeMesh::edgeMesh(const edgeMesh& em)
|
||||||
:
|
:
|
||||||
points_(em.points_),
|
points_(em.points_),
|
||||||
edges_(em.edges_),
|
edges_(em.edges_),
|
||||||
@ -99,7 +96,7 @@ edgeMesh::edgeMesh(const edgeMesh& em)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
label edgeMesh::regions(labelList& edgeRegion) const
|
Foam::label Foam::edgeMesh::regions(labelList& edgeRegion) const
|
||||||
{
|
{
|
||||||
edgeRegion.setSize(edges_.size());
|
edgeRegion.setSize(edges_.size());
|
||||||
edgeRegion = -1;
|
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;
|
pointField newPoints;
|
||||||
labelList pointMap;
|
labelList pointMap;
|
||||||
@ -245,7 +242,7 @@ void edgeMesh::mergePoints(const scalar mergeDist)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void edgeMesh::operator=(const edgeMesh& rhs)
|
void Foam::edgeMesh::operator=(const edgeMesh& rhs)
|
||||||
{
|
{
|
||||||
points_ = rhs.points_;
|
points_ = rhs.points_;
|
||||||
edges_ = rhs.edges_;
|
edges_ = rhs.edges_;
|
||||||
@ -253,8 +250,4 @@ void edgeMesh::operator=(const edgeMesh& rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,10 +24,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -40,21 +36,21 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const pointField& edgeMesh::points() const
|
inline const Foam::pointField& Foam::edgeMesh::points() const
|
||||||
{
|
{
|
||||||
return points_;
|
return points_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const edgeList& edgeMesh::edges() const
|
inline const Foam::edgeList& Foam::edgeMesh::edges() const
|
||||||
{
|
{
|
||||||
return edges_;
|
return edges_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const labelListList& edgeMesh::pointEdges() const
|
inline const Foam::labelListList& Foam::edgeMesh::pointEdges() const
|
||||||
{
|
{
|
||||||
if (!pointEdgesPtr_.valid())
|
if (pointEdgesPtr_.empty())
|
||||||
{
|
{
|
||||||
calcPointEdges();
|
calcPointEdges();
|
||||||
}
|
}
|
||||||
@ -73,6 +69,4 @@ inline const labelListList& edgeMesh::pointEdges() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,15 +27,11 @@ License
|
|||||||
#include "edgeMesh.H"
|
#include "edgeMesh.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// construct from file
|
// construct from file
|
||||||
edgeMesh::edgeMesh(const fileName& fname)
|
Foam::edgeMesh::edgeMesh(const fileName& fname)
|
||||||
:
|
:
|
||||||
points_(0),
|
points_(0),
|
||||||
edges_(0),
|
edges_(0),
|
||||||
@ -57,7 +53,7 @@ edgeMesh::edgeMesh(const fileName& fname)
|
|||||||
|
|
||||||
|
|
||||||
// construct from Istream
|
// construct from Istream
|
||||||
edgeMesh::edgeMesh(Istream& is)
|
Foam::edgeMesh::edgeMesh(Istream& is)
|
||||||
:
|
:
|
||||||
points_(is),
|
points_(is),
|
||||||
edges_(is),
|
edges_(is),
|
||||||
@ -70,7 +66,7 @@ edgeMesh::edgeMesh(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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;
|
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_;
|
is >> em.points_ >> em.edges_;
|
||||||
|
|
||||||
@ -92,8 +88,4 @@ Istream& operator>>(Istream& is, edgeMesh& em)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
|
|
||||||
bool Foam::fvMeshSubset::checkCellSubset() const
|
bool Foam::fvMeshSubset::checkCellSubset() const
|
||||||
{
|
{
|
||||||
if (!fvMeshSubsetPtr_.valid())
|
if (fvMeshSubsetPtr_.empty())
|
||||||
{
|
{
|
||||||
FatalErrorIn("bool fvMeshSubset::checkCellSubset() const")
|
FatalErrorIn("bool fvMeshSubset::checkCellSubset() const")
|
||||||
<< "Mesh subset not set. Please set the cell map using "
|
<< "Mesh subset not set. Please set the cell map using "
|
||||||
|
|||||||
@ -136,10 +136,10 @@ surfaceSlipDisplacementPointPatchVectorField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const searchableSurfaces& surfaceSlipDisplacementPointPatchVectorField::
|
const searchableSurfaces&
|
||||||
surfaces() const
|
surfaceSlipDisplacementPointPatchVectorField::surfaces() const
|
||||||
{
|
{
|
||||||
if (!surfacesPtr_.valid())
|
if (surfacesPtr_.empty())
|
||||||
{
|
{
|
||||||
surfacesPtr_.reset
|
surfacesPtr_.reset
|
||||||
(
|
(
|
||||||
|
|||||||
@ -292,7 +292,7 @@ public:
|
|||||||
//- Access to communication.
|
//- Access to communication.
|
||||||
const List<labelPair>& schedule() const
|
const List<labelPair>& schedule() const
|
||||||
{
|
{
|
||||||
if (!schedulePtr_.valid())
|
if (schedulePtr_.empty())
|
||||||
{
|
{
|
||||||
calcMapping();
|
calcMapping();
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ public:
|
|||||||
Pout<< "Asking for sendLabels." << endl;
|
Pout<< "Asking for sendLabels." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sendLabelsPtr_.valid())
|
if (sendLabelsPtr_.empty())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ public:
|
|||||||
Pout<< "Asking for receiveFaceLabels." << endl;
|
Pout<< "Asking for receiveFaceLabels." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!receiveFaceLabelsPtr_.valid())
|
if (receiveFaceLabelsPtr_.empty())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1260,7 +1260,7 @@ void Foam::distributedTriSurfaceMesh::clearOut()
|
|||||||
|
|
||||||
const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const
|
const Foam::globalIndex& Foam::distributedTriSurfaceMesh::globalTris() const
|
||||||
{
|
{
|
||||||
if (!globalTris_.valid())
|
if (globalTris_.empty())
|
||||||
{
|
{
|
||||||
globalTris_.reset(new globalIndex(triSurface::size()));
|
globalTris_.reset(new globalIndex(triSurface::size()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -229,7 +229,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
|||||||
const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||||
Foam::triSurfaceMesh::tree() const
|
Foam::triSurfaceMesh::tree() const
|
||||||
{
|
{
|
||||||
if (!tree_.valid())
|
if (tree_.empty())
|
||||||
{
|
{
|
||||||
treeBoundBox bb(points(), meshPoints());
|
treeBoundBox bb(points(), meshPoints());
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
|||||||
const Foam::indexedOctree<Foam::treeDataEdge>&
|
const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||||
Foam::triSurfaceMesh::edgeTree() const
|
Foam::triSurfaceMesh::edgeTree() const
|
||||||
{
|
{
|
||||||
if (!edgeTree_.valid())
|
if (edgeTree_.empty())
|
||||||
{
|
{
|
||||||
treeBoundBox bb(localPoints());
|
treeBoundBox bb(localPoints());
|
||||||
|
|
||||||
|
|||||||
@ -220,7 +220,7 @@ void Foam::forces::read(const dictionary& dict)
|
|||||||
void Foam::forces::makeFile()
|
void Foam::forces::makeFile()
|
||||||
{
|
{
|
||||||
// Create the forces file if not already created
|
// Create the forces file if not already created
|
||||||
if (!forcesFilePtr_.valid())
|
if (forcesFilePtr_.empty())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -93,7 +93,7 @@ void Foam::minMaxFields::read(const dictionary& dict)
|
|||||||
void Foam::minMaxFields::makeFile()
|
void Foam::minMaxFields::makeFile()
|
||||||
{
|
{
|
||||||
// Create the minMaxFields file if not already created
|
// Create the minMaxFields file if not already created
|
||||||
if (!minMaxFieldsFilePtr_.valid())
|
if (minMaxFieldsFilePtr_.empty())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -227,7 +227,7 @@ void Foam::sampledSets::sampleAndWrite
|
|||||||
bool interpolate = interpolationScheme_ != "cell";
|
bool interpolate = interpolationScheme_ != "cell";
|
||||||
|
|
||||||
// Create or use existing writer
|
// Create or use existing writer
|
||||||
if (!fields.formatter.valid())
|
if (fields.formatter.empty())
|
||||||
{
|
{
|
||||||
fields.formatter = writer<Type>::New(writeFormat_);
|
fields.formatter = writer<Type>::New(writeFormat_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public:
|
|||||||
//- Faces of surface
|
//- Faces of surface
|
||||||
virtual const faceList& faces() const
|
virtual const faceList& faces() const
|
||||||
{
|
{
|
||||||
if (!facesPtr_.valid())
|
if (facesPtr_.empty())
|
||||||
{
|
{
|
||||||
const triSurface& s = surface();
|
const triSurface& s = surface();
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,7 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!storedVolFieldPtr_.valid()
|
storedVolFieldPtr_.empty()
|
||||||
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
|
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!storedPointFieldPtr_.valid()
|
storedPointFieldPtr_.empty()
|
||||||
|| (fvm.time().timeName() != storedPointFieldPtr_().instance())
|
|| (fvm.time().timeName() != storedPointFieldPtr_().instance())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -160,7 +160,7 @@ public:
|
|||||||
//- Faces of surface
|
//- Faces of surface
|
||||||
virtual const faceList& faces() const
|
virtual const faceList& faces() const
|
||||||
{
|
{
|
||||||
if (!facesPtr_.valid())
|
if (facesPtr_.empty())
|
||||||
{
|
{
|
||||||
const triSurface& s = surface();
|
const triSurface& s = surface();
|
||||||
|
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public:
|
|||||||
//- Faces of surface
|
//- Faces of surface
|
||||||
virtual const faceList& faces() const
|
virtual const faceList& faces() const
|
||||||
{
|
{
|
||||||
if (!facesPtr_.valid())
|
if (facesPtr_.empty())
|
||||||
{
|
{
|
||||||
const triSurface& s = *this;
|
const triSurface& s = *this;
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
|
|
||||||
if (s.interpolate())
|
if (s.interpolate())
|
||||||
{
|
{
|
||||||
if (!interpolator.valid())
|
if (interpolator.empty())
|
||||||
{
|
{
|
||||||
interpolator = interpolation<Type>::New
|
interpolator = interpolation<Type>::New
|
||||||
(
|
(
|
||||||
@ -170,7 +170,7 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
if (fields.size())
|
if (fields.size())
|
||||||
{
|
{
|
||||||
// create or use existing surfaceWriter
|
// create or use existing surfaceWriter
|
||||||
if (!fields.formatter.valid())
|
if (fields.formatter.empty())
|
||||||
{
|
{
|
||||||
fields.formatter = surfaceWriter<Type>::New(writeFormat_);
|
fields.formatter = surfaceWriter<Type>::New(writeFormat_);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user