10 #ifndef vtk_m_exec_Interpolate_h
11 #define vtk_m_exec_Interpolate_h
20 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
21 #pragma GCC diagnostic push
22 #pragma GCC diagnostic ignored "-Wconversion"
23 #endif // gcc || clang
33 template <
typename VtkcCellShapeTag,
typename FieldVecType,
typename ParametricCoordType>
35 const FieldVecType& field,
36 const ParametricCoordType& pcoords,
37 typename FieldVecType::ComponentType& result)
39 if (tag.numberOfPoints() != field.GetNumberOfComponents())
45 using FieldValueType =
typename FieldVecType::ComponentType;
48 lcl::interpolate(tag, lcl::makeFieldAccessorNestedSOA(field, numComponents), pcoords, result);
49 return vtkm::internal::LclErrorToVtkmError(status);
55 template <
typename FieldVecType,
typename ParametricCoordType,
typename CellShapeTag>
59 typename FieldVecType::ComponentType& result)
61 auto lclTag = vtkm::internal::make_LclCellShapeTag(tag, pointFieldValues.GetNumberOfComponents());
62 return internal::CellInterpolateImpl(lclTag, pointFieldValues, pcoords, result);
66 template <
typename FieldVecType,
typename ParametricCoordType>
69 vtkm::CellShapeTagEmpty,
70 typename FieldVecType::ComponentType& result)
77 template <
typename FieldVecType,
typename ParametricCoordType>
80 vtkm::CellShapeTagPolyLine,
81 typename FieldVecType::ComponentType& result)
92 return CellInterpolate(field, pcoords, vtkm::CellShapeTagVertex(), result);
95 using T = ParametricCoordType;
97 T dt = 1 /
static_cast<T
>(numPoints - 1);
99 if (idx == numPoints - 1)
101 result = field[numPoints - 1];
105 T pc = (pcoords[0] -
static_cast<T
>(idx) * dt) / dt;
106 return internal::CellInterpolateImpl(
111 template <
typename FieldVecType,
typename ParametricCoordType>
114 vtkm::CellShapeTagPolygon,
115 typename FieldVecType::ComponentType& result)
127 return CellInterpolate(field, pcoords, vtkm::CellShapeTagVertex(), result);
129 return CellInterpolate(field, pcoords, vtkm::CellShapeTagLine(), result);
131 return internal::CellInterpolateImpl(lcl::Polygon(numPoints), field, pcoords, result);
136 template <
typename ParametricCoordType>
139 vtkm::CellShapeTagQuad,
142 return internal::CellInterpolateImpl(lcl::Pixel{}, field, pcoords, result);
146 template <
typename ParametricCoordType>
149 vtkm::CellShapeTagHexahedron,
152 return internal::CellInterpolateImpl(lcl::Voxel{}, field, pcoords, result);
161 template <
typename FieldVecType,
typename ParametricCoordType>
165 typename FieldVecType::ComponentType& result)
171 status =
CellInterpolate(pointFieldValues, parametricCoords, CellShapeTag(), result));
182 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
183 #pragma GCC diagnostic pop
184 #endif // gcc || clang
186 #endif //vtk_m_exec_Interpolate_h