ENH: additional constructors and methods for meshedSurfRef

- construct null, clear() and reset() methods
This commit is contained in:
Mark Olesen
2019-02-22 11:10:53 +01:00
committed by Andrew Heather
parent e322894476
commit 0ca95ac0cf

View File

@ -50,24 +50,33 @@ class meshedSurfRef
{ {
std::reference_wrapper<const pointField> points_; std::reference_wrapper<const pointField> points_;
std::reference_wrapper<const faceList> faces_; std::reference_wrapper<const faceList> faces_;
std::reference_wrapper<const labelList> zoneIds_; std::reference_wrapper<const labelList> ids_;
public: public:
// Constructors // Constructors
//- Construct null
meshedSurfRef()
:
points_(std::cref<pointField>(pointField::null())),
faces_(std::cref<faceList>(faceList::null())),
ids_(std::cref<labelList>(labelList::null()))
{}
//- Construct from components //- Construct from components
meshedSurfRef meshedSurfRef
( (
const pointField& pts, const pointField& pts,
const faceList& faces, const faceList& fcs,
const labelList& ids = labelList::null() const labelList& ids = labelList::null()
) )
: :
points_(std::cref<pointField>(pts)), points_(std::cref<pointField>(pts)),
faces_(std::cref<faceList>(faces)), faces_(std::cref<faceList>(fcs)),
zoneIds_(std::cref<labelList>(ids)) ids_(std::cref<labelList>(ids))
{} {}
@ -92,11 +101,32 @@ public:
//- Per-face zone/region information. //- Per-face zone/region information.
virtual const labelList& zoneIds() const virtual const labelList& zoneIds() const
{ {
return zoneIds_.get(); return ids_.get();
} }
//- Remove all references by redirecting to null objects
void clear()
{
points_ = std::cref<pointField>(pointField::null());
faces_ = std::cref<faceList>(faceList::null());
ids_ = std::cref<labelList>(labelList::null());
}
//- Reset components
void reset
(
const pointField& pts,
const faceList& fcs,
const labelList& ids = labelList::null()
)
{
points_ = std::cref<pointField>(pts);
faces_ = std::cref<faceList>(fcs);
ids_ = std::cref<labelList>(ids);
}
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam