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&,
83 vtkm::CellShapeTagEmpty,
90 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
92 const WorldCoordType& wCoords,
94 vtkm::CellShapeTagPolyLine,
98 if (numPoints != wCoords.GetNumberOfComponents())
107 return CellDerivative(field, wCoords, pcoords, vtkm::CellShapeTagVertex(), result);
109 return CellDerivative(field, wCoords, pcoords, vtkm::CellShapeTagLine(), result);
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,
134 vtkm::CellShapeTagPolygon,
138 if ((numPoints <= 0) || (numPoints != wCoords.GetNumberOfComponents()))
144 switch (field.GetNumberOfComponents())
147 return CellDerivative(field, wCoords, pcoords, vtkm::CellShapeTagVertex(), result);
149 return CellDerivative(field, wCoords, pcoords, vtkm::CellShapeTagLine(), result);
151 return internal::CellDerivativeImpl(lcl::Polygon(numPoints), field, wCoords, pcoords, result);
156 template <
typename FieldVecType,
typename ParametricCoordType>
160 vtkm::CellShapeTagQuad,
163 return internal::CellDerivativeImpl(lcl::Pixel{}, field, wCoords, pcoords, result);
166 template <
typename FieldVecType,
typename ParametricCoordType>
170 vtkm::CellShapeTagHexahedron,
173 return internal::CellDerivativeImpl(lcl::Voxel{}, field, wCoords, pcoords, result);
184 template <
typename FieldVecType,
typename WorldCoordType,
typename ParametricCoordType>
186 const WorldCoordType& worldCoordinateValues,
196 pointFieldValues, worldCoordinateValues, parametricCoords, CellShapeTag(), result));
207 #endif //vtk_m_exec_Derivative_h