diff options
author | 2019-02-05 09:19:09 -0800 | |
---|---|---|
committer | 2019-02-05 09:19:09 -0800 | |
commit | a95c2d46ea81dba3c7062e3ee863525d4bd80a13 (patch) | |
tree | 251e5fe60491d19154aeacbea56507966423da6a /Source | |
parent | a875adf635afc918567384d9aa91e4c4edb36759 (diff) | |
download | WarpX-a95c2d46ea81dba3c7062e3ee863525d4bd80a13.tar.gz WarpX-a95c2d46ea81dba3c7062e3ee863525d4bd80a13.tar.zst WarpX-a95c2d46ea81dba3c7062e3ee863525d4bd80a13.zip |
cleaning. Error in Redistribute: invalid particle
Diffstat (limited to 'Source')
-rw-r--r-- | Source/ParticleContainer.H | 3 | ||||
-rw-r--r-- | Source/ParticleContainer.cpp | 8 | ||||
-rw-r--r-- | Source/PhysicalParticleContainer.cpp | 16 | ||||
-rw-r--r-- | Source/WarpXParticleContainer.cpp | 57 |
4 files changed, 4 insertions, 80 deletions
diff --git a/Source/ParticleContainer.H b/Source/ParticleContainer.H index 21eeca395..a721eea27 100644 --- a/Source/ParticleContainer.H +++ b/Source/ParticleContainer.H @@ -180,9 +180,6 @@ public: std::vector<std::string> GetSpeciesNames() const { return species_names; } - // std::unique_ptr<amrex::ParticleContainer<0,0,PIdx::nattribs>> pc_tmp; - // std::unique_ptr<WarpXParticleContainer> pc_tmp; - PhysicalParticleContainer& GetPCtmp () { return *pc_tmp; } protected: diff --git a/Source/ParticleContainer.cpp b/Source/ParticleContainer.cpp index 8ca6b7614..1598f5237 100644 --- a/Source/ParticleContainer.cpp +++ b/Source/ParticleContainer.cpp @@ -28,13 +28,7 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core) if (WarpX::use_laser) { allcontainers[n-1].reset(new LaserParticleContainer(amr_core,n-1)); } - // pc_tmp = WarpXParticleContainer(amr_core, 0); - // pc_tmp = std::unique_ptr<WarpXParticleContainer> (new WarpXParticleContainer(this)); - pc_tmp.reset(new PhysicalParticleContainer(amr_core)); - // pc_tmp = std::unique_ptr<WarpXParticleContainer> (new WarpXParticleContainer(amr_core, 0)); - // pc_tmp = std::unique_ptr<PhysicalParticleContainer> (new PhysicalParticleContainer(amr_core)); - // pc_tmp = std::unique_ptr<amrex::ParticleContainer<0,0,PIdx::nattribs>> (new amrex::ParticleContainer<0,0,PIdx::nattribs>); - + pc_tmp.reset(new PhysicalParticleContainer(amr_core)); } void diff --git a/Source/PhysicalParticleContainer.cpp b/Source/PhysicalParticleContainer.cpp index 3bc18e912..9011df8ed 100644 --- a/Source/PhysicalParticleContainer.cpp +++ b/Source/PhysicalParticleContainer.cpp @@ -1443,8 +1443,6 @@ PhysicalParticleContainer::SplitParticles(WarpXParIter& pti, int lev) { auto& mypc = WarpX::GetInstance().GetPartContainer(); auto& pctmp_split = mypc.GetPCtmp(); - // std::unique_ptr<PhysicalParticleContainer> pc_tmp = mypc.pc_tmp; - // WarpXParticleContainer ppc_tmp(amr_core, ispecies); Cuda::DeviceVector<Real> xp, yp, zp; pti.GetPosition(xp, yp, zp); auto& attribs = pti.GetAttribs(); @@ -1459,7 +1457,6 @@ PhysicalParticleContainer::SplitParticles(WarpXParIter& pti, int lev) RealVector psplit_x, psplit_y, psplit_z, psplit_w; RealVector psplit_ux, psplit_uy, psplit_uz; - // for (auto& p : particles){ for(int i=0; i<np; i++){ auto& p = particles[i]; if (p.id() == SplitParticleID){ @@ -1491,19 +1488,6 @@ PhysicalParticleContainer::SplitParticles(WarpXParIter& pti, int lev) #endif } } - /* - for (auto& p : particles){ - if (p.id() == SplitParticleID){ - Print()<<"toto\n"; - - } - } - - auto& uxp = attribs[PIdx::ux]; - - for(int i, i<np, ++i){ - if - }*/ } void PhysicalParticleContainer::PushPX(WarpXParIter& pti, diff --git a/Source/WarpXParticleContainer.cpp b/Source/WarpXParticleContainer.cpp index 231f72dda..333155ec3 100644 --- a/Source/WarpXParticleContainer.cpp +++ b/Source/WarpXParticleContainer.cpp @@ -132,17 +132,14 @@ WarpXParticleContainer::AddNParticles (int lev, int nattr, const Real* attr, int uniqueparticles) { - Print()<<"here -1\n"; BL_ASSERT(nattr == 1); const Real* weight = attr; int ibegin, iend; if (uniqueparticles) { - Print()<<"here -2\n"; ibegin = 0; iend = n; } else { - Print()<<"here -3\n"; int myproc = ParallelDescriptor::MyProc(); int nprocs = ParallelDescriptor::NProcs(); int navg = n/nprocs; @@ -158,27 +155,19 @@ WarpXParticleContainer::AddNParticles (int lev, // Add to grid 0 and tile 0 // Redistribute() will move them to proper places. - Print()<<"here -4\n"; - std::pair<int,int> key {0,0}; - Print()<<"here -10\n"; - auto& particle_tile = GetParticles(lev)[key]; - Print()<<"here -11\n"; - + std::pair<int,int> key {0,0}; + auto& particle_tile = GetParticles(lev)[key]; + for (int i = ibegin; i < iend; ++i) { - Print()<<"here -5\n"; ParticleType p; - Print()<<"here -51\n"; p.id() = ParticleType::NextID(); - Print()<<"here -52\n"; p.cpu() = ParallelDescriptor::MyProc(); - Print()<<"here -53\n"; #if (AMREX_SPACEDIM == 3) p.pos(0) = x[i]; p.pos(1) = y[i]; p.pos(2) = z[i]; #elif (AMREX_SPACEDIM == 2) - Print()<<"here -6\n"; p.pos(0) = x[i]; p.pos(1) = z[i]; #endif @@ -189,24 +178,18 @@ WarpXParticleContainer::AddNParticles (int lev, if (np > 0) { - Print()<<"here 1\n"; particle_tile.push_back_real(PIdx::w , weight + ibegin, weight + iend); - Print()<<"here 2\n"; particle_tile.push_back_real(PIdx::ux, vx + ibegin, vx + iend); particle_tile.push_back_real(PIdx::uy, vy + ibegin, vy + iend); particle_tile.push_back_real(PIdx::uz, vz + ibegin, vz + iend); - Print()<<"here 3\n"; for (int comp = PIdx::uz+1; comp < PIdx::nattribs; ++comp) { - Print()<<"here 4\n"; particle_tile.push_back_real(comp, np, 0.0); } } - Print()<<"here 5\n"; Redistribute(); - Print()<<"here 6\n"; } @@ -902,43 +885,9 @@ WarpXParticleContainer::particlePostLocate(ParticleType& p, const ParticleLocData& pld, const int lev) { - // Print()<<"in WarpXParticleContainer::particlePostLocate"<<'\n'; - //Print()<<p.id()<<'\n'; if (pld.m_lev == lev+1){ Print()<<"particle goes to higher level"<<'\n'; - //p.id() = -777; p.m_idata.id = SplitParticleID; - //p.id() = -777; - /* - std::array<Real,PIdx::nattribs> attribs; - attribs = p.attribs(); - attribs.fill(0.0); - attribs[PIdx::w ] = dens * scale_fac / (AMREX_D_TERM(fac, *fac, *fac)); - attribs[PIdx::ux] = u[0]; - attribs[PIdx::uy] = u[1]; - attribs[PIdx::uz] = u[2]; -#ifdef WARPX_STORE_OLD_PARTICLE_ATTRIBS -attribs[PIdx::xold] = x; -attribs[PIdx::yold] = y; -attribs[PIdx::zold] = z; -attribs[PIdx::uxold] = u[0]; -attribs[PIdx::uyold] = u[1]; -attribs[PIdx::uzold] = u[2]; -#endif -AddOneParticle(lev, grid_id, tile_id, x, y, z, attribs); - */ - - /* - const int grid_id = mfi.index(); - const int tile_id = mfi.LocalTileIndex(); - locateParticle(p, pld, lev_min, lev_max, nGrow, local ? grid : -1); - */ - /* - AddOneParticle(pld.m_lev, 0, 0, x, 0, z, attribs); - WarpXParticleContainer::AddOneParticle (int lev, int grid, int tile, - Real x, Real y, Real z, - const std::array<Real,PIdx::nattribs>& attribs) - */ } if (pld.m_lev == lev-1){ Print()<<"particle goes to lower level"<<'\n'; |