Introduce vtkm_cont library to reduce weak vtable creation.
This reduces the number of weak vtables vtkm generates, resulting in a reduction of binary sizes for projects that include vtkm classes in multiple translation units.
This commit is contained in:
parent
d8d6fd1741
commit
3c07c77fa7
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_ArrayHandle_h
|
||||
#define vtk_m_cont_ArrayHandle_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
@ -36,7 +38,6 @@
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
|
@ -38,14 +38,14 @@ public:
|
||||
ArrayPortalStreaming() : InputPortal(), BlockIndex(0), BlockSize(0), CurBlockSize(0) { }
|
||||
|
||||
VTKM_CONT
|
||||
ArrayPortalStreaming(const PortalType &inputPortal, vtkm::Id blockIndex,
|
||||
vtkm::Id blockSize, vtkm::Id curBlockSize) :
|
||||
InputPortal(inputPortal), BlockIndex(blockIndex),
|
||||
ArrayPortalStreaming(const PortalType &inputPortal, vtkm::Id blockIndex,
|
||||
vtkm::Id blockSize, vtkm::Id curBlockSize) :
|
||||
InputPortal(inputPortal), BlockIndex(blockIndex),
|
||||
BlockSize(blockSize), CurBlockSize(curBlockSize) { }
|
||||
|
||||
template<typename OtherP>
|
||||
VTKM_CONT
|
||||
ArrayPortalStreaming(const ArrayPortalStreaming<OtherP> &src) :
|
||||
ArrayPortalStreaming(const ArrayPortalStreaming<OtherP> &src) :
|
||||
InputPortal(src.GetPortal()),
|
||||
BlockIndex(src.GetBlockIndex()),
|
||||
BlockSize(src.GetBlockSize()),
|
||||
@ -53,7 +53,7 @@ public:
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
return this->CurBlockSize;
|
||||
return this->CurBlockSize;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -118,29 +118,29 @@ public:
|
||||
Storage() : Valid(false) { }
|
||||
|
||||
VTKM_CONT
|
||||
Storage(const ArrayHandleInputType inputArray, vtkm::Id blockSize,
|
||||
vtkm::Id blockIndex, vtkm::Id curBlockSize) :
|
||||
InputArray(inputArray), BlockSize(blockSize),
|
||||
Storage(const ArrayHandleInputType inputArray, vtkm::Id blockSize,
|
||||
vtkm::Id blockIndex, vtkm::Id curBlockSize) :
|
||||
InputArray(inputArray), BlockSize(blockSize),
|
||||
BlockIndex(blockIndex), CurBlockSize(curBlockSize), Valid(true) { }
|
||||
|
||||
VTKM_CONT
|
||||
PortalType GetPortal() {
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalType(this->InputArray.GetPortalControl(),
|
||||
return PortalType(this->InputArray.GetPortalControl(),
|
||||
BlockSize, BlockIndex, CurBlockSize);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
PortalConstType GetPortalConst() const {
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return PortalConstType(this->InputArray.GetPortalConstControl(),
|
||||
return PortalConstType(this->InputArray.GetPortalConstControl(),
|
||||
BlockSize, BlockIndex, CurBlockSize);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id GetNumberOfValues() const {
|
||||
VTKM_ASSERT(this->Valid);
|
||||
return CurBlockSize;
|
||||
return CurBlockSize;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -208,10 +208,10 @@ private:
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleStreaming(const ArrayHandleInputType &inputArray,
|
||||
const vtkm::Id blockIndex, const vtkm::Id blockSize,
|
||||
const vtkm::Id blockIndex, const vtkm::Id blockSize,
|
||||
const vtkm::Id curBlockSize)
|
||||
: Superclass(StorageType(inputArray, blockIndex, blockSize, curBlockSize))
|
||||
{
|
||||
: Superclass(StorageType(inputArray, blockIndex, blockSize, curBlockSize))
|
||||
{
|
||||
this->GetPortalConstControl().SetBlockIndex(blockIndex);
|
||||
this->GetPortalConstControl().SetBlockSize(blockSize);
|
||||
this->GetPortalConstControl().SetCurBlockSize(curBlockSize);
|
||||
|
@ -62,7 +62,6 @@ set(headers
|
||||
ErrorControlInternal.h
|
||||
ErrorExecution.h
|
||||
Field.h
|
||||
LogicalStructure.h
|
||||
RuntimeDeviceInformation.h
|
||||
Storage.h
|
||||
StorageBasic.h
|
||||
@ -72,11 +71,29 @@ set(headers
|
||||
TryExecute.h
|
||||
)
|
||||
|
||||
set(header_impls
|
||||
ArrayHandle.hxx
|
||||
CellSetStructured.hxx
|
||||
)
|
||||
|
||||
set(sources
|
||||
ArrayHandle.cxx
|
||||
CellSet.cxx
|
||||
CellSetStructured.cxx
|
||||
CoordinateSystem.cxx
|
||||
DynamicArrayHandle.cxx
|
||||
Field.cxx
|
||||
internal/SimplePolymorphicContainer.cxx
|
||||
)
|
||||
|
||||
vtkm_library(SOURCES ${sources})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory(internal)
|
||||
add_subdirectory(arg)
|
||||
|
||||
vtkm_declare_headers(${impl_headers} ${headers})
|
||||
vtkm_declare_headers(${headers})
|
||||
vtkm_install_headers(vtkm/cont ${header_impls})
|
||||
|
||||
add_subdirectory(serial)
|
||||
add_subdirectory(cuda)
|
||||
|
@ -17,17 +17,17 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_LogicalStructure_h
|
||||
#define vtk_m_cont_LogicalStructure_h
|
||||
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
class LogicalStructure
|
||||
CellSet::~CellSet()
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace cont
|
||||
} // namespace vtkm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
@ -20,60 +20,51 @@
|
||||
#ifndef vtk_m_cont_CellSet_h
|
||||
#define vtk_m_cont_CellSet_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/StaticAssert.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/LogicalStructure.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
class CellSet
|
||||
class VTKM_CONT_EXPORT CellSet
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
CellSet(const std::string &name)
|
||||
: Name(name), LogicalStructure()
|
||||
: Name(name)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
CellSet(const vtkm::cont::CellSet &src)
|
||||
: Name(src.Name),
|
||||
LogicalStructure(src.LogicalStructure)
|
||||
: Name(src.Name)
|
||||
{ }
|
||||
|
||||
VTKM_CONT
|
||||
CellSet &operator=(const vtkm::cont::CellSet &src)
|
||||
{
|
||||
this->Name = src.Name;
|
||||
this->LogicalStructure = src.LogicalStructure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSet()
|
||||
{
|
||||
}
|
||||
virtual ~CellSet();
|
||||
|
||||
virtual std::string GetName() const
|
||||
std::string GetName() const
|
||||
{
|
||||
return this->Name;
|
||||
}
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const = 0;
|
||||
|
||||
virtual vtkm::Id GetNumberOfFaces() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual vtkm::Id GetNumberOfFaces() const = 0;
|
||||
|
||||
virtual vtkm::Id GetNumberOfEdges() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual vtkm::Id GetNumberOfEdges() const = 0;
|
||||
|
||||
virtual vtkm::Id GetNumberOfPoints() const = 0;
|
||||
|
||||
@ -81,7 +72,6 @@ public:
|
||||
|
||||
protected:
|
||||
std::string Name;
|
||||
vtkm::cont::LogicalStructure LogicalStructure;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
@ -138,16 +138,20 @@ public:
|
||||
|
||||
virtual ~CellSetExplicit() { }
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const
|
||||
vtkm::Id GetNumberOfCells() const VTKM_OVERRIDE
|
||||
{
|
||||
return this->PointToCell.GetNumberOfElements();
|
||||
}
|
||||
|
||||
virtual vtkm::Id GetNumberOfPoints() const
|
||||
vtkm::Id GetNumberOfPoints() const VTKM_OVERRIDE
|
||||
{
|
||||
return this->NumberOfPoints;
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfFaces() const VTKM_OVERRIDE { return -1; }
|
||||
|
||||
vtkm::Id GetNumberOfEdges() const VTKM_OVERRIDE { return -1; }
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id GetSchedulingRange(vtkm::TopologyElementTagCell) const
|
||||
{
|
||||
@ -458,7 +462,7 @@ public:
|
||||
this->CellToPoint.IndexOffsetsValid = false;
|
||||
}
|
||||
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
void PrintSummary(std::ostream &out) const VTKM_OVERRIDE
|
||||
{
|
||||
out << " ExplicitCellSet: " << this->Name << std::endl;
|
||||
out << " PointToCell: " << std::endl;
|
||||
|
@ -57,17 +57,21 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id GetNumberOfCells() const
|
||||
vtkm::Id GetNumberOfCells() const VTKM_OVERRIDE
|
||||
{
|
||||
return this->ValidCellIds.GetNumberOfValues();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Id GetNumberOfPoints() const
|
||||
vtkm::Id GetNumberOfPoints() const VTKM_OVERRIDE
|
||||
{
|
||||
return this->FullCellSet.GetNumberOfPoints();
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfFaces() const VTKM_OVERRIDE { return -1; }
|
||||
|
||||
vtkm::Id GetNumberOfEdges() const VTKM_OVERRIDE { return -1; }
|
||||
|
||||
//This is the way you can fill the memory from another system without copying
|
||||
VTKM_CONT
|
||||
void Fill(const PermutationArrayHandleType &validCellIds,
|
||||
@ -111,7 +115,7 @@ public:
|
||||
this->FullCellSet.PrepareForInput(d,f,t) );
|
||||
}
|
||||
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
void PrintSummary(std::ostream &out) const VTKM_OVERRIDE
|
||||
{
|
||||
out << " CellSetGeneralPermutation of: "<< std::endl;
|
||||
this->FullCellSet.PrintSummary(out);
|
||||
|
32
vtkm/cont/CellSetStructured.cxx
Normal file
32
vtkm/cont/CellSetStructured.cxx
Normal file
@ -0,0 +1,32 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#define vtkm_cont_CellSetStructured_cxx
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
template class VTKM_CONT_EXPORT CellSetStructured<1>;
|
||||
template class VTKM_CONT_EXPORT CellSetStructured<2>;
|
||||
template class VTKM_CONT_EXPORT CellSetStructured<3>;
|
||||
|
||||
}
|
||||
}
|
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_CellSetStructured_h
|
||||
#define vtk_m_cont_CellSetStructured_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/TopologyElementTag.h>
|
||||
@ -29,8 +31,6 @@
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
class CellSetStructured : public CellSet
|
||||
{
|
||||
@ -44,26 +44,14 @@ public:
|
||||
|
||||
typedef typename InternalsType::SchedulingRangeType SchedulingRangeType;
|
||||
|
||||
VTKM_CONT
|
||||
CellSetStructured(const std::string &name = std::string())
|
||||
: CellSet(name)
|
||||
: CellSet(name), Structure()
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
CellSetStructured(const Thisclass &src)
|
||||
: CellSet(src), Structure(src.Structure)
|
||||
{ }
|
||||
CellSetStructured(const Thisclass &src);
|
||||
|
||||
VTKM_CONT
|
||||
Thisclass &operator=(const Thisclass &src)
|
||||
{
|
||||
this->CellSet::operator=(src);
|
||||
this->Structure = src.Structure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSetStructured() { }
|
||||
Thisclass &operator=(const Thisclass &src);
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const
|
||||
{
|
||||
@ -75,6 +63,10 @@ public:
|
||||
return this->Structure.GetNumberOfPoints();
|
||||
}
|
||||
|
||||
virtual vtkm::Id GetNumberOfFaces() const { return -1; }
|
||||
|
||||
virtual vtkm::Id GetNumberOfEdges() const { return -1; }
|
||||
|
||||
void SetPointDimensions(SchedulingRangeType dimensions)
|
||||
{
|
||||
this->Structure.SetPointDimensions(dimensions);
|
||||
@ -90,25 +82,19 @@ public:
|
||||
return this->Structure.GetCellDimensions();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::IdComponent
|
||||
GetNumberOfPointsInCell(vtkm::Id vtkmNotUsed(cellIndex)=0) const
|
||||
{
|
||||
return this->Structure.GetNumberOfPointsInCell();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::IdComponent GetCellShape() const
|
||||
{
|
||||
return this->Structure.GetCellShape();
|
||||
}
|
||||
|
||||
template<typename TopologyElement>
|
||||
VTKM_CONT
|
||||
SchedulingRangeType GetSchedulingRange(TopologyElement) const {
|
||||
VTKM_IS_TOPOLOGY_ELEMENT_TAG(TopologyElement);
|
||||
return this->Structure.GetSchedulingRange(TopologyElement());
|
||||
}
|
||||
SchedulingRangeType GetSchedulingRange(TopologyElement) const;
|
||||
|
||||
template<typename DeviceAdapter, typename FromTopology, typename ToTopology>
|
||||
struct ExecutionTypes {
|
||||
@ -120,26 +106,23 @@ public:
|
||||
|
||||
template<typename DeviceAdapter, typename FromTopology, typename ToTopology>
|
||||
typename ExecutionTypes<DeviceAdapter,FromTopology,ToTopology>::ExecObjectType
|
||||
PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const
|
||||
{
|
||||
typedef typename
|
||||
ExecutionTypes<DeviceAdapter,FromTopology,ToTopology>::ExecObjectType
|
||||
ConnectivityType;
|
||||
return ConnectivityType(this->Structure);
|
||||
}
|
||||
PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const;
|
||||
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " StructuredCellSet: " << this->GetName() << std::endl;
|
||||
this->Structure.PrintSummary(out);
|
||||
}
|
||||
virtual void PrintSummary(std::ostream &out) const;
|
||||
|
||||
private:
|
||||
InternalsType Structure;
|
||||
};
|
||||
|
||||
#ifndef vtkm_cont_CellSetStructured_cxx
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT CellSetStructured<1>;
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT CellSetStructured<2>;
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT CellSetStructured<3>;
|
||||
#endif
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.hxx>
|
||||
|
||||
#endif //vtk_m_cont_CellSetStructured_h
|
||||
|
69
vtkm/cont/CellSetStructured.hxx
Normal file
69
vtkm/cont/CellSetStructured.hxx
Normal file
@ -0,0 +1,69 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
CellSetStructured<DIMENSION>::CellSetStructured(const CellSetStructured<DIMENSION> &src)
|
||||
: CellSet(src), Structure(src.Structure)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
CellSetStructured<DIMENSION>&
|
||||
CellSetStructured<DIMENSION>::operator=(const CellSetStructured<DIMENSION> &src)
|
||||
{
|
||||
this->CellSet::operator=(src);
|
||||
this->Structure = src.Structure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
template<typename TopologyElement>
|
||||
typename CellSetStructured<DIMENSION>::SchedulingRangeType
|
||||
CellSetStructured<DIMENSION>::GetSchedulingRange(TopologyElement) const
|
||||
{
|
||||
VTKM_IS_TOPOLOGY_ELEMENT_TAG(TopologyElement);
|
||||
return this->Structure.GetSchedulingRange(TopologyElement());
|
||||
}
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
template<typename DeviceAdapter, typename FromTopology, typename ToTopology>
|
||||
typename CellSetStructured<DIMENSION>::template ExecutionTypes<DeviceAdapter,FromTopology,ToTopology>::ExecObjectType
|
||||
CellSetStructured<DIMENSION>::PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const
|
||||
{
|
||||
typedef typename
|
||||
ExecutionTypes<DeviceAdapter,FromTopology,ToTopology>::ExecObjectType
|
||||
ConnectivityType;
|
||||
return ConnectivityType(this->Structure);
|
||||
}
|
||||
|
||||
template<vtkm::IdComponent DIMENSION>
|
||||
void CellSetStructured<DIMENSION>::PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " StructuredCellSet: " << this->GetName() << std::endl;
|
||||
this->Structure.PrintSummary(out);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
33
vtkm/cont/CoordinateSystem.cxx
Normal file
33
vtkm/cont/CoordinateSystem.cxx
Normal file
@ -0,0 +1,33 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
void CoordinateSystem::PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " Coordinate System ";
|
||||
this->Superclass::PrintSummary(out);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
@ -78,7 +78,7 @@ typedef vtkm::cont::DynamicArrayHandleBase<
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG>
|
||||
DynamicArrayHandleCoordinateSystem;
|
||||
|
||||
class CoordinateSystem : public vtkm::cont::Field
|
||||
class VTKM_CONT_EXPORT CoordinateSystem : public vtkm::cont::Field
|
||||
{
|
||||
typedef vtkm::cont::Field Superclass;
|
||||
|
||||
@ -249,13 +249,7 @@ public:
|
||||
rangePortal.Get(2));
|
||||
}
|
||||
|
||||
|
||||
VTKM_CONT
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " Coordinate System ";
|
||||
this->Superclass::PrintSummary(out);
|
||||
}
|
||||
virtual void PrintSummary(std::ostream &out) const;
|
||||
};
|
||||
|
||||
template<typename Functor>
|
||||
|
39
vtkm/cont/DynamicArrayHandle.cxx
Normal file
39
vtkm/cont/DynamicArrayHandle.cxx
Normal file
@ -0,0 +1,39 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
namespace detail {
|
||||
|
||||
PolymorphicArrayHandleContainerBase::PolymorphicArrayHandleContainerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PolymorphicArrayHandleContainerBase::~PolymorphicArrayHandleContainerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont::detail
|
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_DynamicArrayHandle_h
|
||||
#define vtk_m_cont_DynamicArrayHandle_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/TypeListTag.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
|
||||
@ -40,10 +42,12 @@ namespace detail {
|
||||
|
||||
/// \brief Base class for PolymorphicArrayHandleContainer
|
||||
///
|
||||
struct PolymorphicArrayHandleContainerBase
|
||||
struct VTKM_CONT_EXPORT PolymorphicArrayHandleContainerBase
|
||||
{
|
||||
PolymorphicArrayHandleContainerBase();
|
||||
|
||||
// This must exist so that subclasses are destroyed correctly.
|
||||
virtual ~PolymorphicArrayHandleContainerBase() { }
|
||||
virtual ~PolymorphicArrayHandleContainerBase();
|
||||
|
||||
virtual vtkm::IdComponent GetNumberOfComponents() const = 0;
|
||||
virtual vtkm::Id GetNumberOfValues() const = 0;
|
||||
@ -135,6 +139,10 @@ DynamicArrayHandleTryCast(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to cast to: " << typeid(vtkm::cont::detail::PolymorphicArrayHandleContainer<Type,Storage>).name() << std::endl;
|
||||
std::cout << "The current rtti info is: " << typeid(*arrayContainer).name() << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -399,7 +407,7 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
this->ArrayContainer->PrintSummary(out);
|
||||
}
|
||||
|
54
vtkm/cont/Field.cxx
Normal file
54
vtkm/cont/Field.cxx
Normal file
@ -0,0 +1,54 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
void Field::PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out<<" "<<this->Name;
|
||||
out<<" assoc= ";
|
||||
switch (this->GetAssociation())
|
||||
{
|
||||
case ASSOC_ANY: out<<"Any "; break;
|
||||
case ASSOC_WHOLE_MESH: out<<"Mesh "; break;
|
||||
case ASSOC_POINTS: out<<"Points "; break;
|
||||
case ASSOC_CELL_SET: out<<"Cells "; break;
|
||||
case ASSOC_LOGICAL_DIM: out<<"LogicalDim "; break;
|
||||
}
|
||||
this->Data.PrintSummary(out);
|
||||
out<<"\n";
|
||||
}
|
||||
|
||||
const vtkm::cont::DynamicArrayHandle &Field::GetData() const
|
||||
{
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
vtkm::cont::DynamicArrayHandle &Field::GetData()
|
||||
{
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_Field_h
|
||||
#define vtk_m_cont_Field_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Range.h>
|
||||
#include <vtkm/Types.h>
|
||||
@ -104,7 +106,7 @@ private:
|
||||
/// A \c Field encapsulates an array on some piece of the mesh, such as
|
||||
/// the points, a cell set, a point logical dimension, or the whole mesh.
|
||||
///
|
||||
class Field
|
||||
class VTKM_CONT_EXPORT Field
|
||||
{
|
||||
public:
|
||||
|
||||
@ -428,18 +430,10 @@ public:
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::DynamicArrayHandle &GetData() const
|
||||
{
|
||||
return this->Data;
|
||||
}
|
||||
const vtkm::cont::DynamicArrayHandle &GetData() const;
|
||||
|
||||
vtkm::cont::DynamicArrayHandle &GetData();
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandle &GetData()
|
||||
{
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT
|
||||
@ -475,21 +469,7 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out<<" "<<this->Name;
|
||||
out<<" assoc= ";
|
||||
switch (this->GetAssociation())
|
||||
{
|
||||
case ASSOC_ANY: out<<"Any "; break;
|
||||
case ASSOC_WHOLE_MESH: out<<"Mesh "; break;
|
||||
case ASSOC_POINTS: out<<"Points "; break;
|
||||
case ASSOC_CELL_SET: out<<"Cells "; break;
|
||||
case ASSOC_LOGICAL_DIM: out<<"LogicalDim "; break;
|
||||
}
|
||||
this->Data.PrintSummary(out);
|
||||
out<<"\n";
|
||||
}
|
||||
virtual void PrintSummary(std::ostream &out) const;
|
||||
|
||||
private:
|
||||
std::string Name; ///< name of field
|
||||
|
@ -28,8 +28,9 @@
|
||||
#define VTKM_STORAGE VTKM_STORAGE_BASIC
|
||||
#endif
|
||||
|
||||
|
||||
#include <vtkm/StaticAssert.h>
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
namespace vtkm {
|
||||
|
39
vtkm/cont/internal/SimplePolymorphicContainer.cxx
Normal file
39
vtkm/cont/internal/SimplePolymorphicContainer.cxx
Normal file
@ -0,0 +1,39 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/internal/SimplePolymorphicContainer.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
namespace internal {
|
||||
|
||||
SimplePolymorphicContainerBase::SimplePolymorphicContainerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SimplePolymorphicContainerBase::~SimplePolymorphicContainerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont::internal
|
@ -31,9 +31,11 @@ namespace internal {
|
||||
|
||||
/// \brief Base class for SimplePolymorphicContainer
|
||||
///
|
||||
struct SimplePolymorphicContainerBase {
|
||||
struct VTKM_CONT_EXPORT SimplePolymorphicContainerBase {
|
||||
SimplePolymorphicContainerBase();
|
||||
|
||||
// This must exist so that subclasses are destroyed correctly.
|
||||
virtual ~SimplePolymorphicContainerBase() { }
|
||||
virtual ~SimplePolymorphicContainerBase();
|
||||
|
||||
virtual std::shared_ptr<SimplePolymorphicContainerBase>
|
||||
NewInstance() const = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user