18 #ifndef viskores_exec_Interpolate_h
19 #define viskores_exec_Interpolate_h
30 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Wconversion"
33 #endif // gcc || clang
43 template <
typename VtkcCellShapeTag,
typename FieldVecType,
typename ParametricCoordType>
45 const FieldVecType& field,
46 const ParametricCoordType& pcoords,
47 typename FieldVecType::ComponentType& result)
49 if (tag.numberOfPoints() != field.GetNumberOfComponents())
55 using FieldValueType =
typename FieldVecType::ComponentType;
58 lcl::interpolate(tag, lcl::makeFieldAccessorNestedSOA(field, numComponents), pcoords, result);
59 return viskores::internal::LclErrorToViskoresError(status);
65 template <
typename FieldVecType,
typename ParametricCoordType,
typename CellShapeTag>
67 const FieldVecType& pointFieldValues,
70 typename FieldVecType::ComponentType& result)
73 viskores::internal::make_LclCellShapeTag(tag, pointFieldValues.GetNumberOfComponents());
74 return internal::CellInterpolateImpl(lclTag, pointFieldValues, pcoords, result);
78 template <
typename FieldVecType,
typename ParametricCoordType>
82 typename FieldVecType::ComponentType& result)
89 template <
typename FieldVecType,
typename ParametricCoordType>
91 const FieldVecType& field,
94 typename FieldVecType::ComponentType& result)
108 using T = ParametricCoordType;
110 T dt = 1 /
static_cast<T
>(numPoints - 1);
112 if (idx == numPoints - 1)
114 result = field[numPoints - 1];
118 T pc = (pcoords[0] -
static_cast<T
>(idx) * dt) / dt;
119 return internal::CellInterpolateImpl(
124 template <
typename FieldVecType,
typename ParametricCoordType>
126 const FieldVecType& field,
129 typename FieldVecType::ComponentType& result)
145 return internal::CellInterpolateImpl(lcl::Polygon(numPoints), field, pcoords, result);
150 template <
typename ParametricCoordType>
157 return internal::CellInterpolateImpl(lcl::Pixel{}, field, pcoords, result);
161 template <
typename ParametricCoordType>
168 return internal::CellInterpolateImpl(lcl::Voxel{}, field, pcoords, result);
185 template <
typename FieldVecType,
typename ParametricCoordType>
187 const FieldVecType& pointFieldValues,
190 typename FieldVecType::ComponentType& result)
196 status =
CellInterpolate(pointFieldValues, parametricCoords, CellShapeTag(), result));
220 template <
typename IndicesVecType,
221 typename FieldPortalType,
222 typename ParametricCoordType,
223 typename CellShapeTag>
225 const IndicesVecType& pointIndices,
226 const FieldPortalType& pointFieldPortal,
229 typename FieldPortalType::ValueType& result)
240 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
241 #pragma GCC diagnostic pop
242 #endif // gcc || clang
244 #endif //viskores_exec_Interpolate_h