MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / testNeighborList

Function testNeighborList

Tests/Particles/NeighborParticles/main.cpp:177–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void 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);

Callers 1

mainFunction · 0.70

Calls 11

PrintToFileClass · 0.85
WriteSingleLevelPlotfileFunction · 0.85
get_test_paramsFunction · 0.70
CheckPairClass · 0.70
setLoMethod · 0.45
setHiMethod · 0.45
InitParticlesMethod · 0.45
checkNeighborListMethod · 0.45
setValMethod · 0.45
WritePlotFileMethod · 0.45

Tested by

no test coverage detected