| 175 | } |
| 176 | |
| 177 | void testNeighborList () |
| 178 | { |
| 179 | BL_PROFILE("main::main()"); |
| 180 | TestParams params; |
| 181 | get_test_params(params, "nbor_list"); |
| 182 | |
| 183 | RealBox real_box; |
| 184 | for (int n = 0; n < BL_SPACEDIM; n++) |
| 185 | { |
| 186 | real_box.setLo(n, 0.0); |
| 187 | real_box.setHi(n, params.size[n]); |
| 188 | } |
| 189 | |
| 190 | IntVect domain_lo(AMREX_D_DECL(0, 0, 0)); |
| 191 | IntVect domain_hi(AMREX_D_DECL(params.size[0]-1,params.size[1]-1,params.size[2]-1)); |
| 192 | const Box domain(domain_lo, domain_hi); |
| 193 | |
| 194 | int coord = 0; |
| 195 | int is_per[] = {AMREX_D_DECL(params.is_periodic, |
| 196 | params.is_periodic, |
| 197 | params.is_periodic)}; |
| 198 | Geometry geom(domain, &real_box, coord, is_per); |
| 199 | |
| 200 | BoxArray ba(domain); |
| 201 | ba.maxSize(params.max_grid_size); |
| 202 | DistributionMapping dm(ba); |
| 203 | |
| 204 | const int ncells = 1; |
| 205 | MDParticleContainer pc(geom, dm, ba, ncells); |
| 206 | |
| 207 | IntVect nppc(fixed_num_ppc); |
| 208 | |
| 209 | amrex::PrintToFile("neighbor_test") << "About to initialize particles" << '\n'; |
| 210 | |
| 211 | pc.InitParticles(nppc, 1.0, 0.0); |
| 212 | pc.fillNeighbors(); |
| 213 | |
| 214 | pc.buildNeighborList(CheckPair()); |
| 215 | |
| 216 | if (params.check_answer) { |
| 217 | pc.checkNeighborList(); |
| 218 | } |
| 219 | |
| 220 | #ifdef AMREX_USE_GPU |
| 221 | pc.clearNeighbors(); |
| 222 | pc.fillNeighbors(); |
| 223 | pc.selectActualNeighbors(CheckPair()); |
| 224 | pc.updateNeighbors(true); |
| 225 | pc.checkNeighborParticles(); |
| 226 | pc.buildNeighborList(CheckPair()); |
| 227 | if (params.check_answer) { |
| 228 | pc.checkNeighborList(); |
| 229 | } |
| 230 | #endif |
| 231 | |
| 232 | if (params.do_plotfile) { |
| 233 | MultiFab dummy_mf(ba, dm, 1, 0); |
| 234 | dummy_mf.setVal(0.0); |
no test coverage detected