10 #ifndef vtk_m_exec_Interpolate_h
11 #define vtk_m_exec_Interpolate_h
22 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Wconversion"
25 #endif // gcc || clang
35 template <
typename VtkcCellShapeTag,
typename FieldVecType,
typename ParametricCoordType>
37 const FieldVecType& field,
38 const ParametricCoordType& pcoords,
39 typename FieldVecType::ComponentType& result)
41 if (tag.numberOfPoints() != field.GetNumberOfComponents())
47 using FieldValueType =
typename FieldVecType::ComponentType;
50 lcl::interpolate(tag, lcl::makeFieldAccessorNestedSOA(field, numComponents), pcoords, result);
51 return vtkm::internal::LclErrorToVtkmError(status);
57 template <
typename FieldVecType,
typename ParametricCoordType,
typename CellShapeTag>
61 typename FieldVecType::ComponentType& result)
63 auto lclTag = vtkm::internal::make_LclCellShapeTag(tag, pointFieldValues.GetNumberOfComponents());
64 return internal::CellInterpolateImpl(lclTag, pointFieldValues, pcoords, result);
68 template <
typename FieldVecType,
typename ParametricCoordType>
72 typename FieldVecType::ComponentType& result)
79 template <
typename FieldVecType,
typename ParametricCoordType>
83 typename FieldVecType::ComponentType& result)
97 using T = ParametricCoordType;
99 T dt = 1 /
static_cast<T
>(numPoints - 1);
101 if (idx == numPoints - 1)
103 result = field[numPoints - 1];
107 T pc = (pcoords[0] -
static_cast<T
>(idx) * dt) / dt;
108 return internal::CellInterpolateImpl(
113 template <
typename FieldVecType,
typename ParametricCoordType>
117 typename FieldVecType::ComponentType& result)
133 return internal::CellInterpolateImpl(lcl::Polygon(numPoints), field, pcoords, result);
138 template <
typename ParametricCoordType>
144 return internal::CellInterpolateImpl(lcl::Pixel{}, field, pcoords, result);
148 template <
typename ParametricCoordType>
154 return internal::CellInterpolateImpl(lcl::Voxel{}, field, pcoords, result);
171 template <
typename FieldVecType,
typename ParametricCoordType>
175 typename FieldVecType::ComponentType& result)
181 status =
CellInterpolate(pointFieldValues, parametricCoords, CellShapeTag(), result));
205 template <
typename IndicesVecType,
206 typename FieldPortalType,
207 typename ParametricCoordType,
208 typename CellShapeTag>
210 const FieldPortalType& pointFieldPortal,
213 typename FieldPortalType::ValueType& result)
224 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
225 #pragma GCC diagnostic pop
226 #endif // gcc || clang
228 #endif //vtk_m_exec_Interpolate_h