Block-Structured AMR Software Framework
AMReX_NeighborList.H
Go to the documentation of this file.
1 #ifndef AMREX_NEIGHBOR_LIST_H_
2 #define AMREX_NEIGHBOR_LIST_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_Particles.H>
6 #include <AMReX_GpuContainers.H>
7 #include <AMReX_DenseBins.H>
8 
9 namespace amrex
10 {
11 
12 namespace detail
13 {
14  // SelectActualNeighbors
15  template <typename F,
16  typename SrcData, typename DstData,
17  typename N1, typename N2>
19  auto call_check_pair (F const& check_pair,
20  const SrcData& src_tile, const DstData& dst_tile,
21  N1 i, N2 j)
22  noexcept -> decltype(check_pair(src_tile.m_aos[i], dst_tile.m_aos[j]))
23  {
24  return check_pair(src_tile.m_aos[i], dst_tile.m_aos[j]);
25  }
26 
27  template <typename F,
28  typename SrcData, typename DstData,
29  typename N1, typename N2>
31  auto call_check_pair (F const& check_pair,
32  const SrcData& src_tile, const DstData& /*dst_tile*/,
33  N1 i, N2 j)
34  noexcept -> decltype(check_pair(src_tile.m_aos, i, j))
35  {
36  return check_pair(src_tile.m_aos, i, j);
37  }
38 
39  template <typename F,
40  typename SrcData, typename DstData,
41  typename N1, typename N2>
43  auto call_check_pair (F const& check_pair,
44  const SrcData& src_tile, const DstData& /*dst_tile*/,
45  N1 i, N2 j)
46  noexcept -> decltype(check_pair(src_tile, i, j))
47  {
48  return check_pair(src_tile, i, j);
49  }
50 
51  // NeighborList Build
52  template <typename F,
53  typename SrcData, typename DstData,
54  typename N1, typename N2, typename N3, typename N4, typename N5>
56  auto call_check_pair (F const& check_pair,
57  const SrcData& src_tile, const DstData& dst_tile,
58  N1 i, N2 j, N3 /*type*/, N4 /*ghost_i*/, N5 /*ghost_pid*/)
59  noexcept -> decltype(check_pair(src_tile.m_aos[i], dst_tile.m_aos[j]))
60  {
61  return check_pair(src_tile.m_aos[i], dst_tile.m_aos[j]);
62  }
63 
64  template <typename F,
65  typename SrcData, typename DstData,
66  typename N1, typename N2, typename N3, typename N4, typename N5>
68  auto call_check_pair (F const& check_pair,
69  const SrcData& src_tile, const DstData& /*dst_tile*/,
70  N1 i, N2 j, N3 /*type*/, N4 /*ghost_i*/, N5 /*ghost_pid*/)
71  noexcept -> decltype(check_pair(src_tile.m_aos, i, j))
72  {
73  return check_pair(src_tile.m_aos, i, j);
74  }
75 
76  template <typename F,
77  typename SrcData, typename DstData,
78  typename N1, typename N2, typename N3, typename N4, typename N5>
80  auto call_check_pair (F const& check_pair,
81  const SrcData& src_tile, const DstData& /*dst_tile*/,
82  N1 i, N2 j, N3 /*type*/, N4 /*ghost_i*/, N5 /*ghost_pid*/)
83  noexcept -> decltype(check_pair(src_tile, i, j))
84  {
85  return check_pair(src_tile, i, j);
86  }
87 
88  template <typename F,
89  typename SrcData, typename DstData,
90  typename N1, typename N2, typename N3, typename N4, typename N5>
92  auto call_check_pair (F const& check_pair,
93  const SrcData& src_tile, const DstData& /*dst_tile*/,
94  N1 i, N2 j, N3 type, N4 ghost_i, N5 ghost_pid)
95  noexcept -> decltype(check_pair(src_tile, i, j, type, ghost_i, ghost_pid))
96  {
97  return check_pair(src_tile, i, j, type, ghost_i, ghost_pid);
98  }
99 }
100 
101 template <class ParticleType>
102 struct Neighbors
103 {
104  struct iterator
105  {
107  iterator (int start, int stop, const unsigned int * nbor_list_ptr, ParticleType* pstruct)
108  : m_index(start), m_stop(stop), m_nbor_list_ptr(nbor_list_ptr), m_pstruct(pstruct)
109  {}
110 
112  void operator++ () { ++m_index;; }
113 
115  bool operator!= (iterator const& /*rhs*/) const { return m_index < m_stop; }
116 
117  [[nodiscard]] AMREX_GPU_HOST_DEVICE
118  ParticleType& operator* () const { return m_pstruct[m_nbor_list_ptr[m_index]]; }
119 
120  [[nodiscard]] AMREX_GPU_HOST_DEVICE
121  unsigned int index () const { return m_nbor_list_ptr[m_index]; }
122 
123  private:
124  int m_index;
125  int m_stop;
126  const unsigned int* m_nbor_list_ptr;
127  ParticleType* m_pstruct;
128  };
129 
131  {
133  const_iterator (int start, int stop, const unsigned int * nbor_list_ptr, const ParticleType* pstruct)
134  : m_index(start), m_stop(stop), m_nbor_list_ptr(nbor_list_ptr), m_pstruct(pstruct)
135  {}
136 
138  void operator++ () { ++m_index;; }
139 
141  bool operator!= (const_iterator const& /*rhs*/) const { return m_index < m_stop; }
142 
143  [[nodiscard]] AMREX_GPU_HOST_DEVICE
144  const ParticleType& operator* () const { return m_pstruct[m_nbor_list_ptr[m_index]]; }
145 
146  [[nodiscard]] AMREX_GPU_HOST_DEVICE
147  unsigned int index () const { return m_nbor_list_ptr[m_index]; }
148 
149  private:
150  int m_index;
151  int m_stop;
152  const unsigned int* m_nbor_list_ptr;
153  const ParticleType* m_pstruct;
154  };
155 
156  [[nodiscard]] AMREX_GPU_HOST_DEVICE
157  iterator begin () noexcept {
160  }
161 
162  [[nodiscard]] AMREX_GPU_HOST_DEVICE
163  iterator end () noexcept {
166  }
167 
168  [[nodiscard]] AMREX_GPU_HOST_DEVICE
169  const_iterator begin () const noexcept {
172  }
173 
174  [[nodiscard]] AMREX_GPU_HOST_DEVICE
175  const_iterator end () const noexcept {
178  }
179 
180  [[nodiscard]] AMREX_GPU_HOST_DEVICE
181  const_iterator cbegin () const noexcept {
184  }
185 
186  [[nodiscard]] AMREX_GPU_HOST_DEVICE
187  const_iterator cend () const noexcept {
190  }
191 
193  Neighbors (int i, const unsigned int *nbor_offsets_ptr, const unsigned int *nbor_list_ptr,
194  ParticleType* pstruct)
195  : m_i(i),
196  m_nbor_offsets_ptr(nbor_offsets_ptr),
197  m_nbor_list_ptr(nbor_list_ptr),
198  m_pstruct(pstruct)
199  {}
200 
201 private:
202 
203  int m_i;
204  const unsigned int * m_nbor_offsets_ptr;
205  const unsigned int * m_nbor_list_ptr;
206  ParticleType * m_pstruct;
207 };
208 
209 template <class ParticleType>
211 {
214  ParticleType* pstruct)
215  : m_nbor_offsets_ptr(offsets.dataPtr()),
216  m_nbor_list_ptr(list.dataPtr()),
217  m_pstruct(pstruct)
218  {}
219 
220  [[nodiscard]] AMREX_GPU_HOST_DEVICE
223 
224  const unsigned int * m_nbor_offsets_ptr;
225  const unsigned int * m_nbor_list_ptr;
226  ParticleType * m_pstruct;
227 };
228 
229 template<typename A, typename B,
230  std::enable_if_t<std::is_same_v<std::remove_cv_t<A>,
231  std::remove_cv_t<B> >, int> = 0>
232 bool isSame (A const* pa, B const* pb)
233 {
234  return pa == pb;
235 }
236 
237 template<typename A, typename B,
238  std::enable_if_t<!std::is_same_v<std::remove_cv_t<A>,
239  std::remove_cv_t<B> >, int> = 0>
240 bool isSame (A const* /*pa*/, B const* /*pb*/)
241 {
242  return false;
243 }
244 
245 template <class ParticleType>
247 {
248 public:
249 
250  template <class PTile, class CheckPair>
251  void build (PTile& ptile,
252  const amrex::Box& bx, const amrex::Geometry& geom,
253  CheckPair&& check_pair, int num_cells=1)
254  {
255  Gpu::DeviceVector<int> off_bins_v;
260  off_bins_v.push_back(0);
261  off_bins_v.push_back(int(bx.numPts()));
262  lo_v.push_back(lbound(bx));
263  hi_v.push_back(ubound(bx));
264  dxi_v.push_back(geom.InvCellSizeArray());
265  plo_v.push_back(geom.ProbLoArray());
266 
267  build(ptile, ptile, std::forward<CheckPair>(check_pair), off_bins_v, dxi_v, plo_v,
268  lo_v, hi_v, num_cells, 1, nullptr );
269  }
270 
271  template <class PTile, class CheckPair>
272  void build (PTile& ptile,
273  CheckPair&& check_pair,
274  const Gpu::DeviceVector<int>& off_bins_v,
277  const Gpu::DeviceVector<Dim3>& lo_v,
278  const Gpu::DeviceVector<Dim3>& hi_v,
279  int num_cells=1,
280  int num_bin_types=1,
281  int* bin_type_array=nullptr)
282  {
283  build(ptile, ptile, std::forward<CheckPair>(check_pair), off_bins_v, dxi_v, plo_v,
284  lo_v, hi_v, num_cells, num_bin_types, bin_type_array );
285  }
286 
287  template <class SrcTile, class TargetTile, class CheckPair>
288  void build (SrcTile& src_tile,
289  TargetTile& target_tile,
290  CheckPair const& check_pair,
291  const Gpu::DeviceVector<int>& off_bins_v,
294  const Gpu::DeviceVector<Dim3>& lo_v,
295  const Gpu::DeviceVector<Dim3>& hi_v,
296  int num_cells=1,
297  int num_bin_types=1,
298  int* bin_type_array=nullptr)
299  {
300  BL_PROFILE("NeighborList::build()");
301 
302  bool is_same = isSame(&src_tile, &target_tile);
303 
304 
305  // Bin particles to their respective grid(s)
306  //---------------------------------------------------------------------------------------------------------
307  auto& aos = target_tile.GetArrayOfStructs();
308  const auto dst_ptile_data = target_tile.getConstParticleTileData();
309 
310  m_pstruct = aos().dataPtr();
311  auto* const pstruct_ptr = aos().dataPtr();
312 
313  const int np_total = aos.size();
314  const int np_real = src_tile.numRealParticles();
315 
316  auto const* off_bins_p = off_bins_v.data();
317  auto const* dxi_p = dxi_v.data();
318  auto const* plo_p = plo_v.data();
319  auto const* lo_p = lo_v.data();
320  auto const* hi_p = hi_v.data();
321  BinMapper bm(off_bins_p, dxi_p, plo_p, lo_p, hi_p, bin_type_array);
322 
323  // Get tot bin count on host
324  int tot_bins;
325 #ifdef AMREX_USE_GPU
326  Gpu::dtoh_memcpy( &tot_bins, off_bins_p + num_bin_types, sizeof(int) );
327 #else
328  std::memcpy( &tot_bins, off_bins_p + num_bin_types, sizeof(int) );
329 #endif
330 
331  m_bins.build(np_total, pstruct_ptr, tot_bins, bm);
332 
333 
334  // First pass: count the number of neighbors for each particle
335  //---------------------------------------------------------------------------------------------------------
336  const int np_size = (num_bin_types > 1) ? np_total : np_real;
337  m_nbor_counts.resize( np_size+1, 0);
338  m_nbor_offsets.resize(np_size+1);
339 
340  auto* pnbor_counts = m_nbor_counts.dataPtr();
341  auto* pnbor_offset = m_nbor_offsets.dataPtr();
342 
343  auto pperm = m_bins.permutationPtr();
344  auto poffset = m_bins.offsetsPtr();
345 
346  const auto src_ptile_data = src_tile.getConstParticleTileData();
347  const auto* src_pstruct_ptr = src_tile.GetArrayOfStructs()().dataPtr();
348 
349  AMREX_FOR_1D ( np_size, i,
350  {
351  int count = 0;
352  int type_i = bin_type_array ? bin_type_array[i] : 0;
353  bool ghost_i = (i >= np_real);
354  for (int type(type_i); type<num_bin_types; ++type) {
355  int off_bins = off_bins_p[type];
356 
358  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(0)-plo_p[type][0])*dxi_p[type][0])) - lo_p[type].x,
359  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(1)-plo_p[type][1])*dxi_p[type][1])) - lo_p[type].y,
360  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(2)-plo_p[type][2])*dxi_p[type][2])) - lo_p[type].z));
361  auto iv3 = iv.dim3();
362 
363  int ix = iv3.x;
364  int iy = iv3.y;
365  int iz = iv3.z;
366 
367  int nx = hi_p[type].x-lo_p[type].x+1;
368  int ny = hi_p[type].y-lo_p[type].y+1;
369  int nz = hi_p[type].z-lo_p[type].z+1;
370 
371  for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx-1); ++ii) {
372  for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny-1); ++jj) {
373  for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz-1); ++kk) {
374  int index = (ii * ny + jj) * nz + kk + off_bins;
375  for (auto p = poffset[index]; p < poffset[index+1]; ++p) {
376  const auto& pid = pperm[p];
377  bool ghost_pid = (pid >= np_real);
378  if (is_same && (pid == i)) { continue; }
379  if (detail::call_check_pair(check_pair,
380  src_ptile_data, dst_ptile_data,
381  i, pid, type, ghost_i, ghost_pid)) {
382  count += 1;
383  }
384  } // p
385  } // kk
386  } // jj
387  } // ii
388  } // type
389 
390  pnbor_counts[i] = count;
391  });
392 
393 
394  // Second-pass: build the offsets (partial sums) and neighbor list
395  //--------------------------------------------------------------------------------------------------------
397 
398  // Now we can allocate and build our neighbor list
399  unsigned int total_nbors;
400 #ifdef AMREX_USE_GPU
401  Gpu::dtoh_memcpy(&total_nbors,m_nbor_offsets.dataPtr()+np_size,sizeof(unsigned int));
402 #else
403  std::memcpy(&total_nbors,m_nbor_offsets.dataPtr()+np_size,sizeof(unsigned int));
404 #endif
405 
406  m_nbor_list.resize(total_nbors);
407  auto* pm_nbor_list = m_nbor_list.dataPtr();
408 
409  AMREX_FOR_1D ( np_size, i,
410  {
411  int n = 0;
412  int type_i = bin_type_array ? bin_type_array[i] : 0;
413  bool ghost_i = (i >= np_real);
414  for (int type(type_i); type<num_bin_types; ++type) {
415  int off_bins = off_bins_p[type];
416 
418  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(0)-plo_p[type][0])*dxi_p[type][0])) - lo_p[type].x,
419  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(1)-plo_p[type][1])*dxi_p[type][1])) - lo_p[type].y,
420  static_cast<int>(amrex::Math::floor((src_pstruct_ptr[i].pos(2)-plo_p[type][2])*dxi_p[type][2])) - lo_p[type].z));
421  auto iv3 = iv.dim3();
422 
423  int ix = iv3.x;
424  int iy = iv3.y;
425  int iz = iv3.z;
426 
427  int nx = hi_p[type].x-lo_p[type].x+1;
428  int ny = hi_p[type].y-lo_p[type].y+1;
429  int nz = hi_p[type].z-lo_p[type].z+1;
430 
431  for (int ii = amrex::max(ix-num_cells, 0); ii <= amrex::min(ix+num_cells, nx-1); ++ii) {
432  for (int jj = amrex::max(iy-num_cells, 0); jj <= amrex::min(iy+num_cells, ny-1); ++jj) {
433  for (int kk = amrex::max(iz-num_cells, 0); kk <= amrex::min(iz+num_cells, nz-1); ++kk) {
434  int index = (ii * ny + jj) * nz + kk + off_bins;
435  for (auto p = poffset[index]; p < poffset[index+1]; ++p) {
436  const auto& pid = pperm[p];
437  bool ghost_pid = (pid >= np_real);
438  if (is_same && (pid == i)) { continue; }
439  if (detail::call_check_pair(check_pair,
440  src_ptile_data, dst_ptile_data,
441  i, pid, type, ghost_i, ghost_pid)) {
442  pm_nbor_list[pnbor_offset[i] + n] = pid;
443  ++n;
444  }
445  }// p
446  }// kk
447  }// jj
448  }// ii
449  } // type
450  });
452  }
453 
455  {
457  }
458 
459  [[nodiscard]] int numParticles () const { return m_nbor_offsets.size() - 1; }
460 
462  [[nodiscard]] const Gpu::DeviceVector<unsigned int>& GetOffsets () const { return m_nbor_offsets; }
463 
465  [[nodiscard]] const Gpu::DeviceVector<unsigned int>& GetCounts () const { return m_nbor_counts; }
466 
468  [[nodiscard]] const Gpu::DeviceVector<unsigned int>& GetList () const { return m_nbor_list; }
469 
470  void print ()
471  {
472  BL_PROFILE("NeighborList::print");
473 
474  Gpu::HostVector<unsigned int> host_nbor_offsets(m_nbor_offsets.size());
475  Gpu::HostVector<unsigned int> host_nbor_list(m_nbor_list.size());
476 
477  Gpu::copyAsync(Gpu::deviceToHost, m_nbor_offsets.begin(), m_nbor_offsets.end(), host_nbor_offsets.begin());
478  Gpu::copyAsync(Gpu::deviceToHost, m_nbor_list.begin(), m_nbor_list.end(), host_nbor_list.begin());
480 
481  for (int i = 0; i < numParticles(); ++i) {
482  amrex::Print() << "Particle " << i << " could collide with: ";
483  for (unsigned int j = host_nbor_offsets[i]; j < host_nbor_offsets[i+1]; ++j) {
484  amrex::Print() << host_nbor_list[j] << " ";
485  }
486  amrex::Print() << "\n";
487  }
488  }
489 
490 protected:
491 
492  ParticleType* m_pstruct;
493 
494  // This is the neighbor list data structure
498 
500 };
501 
502 }
503 
504 #endif
#define BL_PROFILE(a)
Definition: AMReX_BLProfiler.H:551
#define AMREX_FOR_1D(...)
Definition: AMReX_GpuLaunch.nolint.H:41
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
AMREX_GPU_HOST_DEVICE Long numPts() const noexcept
Returns the number of points contained in the BoxND.
Definition: AMReX_Box.H:346
GpuArray< Real, AMREX_SPACEDIM > InvCellSizeArray() const noexcept
Definition: AMReX_CoordSys.H:87
index_type * offsetsPtr() noexcept
returns the pointer to the offsets array
Definition: AMReX_DenseBins.H:510
void build(N nitems, const_pointer_input_type v, const Box &bx, F &&f)
Populate the bins with a set of items.
Definition: AMReX_DenseBins.H:130
index_type * permutationPtr() noexcept
returns the pointer to the permutation array
Definition: AMReX_DenseBins.H:507
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
GpuArray< Real, AMREX_SPACEDIM > ProbLoArray() const noexcept
Definition: AMReX_Geometry.H:186
static void streamSynchronize() noexcept
Definition: AMReX_GpuDevice.cpp:641
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 dim3() const noexcept
Definition: AMReX_IntVect.H:163
Definition: AMReX_NeighborList.H:247
Gpu::DeviceVector< unsigned int > & GetList()
Definition: AMReX_NeighborList.H:467
Gpu::DeviceVector< unsigned int > m_nbor_counts
Definition: AMReX_NeighborList.H:497
void build(SrcTile &src_tile, TargetTile &target_tile, CheckPair const &check_pair, const Gpu::DeviceVector< int > &off_bins_v, const Gpu::DeviceVector< GpuArray< Real, AMREX_SPACEDIM >> &dxi_v, const Gpu::DeviceVector< GpuArray< Real, AMREX_SPACEDIM >> &plo_v, const Gpu::DeviceVector< Dim3 > &lo_v, const Gpu::DeviceVector< Dim3 > &hi_v, int num_cells=1, int num_bin_types=1, int *bin_type_array=nullptr)
Definition: AMReX_NeighborList.H:288
Gpu::DeviceVector< unsigned int > & GetCounts()
Definition: AMReX_NeighborList.H:464
const Gpu::DeviceVector< unsigned int > & GetList() const
Definition: AMReX_NeighborList.H:468
const Gpu::DeviceVector< unsigned int > & GetOffsets() const
Definition: AMReX_NeighborList.H:462
void print()
Definition: AMReX_NeighborList.H:470
Gpu::DeviceVector< unsigned int > & GetOffsets()
Definition: AMReX_NeighborList.H:461
const Gpu::DeviceVector< unsigned int > & GetCounts() const
Definition: AMReX_NeighborList.H:465
void build(PTile &ptile, CheckPair &&check_pair, const Gpu::DeviceVector< int > &off_bins_v, const Gpu::DeviceVector< GpuArray< Real, AMREX_SPACEDIM >> &dxi_v, const Gpu::DeviceVector< GpuArray< Real, AMREX_SPACEDIM >> &plo_v, const Gpu::DeviceVector< Dim3 > &lo_v, const Gpu::DeviceVector< Dim3 > &hi_v, int num_cells=1, int num_bin_types=1, int *bin_type_array=nullptr)
Definition: AMReX_NeighborList.H:272
Gpu::DeviceVector< unsigned int > m_nbor_list
Definition: AMReX_NeighborList.H:496
ParticleType * m_pstruct
Definition: AMReX_NeighborList.H:492
Gpu::DeviceVector< unsigned int > m_nbor_offsets
Definition: AMReX_NeighborList.H:495
NeighborData< ParticleType > data()
Definition: AMReX_NeighborList.H:454
void build(PTile &ptile, const amrex::Box &bx, const amrex::Geometry &geom, CheckPair &&check_pair, int num_cells=1)
Definition: AMReX_NeighborList.H:251
int numParticles() const
Definition: AMReX_NeighborList.H:459
DenseBins< ParticleType > m_bins
Definition: AMReX_NeighborList.H:499
Definition: AMReX_PODVector.H:246
T * data() noexcept
Definition: AMReX_PODVector.H:593
iterator begin() noexcept
Definition: AMReX_PODVector.H:601
void push_back(const T &a_value)
Definition: AMReX_PODVector.H:556
This class provides the user with a few print options.
Definition: AMReX_Print.H:35
void copyAsync(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition: AMReX_GpuContainers.H:233
OutIter exclusive_scan(InIter begin, InIter end, OutIter result)
Definition: AMReX_Scan.H:1377
static constexpr DeviceToHost deviceToHost
Definition: AMReX_GpuContainers.H:99
void streamSynchronize() noexcept
Definition: AMReX_GpuDevice.H:237
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void * memcpy(void *dest, const void *src, std::size_t count)
Definition: AMReX_GpuUtility.H:214
void dtoh_memcpy(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:301
AMREX_GPU_HOST_DEVICE auto call_check_pair(F const &check_pair, const SrcData &src_tile, const DstData &dst_tile, N1 i, N2 j) noexcept -> decltype(check_pair(src_tile.m_aos[i], dst_tile.m_aos[j]))
Definition: AMReX_NeighborList.H:19
constexpr int iz
Definition: AMReX_Interp_3D_C.H:37
constexpr int iy
Definition: AMReX_Interp_2D_C.H:33
constexpr int ix
Definition: AMReX_Interp_2D_C.H:32
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:35
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
bool isSame(A const *pa, B const *pb)
Definition: AMReX_NeighborList.H:232
Definition: AMReX_FabArrayCommI.H:896
Definition: AMReX_ParticleUtil.H:296
Definition: AMReX_NeighborList.H:211
ParticleType * m_pstruct
Definition: AMReX_NeighborList.H:226
AMREX_GPU_HOST_DEVICE amrex::Neighbors< ParticleType > getNeighbors(int i) const
Definition: AMReX_NeighborList.H:221
NeighborData(const Gpu::DeviceVector< unsigned int > &offsets, const Gpu::DeviceVector< unsigned int > &list, ParticleType *pstruct)
Definition: AMReX_NeighborList.H:212
const unsigned int * m_nbor_list_ptr
Definition: AMReX_NeighborList.H:225
const unsigned int * m_nbor_offsets_ptr
Definition: AMReX_NeighborList.H:224
Definition: AMReX_NeighborList.H:131
const unsigned int * m_nbor_list_ptr
Definition: AMReX_NeighborList.H:152
AMREX_GPU_HOST_DEVICE const_iterator(int start, int stop, const unsigned int *nbor_list_ptr, const ParticleType *pstruct)
Definition: AMReX_NeighborList.H:133
AMREX_GPU_HOST_DEVICE bool operator!=(const_iterator const &) const
Definition: AMReX_NeighborList.H:141
int m_stop
Definition: AMReX_NeighborList.H:151
AMREX_GPU_HOST_DEVICE unsigned int index() const
Definition: AMReX_NeighborList.H:147
int m_index
Definition: AMReX_NeighborList.H:150
const ParticleType * m_pstruct
Definition: AMReX_NeighborList.H:153
AMREX_GPU_HOST_DEVICE const ParticleType & operator*() const
Definition: AMReX_NeighborList.H:144
AMREX_GPU_HOST_DEVICE void operator++()
Definition: AMReX_NeighborList.H:138
Definition: AMReX_NeighborList.H:105
const unsigned int * m_nbor_list_ptr
Definition: AMReX_NeighborList.H:126
AMREX_GPU_HOST_DEVICE iterator(int start, int stop, const unsigned int *nbor_list_ptr, ParticleType *pstruct)
Definition: AMReX_NeighborList.H:107
ParticleType * m_pstruct
Definition: AMReX_NeighborList.H:127
AMREX_GPU_HOST_DEVICE ParticleType & operator*() const
Definition: AMReX_NeighborList.H:118
int m_stop
Definition: AMReX_NeighborList.H:125
AMREX_GPU_HOST_DEVICE void operator++()
Definition: AMReX_NeighborList.H:112
AMREX_GPU_HOST_DEVICE unsigned int index() const
Definition: AMReX_NeighborList.H:121
int m_index
Definition: AMReX_NeighborList.H:124
AMREX_GPU_HOST_DEVICE bool operator!=(iterator const &) const
Definition: AMReX_NeighborList.H:115
Definition: AMReX_NeighborList.H:103
AMREX_GPU_HOST_DEVICE iterator end() noexcept
Definition: AMReX_NeighborList.H:163
AMREX_GPU_HOST_DEVICE const_iterator begin() const noexcept
Definition: AMReX_NeighborList.H:169
ParticleType * m_pstruct
Definition: AMReX_NeighborList.H:206
int m_i
Definition: AMReX_NeighborList.H:203
AMREX_GPU_HOST_DEVICE Neighbors(int i, const unsigned int *nbor_offsets_ptr, const unsigned int *nbor_list_ptr, ParticleType *pstruct)
Definition: AMReX_NeighborList.H:193
AMREX_GPU_HOST_DEVICE const_iterator cbegin() const noexcept
Definition: AMReX_NeighborList.H:181
AMREX_GPU_HOST_DEVICE const_iterator end() const noexcept
Definition: AMReX_NeighborList.H:175
const unsigned int * m_nbor_offsets_ptr
Definition: AMReX_NeighborList.H:204
AMREX_GPU_HOST_DEVICE const_iterator cend() const noexcept
Definition: AMReX_NeighborList.H:187
const unsigned int * m_nbor_list_ptr
Definition: AMReX_NeighborList.H:205
AMREX_GPU_HOST_DEVICE iterator begin() noexcept
Definition: AMReX_NeighborList.H:157