Go to the documentation of this file.
51 #ifndef vtkm_worklet_cosmotools_compute_potential_on_candidates_h
52 #define vtkm_worklet_cosmotools_compute_potential_on_candidates_h
89 template <
typename InFieldPortalType>
91 const InFieldPortalType& xLoc,
92 const InFieldPortalType& yLoc,
93 const InFieldPortalType& zLoc)
const
98 T xDist = xLoc.Get(i) - xLoc.Get(j);
99 T yDist = yLoc.Get(i) - yLoc.Get(j);
100 T zDist = zLoc.Get(i) - zLoc.Get(j);
101 T r =
vtkm::Sqrt((xDist * xDist) + (yDist * yDist) + (zDist * zDist));
102 if ((i != j) && (fabs(r) > 0.00000000001f))
104 potential -=
mass / r;
VTKM_EXEC_CONT vtkm::Float32 Sqrt(vtkm::Float32 x)
Compute the square root of x.
Definition: Math.h:958
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
A control signature tag for input fields.
Definition: WorkletMapField.h:49
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38