@@ -730,6 +730,8 @@ ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
730730 AMREX_ASSERT (finest_level_in_file >= 0 );
731731
732732 // Determine whether this is a dual-grid restart or not.
733+ Vector<DistributionMapping> old_dms (finest_level_in_file + 1 );
734+ Vector<BoxArray> old_bas (finest_level_in_file + 1 );
733735 Vector<BoxArray> particle_box_arrays (finest_level_in_file + 1 );
734736 bool dual_grid = false ;
735737
@@ -750,6 +752,8 @@ ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
750752 {
751753 for (int lev = 0 ; lev <= finest_level_in_file; lev++)
752754 {
755+ old_dms[lev] = ParticleDistributionMap (lev);
756+ old_bas[lev] = ParticleBoxArray (lev);
753757 std::string phdr_name = fullname;
754758 phdr_name = amrex::Concatenate (phdr_name + " /Level_" , lev, 1 );
755759 phdr_name += " /Particle_H" ;
@@ -777,6 +781,10 @@ ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
777781
778782 if (dual_grid) {
779783 for (int lev = 0 ; lev <= finestLevel (); lev++) {
784+ // this can happen if there are no particles at a given level in the checkpoint
785+ if (particle_box_arrays[lev].size () == 0 ) {
786+ particle_box_arrays[lev] = BoxArray (Geom (lev).Domain ());
787+ }
780788 SetParticleBoxArray (lev, particle_box_arrays[lev]);
781789 DistributionMapping pdm (particle_box_arrays[lev]);
782790 SetParticleDistributionMap (lev, pdm);
@@ -883,6 +891,13 @@ ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
883891 }
884892 }
885893
894+ if (dual_grid) {
895+ for (int lev = 0 ; lev <= finest_level_in_file; lev++) {
896+ SetParticleBoxArray (lev, old_bas[lev]);
897+ SetParticleDistributionMap (lev, old_dms[lev]);
898+ }
899+ }
900+
886901 Redistribute ();
887902
888903 AMREX_ASSERT (OK ());
0 commit comments