Commit dcbb444a authored by Abhishek Yenpure's avatar Abhishek Yenpure Committed by Abhishek Yenpure
Browse files

Warning fixes for BoundingIntervalHierarchy

- Adding VTKM_CONT_EXPORT to CellLocator
- Removing whitespaces
- Fixing warnings of unused typedef
parent 50963290
...@@ -26,6 +26,8 @@ namespace vtkm ...@@ -26,6 +26,8 @@ namespace vtkm
namespace cont namespace cont
{ {
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
VTKM_CONT VTKM_CONT
void BoundingIntervalHierarchy::Build() void BoundingIntervalHierarchy::Build()
{ {
...@@ -34,14 +36,19 @@ void BoundingIntervalHierarchy::Build() ...@@ -34,14 +36,19 @@ void BoundingIntervalHierarchy::Build()
} }
VTKM_CONT VTKM_CONT
const vtkm::exec::CellLocator* BoundingIntervalHierarchy::PrepareForExecutionImpl( const HandleType BoundingIntervalHierarchy::PrepareForExecutionImpl(const vtkm::Int8 deviceId) const
const vtkm::Int8 device) const
{ {
using DeviceList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG; /*using DeviceList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG;
const vtkm::exec::CellLocator* toReturn; const vtkm::exec::CellLocator* toReturn;
vtkm::cont::internal::FindDeviceAdapterTagAndCall( vtkm::cont::internal::FindDeviceAdapterTagAndCall(
device, DeviceList(), PrepareForExecutionFunctor(), this, &toReturn); device, DeviceList(), PrepareForExecutionFunctor(), *this, &toReturn);
return toReturn; return toReturn;*/
using DeviceList = VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG;
//HandleType ExecHandle; // = new HandleType(locator, false);
vtkm::cont::internal::FindDeviceAdapterTagAndCall(
deviceId, DeviceList(), PrepareForExecutionFunctor(), *this, this->ExecHandle);
return this->ExecHandle;
} }
} }
} }
...@@ -43,6 +43,7 @@ private: ...@@ -43,6 +43,7 @@ private:
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, RangeArrayHandle>; vtkm::cont::ArrayHandlePermutation<IdArrayHandle, RangeArrayHandle>;
using SplitPropertiesArrayHandle = using SplitPropertiesArrayHandle =
vtkm::cont::ArrayHandle<vtkm::worklet::spatialstructure::SplitProperties>; vtkm::cont::ArrayHandle<vtkm::worklet::spatialstructure::SplitProperties>;
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
class BuildFunctor; class BuildFunctor;
class PrepareForExecutionFunctor; class PrepareForExecutionFunctor;
...@@ -111,13 +112,14 @@ protected: ...@@ -111,13 +112,14 @@ protected:
void Build() override; void Build() override;
VTKM_CONT VTKM_CONT
const vtkm::exec::CellLocator* PrepareForExecutionImpl(const vtkm::Int8 device) const override; virtual const HandleType PrepareForExecutionImpl(const vtkm::Int8 device) const override;
private: private:
vtkm::IdComponent NumPlanes; vtkm::IdComponent NumPlanes;
vtkm::IdComponent MaxLeafSize; vtkm::IdComponent MaxLeafSize;
vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> Nodes; vtkm::cont::ArrayHandle<BoundingIntervalHierarchyNode> Nodes;
IdArrayHandle ProcessedCellIds; IdArrayHandle ProcessedCellIds;
mutable HandleType ExecHandle;
}; };
} // namespace cont } // namespace cont
......
...@@ -58,6 +58,9 @@ using SplitPermutationArrayHandle = ...@@ -58,6 +58,9 @@ using SplitPermutationArrayHandle =
vtkm::cont::ArrayHandlePermutation<IdArrayHandle, SplitArrayHandle>; vtkm::cont::ArrayHandlePermutation<IdArrayHandle, SplitArrayHandle>;
using SplitPropertiesArrayHandle = using SplitPropertiesArrayHandle =
vtkm::cont::ArrayHandle<vtkm::worklet::spatialstructure::SplitProperties>; vtkm::cont::ArrayHandle<vtkm::worklet::spatialstructure::SplitProperties>;
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT IdArrayHandle VTKM_CONT IdArrayHandle
...@@ -441,54 +444,53 @@ class BoundingIntervalHierarchy::PrepareForExecutionFunctor ...@@ -441,54 +444,53 @@ class BoundingIntervalHierarchy::PrepareForExecutionFunctor
public: public:
template <typename DeviceAdapter> template <typename DeviceAdapter>
VTKM_CONT void operator()(DeviceAdapter, VTKM_CONT void operator()(DeviceAdapter,
const vtkm::cont::BoundingIntervalHierarchy* bih, const vtkm::cont::BoundingIntervalHierarchy& bih,
const vtkm::exec::CellLocator** bihExec) const HandleType& bihExec) const
{ {
using LocatorHandle = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>; vtkm::cont::DynamicCellSet cellSet = bih.GetCellSet();
vtkm::cont::DynamicCellSet cellSet = bih->GetCellSet();
if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>()) if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>())
{ {
using CellSetType = vtkm::cont::CellSetExplicit<>; using CellSetType = vtkm::cont::CellSetExplicit<>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih->Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih->ProcessedCellIds, bih.ProcessedCellIds,
bih->GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
bih->GetCoordinates().GetData(), bih.GetCoordinates().GetData(),
DeviceAdapter()); DeviceAdapter());
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); bihExec.Reset(execObject);
} }
else if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>()) else if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>())
{ {
using CellSetType = vtkm::cont::CellSetStructured<2>; using CellSetType = vtkm::cont::CellSetStructured<2>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih->Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih->ProcessedCellIds, bih.ProcessedCellIds,
bih->GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
bih->GetCoordinates().GetData(), bih.GetCoordinates().GetData(),
DeviceAdapter()); DeviceAdapter());
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); bihExec.Reset(execObject);
} }
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>()) else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
{ {
using CellSetType = vtkm::cont::CellSetStructured<3>; using CellSetType = vtkm::cont::CellSetStructured<3>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih->Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih->ProcessedCellIds, bih.ProcessedCellIds,
bih->GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
bih->GetCoordinates().GetData(), bih.GetCoordinates().GetData(),
DeviceAdapter()); DeviceAdapter());
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); bihExec.Reset(execObject);
} }
else if (cellSet.IsType<vtkm::cont::CellSetSingleType<>>()) else if (cellSet.IsType<vtkm::cont::CellSetSingleType<>>())
{ {
using CellSetType = vtkm::cont::CellSetSingleType<>; using CellSetType = vtkm::cont::CellSetSingleType<>;
using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>; using ExecutionType = vtkm::exec::BoundingIntervalHierarchyExec<DeviceAdapter, CellSetType>;
ExecutionType* execObject = new ExecutionType(bih->Nodes, ExecutionType* execObject = new ExecutionType(bih.Nodes,
bih->ProcessedCellIds, bih.ProcessedCellIds,
bih->GetCellSet().Cast<CellSetType>(), bih.GetCellSet().Cast<CellSetType>(),
bih->GetCoordinates().GetData(), bih.GetCoordinates().GetData(),
DeviceAdapter()); DeviceAdapter());
*bihExec = (new LocatorHandle(execObject, false))->PrepareForExecution(DeviceAdapter()); bihExec.Reset(execObject);
} }
else else
{ {
......
...@@ -32,8 +32,10 @@ namespace vtkm ...@@ -32,8 +32,10 @@ namespace vtkm
namespace cont namespace cont
{ {
class CellLocator : public vtkm::cont::ExecutionObjectBase class VTKM_CONT_EXPORT CellLocator : public vtkm::cont::ExecutionObjectBase
{ {
private:
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::CellLocator>;
public: public:
CellLocator() CellLocator()
...@@ -68,7 +70,7 @@ public: ...@@ -68,7 +70,7 @@ public:
VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution(DeviceAdapter) const VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution(DeviceAdapter) const
{ {
vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::GetId(); vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::GetId();
return PrepareForExecutionImpl(deviceId); return PrepareForExecutionImpl(deviceId).PrepareForExecution(DeviceAdapter());
} }
protected: protected:
...@@ -77,8 +79,7 @@ protected: ...@@ -77,8 +79,7 @@ protected:
//This is going to need a TryExecute //This is going to need a TryExecute
VTKM_CONT virtual void Build() = 0; VTKM_CONT virtual void Build() = 0;
VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecutionImpl( VTKM_CONT virtual const HandleType PrepareForExecutionImpl(const vtkm::Int8 device) const = 0;
const vtkm::Int8 device) const = 0;
private: private:
vtkm::cont::DynamicCellSet CellSet; vtkm::cont::DynamicCellSet CellSet;
......
...@@ -100,7 +100,7 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen ...@@ -100,7 +100,7 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen
std::cout << "Default stack size " << stackSizeBackup << "\n"; std::cout << "Default stack size " << stackSizeBackup << "\n";
cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 50); cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 200);
#endif #endif
vtkm::worklet::DispatcherMapField<BoundingIntervalHierarchyTester>().Invoke( vtkm::worklet::DispatcherMapField<BoundingIntervalHierarchyTester>().Invoke(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment