@@ -2278,239 +2278,3 @@ Gravity::set_boundary(BndryData& bd, MultiFab& rhs, const Real* dx)
2278
2278
}
2279
2279
2280
2280
2281
-
2282
- // Routine to duplicate Gravity class data onto sidecars
2283
- void
2284
- Gravity::AddProcsToComp (Amr *aptr, int level, AmrLevel *level_data_to_install,
2285
- int ioProcNumSCS, int ioProcNumAll, int scsMyId, MPI_Comm scsComm)
2286
- {
2287
- parent = aptr;
2288
-
2289
-
2290
- // ---- pack up the ints
2291
- Vector<int > allInts;
2292
-
2293
- if (scsMyId == ioProcNumSCS) {
2294
- allInts.push_back (density);
2295
- allInts.push_back (finest_level);
2296
- allInts.push_back (finest_level_allocated);
2297
- allInts.push_back (verbose);
2298
- allInts.push_back (no_sync);
2299
- allInts.push_back (no_composite);
2300
- allInts.push_back (dirichlet_bcs);
2301
- allInts.push_back (monopole_bcs);
2302
- allInts.push_back (solve_with_cpp);
2303
- allInts.push_back (solve_with_hpgmg);
2304
- allInts.push_back (stencil_type);
2305
- for (int i (0 ); i < 2 *BL_SPACEDIM; ++i) { allInts.push_back (mg_bc[i]); }
2306
- }
2307
-
2308
- amrex::BroadcastArray (allInts, scsMyId, ioProcNumSCS, scsComm);
2309
-
2310
- // ---- unpack the ints
2311
- if (scsMyId != ioProcNumSCS) {
2312
- int count (0 );
2313
-
2314
- density = allInts[count++];
2315
- finest_level = allInts[count++];
2316
- finest_level_allocated = allInts[count++];
2317
- verbose = allInts[count++];
2318
- no_sync = allInts[count++];
2319
- no_composite = allInts[count++];
2320
- dirichlet_bcs = allInts[count++];
2321
- monopole_bcs = allInts[count++];
2322
- solve_with_cpp = allInts[count++];
2323
- solve_with_hpgmg = allInts[count++];
2324
- stencil_type = allInts[count++];
2325
- for (int i (0 ); i < 2 *BL_SPACEDIM; ++i) { mg_bc[i] = allInts[count++]; }
2326
-
2327
- BL_ASSERT (count == allInts.size ());
2328
- }
2329
-
2330
-
2331
- // ---- pack up the Reals
2332
- Vector<Real> allReals;
2333
- if (scsMyId == ioProcNumSCS) {
2334
- allReals.push_back (mass_offset);
2335
- allReals.push_back (sl_tol);
2336
- allReals.push_back (ml_tol);
2337
- allReals.push_back (delta_tol);
2338
- allReals.push_back (Ggravity);
2339
- }
2340
-
2341
- amrex::BroadcastArray (allReals, scsMyId, ioProcNumSCS, scsComm);
2342
- amrex::BroadcastArray (level_solver_resnorm, scsMyId, ioProcNumSCS, scsComm);
2343
-
2344
- // ---- unpack the Reals
2345
- if (scsMyId != ioProcNumSCS) {
2346
- int count (0 );
2347
- mass_offset = allReals[count++];
2348
- sl_tol = allReals[count++];
2349
- ml_tol = allReals[count++];
2350
- delta_tol = allReals[count++];
2351
- Ggravity = allReals[count++];
2352
-
2353
- BL_ASSERT (count == allReals.size ());
2354
- }
2355
-
2356
-
2357
- // ---- pack up the strings
2358
- Vector<std::string> allStrings;
2359
- Vector<char > serialStrings;
2360
- if (scsMyId == ioProcNumSCS) {
2361
- allStrings.push_back (gravity_type);
2362
- serialStrings = amrex::SerializeStringArray (allStrings);
2363
- }
2364
-
2365
- amrex::BroadcastArray (serialStrings, scsMyId, ioProcNumSCS, scsComm);
2366
-
2367
- // ---- unpack the strings
2368
- if (scsMyId != ioProcNumSCS) {
2369
- int count (0 );
2370
- allStrings = amrex::UnSerializeStringArray (serialStrings);
2371
- gravity_type = allStrings[count++];
2372
- }
2373
-
2374
-
2375
- // ---- BCRec
2376
- Vector<int > bcrLo (BL_SPACEDIM), bcrHi (BL_SPACEDIM);
2377
- if (scsMyId == ioProcNumSCS) {
2378
- for (int i (0 ); i < bcrLo.size (); ++i) { bcrLo[i] = phys_bc->lo (i); }
2379
- for (int i (0 ); i < bcrHi.size (); ++i) { bcrHi[i] = phys_bc->hi (i); }
2380
- }
2381
- ParallelDescriptor::Bcast (bcrLo.dataPtr (), bcrLo.size (), ioProcNumSCS, scsComm);
2382
- ParallelDescriptor::Bcast (bcrHi.dataPtr (), bcrHi.size (), ioProcNumSCS, scsComm);
2383
- if (scsMyId != ioProcNumSCS) {
2384
- for (int i (0 ); i < bcrLo.size (); ++i) { phys_bc->setLo (i, bcrLo[i]); }
2385
- for (int i (0 ); i < bcrHi.size (); ++i) { phys_bc->setHi (i, bcrHi[i]); }
2386
- }
2387
-
2388
-
2389
- // ---- MultiFabs
2390
-
2391
- // ---- ---- grad_phi_curr :: Vector< Vector<std::unique_ptr<MultiFab> > > grad_phi_curr;
2392
- if (scsMyId != ioProcNumSCS) {
2393
- for (int j (0 ); j < grad_phi_curr.size (); ++j) {
2394
- grad_phi_curr[j].clear ();
2395
- }
2396
- }
2397
- int gpcSize (grad_phi_curr.size ());
2398
- ParallelDescriptor::Bcast (&gpcSize, 1 , ioProcNumSCS, scsComm);
2399
- if (scsMyId != ioProcNumSCS) {
2400
- grad_phi_curr.resize (gpcSize);
2401
- }
2402
-
2403
- for (int j (0 ); j < grad_phi_curr.size (); ++j) {
2404
- Vector<int > isDefined;
2405
-
2406
- if (scsMyId == ioProcNumSCS) {
2407
- isDefined.resize (grad_phi_curr[j].size ());
2408
- for (int i (0 ); i < grad_phi_curr[j].size (); ++i) {
2409
- isDefined[i] = (grad_phi_curr[j][i] != nullptr );
2410
- }
2411
- }
2412
- amrex::BroadcastArray (isDefined, scsMyId, ioProcNumAll, scsComm);
2413
- if (isDefined.size () > 0 ) {
2414
- BL_ASSERT (isDefined.size () == BL_SPACEDIM);
2415
- if (scsMyId != ioProcNumSCS) {
2416
- grad_phi_curr[j].resize (isDefined.size ());
2417
- for (int i (0 ); i < grad_phi_curr[j].size (); ++i) {
2418
- if (isDefined[i]) {
2419
- grad_phi_curr[j][i].reset (new MultiFab);
2420
- }
2421
- }
2422
- }
2423
-
2424
- for (int i (0 ); i < grad_phi_curr[j].size (); ++i) {
2425
- if (grad_phi_curr[j][i]) {
2426
- grad_phi_curr[j][i]->AddProcsToComp (ioProcNumSCS, ioProcNumAll, scsMyId, scsComm);
2427
- }
2428
- }
2429
- }
2430
- }
2431
-
2432
-
2433
- // ---- ---- grad_phi_prev :: Vector< Vector<std::unique_ptr<MultiFab> > > grad_phi_prev;
2434
- if (scsMyId != ioProcNumSCS) {
2435
- for (int j (0 ); j < grad_phi_prev.size (); ++j) {
2436
- grad_phi_prev[j].clear ();
2437
- }
2438
- }
2439
- int gppSize (grad_phi_prev.size ());
2440
- ParallelDescriptor::Bcast (&gppSize, 1 , ioProcNumSCS, scsComm);
2441
- if (scsMyId != ioProcNumSCS) {
2442
- grad_phi_prev.resize (gppSize);
2443
- }
2444
-
2445
- for (int j (0 ); j < grad_phi_prev.size (); ++j) {
2446
- Vector<int > isDefined;
2447
-
2448
- if (scsMyId == ioProcNumSCS) {
2449
- isDefined.resize (grad_phi_prev[j].size ());
2450
- for (int i (0 ); i < grad_phi_prev[j].size (); ++i) {
2451
- isDefined[i] = (grad_phi_prev[j][i] != nullptr );
2452
- }
2453
- }
2454
- amrex::BroadcastArray (isDefined, scsMyId, ioProcNumAll, scsComm);
2455
- if (isDefined.size () > 0 ) {
2456
- BL_ASSERT (isDefined.size () == BL_SPACEDIM);
2457
- if (scsMyId != ioProcNumSCS) {
2458
- grad_phi_prev[j].resize (isDefined.size ());
2459
- for (int i (0 ); i < grad_phi_prev[j].size (); ++i) {
2460
- if (isDefined[i]) {
2461
- grad_phi_prev[j][i].reset (new MultiFab);
2462
- }
2463
- }
2464
- }
2465
- for (int i (0 ); i < grad_phi_prev[j].size (); ++i) {
2466
- if (grad_phi_prev[j][i]) {
2467
- grad_phi_prev[j][i]->AddProcsToComp (ioProcNumSCS, ioProcNumAll, scsMyId, scsComm);
2468
- }
2469
- }
2470
- }
2471
- }
2472
-
2473
-
2474
- // ---- FluxRegisters :: Vector<std::unique_ptr<FluxRegister> > phi_flux_reg;
2475
- if (scsMyId != ioProcNumSCS) {
2476
- phi_flux_reg.clear ();
2477
- }
2478
- int pfrSize (phi_flux_reg.size ());
2479
- ParallelDescriptor::Bcast (&pfrSize, 1 , ioProcNumSCS, scsComm);
2480
- if (scsMyId != ioProcNumSCS) {
2481
- phi_flux_reg.resize (pfrSize);
2482
- }
2483
-
2484
- Vector<int > isDefined;
2485
-
2486
- if (scsMyId == ioProcNumSCS) {
2487
- isDefined.resize (phi_flux_reg.size ());
2488
- for (int i (0 ); i < phi_flux_reg.size (); ++i) {
2489
- isDefined[i] = (phi_flux_reg[i] != nullptr );
2490
- }
2491
- }
2492
- amrex::BroadcastArray (isDefined, scsMyId, ioProcNumAll, scsComm);
2493
- if (isDefined.size () > 0 ) {
2494
- if (scsMyId != ioProcNumSCS) {
2495
- phi_flux_reg.resize (isDefined.size ());
2496
- for (int i (0 ); i < phi_flux_reg.size (); ++i) {
2497
- if (isDefined[i]) {
2498
- phi_flux_reg[i].reset (new FluxRegister);
2499
- }
2500
- }
2501
- }
2502
-
2503
- for (int i (0 ); i < phi_flux_reg.size (); ++i) {
2504
- if (phi_flux_reg[i]) {
2505
- phi_flux_reg[i]->AddProcsToComp (ioProcNumSCS, ioProcNumAll, scsMyId, scsComm);
2506
- }
2507
- }
2508
- }
2509
-
2510
-
2511
-
2512
- // ---- LevelData
2513
- LevelData[level] = level_data_to_install;
2514
- }
2515
-
2516
-
0 commit comments