From c7e9c1b67c95edba3ae84633436020f3a419b3bb Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Wed, 21 Oct 2015 16:27:09 -0600 Subject: [PATCH] Add default constructors/destructors/assignment to CellSet classes The CellSet classes all exclusively work in the control environment. However, CUDA likes to add __device__ to constructors, destructors, and assignment operators it automatically adds. This in turn causes warnings about the __device__ function using host-only classes (like boost::shared_ptr). Solve this problem by adding explicit methods for all of these. --- vtkm/cont/CellSet.h | 16 ++++++++++++++++ vtkm/cont/CellSetExplicit.h | 35 +++++++++++++++++++++++++++++----- vtkm/cont/CellSetPermutation.h | 21 ++++++++++++++++++++ vtkm/cont/CellSetSingleType.h | 16 ++++++++++++++++ vtkm/cont/CellSetStructured.h | 15 +++++++++++++++ 5 files changed, 98 insertions(+), 5 deletions(-) diff --git a/vtkm/cont/CellSet.h b/vtkm/cont/CellSet.h index e491da9b7..a0688c683 100644 --- a/vtkm/cont/CellSet.h +++ b/vtkm/cont/CellSet.h @@ -44,6 +44,22 @@ public: { } + VTKM_CONT_EXPORT + CellSet(const vtkm::cont::CellSet &src) + : Name(src.Name), + Dimensionality(src.Dimensionality), + LogicalStructure(src.LogicalStructure) + { } + + VTKM_CONT_EXPORT + CellSet &operator=(const vtkm::cont::CellSet &src) + { + this->Name = src.Name; + this->Dimensionality = src.Dimensionality; + this->LogicalStructure = src.LogicalStructure; + return *this; + } + virtual ~CellSet() { } diff --git a/vtkm/cont/CellSetExplicit.h b/vtkm/cont/CellSetExplicit.h index 1cd4fce22..03e338678 100644 --- a/vtkm/cont/CellSetExplicit.h +++ b/vtkm/cont/CellSetExplicit.h @@ -66,15 +66,16 @@ template class CellSetExplicit : public CellSet { + typedef CellSetExplicit< ShapeStorageTag, + NumIndicesStorageTag, + ConnectivityStorageTag, + OffsetsStorageTag > Thisclass; + template struct ConnectivityChooser { - typedef CellSetExplicit< ShapeStorageTag, - NumIndicesStorageTag, - ConnectivityStorageTag, - OffsetsStorageTag > CellSetExplicitType; typedef typename detail::CellSetExplicitConnectivityChooser< - CellSetExplicitType, + Thisclass, FromTopology, ToTopology>::ConnectivityType ConnectivityType; @@ -118,6 +119,30 @@ public: { } + VTKM_CONT_EXPORT + CellSetExplicit(const Thisclass &src) + : CellSet(src), + PointToCell(src.PointToCell), + CellToPoint(src.CellToPoint), + ConnectivityLength(src.ConnectivityLength), + NumberOfCells(src.NumberOfCells), + NumberOfPoints(src.NumberOfPoints) + { } + + VTKM_CONT_EXPORT + Thisclass &operator=(const Thisclass &src) + { + this->CellSet::operator=(src); + this->PointToCell = src.PointToCell; + this->CellToPoint = src.CellToPoint; + this->ConnectivityLength = src.ConnectivityLength; + this->NumberOfCells = src.NumberOfCells; + this->NumberOfPoints = src.NumberOfPoints; + return *this; + } + + virtual ~CellSetExplicit() { } + virtual vtkm::Id GetNumberOfCells() const { return this->PointToCell.GetNumberOfElements(); diff --git a/vtkm/cont/CellSetPermutation.h b/vtkm/cont/CellSetPermutation.h index 62cb60bcb..544c9d45f 100644 --- a/vtkm/cont/CellSetPermutation.h +++ b/vtkm/cont/CellSetPermutation.h @@ -70,6 +70,9 @@ template< typename ValidCellArrayHandleType, typename OriginalCellSet > class CellSetPermutation : public CellSet { + typedef vtkm::cont::CellSetPermutation< + ValidCellArrayHandleType,OriginalCellSet> Thisclass; + public: typedef typename vtkm::cont::internal::CellSetPermutationTraits< ValidCellArrayHandleType,OriginalCellSet>::PermutedCellSetType PermutedCellSetType; @@ -100,6 +103,24 @@ public: { } + VTKM_CONT_EXPORT + CellSetPermutation(const Thisclass &src) + : CellSet(src), + ValidCellIds(src.ValidCellIds), + PermutedCellSet(src.PermutedCellSet) + { } + + VTKM_CONT_EXPORT + Thisclass &operator=(const Thisclass &src) + { + this->CellSet::operator=(src); + this->ValidCellIds = src.ValidCellIds; + this->PermutedCellSet = src.PermutedCellSet; + return *this; + } + + virtual ~CellSetPermutation() { } + //This is the way you can fill the memory from another system without copying VTKM_CONT_EXPORT void Fill(const ValidCellArrayHandleType &validCellIds, diff --git a/vtkm/cont/CellSetSingleType.h b/vtkm/cont/CellSetSingleType.h index 53104b18d..25e66e786 100644 --- a/vtkm/cont/CellSetSingleType.h +++ b/vtkm/cont/CellSetSingleType.h @@ -45,6 +45,7 @@ class CellSetSingleType : typename vtkm::cont::ArrayHandleCounting::StorageTag //IndexOffsetStorageTag > { + typedef vtkm::cont::CellSetSingleType Thisclass; typedef vtkm::cont::CellSetExplicit< typename vtkm::cont::ArrayHandleConstant::StorageTag, typename vtkm::cont::ArrayHandleConstant::StorageTag, @@ -67,6 +68,21 @@ public: { } + VTKM_CONT_EXPORT + CellSetSingleType(const Thisclass &src) + : Superclass(src), CellTypeAsId(src.CellTypeAsId) + { } + + VTKM_CONT_EXPORT + Thisclass &operator=(const Thisclass &src) + { + this->Superclass::operator=(src); + this->CellTypeAsId = src.CellTypeAsId; + return *this; + } + + virtual ~CellSetSingleType() { } + /// First method to add cells -- one at a time. VTKM_CONT_EXPORT void PrepareToAddCells(vtkm::Id numShapes, vtkm::Id connectivityMaxLen) diff --git a/vtkm/cont/CellSetStructured.h b/vtkm/cont/CellSetStructured.h index 4dfe4fb51..5ab6f4907 100644 --- a/vtkm/cont/CellSetStructured.h +++ b/vtkm/cont/CellSetStructured.h @@ -35,6 +35,7 @@ template class CellSetStructured : public CellSet { private: + typedef vtkm::cont::CellSetStructured Thisclass; typedef vtkm::internal::ConnectivityStructuredInternals InternalsType; @@ -49,6 +50,20 @@ public: { } + VTKM_CONT_EXPORT + CellSetStructured(const Thisclass &src) + : CellSet(src), Structure(src.Structure) + { } + + VTKM_CONT_EXPORT + Thisclass &operator=(const Thisclass &src) + { + this->CellSet::operator=(src); + this->Structure = src.Structure; + return *this; + } + + virtual ~CellSetStructured() { } virtual vtkm::Id GetNumberOfCells() const {