Go to the documentation of this file.
11 #ifndef vtk_m_worklet_gradient_PointGradient_h
12 #define vtk_m_worklet_gradient_PointGradient_h
32 WholeCellSetIn<Cell, Point>,
33 WholeArrayIn pointCoordinates,
34 WholeArrayIn inputField,
40 template <
typename FromIndexType,
41 typename CellSetInType,
42 typename WholeCoordinatesIn,
43 typename WholeFieldIn,
44 typename GradientOutType>
46 const FromIndexType& cellIds,
48 const CellSetInType& geometry,
49 const WholeCoordinatesIn& pointCoordinates,
50 const WholeFieldIn& inputField,
51 GradientOutType& outputGradient)
const
54 using CellThreadIndices =
58 using ValueType =
typename WholeFieldIn::ValueType;
59 using CellShapeTag =
typename CellSetInType::CellShapeTag;
65 CellThreadIndices cellIndices(cellId, cellId, 0, cellId, geometry);
67 const CellShapeTag cellShape = cellIndices.GetCellShape();
70 const auto wCoords = this->
GetValues(cellIndices, pointCoordinates);
71 const auto field = this->
GetValues(cellIndices, inputField);
75 this->
ComputeGradient(cellShape, pointIndexForCell, wCoords, field, gradient);
81 const BaseGradientType invNumCells =
82 static_cast<BaseGradientType
>(1.) /
static_cast<BaseGradientType
>(numCells);
84 gradient[0] = gradient[0] * invNumCells;
85 gradient[1] = gradient[1] * invNumCells;
86 gradient[2] = gradient[2] * invNumCells;
88 outputGradient = gradient;
92 template <
typename CellShapeTag,
93 typename PointCoordVecType,
94 typename FieldInVecType,
95 typename OutValueType>
98 const PointCoordVecType& wCoords,
99 const FieldInVecType& field,
103 vtkm::exec::ParametricCoordinatesPoint(
104 wCoords.GetNumberOfComponents(), pointIndexForCell, cellShape, pCoords);
111 gradient += pointGradient;
115 template <
typename ThreadIndicesType>
120 const auto& topo = indices.GetIndicesIncident();
123 if (topo[i] == pointId)
131 template <
typename ThreadIndicesType,
typename WholeFieldIn>
141 return fetch.Load(indices, in);
VTKM_EXEC auto GetValues(const ThreadIndicesType &indices, const WholeFieldIn &in) const
Definition: PointGradient.h:132
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC void operator()(const vtkm::IdComponent &numCells, const FromIndexType &cellIds, const vtkm::Id &pointId, const CellSetInType &geometry, const WholeCoordinatesIn &pointCoordinates, const WholeFieldIn &inputField, GradientOutType &outputGradient) const
Definition: PointGradient.h:45
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
Fetch tag for getting array values determined by topology connections.
Definition: FetchTagArrayTopologyMapIn.h:40
Class for loading and storing values in thread instance.
Definition: Fetch.h:49
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:80
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Definition: PointGradient.h:29
_1 InputDomain
Definition: PointGradient.h:38
IncidentElementCount CellCount
Definition: WorkletMapTopology.h:286
Base class for worklets that map from Cells to Points.
Definition: WorkletMapTopology.h:274
VTKM_EXEC vtkm::ErrorCode CellDerivative(const FieldVecType &field, const WorldCoordType &wCoords, const vtkm::Vec< ParametricCoordType, 3 > &pcoords, CellShapeTag shape, vtkm::Vec< typename FieldVecType::ComponentType, 3 > &result)
Definition: CellDerivative.h:69
IncidentElementIndices CellIndices
Definition: WorkletMapTopology.h:288
A short fixed-length array.
Definition: Types.h:767
void(CellSetIn, WholeCellSetIn< Cell, Point >, WholeArrayIn pointCoordinates, WholeArrayIn inputField, GradientOutputs outputFields) ControlSignature
Definition: PointGradient.h:35
Aspect tag to use for default load/store of data.
Definition: AspectTagDefault.h:22
VTKM_EXEC vtkm::IdComponent GetPointIndexForCell(const ThreadIndicesType &indices, vtkm::Id pointId) const
Definition: PointGradient.h:116
void(CellCount, CellIndices, WorkIndex, _2, _3, _4, _5) ExecutionSignature
Definition: PointGradient.h:37
VTKM_EXEC void ComputeGradient(CellShapeTag cellShape, const vtkm::IdComponent &pointIndexForCell, const PointCoordVecType &wCoords, const FieldInVecType &field, vtkm::Vec< OutValueType, 3 > &gradient) const
Definition: PointGradient.h:96
Container for thread indices in a topology map.
Definition: ThreadIndicesTopologyMap.h:95
Uses spaces optimizations when using MaskNone and ScatterIdentity.
Definition: ThreadIndicesTopologyMap.h:74
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39
Definition: GradientOutput.h:305