Go to the documentation of this file.
51 #ifndef vtkm_worklet_cosmotools_compute_potential_neighbors_h
52 #define vtkm_worklet_cosmotools_compute_potential_neighbors_h
76 WholeArrayIn firstParticleId,
77 WholeArrayIn lastParticleId,
101 template <
typename InFieldPortalType,
typename InIdPortalType,
typename InVectorPortalType>
103 const InIdPortalType& binId,
104 const InIdPortalType& partId,
105 const InFieldPortalType& xLoc,
106 const InFieldPortalType& yLoc,
107 const InFieldPortalType& zLoc,
108 const InVectorPortalType& firstParticleId,
109 const InVectorPortalType& lastParticleId)
const
120 for (
vtkm::Id z = zVal - 1; z <= zVal + 1; z++)
122 for (
vtkm::Id y = yVal - 1; y <= yVal + 1; y++)
125 vtkm::Id startParticle = firstParticleId.Get(firstBinId);
126 vtkm::Id endParticle = lastParticleId.Get(firstBinId);
128 for (
vtkm::Id j = startParticle; j < endParticle; j++)
131 T xDist = xLoc.Get(iId) - xLoc.Get(jId);
132 T yDist = yLoc.Get(iId) - yLoc.Get(jId);
133 T zDist = zLoc.Get(iId) - zLoc.Get(jId);
134 T r =
vtkm::Sqrt((xDist * xDist) + (yDist * yDist) + (zDist * zDist));
135 if ((i != j) && (fabs(r) > 0.00000000001f))
136 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