| 58 | } |
| 59 | |
| 60 | void testNeighborParticles () |
| 61 | { |
| 62 | BL_PROFILE("testNeighborParticles"); |
| 63 | TestParams params; |
| 64 | get_test_params(params, "nbor_parts"); |
| 65 | |
| 66 | RealBox real_box; |
| 67 | for (int n = 0; n < BL_SPACEDIM; n++) |
| 68 | { |
| 69 | real_box.setLo(n, 0.0); |
| 70 | real_box.setHi(n, params.size[n]); |
| 71 | } |
| 72 | |
| 73 | IntVect domain_lo(AMREX_D_DECL(0, 0, 0)); |
| 74 | IntVect domain_hi(AMREX_D_DECL(params.size[0]-1,params.size[1]-1,params.size[2]-1)); |
| 75 | const Box domain(domain_lo, domain_hi); |
| 76 | |
| 77 | int coord = 0; |
| 78 | int is_per[] = {AMREX_D_DECL(params.is_periodic, |
| 79 | params.is_periodic, |
| 80 | params.is_periodic)}; |
| 81 | Geometry geom(domain, &real_box, coord, is_per); |
| 82 | |
| 83 | BoxArray ba(domain); |
| 84 | ba.maxSize(params.max_grid_size); |
| 85 | DistributionMapping dm(ba); |
| 86 | |
| 87 | const int ncells = 1; |
| 88 | MDParticleContainer pc(geom, dm, ba, ncells); |
| 89 | |
| 90 | IntVect nppc(fixed_num_ppc); |
| 91 | |
| 92 | if (ParallelDescriptor::MyProc() == dm[0]) { |
| 93 | amrex::PrintToFile("neighbor_test") << "About to initialize particles \n"; |
| 94 | } |
| 95 | |
| 96 | pc.InitParticles(nppc, 1.0, 0.0); |
| 97 | |
| 98 | if (ParallelDescriptor::MyProc() == dm[0]) { |
| 99 | amrex::PrintToFile("neighbor_test") << "Check neighbors after init ... \n"; |
| 100 | } |
| 101 | pc.checkNeighborParticles(); |
| 102 | |
| 103 | pc.fillNeighbors(); |
| 104 | |
| 105 | if (ParallelDescriptor::MyProc() == dm[0]) { |
| 106 | amrex::PrintToFile("neighbor_test") << "Check neighbors after fill ... \n"; |
| 107 | } |
| 108 | pc.checkNeighborParticles(); |
| 109 | |
| 110 | pc.updateNeighbors(); |
| 111 | |
| 112 | if (ParallelDescriptor::MyProc() == dm[0]) { |
| 113 | amrex::PrintToFile("neighbor_test") << "Check neighbors after update ... \n"; |
| 114 | } |
| 115 | pc.checkNeighborParticles(); |
| 116 | |
| 117 | if (ParallelDescriptor::MyProc() == dm[0]) { |
no test coverage detected