10 #ifndef vtk_m_exec_Derivative_h
11 #define vtk_m_exec_Derivative_h
32 template <
typename LclCellShapeTag,
33 typename FieldVecType,
34 typename WorldCoordType,
35 typename ParametricCoordType>
38 const FieldVecType& field,
39 const WorldCoordType& wCoords,
40 const ParametricCoordType& pcoords,
44 if ((field.GetNumberOfComponents() != tag.numberOfPoints()) ||
45 (wCoords.GetNumberOfComponents() != tag.numberOfPoints()))
50 using FieldType =
typename FieldVecType::ComponentType;
53 auto status = lcl::derivative(tag,
54 lcl::makeFieldAccessorNestedSOA(wCoords, 3),
55 lcl::makeFieldAccessorNestedSOA(field, fieldNumComponents),
60 return vtkm::internal::LclErrorToVtkmError(status);
65 template <
typename FieldVecType,
66 typename WorldCoordType,
67 typename ParametricCoordType,
68 typename CellShapeTag>
70 const WorldCoordType& wCoords,
75 return internal::CellDerivativeImpl(
76 vtkm::internal::make_LclCellShapeTag(shape), field, wCoords, pcoords, result);
79 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
81 const WorldCoordType&,
90 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
92 const WorldCoordType& wCoords,
98 if (numPoints != wCoords.GetNumberOfComponents())
112 auto dt =
static_cast<ParametricCoordType
>(1) /
static_cast<ParametricCoordType
>(numPoints - 1);
118 if (idx > numPoints - 1)
124 auto lineWCoords =
vtkm::make_Vec(wCoords[idx - 1], wCoords[idx]);
125 auto pc = (pcoords[0] -
static_cast<ParametricCoordType
>(idx) * dt) / dt;
126 return internal::CellDerivativeImpl(
lcl::Line{}, lineField, lineWCoords, &pc, result);
130 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
132 const WorldCoordType& wCoords,
138 if ((numPoints <= 0) || (numPoints != wCoords.GetNumberOfComponents()))
144 switch (field.GetNumberOfComponents())
151 return internal::CellDerivativeImpl(lcl::Polygon(numPoints), field, wCoords, pcoords, result);
156 template <
typename FieldVecType,
typename ParametricCoordType>
163 return internal::CellDerivativeImpl(lcl::Pixel{}, field, wCoords, pcoords, result);
166 template <
typename FieldVecType,
typename ParametricCoordType>
173 return internal::CellDerivativeImpl(lcl::Voxel{}, field, wCoords, pcoords, result);
198 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
200 const WorldCoordType& worldCoordinateValues,
210 pointFieldValues, worldCoordinateValues, parametricCoords, CellShapeTag(), result));
221 #endif //vtk_m_exec_Derivative_h