18 #ifndef viskores_exec_Derivative_h
19 #define viskores_exec_Derivative_h
40 template <
typename LclCellShapeTag,
41 typename FieldVecType,
42 typename WorldCoordType,
43 typename ParametricCoordType>
46 const FieldVecType& field,
47 const WorldCoordType& wCoords,
48 const ParametricCoordType& pcoords,
52 if ((field.GetNumberOfComponents() != tag.numberOfPoints()) ||
53 (wCoords.GetNumberOfComponents() != tag.numberOfPoints()))
58 using FieldType =
typename FieldVecType::ComponentType;
61 auto status = lcl::derivative(tag,
62 lcl::makeFieldAccessorNestedSOA(wCoords, 3),
63 lcl::makeFieldAccessorNestedSOA(field, fieldNumComponents),
68 return viskores::internal::LclErrorToViskoresError(status);
73 template <
typename FieldVecType,
74 typename WorldCoordType,
75 typename ParametricCoordType,
76 typename CellShapeTag>
78 const FieldVecType& field,
79 const WorldCoordType& wCoords,
84 return internal::CellDerivativeImpl(
85 viskores::internal::make_LclCellShapeTag(shape), field, wCoords, pcoords, result);
88 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
91 const WorldCoordType&,
100 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
102 const FieldVecType& field,
103 const WorldCoordType& wCoords,
109 if (numPoints != wCoords.GetNumberOfComponents())
123 auto dt =
static_cast<ParametricCoordType
>(1) /
static_cast<ParametricCoordType
>(numPoints - 1);
129 if (idx > numPoints - 1)
136 auto pc = (pcoords[0] -
static_cast<ParametricCoordType
>(idx) * dt) / dt;
137 return internal::CellDerivativeImpl(
lcl::Line{}, lineField, lineWCoords, &pc, result);
141 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
143 const FieldVecType& field,
144 const WorldCoordType& wCoords,
150 if ((numPoints <= 0) || (numPoints != wCoords.GetNumberOfComponents()))
156 switch (field.GetNumberOfComponents())
163 return internal::CellDerivativeImpl(lcl::Polygon(numPoints), field, wCoords, pcoords, result);
168 template <
typename FieldVecType,
typename ParametricCoordType>
170 const FieldVecType& field,
176 return internal::CellDerivativeImpl(lcl::Pixel{}, field, wCoords, pcoords, result);
179 template <
typename FieldVecType,
typename ParametricCoordType>
181 const FieldVecType& field,
187 return internal::CellDerivativeImpl(lcl::Voxel{}, field, wCoords, pcoords, result);
212 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
214 const FieldVecType& pointFieldValues,
215 const WorldCoordType& worldCoordinateValues,
225 pointFieldValues, worldCoordinateValues, parametricCoords, CellShapeTag(), result));
236 #endif //viskores_exec_Derivative_h