STYLE: make meshedSurfRef copyable

This commit is contained in:
Mark Olesen
2019-01-17 04:40:29 +01:00
parent 03bd58ee3a
commit 89438778aa

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,6 +33,7 @@ Description
#define meshedSurfRef_H #define meshedSurfRef_H
#include "meshedSurf.H" #include "meshedSurf.H"
#include <functional>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,19 +48,11 @@ class meshedSurfRef
: :
public meshedSurf public meshedSurf
{ {
const pointField& points_; std::reference_wrapper<const pointField> points_;
const faceList& faces_; std::reference_wrapper<const faceList> faces_;
const labelList& zoneIds_; std::reference_wrapper<const labelList> zoneIds_;
// Private Member Functions
//- No copy construct
meshedSurfRef(const meshedSurfRef&) = delete;
//- No copy assignment
void operator=(const meshedSurfRef&) = delete;
public: public:
// Constructors // Constructors
@ -69,12 +62,12 @@ public:
( (
const pointField& pts, const pointField& pts,
const faceList& faces, const faceList& faces,
const labelList& ids = labelList() const labelList& ids = emptyLabelList
) )
: :
points_(pts), points_(std::cref<pointField>(pts)),
faces_(faces), faces_(std::cref<faceList>(faces)),
zoneIds_(ids) zoneIds_(std::cref<labelList>(ids))
{} {}
@ -82,24 +75,24 @@ public:
virtual ~meshedSurfRef() = default; virtual ~meshedSurfRef() = default;
// Access Member Functions // Member Functions
//- Const access to (global) points used for the surface //- Const access to (global) points used for the surface
virtual const pointField& points() const virtual const pointField& points() const
{ {
return points_; return points_.get();
} }
//- Const access to the surface faces //- Const access to the surface faces
virtual const faceList& faces() const virtual const faceList& faces() const
{ {
return faces_; return faces_.get();
} }
//- Const access to per-face zone/region information //- Const access to per-face zone/region information
virtual const labelList& zoneIds() const virtual const labelList& zoneIds() const
{ {
return zoneIds_; return zoneIds_.get();
} }
}; };