Go to the documentation of this file.
   51 #ifndef vtkm_worklet_cosmotools_compute_potential_bin_h 
   52 #define vtkm_worklet_cosmotools_compute_potential_bin_h 
   71                                 WholeArrayIn binCount, 
 
   93   template <
typename InIdPortalType>
 
   95                             const InIdPortalType& count,
 
   96                             const InIdPortalType& binX,
 
   97                             const InIdPortalType& binY,
 
   98                             const InIdPortalType& binZ,
 
  100                             T& worstPotential)
 const 
  108       vtkm::Id xDelta = vtkm::Abs(ibinX - binX.Get(j));
 
  109       vtkm::Id yDelta = vtkm::Abs(ibinY - binY.Get(j));
 
  110       vtkm::Id zDelta = vtkm::Abs(ibinZ - binZ.Get(j));
 
  112       if ((count.Get(j) != 0) && (xDelta > 1) && (yDelta > 1) && (zDelta > 1))
 
  114         T xDistNear = 
static_cast<T
>((xDelta - 1)) * 
linkLen;
 
  115         T yDistNear = 
static_cast<T
>((yDelta - 1)) * 
linkLen;
 
  116         T zDistNear = 
static_cast<T
>((zDelta - 1)) * 
linkLen;
 
  117         T xDistFar = 
static_cast<T
>((xDelta + 1)) * 
linkLen;
 
  118         T yDistFar = 
static_cast<T
>((yDelta + 1)) * 
linkLen;
 
  119         T zDistFar = 
static_cast<T
>((zDelta + 1)) * 
linkLen;
 
  122           vtkm::Sqrt((xDistNear * xDistNear) + (yDistNear * yDistNear) + (zDistNear * zDistNear));
 
  123         T rFar = 
vtkm::Sqrt((xDistFar * xDistFar) + (yDistFar * yDistFar) + (zDistFar * zDistFar));
 
  125         if (rFar > 0.00000000001f)
 
  127           worstPotential -= (
static_cast<T
>(count.Get(j)) * 
mass) / rFar;
 
  129         if (rNear > 0.00000000001f)
 
  131           bestPotential -= (
static_cast<T
>(count.Get(j)) * 
mass) / rNear;
 
  
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
 
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
 
A control signature tag for input fields.
Definition: WorkletMapField.h:49
 
A control signature tag for input-output (in-place) fields.
Definition: WorkletMapField.h:71
 
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38