From 8a3528d700ae1fbb82c01d840f152eb87a154f4b Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Sat, 22 Jun 2019 00:48:12 -0400 Subject: [PATCH] consolidate some files ArrayPortalExtrude and ArrayPortalExtrudePlane merged into StorageExtrude.h --- vtkm/cont/ArrayHandleExtrudeCoords.h | 1 - vtkm/cont/ArrayHandleExtrudeField.h | 1 - vtkm/cont/ArrayPortalExtrude.h | 153 ----------- vtkm/cont/ArrayPortalExtrudePlane.h | 223 ---------------- vtkm/cont/ArrayPortalExtrudePlane.hxx | 32 --- vtkm/cont/CMakeLists.txt | 3 - vtkm/cont/StorageExtrude.h | 350 +++++++++++++++++++++++++- vtkm/exec/arg/FetchExtrude.h | 2 - 8 files changed, 349 insertions(+), 416 deletions(-) delete mode 100644 vtkm/cont/ArrayPortalExtrude.h delete mode 100644 vtkm/cont/ArrayPortalExtrudePlane.h delete mode 100644 vtkm/cont/ArrayPortalExtrudePlane.hxx diff --git a/vtkm/cont/ArrayHandleExtrudeCoords.h b/vtkm/cont/ArrayHandleExtrudeCoords.h index f613f14e6..496c49170 100644 --- a/vtkm/cont/ArrayHandleExtrudeCoords.h +++ b/vtkm/cont/ArrayHandleExtrudeCoords.h @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/vtkm/cont/ArrayHandleExtrudeField.h b/vtkm/cont/ArrayHandleExtrudeField.h index 81aa0b83c..1341f582c 100644 --- a/vtkm/cont/ArrayHandleExtrudeField.h +++ b/vtkm/cont/ArrayHandleExtrudeField.h @@ -11,7 +11,6 @@ #define vtk_m_cont_ArrayHandleExtrudeField_h #include -#include #include namespace vtkm diff --git a/vtkm/cont/ArrayPortalExtrude.h b/vtkm/cont/ArrayPortalExtrude.h deleted file mode 100644 index 96cc8ba86..000000000 --- a/vtkm/cont/ArrayPortalExtrude.h +++ /dev/null @@ -1,153 +0,0 @@ -//============================================================================ -// 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. -//============================================================================ -#ifndef vtk_m_internal_ArrayPortalExtrude_h -#define vtk_m_internal_ArrayPortalExtrude_h - -#include - -#include -#include -#include - -#include -#include - -namespace vtkm -{ -namespace exec -{ - -template -struct VTKM_ALWAYS_EXPORT ArrayPortalExtrude -{ - using ValueType = vtkm::Vec; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ArrayPortalExtrude() - : Portal() - , NumberOfValues(0) - , NumberOfPlanes(0) - , UseCylindrical(false){}; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ArrayPortalExtrude(const PortalType& p, - vtkm::Int32 numOfValues, - vtkm::Int32 numOfPlanes, - bool cylindrical = false) - : Portal(p) - , NumberOfValues(numOfValues) - , NumberOfPlanes(numOfPlanes) - , UseCylindrical(cylindrical) - { - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - vtkm::Id GetNumberOfValues() const - { - return ((NumberOfValues / 2) * static_cast(NumberOfPlanes)); - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ValueType Get(vtkm::Id index) const; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ValueType Get(vtkm::Id2 index) const; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - vtkm::Vec GetWedge(const IndicesExtrude& index) const; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const {} - - PortalType Portal; - vtkm::Int32 NumberOfValues; - vtkm::Int32 NumberOfPlanes; - bool UseCylindrical; -}; -template -typename ArrayPortalExtrude::ValueType -ArrayPortalExtrude::ArrayPortalExtrude::Get(vtkm::Id index) const -{ - using CompType = typename ValueType::ComponentType; - - const vtkm::Id realIdx = (index * 2) % this->NumberOfValues; - const vtkm::Id whichPlane = (index * 2) / this->NumberOfValues; - const auto phi = static_cast(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes)); - - auto r = this->Portal.Get(realIdx); - auto z = this->Portal.Get(realIdx + 1); - if (this->UseCylindrical) - { - return ValueType(r, phi, z); - } - else - { - return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); - } -} - -template -typename ArrayPortalExtrude::ValueType -ArrayPortalExtrude::ArrayPortalExtrude::Get(vtkm::Id2 index) const -{ - using CompType = typename ValueType::ComponentType; - - const vtkm::Id realIdx = (index[0] * 2); - const vtkm::Id whichPlane = index[1]; - const auto phi = static_cast(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes)); - - auto r = this->Portal.Get(realIdx); - auto z = this->Portal.Get(realIdx + 1); - if (this->UseCylindrical) - { - return ValueType(r, phi, z); - } - else - { - return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); - } -} - -template -vtkm::Vec::ValueType, 6> -ArrayPortalExtrude::ArrayPortalExtrude::GetWedge(const IndicesExtrude& index) const -{ - using CompType = typename ValueType::ComponentType; - - vtkm::Vec result; - for (int j = 0; j < 2; ++j) - { - const auto phi = - static_cast(index.Planes[j] * (vtkm::TwoPi() / this->NumberOfPlanes)); - for (int i = 0; i < 3; ++i) - { - const vtkm::Id realIdx = index.PointIds[j][i] * 2; - auto r = this->Portal.Get(realIdx); - auto z = this->Portal.Get(realIdx + 1); - result[3 * j + i] = this->UseCylindrical - ? ValueType(r, phi, z) - : ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); - } - } - - return result; -} -} -} - - -#endif diff --git a/vtkm/cont/ArrayPortalExtrudePlane.h b/vtkm/cont/ArrayPortalExtrudePlane.h deleted file mode 100644 index af6cd0263..000000000 --- a/vtkm/cont/ArrayPortalExtrudePlane.h +++ /dev/null @@ -1,223 +0,0 @@ -//============================================================================ -// 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. -//============================================================================ -#ifndef vtk_m_internal_ArrayPortalExtrudePlane_h -#define vtk_m_internal_ArrayPortalExtrudePlane_h - -#include - -#include - - -namespace vtkm -{ -namespace exec -{ - -template -struct VTKM_ALWAYS_EXPORT ArrayPortalExtrudePlane -{ - using ValueType = typename PortalType::ValueType; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ArrayPortalExtrudePlane() - : Portal() - , NumberOfPlanes(0){}; - - ArrayPortalExtrudePlane(const PortalType& p, vtkm::Int32 numOfPlanes) - : Portal(p) - , NumberOfPlanes(numOfPlanes) - { - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - vtkm::Id GetNumberOfValues() const - { - return this->Portal.GetNumberOfValues() * static_cast(NumberOfPlanes); - } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ValueType Get(vtkm::Id index) const { return this->Portal.Get(index % this->NumberOfPlanes); } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - ValueType Get(vtkm::Id2 index) const { return this->Portal.Get(index[0]); } - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - vtkm::Vec GetWedge(const IndicesExtrude& index) const; - - VTKM_SUPPRESS_EXEC_WARNINGS - VTKM_EXEC_CONT - void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const {} - - PortalType Portal; - vtkm::Int32 NumberOfPlanes; -}; -} -} // vtkm::exec - -namespace vtkm -{ -namespace cont -{ -namespace internal -{ - -struct VTKM_ALWAYS_EXPORT StorageTagExtrudePlane -{ -}; - -template -class VTKM_ALWAYS_EXPORT Storage -{ - using HandleType = vtkm::cont::ArrayHandle; - -public: - using ValueType = T; - - // This is meant to be invalid. Because point arrays are read only, you - // should only be able to use the const version. - struct PortalType - { - using ValueType = void*; - using IteratorType = void*; - }; - - using PortalConstType = - vtkm::exec::ArrayPortalExtrudePlane; - - Storage() - : Array() - , NumberOfPlanes(0) - { - } - - Storage(const HandleType& array, vtkm::Int32 numberOfPlanes) - : Array(array) - , NumberOfPlanes(numberOfPlanes) - { - } - - PortalType GetPortal() { return PortalType{}; } - - PortalConstType GetPortalConst() const - { - return PortalConstType(this->Array.GetPortalConstControl(), this->NumberOfPlanes); - } - - vtkm::Id GetNumberOfValues() const - { - return this->Array.GetNumberOfValues() * static_cast(this->NumberOfPlanes); - } - - vtkm::Int32 GetNumberOfValuesPerPlane() const - { - return static_cast(this->Array->GetNumberOfValues()); - } - - vtkm::Int32 GetNumberOfPlanes() const { return this->NumberOfPlanes; } - - void Allocate(vtkm::Id vtkmNotUsed(numberOfValues)) - { - throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot be allocated."); - } - - void Shrink(vtkm::Id vtkmNotUsed(numberOfValues)) - { - throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot shrink."); - } - - void ReleaseResources() - { - // This request is ignored since we don't own the memory that was past - // to us - } - -private: - vtkm::cont::ArrayHandle Array; - vtkm::Int32 NumberOfPlanes; -}; - -template -class VTKM_ALWAYS_EXPORT ArrayTransfer -{ -public: - using ValueType = T; - using StorageType = vtkm::cont::internal::Storage; - - using PortalControl = typename StorageType::PortalType; - using PortalConstControl = typename StorageType::PortalConstType; - - //meant to be an invalid writeable execution portal - using PortalExecution = typename StorageType::PortalType; - using PortalConstExecution = vtkm::exec::ArrayPortalExtrudePlane{}.PrepareForInput(Device{}))>; - - VTKM_CONT - ArrayTransfer(StorageType* storage) - : ControlData(storage) - { - } - - vtkm::Id GetNumberOfValues() const { return this->ControlData->GetNumberOfValues(); } - - VTKM_CONT - PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData)) - { - return PortalConstExecution(this->ControlData->Array.PrepareForInput(Device()), - this->ControlData->NumberOfPlanes); - } - - VTKM_CONT - PortalExecution PrepareForInPlace(bool& vtkmNotUsed(updateData)) - { - throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. " - "Cannot be used for in-place operations."); - } - - VTKM_CONT - PortalExecution PrepareForOutput(vtkm::Id vtkmNotUsed(numberOfValues)) - { - throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot be used as output."); - } - - VTKM_CONT - void RetrieveOutputData(StorageType* vtkmNotUsed(storage)) const - { - throw vtkm::cont::ErrorInternal( - "ArrayPortalExtrudePlane read only. " - "There should be no occurance of the ArrayHandle trying to pull " - "data from the execution environment."); - } - - VTKM_CONT - void Shrink(vtkm::Id vtkmNotUsed(numberOfValues)) - { - throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot shrink."); - } - - VTKM_CONT - void ReleaseResources() - { - // This request is ignored since we don't own the memory that was past - // to us - } - -private: - const StorageType* const ControlData; -}; -} -} -} // vtkm::cont::internal - -#endif diff --git a/vtkm/cont/ArrayPortalExtrudePlane.hxx b/vtkm/cont/ArrayPortalExtrudePlane.hxx deleted file mode 100644 index b6a05c3d8..000000000 --- a/vtkm/cont/ArrayPortalExtrudePlane.hxx +++ /dev/null @@ -1,32 +0,0 @@ -//============================================================================ -// 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. -//============================================================================ -#include - -namespace vtkm -{ -namespace exec -{ - -template -vtkm::Vec::ValueType, 6> ArrayPortalExtrudePlane< - PortalType>::ArrayPortalExtrudePlane::GetWedge(const ToroidIndices& index) const -{ - vtkm::Vec result; - result[0] = this->Portal.Get(index.PointIds[0][0]); - result[1] = this->Portal.Get(index.PointIds[0][1]); - result[2] = this->Portal.Get(index.PointIds[0][2]); - result[3] = this->Portal.Get(index.PointIds[1][0]); - result[4] = this->Portal.Get(index.PointIds[1][1]); - result[5] = this->Portal.Get(index.PointIds[1][2]); - - return result; -} -} -} // vtkm::exec diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index 11d8cdd3f..9cd38088e 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -39,8 +39,6 @@ set(headers ArrayHandleZip.h ArrayPortal.h ArrayPortalToIterators.h - ArrayPortalExtrude.h - ArrayPortalExtrudePlane.h ArrayRangeCompute.h AssignerMultiBlock.h AtomicArray.h @@ -112,7 +110,6 @@ set(headers set(template_sources ArrayHandle.hxx - ArrayPortalExtrudePlane.hxx ArrayHandleVirtual.hxx ArrayRangeCompute.hxx CellSetExplicit.hxx diff --git a/vtkm/cont/StorageExtrude.h b/vtkm/cont/StorageExtrude.h index eb75ce957..0988f0461 100644 --- a/vtkm/cont/StorageExtrude.h +++ b/vtkm/cont/StorageExtrude.h @@ -10,10 +10,358 @@ #ifndef vtkm_internal_StorageExtrude_h #define vtkm_internal_StorageExtrude_h -#include +#include + #include #include +namespace vtkm +{ +namespace exec +{ + +template +struct VTKM_ALWAYS_EXPORT ArrayPortalExtrudePlane +{ + using ValueType = typename PortalType::ValueType; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ArrayPortalExtrudePlane() + : Portal() + , NumberOfPlanes(0){}; + + ArrayPortalExtrudePlane(const PortalType& p, vtkm::Int32 numOfPlanes) + : Portal(p) + , NumberOfPlanes(numOfPlanes) + { + } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + vtkm::Id GetNumberOfValues() const + { + return this->Portal.GetNumberOfValues() * static_cast(NumberOfPlanes); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ValueType Get(vtkm::Id index) const { return this->Portal.Get(index % this->NumberOfPlanes); } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ValueType Get(vtkm::Id2 index) const { return this->Portal.Get(index[0]); } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + vtkm::Vec GetWedge(const IndicesExtrude& index) const + { + vtkm::Vec result; + result[0] = this->Portal.Get(index.PointIds[0][0]); + result[1] = this->Portal.Get(index.PointIds[0][1]); + result[2] = this->Portal.Get(index.PointIds[0][2]); + result[3] = this->Portal.Get(index.PointIds[1][0]); + result[4] = this->Portal.Get(index.PointIds[1][1]); + result[5] = this->Portal.Get(index.PointIds[1][2]); + + return result; + } + + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const {} + + PortalType Portal; + vtkm::Int32 NumberOfPlanes; +}; +} +} // vtkm::exec + +namespace vtkm +{ +namespace cont +{ +namespace internal +{ + +struct VTKM_ALWAYS_EXPORT StorageTagExtrudePlane +{ +}; + +template +class VTKM_ALWAYS_EXPORT Storage +{ + using HandleType = vtkm::cont::ArrayHandle; + +public: + using ValueType = T; + + // This is meant to be invalid. Because point arrays are read only, you + // should only be able to use the const version. + struct PortalType + { + using ValueType = void*; + using IteratorType = void*; + }; + + using PortalConstType = + vtkm::exec::ArrayPortalExtrudePlane; + + Storage() + : Array() + , NumberOfPlanes(0) + { + } + + Storage(const HandleType& array, vtkm::Int32 numberOfPlanes) + : Array(array) + , NumberOfPlanes(numberOfPlanes) + { + } + + PortalType GetPortal() { return PortalType{}; } + + PortalConstType GetPortalConst() const + { + return PortalConstType(this->Array.GetPortalConstControl(), this->NumberOfPlanes); + } + + vtkm::Id GetNumberOfValues() const + { + return this->Array.GetNumberOfValues() * static_cast(this->NumberOfPlanes); + } + + vtkm::Int32 GetNumberOfValuesPerPlane() const + { + return static_cast(this->Array->GetNumberOfValues()); + } + + vtkm::Int32 GetNumberOfPlanes() const { return this->NumberOfPlanes; } + + void Allocate(vtkm::Id vtkmNotUsed(numberOfValues)) + { + throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot be allocated."); + } + + void Shrink(vtkm::Id vtkmNotUsed(numberOfValues)) + { + throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot shrink."); + } + + void ReleaseResources() + { + // This request is ignored since we don't own the memory that was past + // to us + } + +private: + vtkm::cont::ArrayHandle Array; + vtkm::Int32 NumberOfPlanes; +}; + +template +class VTKM_ALWAYS_EXPORT ArrayTransfer +{ +public: + using ValueType = T; + using StorageType = vtkm::cont::internal::Storage; + + using PortalControl = typename StorageType::PortalType; + using PortalConstControl = typename StorageType::PortalConstType; + + //meant to be an invalid writeable execution portal + using PortalExecution = typename StorageType::PortalType; + using PortalConstExecution = vtkm::exec::ArrayPortalExtrudePlane{}.PrepareForInput(Device{}))>; + + VTKM_CONT + ArrayTransfer(StorageType* storage) + : ControlData(storage) + { + } + + vtkm::Id GetNumberOfValues() const { return this->ControlData->GetNumberOfValues(); } + + VTKM_CONT + PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData)) + { + return PortalConstExecution(this->ControlData->Array.PrepareForInput(Device()), + this->ControlData->NumberOfPlanes); + } + + VTKM_CONT + PortalExecution PrepareForInPlace(bool& vtkmNotUsed(updateData)) + { + throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. " + "Cannot be used for in-place operations."); + } + + VTKM_CONT + PortalExecution PrepareForOutput(vtkm::Id vtkmNotUsed(numberOfValues)) + { + throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot be used as output."); + } + + VTKM_CONT + void RetrieveOutputData(StorageType* vtkmNotUsed(storage)) const + { + throw vtkm::cont::ErrorInternal( + "ArrayPortalExtrudePlane read only. " + "There should be no occurance of the ArrayHandle trying to pull " + "data from the execution environment."); + } + + VTKM_CONT + void Shrink(vtkm::Id vtkmNotUsed(numberOfValues)) + { + throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot shrink."); + } + + VTKM_CONT + void ReleaseResources() + { + // This request is ignored since we don't own the memory that was past + // to us + } + +private: + const StorageType* const ControlData; +}; +} +} +} // vtkm::cont::internal + +namespace vtkm +{ +namespace exec +{ + +template +struct VTKM_ALWAYS_EXPORT ArrayPortalExtrude +{ + using ValueType = vtkm::Vec; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ArrayPortalExtrude() + : Portal() + , NumberOfValues(0) + , NumberOfPlanes(0) + , UseCylindrical(false){}; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ArrayPortalExtrude(const PortalType& p, + vtkm::Int32 numOfValues, + vtkm::Int32 numOfPlanes, + bool cylindrical = false) + : Portal(p) + , NumberOfValues(numOfValues) + , NumberOfPlanes(numOfPlanes) + , UseCylindrical(cylindrical) + { + } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + vtkm::Id GetNumberOfValues() const + { + return ((NumberOfValues / 2) * static_cast(NumberOfPlanes)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ValueType Get(vtkm::Id index) const; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + ValueType Get(vtkm::Id2 index) const; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + vtkm::Vec GetWedge(const IndicesExtrude& index) const; + + VTKM_SUPPRESS_EXEC_WARNINGS + VTKM_EXEC_CONT + void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const {} + + PortalType Portal; + vtkm::Int32 NumberOfValues; + vtkm::Int32 NumberOfPlanes; + bool UseCylindrical; +}; +template +typename ArrayPortalExtrude::ValueType +ArrayPortalExtrude::ArrayPortalExtrude::Get(vtkm::Id index) const +{ + using CompType = typename ValueType::ComponentType; + + const vtkm::Id realIdx = (index * 2) % this->NumberOfValues; + const vtkm::Id whichPlane = (index * 2) / this->NumberOfValues; + const auto phi = static_cast(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes)); + + auto r = this->Portal.Get(realIdx); + auto z = this->Portal.Get(realIdx + 1); + if (this->UseCylindrical) + { + return ValueType(r, phi, z); + } + else + { + return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); + } +} + +template +typename ArrayPortalExtrude::ValueType +ArrayPortalExtrude::ArrayPortalExtrude::Get(vtkm::Id2 index) const +{ + using CompType = typename ValueType::ComponentType; + + const vtkm::Id realIdx = (index[0] * 2); + const vtkm::Id whichPlane = index[1]; + const auto phi = static_cast(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes)); + + auto r = this->Portal.Get(realIdx); + auto z = this->Portal.Get(realIdx + 1); + if (this->UseCylindrical) + { + return ValueType(r, phi, z); + } + else + { + return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); + } +} + +template +vtkm::Vec::ValueType, 6> +ArrayPortalExtrude::ArrayPortalExtrude::GetWedge(const IndicesExtrude& index) const +{ + using CompType = typename ValueType::ComponentType; + + vtkm::Vec result; + for (int j = 0; j < 2; ++j) + { + const auto phi = + static_cast(index.Planes[j] * (vtkm::TwoPi() / this->NumberOfPlanes)); + for (int i = 0; i < 3; ++i) + { + const vtkm::Id realIdx = index.PointIds[j][i] * 2; + auto r = this->Portal.Get(realIdx); + auto z = this->Portal.Get(realIdx + 1); + result[3 * j + i] = this->UseCylindrical + ? ValueType(r, phi, z) + : ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z); + } + } + + return result; +} +} +} + namespace vtkm { namespace cont diff --git a/vtkm/exec/arg/FetchExtrude.h b/vtkm/exec/arg/FetchExtrude.h index 05bc83863..afa55fbf2 100644 --- a/vtkm/exec/arg/FetchExtrude.h +++ b/vtkm/exec/arg/FetchExtrude.h @@ -10,8 +10,6 @@ #ifndef vtk_m_exec_arg_FetchExtrude_h #define vtk_m_exec_arg_FetchExtrude_h -#include -#include #include #include #include