//============================================================================ // 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_exec_arg_FetchExtrude_h #define vtk_m_exec_arg_FetchExtrude_h #include #include #include #include //optimized fetches for ArrayPortalXGCCoordinates for // - 3D Scheduling // - WorkletNeighboorhood namespace vtkm { namespace exec { namespace arg { /// \brief Aspect tag to use for getting the visited indices. /// /// The \c AspectTagIncidentElementIndices aspect tag causes the \c Fetch class /// to obtain the indices that map to the current topology element. /// struct AspectTagIncidentElementIndices { }; //Optimized fetch for point ids when iterating the cells ConnectivityExtrude template struct Fetch { VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load( const vtkm::exec::arg::ThreadIndicesTopologyMap& indices, const ExecObjectType&) const -> vtkm::Vec { // std::cout << "opimized fetch for point ids" << std::endl; const auto& xgcidx = indices.GetIndicesIncident(); const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane); const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane); vtkm::Vec result; result[0] = offset1 + xgcidx.PointIds[0][0]; result[1] = offset1 + xgcidx.PointIds[0][1]; result[2] = offset1 + xgcidx.PointIds[0][2]; result[3] = offset2 + xgcidx.PointIds[1][0]; result[4] = offset2 + xgcidx.PointIds[1][1]; result[5] = offset2 + xgcidx.PointIds[1][2]; return result; } VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load( const vtkm::exec::arg::ThreadIndicesTopologyMap& indices, const ExecObjectType&) const -> decltype(indices.GetIndicesIncident()) { return indices.GetIndicesIncident(); } template VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const { // Store is a no-op. } }; //Optimized fetch for point coordinates when iterating the cells of ConnectivityExtrude template struct Fetch> { //Optimized fetch for point arrays when iterating the cells ConnectivityExtrude VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load( const vtkm::exec::arg::ThreadIndicesTopologyMap& indices, const vtkm::internal::ArrayPortalXGCCoordinates& portal) -> decltype(portal.GetWedge(indices.GetIndicesIncident())) { return portal.GetWedge(indices.GetIndicesIncident()); } VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load(const ThreadIndicesType& indices, const vtkm::internal::ArrayPortalXGCCoordinates& field) const -> decltype( detail::FetchArrayTopologyMapInImplementation, ThreadIndicesType>::Load(indices, field)) { using Implementation = detail::FetchArrayTopologyMapInImplementation, ThreadIndicesType>; return Implementation::Load(indices, field); } template VTKM_EXEC void Store(const ThreadIndicesType&, const vtkm::internal::ArrayPortalXGCCoordinates&, const ValueType&) const { // Store is a no-op for this fetch. } }; //Optimized fetch for point coordinates when iterating the points of ConnectivityExtrude template struct Fetch> { VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load(const ThreadIndicesType& indices, const vtkm::internal::ArrayPortalXGCCoordinates& points) -> decltype(points.Get(indices.GetInputIndex())) { // std::cout << "optimized fetch for point coordinates" << std::endl; return points.Get(indices.GetInputIndex()); } VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC auto Load( const vtkm::exec::arg::ThreadIndicesTopologyMap& indices, const vtkm::internal::ArrayPortalXGCCoordinates& points) -> decltype(points.Get(indices.GetIndexLogical())) { // std::cout << "optimized fetch for point coordinates" << std::endl; return points.Get(indices.GetIndexLogical()); } template VTKM_EXEC void Store(const ThreadIndicesType&, const vtkm::internal::ArrayPortalXGCCoordinates&, const ValueType&) const { // Store is a no-op for this fetch. } }; } } } #endif