Go to the documentation of this file.
51 #ifndef vtkm_worklet_cosmotools_compute_potential_h
52 #define vtkm_worklet_cosmotools_compute_potential_h
75 WholeArrayIn firstParticleId,
76 WholeArrayIn lastParticleId,
90 template <
typename InFieldPortalType,
typename InIdPortalType,
typename PermutePortalType>
92 const InIdPortalType& partId,
93 const InFieldPortalType& xLoc,
94 const InFieldPortalType& yLoc,
95 const InFieldPortalType& zLoc,
96 const InIdPortalType& firstParticleId,
97 const PermutePortalType& lastParticleId)
const
105 for (
vtkm::Id j = firstParticleId.Get(i); j <= lastParticleId.Get(i); j++)
108 T xDist = xLoc.Get(iId) - xLoc.Get(jId);
109 T yDist = yLoc.Get(iId) - yLoc.Get(jId);
110 T zDist = zLoc.Get(iId) - zLoc.Get(jId);
111 T r =
vtkm::Sqrt((xDist * xDist) + (yDist * yDist) + (zDist * zDist));
112 if ((i != j) && (fabs(r) > 0.00000000001f))
113 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