diff --git a/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf b/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf index 2c5c8d7a9b..8d4ff943b1 100644 Binary files a/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf and b/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf differ diff --git a/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html index 00a6c8c416..b301101aee 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html @@ -2832,12 +2832,12 @@
amrex::ParticleLocData::m_tilebox
Box m_tilebox
Definition: AMReX_ParticleContainer.H:96
amrex::ParticleLocData::m_gridbox
Box m_gridbox
Definition: AMReX_ParticleContainer.H:95
amrex::ParticleTile
Definition: AMReX_ParticleTile.H:690
-
amrex::ParticleTile::GetArrayOfStructs
AoS & GetArrayOfStructs()
Definition: AMReX_ParticleTile.H:793
-
amrex::ParticleTile::getParticleTileData
ParticleTileDataType getParticleTileData()
Definition: AMReX_ParticleTile.H:1110
-
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:818
-
amrex::ParticleTile::resize
void resize(std::size_t count)
Definition: AMReX_ParticleTile.H:884
-
amrex::ParticleTile::define
void define(int a_num_runtime_real, int a_num_runtime_int)
Definition: AMReX_ParticleTile.H:723
-
amrex::ParticleTile::empty
bool empty() const
Definition: AMReX_ParticleTile.H:799
+
amrex::ParticleTile::GetArrayOfStructs
AoS & GetArrayOfStructs()
Definition: AMReX_ParticleTile.H:803
+
amrex::ParticleTile::getParticleTileData
ParticleTileDataType getParticleTileData()
Definition: AMReX_ParticleTile.H:1120
+
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:828
+
amrex::ParticleTile::resize
void resize(std::size_t count)
Definition: AMReX_ParticleTile.H:894
+
amrex::ParticleTile::define
void define(int a_num_runtime_real, int a_num_runtime_int)
Definition: AMReX_ParticleTile.H:733
+
amrex::ParticleTile::empty
bool empty() const
Definition: AMReX_ParticleTile.H:809
amrex::Particle
The struct used to store particles.
Definition: AMReX_Particle.H:295
amrex::Particle::id
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper id() &
Definition: AMReX_Particle.H:315
amrex::Particle::pos
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_Particle.H:338
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html index 1e3eab6a2d..8596c873d3 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html @@ -881,7 +881,7 @@
amrex::ParticleContainer_impl::ParticleLevel
std::map< std::pair< int, int >, ParticleTileType > ParticleLevel
Definition: AMReX_ParticleContainer.H:185
amrex::ParticleContainer_impl::levelDirectoriesCreated
bool levelDirectoriesCreated
Variables for i/o optimization saved for pre and post checkpoint.
Definition: AMReX_ParticleContainer.H:1349
amrex::ParticleContainer_impl::make_alike
ContainerLike< NewAllocator > make_alike() const
Definition: AMReX_ParticleContainer.H:1332
-
amrex::ParticleContainer_impl::WriteAsciiFile
void WriteAsciiFile(const std::string &file)
Definition: AMReX_ParticleIO.H:1134
+
amrex::ParticleContainer_impl::WriteAsciiFile
void WriteAsciiFile(const std::string &file)
Definition: AMReX_ParticleIO.H:1128
amrex::ParticleContainer_impl::NArrayInt
static constexpr int NArrayInt
Number of extra integer components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:157
amrex::ParticleContainer_impl::Initialize
void Initialize()
Definition: AMReX_ParticleContainerI.H:33
amrex::ParticleContainer_impl::NArrayReal
static constexpr int NArrayReal
Number of extra Real components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:155
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html index d5bcc90606..4de7119aa0 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html @@ -876,7 +876,7 @@
775 
776  if (have_pheaders)
777  {
-
778  for (int lev = 0; lev <= finest_level_in_file; lev++)
+
778  for (int lev = 0; lev <= finestLevel(); lev++)
779  {
780  old_dms[lev] = ParticleDistributionMap(lev);
781  old_bas[lev] = ParticleBoxArray(lev);
@@ -892,505 +892,499 @@
791  std::string phdr_string(phdr_chars.dataPtr());
792  std::istringstream phdr_file(phdr_string, std::istringstream::in);
793 
-
794  if (lev > finestLevel())
-
795  {
-
796  dual_grid = true;
-
797  break;
-
798  }
-
799 
-
800  particle_box_arrays[lev].readFrom(phdr_file);
-
801  if (! particle_box_arrays[lev].CellEqual(ParticleBoxArray(lev))) { dual_grid = true; }
-
802  }
-
803  } else // if no particle box array information exists in the file, we assume a single grid restart
-
804  {
-
805  dual_grid = false;
-
806  }
-
807 
-
808  if (dual_grid) {
-
809  for (int lev = 0; lev <= finestLevel(); lev++) {
-
810  // this can happen if there are no particles at a given level in the checkpoint
-
811  if (particle_box_arrays[lev].empty()) {
-
812  particle_box_arrays[lev] = BoxArray(Geom(lev).Domain());
-
813  }
-
814  SetParticleBoxArray(lev, particle_box_arrays[lev]);
-
815  DistributionMapping pdm(particle_box_arrays[lev]);
-
816  SetParticleDistributionMap(lev, pdm);
-
817  }
+
794  particle_box_arrays[lev].readFrom(phdr_file);
+
795  if (! particle_box_arrays[lev].CellEqual(ParticleBoxArray(lev))) { dual_grid = true; }
+
796  }
+
797  } else // if no particle box array information exists in the file, we assume a single grid restart
+
798  {
+
799  dual_grid = false;
+
800  }
+
801 
+
802  if (dual_grid) {
+
803  for (int lev = 0; lev <= finestLevel(); lev++) {
+
804  // this can happen if there are no particles at a given level in the checkpoint
+
805  if (particle_box_arrays[lev].empty()) {
+
806  particle_box_arrays[lev] = BoxArray(Geom(lev).Domain());
+
807  }
+
808  SetParticleBoxArray(lev, particle_box_arrays[lev]);
+
809  DistributionMapping pdm(particle_box_arrays[lev]);
+
810  SetParticleDistributionMap(lev, pdm);
+
811  }
+
812  }
+
813 
+
814  Vector<int> ngrids(finest_level_in_file+1);
+
815  for (int lev = 0; lev <= finest_level_in_file; lev++) {
+
816  HdrFile >> ngrids[lev];
+
817  AMREX_ASSERT(ngrids[lev] > 0);
818  }
819 
-
820  Vector<int> ngrids(finest_level_in_file+1);
-
821  for (int lev = 0; lev <= finest_level_in_file; lev++) {
-
822  HdrFile >> ngrids[lev];
-
823  AMREX_ASSERT(ngrids[lev] > 0);
+
820  resizeData();
+
821 
+
822  if (finest_level_in_file > finestLevel()) {
+
823  m_particles.resize(finest_level_in_file+1);
824  }
825 
-
826  resizeData();
-
827 
-
828  if (finest_level_in_file > finestLevel()) {
-
829  m_particles.resize(finest_level_in_file+1);
-
830  }
-
831 
-
832  for (int lev = 0; lev <= finest_level_in_file; lev++) {
-
833  Vector<int> which(ngrids[lev]);
-
834  Vector<int> count(ngrids[lev]);
-
835  Vector<Long> where(ngrids[lev]);
-
836  for (int i = 0; i < ngrids[lev]; i++) {
-
837  HdrFile >> which[i] >> count[i] >> where[i];
-
838  }
-
839 
-
840  Vector<int> grids_to_read;
-
841  if (lev <= finestLevel()) {
-
842  for (MFIter mfi(*m_dummy_mf[lev]); mfi.isValid(); ++mfi) {
-
843  grids_to_read.push_back(mfi.index());
-
844  }
-
845  } else {
-
846 
-
847  // we lost a level on restart. we still need to read in particles
-
848  // on finer levels, and put them in the right place via Redistribute()
-
849 
-
850  const int rank = ParallelDescriptor::MyProc();
-
851  const int NReaders = MaxReaders();
-
852  if (rank >= NReaders) { return; }
-
853 
-
854  const int Navg = ngrids[lev] / NReaders;
-
855  const int Nleft = ngrids[lev] - Navg * NReaders;
-
856 
-
857  int lo, hi;
-
858  if (rank < Nleft) {
-
859  lo = rank*(Navg + 1);
-
860  hi = lo + Navg + 1;
-
861  }
-
862  else {
-
863  lo = rank * Navg + Nleft;
-
864  hi = lo + Navg;
-
865  }
-
866 
-
867  for (int i = lo; i < hi; ++i) {
-
868  grids_to_read.push_back(i);
-
869  }
-
870  }
+
826  for (int lev = 0; lev <= finest_level_in_file; lev++) {
+
827  Vector<int> which(ngrids[lev]);
+
828  Vector<int> count(ngrids[lev]);
+
829  Vector<Long> where(ngrids[lev]);
+
830  for (int i = 0; i < ngrids[lev]; i++) {
+
831  HdrFile >> which[i] >> count[i] >> where[i];
+
832  }
+
833 
+
834  Vector<int> grids_to_read;
+
835  if (lev <= finestLevel()) {
+
836  for (MFIter mfi(*m_dummy_mf[lev]); mfi.isValid(); ++mfi) {
+
837  grids_to_read.push_back(mfi.index());
+
838  }
+
839  } else {
+
840 
+
841  // we lost a level on restart. we still need to read in particles
+
842  // on finer levels, and put them in the right place via Redistribute()
+
843 
+
844  const int rank = ParallelDescriptor::MyProc();
+
845  const int NReaders = MaxReaders();
+
846  if (rank >= NReaders) { return; }
+
847 
+
848  const int Navg = ngrids[lev] / NReaders;
+
849  const int Nleft = ngrids[lev] - Navg * NReaders;
+
850 
+
851  int lo, hi;
+
852  if (rank < Nleft) {
+
853  lo = rank*(Navg + 1);
+
854  hi = lo + Navg + 1;
+
855  }
+
856  else {
+
857  lo = rank * Navg + Nleft;
+
858  hi = lo + Navg;
+
859  }
+
860 
+
861  for (int i = lo; i < hi; ++i) {
+
862  grids_to_read.push_back(i);
+
863  }
+
864  }
+
865 
+
866  for(int grid : grids_to_read) {
+
867  if (count[grid] <= 0) { continue; }
+
868 
+
869  // The file names in the header file are relative.
+
870  std::string name = fullname;
871 
-
872  for(int grid : grids_to_read) {
-
873  if (count[grid] <= 0) { continue; }
-
874 
-
875  // The file names in the header file are relative.
-
876  std::string name = fullname;
-
877 
-
878  if (!name.empty() && name[name.size()-1] != '/') {
-
879  name += '/';
-
880  }
+
872  if (!name.empty() && name[name.size()-1] != '/') {
+
873  name += '/';
+
874  }
+
875 
+
876  name += "Level_";
+
877  name += amrex::Concatenate("", lev, 1);
+
878  name += '/';
+
879  name += DataPrefix();
+
880  name += amrex::Concatenate("", which[grid], DATA_Digits_Read);
881 
-
882  name += "Level_";
-
883  name += amrex::Concatenate("", lev, 1);
-
884  name += '/';
-
885  name += DataPrefix();
-
886  name += amrex::Concatenate("", which[grid], DATA_Digits_Read);
-
887 
-
888  std::ifstream ParticleFile;
+
882  std::ifstream ParticleFile;
+
883 
+
884  ParticleFile.open(name.c_str(), std::ios::in | std::ios::binary);
+
885 
+
886  if (!ParticleFile.good()) {
+
887  amrex::FileOpenFailed(name);
+
888  }
889 
-
890  ParticleFile.open(name.c_str(), std::ios::in | std::ios::binary);
+
890  ParticleFile.seekg(where[grid], std::ios::beg);
891 
-
892  if (!ParticleFile.good()) {
-
893  amrex::FileOpenFailed(name);
-
894  }
-
895 
-
896  ParticleFile.seekg(where[grid], std::ios::beg);
-
897 
-
898  // Use if constexpr to avoid instantiating the mis-matched
-
899  // type case and triggering the static_assert on the
-
900  // underlying copy calls
-
901  if (how == "single") {
-
902  if constexpr (std::is_same_v<ParticleReal, float>) {
-
903  ReadParticles<float>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
-
904  } else {
-
905  amrex::Error("File contains single-precision data, while AMReX is compiled with ParticleReal==double");
-
906  }
-
907  }
-
908  else if (how == "double") {
-
909  if constexpr (std::is_same_v<ParticleReal, double>) {
-
910  ReadParticles<double>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
-
911  } else {
-
912  amrex::Error("File contains double-precision data, while AMReX is compiled with ParticleReal==float");
-
913  }
-
914  }
-
915  else {
-
916  std::string msg("ParticleContainer::Restart(): bad parameter: ");
-
917  msg += how;
-
918  amrex::Error(msg.c_str());
+
892  // Use if constexpr to avoid instantiating the mis-matched
+
893  // type case and triggering the static_assert on the
+
894  // underlying copy calls
+
895  if (how == "single") {
+
896  if constexpr (std::is_same_v<ParticleReal, float>) {
+
897  ReadParticles<float>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
+
898  } else {
+
899  amrex::Error("File contains single-precision data, while AMReX is compiled with ParticleReal==double");
+
900  }
+
901  }
+
902  else if (how == "double") {
+
903  if constexpr (std::is_same_v<ParticleReal, double>) {
+
904  ReadParticles<double>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
+
905  } else {
+
906  amrex::Error("File contains double-precision data, while AMReX is compiled with ParticleReal==float");
+
907  }
+
908  }
+
909  else {
+
910  std::string msg("ParticleContainer::Restart(): bad parameter: ");
+
911  msg += how;
+
912  amrex::Error(msg.c_str());
+
913  }
+
914 
+
915  ParticleFile.close();
+
916 
+
917  if (!ParticleFile.good()) {
+
918  amrex::Abort("ParticleContainer::Restart(): problem reading particles");
919  }
-
920 
-
921  ParticleFile.close();
+
920  }
+
921  }
922 
-
923  if (!ParticleFile.good()) {
-
924  amrex::Abort("ParticleContainer::Restart(): problem reading particles");
-
925  }
-
926  }
-
927  }
-
928 
-
929  if (dual_grid) {
-
930  for (int lev = 0; lev <= finest_level_in_file; lev++) {
-
931  SetParticleBoxArray(lev, old_bas[lev]);
-
932  SetParticleDistributionMap(lev, old_dms[lev]);
-
933  }
-
934  }
-
935 
-
936  Redistribute();
-
937 
-
938  AMREX_ASSERT(OK());
-
939 
-
940  if (m_verbose > 1) {
-
941  auto stoptime = amrex::second() - strttime;
-
942  ParallelDescriptor::ReduceRealMax(stoptime, ParallelDescriptor::IOProcessorNumber());
-
943  amrex::Print() << "ParticleContainer::Restart() time: " << stoptime << '\n';
-
944  }
-
945 }
-
946 
-
947 // Read a batch of particles from the checkpoint file
-
948 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
949  template<class> class Allocator, class CellAssignor>
-
950 template <class RTYPE>
-
951 void
-
952 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
-
953 ::ReadParticles (int cnt, int grd, int lev, std::ifstream& ifs,
-
954  int finest_level_in_file, bool convert_ids)
-
955 {
-
956  BL_PROFILE("ParticleContainer::ReadParticles()");
-
957  AMREX_ASSERT(cnt > 0);
-
958  AMREX_ASSERT(lev < int(m_particles.size()));
-
959 
-
960  // First read in the integer data in binary. We do not store
-
961  // the m_lev and m_grid data on disk. We can easily recreate
-
962  // that given the structure of the checkpoint file.
-
963  const int iChunkSize = 2 + NStructInt + NumIntComps();
-
964  Vector<int> istuff(std::size_t(cnt)*iChunkSize);
-
965  readIntData(istuff.dataPtr(), istuff.size(), ifs, FPC::NativeIntDescriptor());
-
966 
-
967  // Then the real data in binary.
-
968  const int rChunkSize = ParticleType::is_soa_particle ? NStructReal + NumRealComps() : AMREX_SPACEDIM + NStructReal + NumRealComps();
-
969  Vector<RTYPE> rstuff(std::size_t(cnt)*rChunkSize);
-
970  ReadParticleRealData(rstuff.dataPtr(), rstuff.size(), ifs);
-
971 
-
972  // Now reassemble the particles.
-
973  int* iptr = istuff.dataPtr();
-
974  RTYPE* rptr = rstuff.dataPtr();
-
975 
-
976  Particle<NStructReal, NStructInt> ptemp;
-
977  ParticleLocData pld;
-
978 
-
979  Vector<std::map<std::pair<int, int>, Gpu::HostVector<ParticleType> > > host_particles;
-
980  host_particles.reserve(15);
-
981  host_particles.resize(finest_level_in_file+1);
-
982 
-
983  Vector<std::map<std::pair<int, int>,
-
984  std::vector<Gpu::HostVector<RTYPE> > > > host_real_attribs;
-
985  host_real_attribs.reserve(15);
-
986  host_real_attribs.resize(finest_level_in_file+1);
-
987 
-
988  Vector<std::map<std::pair<int, int>,
-
989  std::vector<Gpu::HostVector<int> > > > host_int_attribs;
-
990  host_int_attribs.reserve(15);
-
991  host_int_attribs.resize(finest_level_in_file+1);
-
992 
-
993  Vector<std::map<std::pair<int, int>, Gpu::HostVector<uint64_t> > > host_idcpu;
-
994  host_idcpu.reserve(15);
-
995  host_idcpu.resize(finestLevel()+1);
-
996 
-
997  for (int i = 0; i < cnt; i++) {
-
998  // note: for pure SoA particle layouts, we do write the id, cpu and positions as a struct
-
999  // for backwards compatibility with readers
-
1000  if (convert_ids) {
-
1001  std::int32_t xi, yi;
-
1002  std::uint32_t xu, yu;
-
1003  xi = iptr[0];
-
1004  yi = iptr[1];
-
1005  std::memcpy(&xu, &xi, sizeof(xi));
-
1006  std::memcpy(&yu, &yi, sizeof(yi));
-
1007  ptemp.m_idcpu = ((std::uint64_t)xu) << 32 | yu;
-
1008  } else {
-
1009  ptemp.id() = iptr[0];
-
1010  ptemp.cpu() = iptr[1];
-
1011  }
-
1012  iptr += 2;
+
923  if (dual_grid) {
+
924  for (int lev = 0; lev <= finestLevel(); lev++) {
+
925  SetParticleBoxArray(lev, old_bas[lev]);
+
926  SetParticleDistributionMap(lev, old_dms[lev]);
+
927  }
+
928  }
+
929 
+
930  Redistribute();
+
931 
+
932  AMREX_ASSERT(OK());
+
933 
+
934  if (m_verbose > 1) {
+
935  auto stoptime = amrex::second() - strttime;
+
936  ParallelDescriptor::ReduceRealMax(stoptime, ParallelDescriptor::IOProcessorNumber());
+
937  amrex::Print() << "ParticleContainer::Restart() time: " << stoptime << '\n';
+
938  }
+
939 }
+
940 
+
941 // Read a batch of particles from the checkpoint file
+
942 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
943  template<class> class Allocator, class CellAssignor>
+
944 template <class RTYPE>
+
945 void
+
946 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
+
947 ::ReadParticles (int cnt, int grd, int lev, std::ifstream& ifs,
+
948  int finest_level_in_file, bool convert_ids)
+
949 {
+
950  BL_PROFILE("ParticleContainer::ReadParticles()");
+
951  AMREX_ASSERT(cnt > 0);
+
952  AMREX_ASSERT(lev < int(m_particles.size()));
+
953 
+
954  // First read in the integer data in binary. We do not store
+
955  // the m_lev and m_grid data on disk. We can easily recreate
+
956  // that given the structure of the checkpoint file.
+
957  const int iChunkSize = 2 + NStructInt + NumIntComps();
+
958  Vector<int> istuff(std::size_t(cnt)*iChunkSize);
+
959  readIntData(istuff.dataPtr(), istuff.size(), ifs, FPC::NativeIntDescriptor());
+
960 
+
961  // Then the real data in binary.
+
962  const int rChunkSize = ParticleType::is_soa_particle ? NStructReal + NumRealComps() : AMREX_SPACEDIM + NStructReal + NumRealComps();
+
963  Vector<RTYPE> rstuff(std::size_t(cnt)*rChunkSize);
+
964  ReadParticleRealData(rstuff.dataPtr(), rstuff.size(), ifs);
+
965 
+
966  // Now reassemble the particles.
+
967  int* iptr = istuff.dataPtr();
+
968  RTYPE* rptr = rstuff.dataPtr();
+
969 
+
970  Particle<NStructReal, NStructInt> ptemp;
+
971  ParticleLocData pld;
+
972 
+
973  Vector<std::map<std::pair<int, int>, Gpu::HostVector<ParticleType> > > host_particles;
+
974  host_particles.reserve(15);
+
975  host_particles.resize(finest_level_in_file+1);
+
976 
+
977  Vector<std::map<std::pair<int, int>,
+
978  std::vector<Gpu::HostVector<RTYPE> > > > host_real_attribs;
+
979  host_real_attribs.reserve(15);
+
980  host_real_attribs.resize(finest_level_in_file+1);
+
981 
+
982  Vector<std::map<std::pair<int, int>,
+
983  std::vector<Gpu::HostVector<int> > > > host_int_attribs;
+
984  host_int_attribs.reserve(15);
+
985  host_int_attribs.resize(finest_level_in_file+1);
+
986 
+
987  Vector<std::map<std::pair<int, int>, Gpu::HostVector<uint64_t> > > host_idcpu;
+
988  host_idcpu.reserve(15);
+
989  host_idcpu.resize(finestLevel()+1);
+
990 
+
991  for (int i = 0; i < cnt; i++) {
+
992  // note: for pure SoA particle layouts, we do write the id, cpu and positions as a struct
+
993  // for backwards compatibility with readers
+
994  if (convert_ids) {
+
995  std::int32_t xi, yi;
+
996  std::uint32_t xu, yu;
+
997  xi = iptr[0];
+
998  yi = iptr[1];
+
999  std::memcpy(&xu, &xi, sizeof(xi));
+
1000  std::memcpy(&yu, &yi, sizeof(yi));
+
1001  ptemp.m_idcpu = ((std::uint64_t)xu) << 32 | yu;
+
1002  } else {
+
1003  ptemp.id() = iptr[0];
+
1004  ptemp.cpu() = iptr[1];
+
1005  }
+
1006  iptr += 2;
+
1007 
+
1008  for (int j = 0; j < NStructInt; j++)
+
1009  {
+
1010  ptemp.idata(j) = *iptr;
+
1011  ++iptr;
+
1012  }
1013 
-
1014  for (int j = 0; j < NStructInt; j++)
-
1015  {
-
1016  ptemp.idata(j) = *iptr;
-
1017  ++iptr;
-
1018  }
+
1014  AMREX_ASSERT(ptemp.id() > 0);
+
1015 
+
1016  AMREX_D_TERM(ptemp.pos(0) = ParticleReal(rptr[0]);,
+
1017  ptemp.pos(1) = ParticleReal(rptr[1]);,
+
1018  ptemp.pos(2) = ParticleReal(rptr[2]););
1019 
-
1020  AMREX_ASSERT(ptemp.id() > 0);
+
1020  rptr += AMREX_SPACEDIM;
1021 
-
1022  AMREX_D_TERM(ptemp.pos(0) = ParticleReal(rptr[0]);,
-
1023  ptemp.pos(1) = ParticleReal(rptr[1]);,
-
1024  ptemp.pos(2) = ParticleReal(rptr[2]););
-
1025 
-
1026  rptr += AMREX_SPACEDIM;
+
1022  for (int j = 0; j < NStructReal; j++)
+
1023  {
+
1024  ptemp.rdata(j) = ParticleReal(*rptr);
+
1025  ++rptr;
+
1026  }
1027 
-
1028  for (int j = 0; j < NStructReal; j++)
-
1029  {
-
1030  ptemp.rdata(j) = ParticleReal(*rptr);
-
1031  ++rptr;
-
1032  }
-
1033 
-
1034  locateParticle(ptemp, pld, 0, finestLevel(), 0);
-
1035 
-
1036  std::pair<int, int> ind(grd, pld.m_tile);
-
1037 
-
1038  host_real_attribs[lev][ind].resize(NumRealComps());
-
1039  host_int_attribs[lev][ind].resize(NumIntComps());
-
1040 
-
1041  // add the struct
-
1042  if constexpr(!ParticleType::is_soa_particle)
-
1043  {
-
1044  host_particles[lev][ind].push_back(ptemp);
+
1028  locateParticle(ptemp, pld, 0, finestLevel(), 0);
+
1029 
+
1030  std::pair<int, int> ind(grd, pld.m_tile);
+
1031 
+
1032  host_real_attribs[lev][ind].resize(NumRealComps());
+
1033  host_int_attribs[lev][ind].resize(NumIntComps());
+
1034 
+
1035  // add the struct
+
1036  if constexpr(!ParticleType::is_soa_particle)
+
1037  {
+
1038  host_particles[lev][ind].push_back(ptemp);
+
1039 
+
1040  // add the real...
+
1041  for (int icomp = 0; icomp < NumRealComps(); icomp++) {
+
1042  host_real_attribs[lev][ind][icomp].push_back(*rptr);
+
1043  ++rptr;
+
1044  }
1045 
-
1046  // add the real...
-
1047  for (int icomp = 0; icomp < NumRealComps(); icomp++) {
-
1048  host_real_attribs[lev][ind][icomp].push_back(*rptr);
-
1049  ++rptr;
+
1046  // ... and int array data
+
1047  for (int icomp = 0; icomp < NumIntComps(); icomp++) {
+
1048  host_int_attribs[lev][ind][icomp].push_back(*iptr);
+
1049  ++iptr;
1050  }
-
1051 
-
1052  // ... and int array data
-
1053  for (int icomp = 0; icomp < NumIntComps(); icomp++) {
-
1054  host_int_attribs[lev][ind][icomp].push_back(*iptr);
-
1055  ++iptr;
+
1051  } else {
+
1052  host_particles[lev][ind];
+
1053 
+
1054  for (int j = 0; j < AMREX_SPACEDIM; j++) {
+
1055  host_real_attribs[pld.m_lev][ind][j].push_back(ptemp.pos(j));
1056  }
-
1057  } else {
-
1058  host_particles[lev][ind];
+
1057 
+
1058  host_idcpu[pld.m_lev][ind].push_back(ptemp.m_idcpu);
1059 
-
1060  for (int j = 0; j < AMREX_SPACEDIM; j++) {
-
1061  host_real_attribs[pld.m_lev][ind][j].push_back(ptemp.pos(j));
-
1062  }
-
1063 
-
1064  host_idcpu[pld.m_lev][ind].push_back(ptemp.m_idcpu);
-
1065 
-
1066  // read all other SoA
-
1067  // add the real...
-
1068  for (int icomp = AMREX_SPACEDIM; icomp < NumRealComps(); icomp++) {
-
1069  host_real_attribs[lev][ind][icomp].push_back(*rptr);
-
1070  ++rptr;
+
1060  // read all other SoA
+
1061  // add the real...
+
1062  for (int icomp = AMREX_SPACEDIM; icomp < NumRealComps(); icomp++) {
+
1063  host_real_attribs[lev][ind][icomp].push_back(*rptr);
+
1064  ++rptr;
+
1065  }
+
1066 
+
1067  // ... and int array data
+
1068  for (int icomp = 0; icomp < NumIntComps(); icomp++) {
+
1069  host_int_attribs[lev][ind][icomp].push_back(*iptr);
+
1070  ++iptr;
1071  }
-
1072 
-
1073  // ... and int array data
-
1074  for (int icomp = 0; icomp < NumIntComps(); icomp++) {
-
1075  host_int_attribs[lev][ind][icomp].push_back(*iptr);
-
1076  ++iptr;
-
1077  }
-
1078  }
-
1079  }
-
1080 
-
1081  for (int host_lev = 0; host_lev < static_cast<int>(host_particles.size()); ++host_lev)
-
1082  {
-
1083  for (auto& kv : host_particles[host_lev]) {
-
1084  auto grid = kv.first.first;
-
1085  auto tile = kv.first.second;
-
1086  const auto& src_tile = kv.second;
-
1087 
-
1088  auto& dst_tile = DefineAndReturnParticleTile(host_lev, grid, tile);
-
1089  auto old_size = dst_tile.size();
-
1090  auto new_size = old_size;
-
1091  if constexpr(!ParticleType::is_soa_particle)
-
1092  {
-
1093  new_size += src_tile.size();
-
1094  } else {
-
1095  amrex::ignore_unused(src_tile);
-
1096  new_size += host_real_attribs[host_lev][std::make_pair(grid,tile)][0].size();
-
1097  }
-
1098  dst_tile.resize(new_size);
-
1099 
-
1100  if constexpr(!ParticleType::is_soa_particle)
-
1101  {
-
1102  Gpu::copyAsync(Gpu::hostToDevice, src_tile.begin(), src_tile.end(),
-
1103  dst_tile.GetArrayOfStructs().begin() + old_size);
-
1104  } else {
-
1105  Gpu::copyAsync(Gpu::hostToDevice,
-
1106  host_idcpu[host_lev][std::make_pair(grid,tile)].begin(),
-
1107  host_idcpu[host_lev][std::make_pair(grid,tile)].end(),
-
1108  dst_tile.GetStructOfArrays().GetIdCPUData().begin() + old_size);
-
1109  }
-
1110 
-
1111  for (int i = 0; i < NumRealComps(); ++i) { // NOLINT(readability-misleading-indentation)
-
1112  Gpu::copyAsync(Gpu::hostToDevice,
-
1113  host_real_attribs[host_lev][std::make_pair(grid,tile)][i].begin(),
-
1114  host_real_attribs[host_lev][std::make_pair(grid,tile)][i].end(),
-
1115  dst_tile.GetStructOfArrays().GetRealData(i).begin() + old_size);
-
1116  }
-
1117 
-
1118  for (int i = 0; i < NumIntComps(); ++i) {
-
1119  Gpu::copyAsync(Gpu::hostToDevice,
-
1120  host_int_attribs[host_lev][std::make_pair(grid,tile)][i].begin(),
-
1121  host_int_attribs[host_lev][std::make_pair(grid,tile)][i].end(),
-
1122  dst_tile.GetStructOfArrays().GetIntData(i).begin() + old_size);
-
1123  }
-
1124  }
-
1125  }
-
1126 
-
1127  Gpu::streamSynchronize();
-
1128 }
-
1129 
-
1130 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
1131  template<class> class Allocator, class CellAssignor>
-
1132 void
-
1133 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
-
1134 ::WriteAsciiFile (const std::string& filename)
-
1135 {
-
1136  BL_PROFILE("ParticleContainer::WriteAsciiFile()");
-
1137  AMREX_ASSERT(!filename.empty());
+
1072  }
+
1073  }
+
1074 
+
1075  for (int host_lev = 0; host_lev < static_cast<int>(host_particles.size()); ++host_lev)
+
1076  {
+
1077  for (auto& kv : host_particles[host_lev]) {
+
1078  auto grid = kv.first.first;
+
1079  auto tile = kv.first.second;
+
1080  const auto& src_tile = kv.second;
+
1081 
+
1082  auto& dst_tile = DefineAndReturnParticleTile(host_lev, grid, tile);
+
1083  auto old_size = dst_tile.size();
+
1084  auto new_size = old_size;
+
1085  if constexpr(!ParticleType::is_soa_particle)
+
1086  {
+
1087  new_size += src_tile.size();
+
1088  } else {
+
1089  amrex::ignore_unused(src_tile);
+
1090  new_size += host_real_attribs[host_lev][std::make_pair(grid,tile)][0].size();
+
1091  }
+
1092  dst_tile.resize(new_size);
+
1093 
+
1094  if constexpr(!ParticleType::is_soa_particle)
+
1095  {
+
1096  Gpu::copyAsync(Gpu::hostToDevice, src_tile.begin(), src_tile.end(),
+
1097  dst_tile.GetArrayOfStructs().begin() + old_size);
+
1098  } else {
+
1099  Gpu::copyAsync(Gpu::hostToDevice,
+
1100  host_idcpu[host_lev][std::make_pair(grid,tile)].begin(),
+
1101  host_idcpu[host_lev][std::make_pair(grid,tile)].end(),
+
1102  dst_tile.GetStructOfArrays().GetIdCPUData().begin() + old_size);
+
1103  }
+
1104 
+
1105  for (int i = 0; i < NumRealComps(); ++i) { // NOLINT(readability-misleading-indentation)
+
1106  Gpu::copyAsync(Gpu::hostToDevice,
+
1107  host_real_attribs[host_lev][std::make_pair(grid,tile)][i].begin(),
+
1108  host_real_attribs[host_lev][std::make_pair(grid,tile)][i].end(),
+
1109  dst_tile.GetStructOfArrays().GetRealData(i).begin() + old_size);
+
1110  }
+
1111 
+
1112  for (int i = 0; i < NumIntComps(); ++i) {
+
1113  Gpu::copyAsync(Gpu::hostToDevice,
+
1114  host_int_attribs[host_lev][std::make_pair(grid,tile)][i].begin(),
+
1115  host_int_attribs[host_lev][std::make_pair(grid,tile)][i].end(),
+
1116  dst_tile.GetStructOfArrays().GetIntData(i).begin() + old_size);
+
1117  }
+
1118  }
+
1119  }
+
1120 
+
1121  Gpu::streamSynchronize();
+
1122 }
+
1123 
+
1124 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
1125  template<class> class Allocator, class CellAssignor>
+
1126 void
+
1127 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
+
1128 ::WriteAsciiFile (const std::string& filename)
+
1129 {
+
1130  BL_PROFILE("ParticleContainer::WriteAsciiFile()");
+
1131  AMREX_ASSERT(!filename.empty());
+
1132 
+
1133  const auto strttime = amrex::second();
+
1134  //
+
1135  // Count # of valid particles.
+
1136  //
+
1137  Long nparticles = 0;
1138 
-
1139  const auto strttime = amrex::second();
-
1140  //
-
1141  // Count # of valid particles.
-
1142  //
-
1143  Long nparticles = 0;
-
1144 
-
1145  for (int lev = 0; lev < m_particles.size(); lev++) {
-
1146  auto& pmap = m_particles[lev];
-
1147  for (const auto& kv : pmap) {
-
1148  const auto& aos = kv.second.GetArrayOfStructs();
-
1149  auto np = aos.numParticles();
-
1150  Gpu::HostVector<ParticleType> host_aos(np);
-
1151  Gpu::copy(Gpu::deviceToHost, aos.begin(), aos.begin() + np, host_aos.begin());
-
1152  for (int k = 0; k < np; ++k) {
-
1153  const ParticleType& p = host_aos[k];
-
1154  if (p.id() > 0) {
-
1155  //
-
1156  // Only count (and checkpoint) valid particles.
-
1157  //
-
1158  nparticles++;
-
1159  }
-
1160  }
-
1161  }
-
1162  }
-
1163 
-
1164  //
-
1165  // And send count to I/O processor.
-
1166  //
-
1167  ParallelDescriptor::ReduceLongSum(nparticles,ParallelDescriptor::IOProcessorNumber());
-
1168 
-
1169  if (ParallelDescriptor::IOProcessor())
-
1170  {
-
1171  //
-
1172  // Have I/O processor open file and write out particle metadata.
-
1173  //
-
1174  std::ofstream File;
+
1139  for (int lev = 0; lev < m_particles.size(); lev++) {
+
1140  auto& pmap = m_particles[lev];
+
1141  for (const auto& kv : pmap) {
+
1142  const auto& aos = kv.second.GetArrayOfStructs();
+
1143  auto np = aos.numParticles();
+
1144  Gpu::HostVector<ParticleType> host_aos(np);
+
1145  Gpu::copy(Gpu::deviceToHost, aos.begin(), aos.begin() + np, host_aos.begin());
+
1146  for (int k = 0; k < np; ++k) {
+
1147  const ParticleType& p = host_aos[k];
+
1148  if (p.id() > 0) {
+
1149  //
+
1150  // Only count (and checkpoint) valid particles.
+
1151  //
+
1152  nparticles++;
+
1153  }
+
1154  }
+
1155  }
+
1156  }
+
1157 
+
1158  //
+
1159  // And send count to I/O processor.
+
1160  //
+
1161  ParallelDescriptor::ReduceLongSum(nparticles,ParallelDescriptor::IOProcessorNumber());
+
1162 
+
1163  if (ParallelDescriptor::IOProcessor())
+
1164  {
+
1165  //
+
1166  // Have I/O processor open file and write out particle metadata.
+
1167  //
+
1168  std::ofstream File;
+
1169 
+
1170  File.open(filename.c_str(), std::ios::out|std::ios::trunc);
+
1171 
+
1172  if (!File.good()) {
+
1173  amrex::FileOpenFailed(filename);
+
1174  }
1175 
-
1176  File.open(filename.c_str(), std::ios::out|std::ios::trunc);
-
1177 
-
1178  if (!File.good()) {
-
1179  amrex::FileOpenFailed(filename);
-
1180  }
+
1176  File << nparticles << '\n';
+
1177  File << NStructReal << '\n';
+
1178  File << NStructInt << '\n';
+
1179  File << NumRealComps() << '\n';
+
1180  File << NumIntComps() << '\n';
1181 
-
1182  File << nparticles << '\n';
-
1183  File << NStructReal << '\n';
-
1184  File << NStructInt << '\n';
-
1185  File << NumRealComps() << '\n';
-
1186  File << NumIntComps() << '\n';
-
1187 
-
1188  File.flush();
-
1189 
-
1190  File.close();
-
1191 
-
1192  if (!File.good()) {
-
1193  amrex::Abort("ParticleContainer::WriteAsciiFile(): problem writing file");
-
1194  }
-
1195  }
-
1196 
-
1197  ParallelDescriptor::Barrier();
-
1198 
-
1199  const int MyProc = ParallelDescriptor::MyProc();
-
1200 
-
1201  for (int proc = 0; proc < ParallelDescriptor::NProcs(); proc++)
-
1202  {
-
1203  if (MyProc == proc)
-
1204  {
-
1205  //
-
1206  // Each CPU opens the file for appending and adds its particles.
-
1207  //
-
1208  VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
+
1182  File.flush();
+
1183 
+
1184  File.close();
+
1185 
+
1186  if (!File.good()) {
+
1187  amrex::Abort("ParticleContainer::WriteAsciiFile(): problem writing file");
+
1188  }
+
1189  }
+
1190 
+
1191  ParallelDescriptor::Barrier();
+
1192 
+
1193  const int MyProc = ParallelDescriptor::MyProc();
+
1194 
+
1195  for (int proc = 0; proc < ParallelDescriptor::NProcs(); proc++)
+
1196  {
+
1197  if (MyProc == proc)
+
1198  {
+
1199  //
+
1200  // Each CPU opens the file for appending and adds its particles.
+
1201  //
+
1202  VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
+
1203 
+
1204  std::ofstream File;
+
1205 
+
1206  File.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
+
1207 
+
1208  File.open(filename.c_str(), std::ios::out|std::ios::app);
1209 
-
1210  std::ofstream File;
+
1210  File.precision(15);
1211 
-
1212  File.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
-
1213 
-
1214  File.open(filename.c_str(), std::ios::out|std::ios::app);
+
1212  if (!File.good()) {
+
1213  amrex::FileOpenFailed(filename);
+
1214  }
1215 
-
1216  File.precision(15);
-
1217 
-
1218  if (!File.good()) {
-
1219  amrex::FileOpenFailed(filename);
-
1220  }
-
1221 
-
1222  for (int lev = 0; lev < m_particles.size(); lev++) {
-
1223  auto& pmap = m_particles[lev];
-
1224  for (const auto& kv : pmap) {
-
1225  ParticleTile<ParticleType, NArrayReal, NArrayInt,
-
1226  amrex::PinnedArenaAllocator> pinned_ptile;
-
1227  pinned_ptile.define(NumRuntimeRealComps(), NumRuntimeIntComps());
-
1228  pinned_ptile.resize(kv.second.numParticles());
-
1229  amrex::copyParticles(pinned_ptile, kv.second);
-
1230  const auto& host_aos = pinned_ptile.GetArrayOfStructs();
-
1231  const auto& host_soa = pinned_ptile.GetStructOfArrays();
-
1232 
-
1233  auto np = host_aos.numParticles();
-
1234  for (int index = 0; index < np; ++index) {
-
1235  const ParticleType* it = &host_aos[index];
-
1236  if (it->id() > 0) {
-
1237 
-
1238  // write out the particle struct first...
-
1239  AMREX_D_TERM(File << it->pos(0) << ' ',
-
1240  << it->pos(1) << ' ',
-
1241  << it->pos(2) << ' ');
-
1242 
-
1243  for (int i = 0; i < NStructReal; i++) {
-
1244  File << it->rdata(i) << ' ';
-
1245  }
-
1246 
-
1247  File << it->id() << ' ';
-
1248  File << it->cpu() << ' ';
-
1249 
-
1250  for (int i = 0; i < NStructInt; i++) {
-
1251  File << it->idata(i) << ' ';
-
1252  }
-
1253 
-
1254  // then the particle attributes.
-
1255  for (int i = 0; i < NumRealComps(); i++) {
-
1256  File << host_soa.GetRealData(i)[index] << ' ';
-
1257  }
-
1258 
-
1259  for (int i = 0; i < NumIntComps(); i++) {
-
1260  File << host_soa.GetIntData(i)[index] << ' ';
-
1261  }
+
1216  for (int lev = 0; lev < m_particles.size(); lev++) {
+
1217  auto& pmap = m_particles[lev];
+
1218  for (const auto& kv : pmap) {
+
1219  ParticleTile<ParticleType, NArrayReal, NArrayInt,
+
1220  amrex::PinnedArenaAllocator> pinned_ptile;
+
1221  pinned_ptile.define(NumRuntimeRealComps(), NumRuntimeIntComps());
+
1222  pinned_ptile.resize(kv.second.numParticles());
+
1223  amrex::copyParticles(pinned_ptile, kv.second);
+
1224  const auto& host_aos = pinned_ptile.GetArrayOfStructs();
+
1225  const auto& host_soa = pinned_ptile.GetStructOfArrays();
+
1226 
+
1227  auto np = host_aos.numParticles();
+
1228  for (int index = 0; index < np; ++index) {
+
1229  const ParticleType* it = &host_aos[index];
+
1230  if (it->id() > 0) {
+
1231 
+
1232  // write out the particle struct first...
+
1233  AMREX_D_TERM(File << it->pos(0) << ' ',
+
1234  << it->pos(1) << ' ',
+
1235  << it->pos(2) << ' ');
+
1236 
+
1237  for (int i = 0; i < NStructReal; i++) {
+
1238  File << it->rdata(i) << ' ';
+
1239  }
+
1240 
+
1241  File << it->id() << ' ';
+
1242  File << it->cpu() << ' ';
+
1243 
+
1244  for (int i = 0; i < NStructInt; i++) {
+
1245  File << it->idata(i) << ' ';
+
1246  }
+
1247 
+
1248  // then the particle attributes.
+
1249  for (int i = 0; i < NumRealComps(); i++) {
+
1250  File << host_soa.GetRealData(i)[index] << ' ';
+
1251  }
+
1252 
+
1253  for (int i = 0; i < NumIntComps(); i++) {
+
1254  File << host_soa.GetIntData(i)[index] << ' ';
+
1255  }
+
1256 
+
1257  File << '\n';
+
1258  }
+
1259  }
+
1260  }
+
1261  }
1262 
-
1263  File << '\n';
-
1264  }
-
1265  }
-
1266  }
-
1267  }
-
1268 
-
1269  File.flush();
+
1263  File.flush();
+
1264 
+
1265  File.close();
+
1266 
+
1267  if (!File.good()) {
+
1268  amrex::Abort("ParticleContainer::WriteAsciiFile(): problem writing file");
+
1269  }
1270 
-
1271  File.close();
+
1271  }
1272 
-
1273  if (!File.good()) {
-
1274  amrex::Abort("ParticleContainer::WriteAsciiFile(): problem writing file");
-
1275  }
-
1276 
-
1277  }
-
1278 
-
1279  ParallelDescriptor::Barrier();
-
1280  }
+
1273  ParallelDescriptor::Barrier();
+
1274  }
+
1275 
+
1276  if (m_verbose > 1)
+
1277  {
+
1278  auto stoptime = amrex::second() - strttime;
+
1279 
+
1280  ParallelDescriptor::ReduceRealMax(stoptime,ParallelDescriptor::IOProcessorNumber());
1281 
-
1282  if (m_verbose > 1)
-
1283  {
-
1284  auto stoptime = amrex::second() - strttime;
+
1282  amrex::Print() << "ParticleContainer::WriteAsciiFile() time: " << stoptime << '\n';
+
1283  }
+
1284 }
1285 
-
1286  ParallelDescriptor::ReduceRealMax(stoptime,ParallelDescriptor::IOProcessorNumber());
-
1287 
-
1288  amrex::Print() << "ParticleContainer::WriteAsciiFile() time: " << stoptime << '\n';
-
1289  }
-
1290 }
-
1291 
-
1292 #endif /*AMREX_PARTICLEIO_H*/
+
1286 #endif /*AMREX_PARTICLEIO_H*/
BL_PROFILE
#define BL_PROFILE(a)
Definition: AMReX_BLProfiler.H:551
AMREX_ASSERT
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
AMREX_ALWAYS_ASSERT
#define AMREX_ALWAYS_ASSERT(EX)
Definition: AMReX_BLassert.H:50
@@ -1400,6 +1394,8 @@
AMReX_WriteBinaryParticleData.H
WriteBinaryParticleDataAsync
void WriteBinaryParticleDataAsync(PC const &pc, const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, bool is_checkpoint)
Definition: AMReX_WriteBinaryParticleData.H:684
WriteBinaryParticleDataSync
void WriteBinaryParticleDataSync(PC const &pc, const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F const &f, bool is_checkpoint)
Definition: AMReX_WriteBinaryParticleData.H:392
+
amrex::BoxArray
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:529
+
amrex::DistributionMapping
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
amrex::MFIter
Definition: AMReX_MFIter.H:57
amrex::MFIter::isValid
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
amrex::MultiFab
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
@@ -1458,6 +1454,7 @@
particle_detail::countFlags
std::enable_if_t< RunOnGpu< typename Container< int, Allocator >::allocator_type >::value, amrex::Long > countFlags(const Vector< std::map< std::pair< int, int >, Container< int, Allocator >>> &particle_io_flags, const PC &pc)
Definition: AMReX_WriteBinaryParticleData.H:76
FilterPositiveID
Definition: AMReX_ParticleIO.H:35
FilterPositiveID::operator()
AMREX_GPU_HOST_DEVICE int operator()(const P &p) const
Definition: AMReX_ParticleIO.H:38
+
amrex::DefaultAssignor
Definition: AMReX_ParticleUtil.H:395
amrex::MFInfo
FabArray memory allocation information.
Definition: AMReX_FabArray.H:65
amrex::MFInfo::SetAlloc
MFInfo & SetAlloc(bool a) noexcept
Definition: AMReX_FabArray.H:72
amrex::ParticleBase::m_idcpu
uint64_t m_idcpu
Definition: AMReX_Particle.H:252
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html index ebd471690b..e8d6adb6a0 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html @@ -1864,10 +1864,10 @@
amrex::ParticleLocData::m_tile
int m_tile
Definition: AMReX_ParticleContainer.H:93
amrex::ParticleLocData::m_lev
int m_lev
Definition: AMReX_ParticleContainer.H:91
amrex::ParticleTile
Definition: AMReX_ParticleTile.H:690
-
amrex::ParticleTile::push_back
void push_back(const ParticleType &p)
Definition: AMReX_ParticleTile.H:896
-
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:818
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, int v)
Definition: AMReX_ParticleTile.H:992
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, ParticleReal v)
Definition: AMReX_ParticleTile.H:940
+
amrex::ParticleTile::push_back
void push_back(const ParticleType &p)
Definition: AMReX_ParticleTile.H:906
+
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:828
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, int v)
Definition: AMReX_ParticleTile.H:1002
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, ParticleReal v)
Definition: AMReX_ParticleTile.H:950
amrex::Particle
The struct used to store particles.
Definition: AMReX_Particle.H:295
amrex::Particle::id
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper id() &
Definition: AMReX_Particle.H:315
amrex::Particle::pos
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_Particle.H:338
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleTile_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleTile_8H_source.html index e5598edb87..96806f76ae 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleTile_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleTile_8H_source.html @@ -805,494 +805,504 @@
720 
721  ParticleTile () = default;
722 
-
723  void define (int a_num_runtime_real, int a_num_runtime_int)
-
724  {
-
725  m_defined = true;
-
726  GetStructOfArrays().define(a_num_runtime_real, a_num_runtime_int);
-
727  m_runtime_r_ptrs.resize(a_num_runtime_real);
-
728  m_runtime_i_ptrs.resize(a_num_runtime_int);
-
729  m_runtime_r_cptrs.resize(a_num_runtime_real);
-
730  m_runtime_i_cptrs.resize(a_num_runtime_int);
-
731  }
+
723 #ifndef _WIN32 // workaround windows compiler bug
+
724  ~ParticleTile () = default;
+
725 
+
726  ParticleTile (ParticleTile const&) = delete;
+
727  ParticleTile (ParticleTile &&) noexcept = default;
+
728 
+
729  ParticleTile& operator= (ParticleTile const&) = delete;
+
730  ParticleTile& operator= (ParticleTile &&) noexcept = default;
+
731 #endif
732 
-
733  // Get id data
-
734  decltype(auto) id (int index) & {
-
735  if constexpr (!ParticleType::is_soa_particle) {
-
736  return m_aos_tile[index].id();
-
737  } else {
-
738  return ParticleIDWrapper(m_soa_tile.GetIdCPUData()[index]);
-
739  }
-
740  }
-
741 
-
742  // const
-
743  decltype(auto) id (int index) const & {
-
744  if constexpr (!ParticleType::is_soa_particle) {
-
745  return m_aos_tile[index].id();
-
746  } else {
-
747  return ConstParticleIDWrapper(m_soa_tile.GetIdCPUData()[index]);
-
748  }
-
749  }
-
750 
-
751  // Get cpu data
-
752  decltype(auto) cpu (int index) & {
-
753  if constexpr (!ParticleType::is_soa_particle) {
-
754  return m_aos_tile[index].cpu();
-
755  } else {
-
756  return ParticleCPUWrapper(m_soa_tile.GetIdCPUData()[index]);
-
757  }
-
758  }
-
759 
-
760  // const
-
761  decltype(auto) cpu (int index) const & {
-
762  if constexpr (!ParticleType::is_soa_particle) {
-
763  return m_aos_tile[index].cpu();
-
764  } else {
-
765  return ConstParticleCPUWrapper(m_soa_tile.GetIdCPUData()[index]);
-
766  }
-
767  }
-
768 
-
769  // Get positions data
-
770  RealType& pos (int index, int position_index) & {
-
771  if constexpr (!ParticleType::is_soa_particle) {
-
772  return m_aos_tile[index].pos(position_index);
-
773  } else {
-
774  static_assert(NArrayReal == ParticleType::PTD::NAR, "ParticleTile mismatch in R");
-
775  static_assert(NArrayInt == ParticleType::PTD::NAI, "ParticleTile mismatch in I");
-
776  static_assert(0 == ParticleType::StorageParticleType::NReal, "ParticleTile 2 mismatch in R");
-
777  static_assert(0 == ParticleType::StorageParticleType::NInt, "ParticleTile 2 mismatch in I");
+
733  void define (int a_num_runtime_real, int a_num_runtime_int)
+
734  {
+
735  m_defined = true;
+
736  GetStructOfArrays().define(a_num_runtime_real, a_num_runtime_int);
+
737  m_runtime_r_ptrs.resize(a_num_runtime_real);
+
738  m_runtime_i_ptrs.resize(a_num_runtime_int);
+
739  m_runtime_r_cptrs.resize(a_num_runtime_real);
+
740  m_runtime_i_cptrs.resize(a_num_runtime_int);
+
741  }
+
742 
+
743  // Get id data
+
744  decltype(auto) id (int index) & {
+
745  if constexpr (!ParticleType::is_soa_particle) {
+
746  return m_aos_tile[index].id();
+
747  } else {
+
748  return ParticleIDWrapper(m_soa_tile.GetIdCPUData()[index]);
+
749  }
+
750  }
+
751 
+
752  // const
+
753  decltype(auto) id (int index) const & {
+
754  if constexpr (!ParticleType::is_soa_particle) {
+
755  return m_aos_tile[index].id();
+
756  } else {
+
757  return ConstParticleIDWrapper(m_soa_tile.GetIdCPUData()[index]);
+
758  }
+
759  }
+
760 
+
761  // Get cpu data
+
762  decltype(auto) cpu (int index) & {
+
763  if constexpr (!ParticleType::is_soa_particle) {
+
764  return m_aos_tile[index].cpu();
+
765  } else {
+
766  return ParticleCPUWrapper(m_soa_tile.GetIdCPUData()[index]);
+
767  }
+
768  }
+
769 
+
770  // const
+
771  decltype(auto) cpu (int index) const & {
+
772  if constexpr (!ParticleType::is_soa_particle) {
+
773  return m_aos_tile[index].cpu();
+
774  } else {
+
775  return ConstParticleCPUWrapper(m_soa_tile.GetIdCPUData()[index]);
+
776  }
+
777  }
778 
-
779  return m_soa_tile.GetRealData(position_index)[index];
-
780  }
-
781  }
-
782 
-
783  // const
-
784  RealType pos (int index, int position_index) const &
-
785  {
-
786  if constexpr (!ParticleType::is_soa_particle) {
-
787  return m_aos_tile[index].pos(position_index);
-
788  } else {
+
779  // Get positions data
+
780  RealType& pos (int index, int position_index) & {
+
781  if constexpr (!ParticleType::is_soa_particle) {
+
782  return m_aos_tile[index].pos(position_index);
+
783  } else {
+
784  static_assert(NArrayReal == ParticleType::PTD::NAR, "ParticleTile mismatch in R");
+
785  static_assert(NArrayInt == ParticleType::PTD::NAI, "ParticleTile mismatch in I");
+
786  static_assert(0 == ParticleType::StorageParticleType::NReal, "ParticleTile 2 mismatch in R");
+
787  static_assert(0 == ParticleType::StorageParticleType::NInt, "ParticleTile 2 mismatch in I");
+
788 
789  return m_soa_tile.GetRealData(position_index)[index];
790  }
791  }
792 
-
793  AoS& GetArrayOfStructs () { return m_aos_tile; }
-
794  const AoS& GetArrayOfStructs () const { return m_aos_tile; }
-
795 
-
796  SoA& GetStructOfArrays () { return m_soa_tile; }
-
797  const SoA& GetStructOfArrays () const { return m_soa_tile; }
-
798 
-
799  bool empty () const { return size() == 0; }
-
800 
-
805  std::size_t size () const
-
806  {
-
807  if constexpr (!ParticleType::is_soa_particle) {
-
808  return m_aos_tile.size();
-
809  } else {
-
810  return m_soa_tile.size();
-
811  }
-
812  }
-
813 
-
818  int numParticles () const
-
819  {
-
820  if constexpr (!ParticleType::is_soa_particle) {
-
821  return m_aos_tile.numParticles();
-
822  } else {
-
823  return m_soa_tile.numParticles();
-
824  }
-
825  }
-
826 
-
831  int numRealParticles () const
-
832  {
-
833  if constexpr (!ParticleType::is_soa_particle) {
-
834  return m_aos_tile.numRealParticles();
-
835  } else {
-
836  return m_soa_tile.numRealParticles();
-
837  }
-
838  }
-
839 
-
844  int numNeighborParticles () const
-
845  {
-
846  if constexpr (!ParticleType::is_soa_particle) {
-
847  return m_aos_tile.numNeighborParticles();
-
848  } else {
-
849  return m_soa_tile.numNeighborParticles();
-
850  }
-
851  }
-
852 
-
857  int numTotalParticles () const
-
858  {
-
859  if constexpr (!ParticleType::is_soa_particle) {
-
860  return m_aos_tile.numTotalParticles();
-
861  } else {
-
862  return m_soa_tile.numTotalParticles();
-
863  }
-
864  }
-
865 
-
866  void setNumNeighbors (int num_neighbors)
-
867  {
-
868  if constexpr(!ParticleType::is_soa_particle) {
-
869  m_aos_tile.setNumNeighbors(num_neighbors);
-
870  }
-
871  m_soa_tile.setNumNeighbors(num_neighbors);
-
872  }
-
873 
-
874  int getNumNeighbors () const
-
875  {
-
876  if constexpr (!ParticleType::is_soa_particle) {
-
877  AMREX_ASSERT( m_soa_tile.getNumNeighbors() == m_aos_tile.getNumNeighbors() );
-
878  return m_aos_tile.getNumNeighbors();
-
879  } else {
-
880  return m_soa_tile.getNumNeighbors();
-
881  }
+
793  // const
+
794  RealType pos (int index, int position_index) const &
+
795  {
+
796  if constexpr (!ParticleType::is_soa_particle) {
+
797  return m_aos_tile[index].pos(position_index);
+
798  } else {
+
799  return m_soa_tile.GetRealData(position_index)[index];
+
800  }
+
801  }
+
802 
+
803  AoS& GetArrayOfStructs () { return m_aos_tile; }
+
804  const AoS& GetArrayOfStructs () const { return m_aos_tile; }
+
805 
+
806  SoA& GetStructOfArrays () { return m_soa_tile; }
+
807  const SoA& GetStructOfArrays () const { return m_soa_tile; }
+
808 
+
809  bool empty () const { return size() == 0; }
+
810 
+
815  std::size_t size () const
+
816  {
+
817  if constexpr (!ParticleType::is_soa_particle) {
+
818  return m_aos_tile.size();
+
819  } else {
+
820  return m_soa_tile.size();
+
821  }
+
822  }
+
823 
+
828  int numParticles () const
+
829  {
+
830  if constexpr (!ParticleType::is_soa_particle) {
+
831  return m_aos_tile.numParticles();
+
832  } else {
+
833  return m_soa_tile.numParticles();
+
834  }
+
835  }
+
836 
+
841  int numRealParticles () const
+
842  {
+
843  if constexpr (!ParticleType::is_soa_particle) {
+
844  return m_aos_tile.numRealParticles();
+
845  } else {
+
846  return m_soa_tile.numRealParticles();
+
847  }
+
848  }
+
849 
+
854  int numNeighborParticles () const
+
855  {
+
856  if constexpr (!ParticleType::is_soa_particle) {
+
857  return m_aos_tile.numNeighborParticles();
+
858  } else {
+
859  return m_soa_tile.numNeighborParticles();
+
860  }
+
861  }
+
862 
+
867  int numTotalParticles () const
+
868  {
+
869  if constexpr (!ParticleType::is_soa_particle) {
+
870  return m_aos_tile.numTotalParticles();
+
871  } else {
+
872  return m_soa_tile.numTotalParticles();
+
873  }
+
874  }
+
875 
+
876  void setNumNeighbors (int num_neighbors)
+
877  {
+
878  if constexpr(!ParticleType::is_soa_particle) {
+
879  m_aos_tile.setNumNeighbors(num_neighbors);
+
880  }
+
881  m_soa_tile.setNumNeighbors(num_neighbors);
882  }
883 
-
884  void resize (std::size_t count)
-
885  {
+
884  int getNumNeighbors () const
+
885  {
886  if constexpr (!ParticleType::is_soa_particle) {
-
887  m_aos_tile.resize(count);
-
888  }
-
889  m_soa_tile.resize(count);
-
890  }
-
891 
-
895  template <typename T = ParticleType, std::enable_if_t<!T::is_soa_particle, int> = 0>
-
896  void push_back (const ParticleType& p) { m_aos_tile().push_back(p); }
-
897 
-
901  template < int NR = NArrayReal, int NI = NArrayInt,
-
902  std::enable_if_t<NR != 0 || NI != 0, int> foo = 0>
-
903  void push_back (const SuperParticleType& sp)
-
904  {
-
905  auto np = numParticles();
-
906 
-
907  if constexpr (!ParticleType::is_soa_particle) {
-
908  m_aos_tile.resize(np+1);
-
909  for (int i = 0; i < AMREX_SPACEDIM; ++i) {
-
910  m_aos_tile[np].pos(i) = sp.pos(i);
-
911  }
-
912  for (int i = 0; i < NStructReal; ++i) {
-
913  m_aos_tile[np].rdata(i) = sp.rdata(i);
-
914  }
-
915  m_aos_tile[np].id() = sp.id();
-
916  m_aos_tile[np].cpu() = sp.cpu();
-
917  for (int i = 0; i < NStructInt; ++i) {
-
918  m_aos_tile[np].idata(i) = sp.idata(i);
-
919  }
-
920  }
-
921 
-
922  m_soa_tile.resize(np+1);
-
923  if constexpr (ParticleType::is_soa_particle) {
-
924  m_soa_tile.GetIdCPUData()[np] = sp.m_idcpu;
-
925  }
-
926  auto& arr_rdata = m_soa_tile.GetRealData();
-
927  auto& arr_idata = m_soa_tile.GetIntData();
-
928  for (int i = 0; i < NArrayReal; ++i) {
-
929  arr_rdata[i][np] = sp.rdata(NStructReal+i);
+
887  AMREX_ASSERT( m_soa_tile.getNumNeighbors() == m_aos_tile.getNumNeighbors() );
+
888  return m_aos_tile.getNumNeighbors();
+
889  } else {
+
890  return m_soa_tile.getNumNeighbors();
+
891  }
+
892  }
+
893 
+
894  void resize (std::size_t count)
+
895  {
+
896  if constexpr (!ParticleType::is_soa_particle) {
+
897  m_aos_tile.resize(count);
+
898  }
+
899  m_soa_tile.resize(count);
+
900  }
+
901 
+
905  template <typename T = ParticleType, std::enable_if_t<!T::is_soa_particle, int> = 0>
+
906  void push_back (const ParticleType& p) { m_aos_tile().push_back(p); }
+
907 
+
911  template < int NR = NArrayReal, int NI = NArrayInt,
+
912  std::enable_if_t<NR != 0 || NI != 0, int> foo = 0>
+
913  void push_back (const SuperParticleType& sp)
+
914  {
+
915  auto np = numParticles();
+
916 
+
917  if constexpr (!ParticleType::is_soa_particle) {
+
918  m_aos_tile.resize(np+1);
+
919  for (int i = 0; i < AMREX_SPACEDIM; ++i) {
+
920  m_aos_tile[np].pos(i) = sp.pos(i);
+
921  }
+
922  for (int i = 0; i < NStructReal; ++i) {
+
923  m_aos_tile[np].rdata(i) = sp.rdata(i);
+
924  }
+
925  m_aos_tile[np].id() = sp.id();
+
926  m_aos_tile[np].cpu() = sp.cpu();
+
927  for (int i = 0; i < NStructInt; ++i) {
+
928  m_aos_tile[np].idata(i) = sp.idata(i);
+
929  }
930  }
-
931  for (int i = 0; i < NArrayInt; ++i) {
-
932  arr_idata[i][np] = sp.idata(NStructInt+i);
-
933  }
-
934  }
-
935 
-
940  void push_back_real (int comp, ParticleReal v) {
-
941  m_soa_tile.GetRealData(comp).push_back(v);
-
942  }
-
943 
-
948  void push_back_real (const std::array<ParticleReal, NArrayReal>& v) {
-
949  for (int i = 0; i < NArrayReal; ++i) {
-
950  m_soa_tile.GetRealData(i).push_back(v[i]);
-
951  }
+
931 
+
932  m_soa_tile.resize(np+1);
+
933  if constexpr (ParticleType::is_soa_particle) {
+
934  m_soa_tile.GetIdCPUData()[np] = sp.m_idcpu;
+
935  }
+
936  auto& arr_rdata = m_soa_tile.GetRealData();
+
937  auto& arr_idata = m_soa_tile.GetIntData();
+
938  for (int i = 0; i < NArrayReal; ++i) {
+
939  arr_rdata[i][np] = sp.rdata(NStructReal+i);
+
940  }
+
941  for (int i = 0; i < NArrayInt; ++i) {
+
942  arr_idata[i][np] = sp.idata(NStructInt+i);
+
943  }
+
944  }
+
945 
+
950  void push_back_real (int comp, ParticleReal v) {
+
951  m_soa_tile.GetRealData(comp).push_back(v);
952  }
953 
-
958  void push_back_real (int comp, const ParticleReal* beg, const ParticleReal* end) {
-
959  auto it = m_soa_tile.GetRealData(comp).end();
-
960  m_soa_tile.GetRealData(comp).insert(it, beg, end);
-
961  }
-
962 
-
967  void push_back_real (int comp, amrex::Vector<amrex::ParticleReal>::const_iterator beg, amrex::Vector<amrex::ParticleReal>::const_iterator end) {
-
968  push_back_real(comp, &(*beg), &(*end));
-
969  }
-
970 
-
975  void push_back_real (int comp, amrex::Vector<amrex::ParticleReal> const & vec) {
-
976  push_back_real(comp, vec.cbegin(), vec.cend());
-
977  }
-
978 
-
983  void push_back_real (int comp, std::size_t npar, ParticleReal v) {
-
984  auto new_size = m_soa_tile.GetRealData(comp).size() + npar;
-
985  m_soa_tile.GetRealData(comp).resize(new_size, v);
-
986  }
-
987 
-
992  void push_back_int (int comp, int v) {
-
993  m_soa_tile.GetIntData(comp).push_back(v);
-
994  }
-
995 
-
1000  void push_back_int (const std::array<int, NArrayInt>& v) {
-
1001  for (int i = 0; i < NArrayInt; ++i) {
-
1002  m_soa_tile.GetIntData(i).push_back(v[i]);
-
1003  }
+
958  void push_back_real (const std::array<ParticleReal, NArrayReal>& v) {
+
959  for (int i = 0; i < NArrayReal; ++i) {
+
960  m_soa_tile.GetRealData(i).push_back(v[i]);
+
961  }
+
962  }
+
963 
+
968  void push_back_real (int comp, const ParticleReal* beg, const ParticleReal* end) {
+
969  auto it = m_soa_tile.GetRealData(comp).end();
+
970  m_soa_tile.GetRealData(comp).insert(it, beg, end);
+
971  }
+
972 
+
977  void push_back_real (int comp, amrex::Vector<amrex::ParticleReal>::const_iterator beg, amrex::Vector<amrex::ParticleReal>::const_iterator end) {
+
978  push_back_real(comp, &(*beg), &(*end));
+
979  }
+
980 
+
985  void push_back_real (int comp, amrex::Vector<amrex::ParticleReal> const & vec) {
+
986  push_back_real(comp, vec.cbegin(), vec.cend());
+
987  }
+
988 
+
993  void push_back_real (int comp, std::size_t npar, ParticleReal v) {
+
994  auto new_size = m_soa_tile.GetRealData(comp).size() + npar;
+
995  m_soa_tile.GetRealData(comp).resize(new_size, v);
+
996  }
+
997 
+
1002  void push_back_int (int comp, int v) {
+
1003  m_soa_tile.GetIntData(comp).push_back(v);
1004  }
1005 
-
1010  void push_back_int (int comp, const int* beg, const int* end) {
-
1011  auto it = m_soa_tile.GetIntData(comp).end();
-
1012  m_soa_tile.GetIntData(comp).insert(it, beg, end);
-
1013  }
-
1014 
-
1019  void push_back_int (int comp, amrex::Vector<int>::const_iterator beg, amrex::Vector<int>::const_iterator end) {
-
1020  push_back_int(comp, &(*beg), &(*end));
-
1021  }
-
1022 
-
1027  void push_back_int (int comp, amrex::Vector<int> const & vec) {
-
1028  push_back_int(comp, vec.cbegin(), vec.cend());
-
1029  }
-
1030 
-
1035  void push_back_int (int comp, std::size_t npar, int v) {
-
1036  auto new_size = m_soa_tile.GetIntData(comp).size() + npar;
-
1037  m_soa_tile.GetIntData(comp).resize(new_size, v);
-
1038  }
-
1039 
-
1040  int NumRealComps () const noexcept { return m_soa_tile.NumRealComps(); }
-
1041 
-
1042  int NumIntComps () const noexcept { return m_soa_tile.NumIntComps(); }
-
1043 
-
1044  int NumRuntimeRealComps () const noexcept { return m_runtime_r_ptrs.size(); }
-
1045 
-
1046  int NumRuntimeIntComps () const noexcept { return m_runtime_i_ptrs.size(); }
-
1047 
-
1048  void shrink_to_fit ()
-
1049  {
-
1050  if constexpr (ParticleType::is_soa_particle) {
-
1051  GetStructOfArrays().GetIdCPUData().shrink_to_fit();
-
1052  } else {
-
1053  m_aos_tile().shrink_to_fit();
-
1054  }
-
1055  for (int j = 0; j < NumRealComps(); ++j)
-
1056  {
-
1057  auto& rdata = GetStructOfArrays().GetRealData(j);
-
1058  rdata.shrink_to_fit();
-
1059  }
-
1060 
-
1061  for (int j = 0; j < NumIntComps(); ++j)
-
1062  {
-
1063  auto& idata = GetStructOfArrays().GetIntData(j);
-
1064  idata.shrink_to_fit();
-
1065  }
-
1066  }
-
1067 
-
1068  Long capacity () const
-
1069  {
-
1070  Long nbytes = 0;
-
1071  if constexpr (ParticleType::is_soa_particle) {
-
1072  nbytes += GetStructOfArrays().GetIdCPUData().capacity() * sizeof(uint64_t);
-
1073  } else {
-
1074  nbytes += m_aos_tile().capacity() * sizeof(ParticleType);
+
1010  void push_back_int (const std::array<int, NArrayInt>& v) {
+
1011  for (int i = 0; i < NArrayInt; ++i) {
+
1012  m_soa_tile.GetIntData(i).push_back(v[i]);
+
1013  }
+
1014  }
+
1015 
+
1020  void push_back_int (int comp, const int* beg, const int* end) {
+
1021  auto it = m_soa_tile.GetIntData(comp).end();
+
1022  m_soa_tile.GetIntData(comp).insert(it, beg, end);
+
1023  }
+
1024 
+
1029  void push_back_int (int comp, amrex::Vector<int>::const_iterator beg, amrex::Vector<int>::const_iterator end) {
+
1030  push_back_int(comp, &(*beg), &(*end));
+
1031  }
+
1032 
+
1037  void push_back_int (int comp, amrex::Vector<int> const & vec) {
+
1038  push_back_int(comp, vec.cbegin(), vec.cend());
+
1039  }
+
1040 
+
1045  void push_back_int (int comp, std::size_t npar, int v) {
+
1046  auto new_size = m_soa_tile.GetIntData(comp).size() + npar;
+
1047  m_soa_tile.GetIntData(comp).resize(new_size, v);
+
1048  }
+
1049 
+
1050  int NumRealComps () const noexcept { return m_soa_tile.NumRealComps(); }
+
1051 
+
1052  int NumIntComps () const noexcept { return m_soa_tile.NumIntComps(); }
+
1053 
+
1054  int NumRuntimeRealComps () const noexcept { return m_runtime_r_ptrs.size(); }
+
1055 
+
1056  int NumRuntimeIntComps () const noexcept { return m_runtime_i_ptrs.size(); }
+
1057 
+
1058  void shrink_to_fit ()
+
1059  {
+
1060  if constexpr (ParticleType::is_soa_particle) {
+
1061  GetStructOfArrays().GetIdCPUData().shrink_to_fit();
+
1062  } else {
+
1063  m_aos_tile().shrink_to_fit();
+
1064  }
+
1065  for (int j = 0; j < NumRealComps(); ++j)
+
1066  {
+
1067  auto& rdata = GetStructOfArrays().GetRealData(j);
+
1068  rdata.shrink_to_fit();
+
1069  }
+
1070 
+
1071  for (int j = 0; j < NumIntComps(); ++j)
+
1072  {
+
1073  auto& idata = GetStructOfArrays().GetIntData(j);
+
1074  idata.shrink_to_fit();
1075  }
-
1076  for (int j = 0; j < NumRealComps(); ++j)
-
1077  {
-
1078  auto& rdata = GetStructOfArrays().GetRealData(j);
-
1079  nbytes += rdata.capacity() * sizeof(ParticleReal);
-
1080  }
-
1081 
-
1082  for (int j = 0; j < NumIntComps(); ++j)
-
1083  {
-
1084  auto& idata = GetStructOfArrays().GetIntData(j);
-
1085  nbytes += idata.capacity()*sizeof(int);
-
1086  }
-
1087  return nbytes;
-
1088  }
-
1089 
-
1090  void swap (ParticleTile<ParticleType, NArrayReal, NArrayInt, Allocator>& other) noexcept
-
1091  {
-
1092  if constexpr (ParticleType::is_soa_particle) {
-
1093  GetStructOfArrays().GetIdCPUData().swap(other.GetStructOfArrays().GetIdCPUData());
-
1094  } else {
-
1095  m_aos_tile().swap(other.GetArrayOfStructs()());
+
1076  }
+
1077 
+
1078  Long capacity () const
+
1079  {
+
1080  Long nbytes = 0;
+
1081  if constexpr (ParticleType::is_soa_particle) {
+
1082  nbytes += GetStructOfArrays().GetIdCPUData().capacity() * sizeof(uint64_t);
+
1083  } else {
+
1084  nbytes += m_aos_tile().capacity() * sizeof(ParticleType);
+
1085  }
+
1086  for (int j = 0; j < NumRealComps(); ++j)
+
1087  {
+
1088  auto& rdata = GetStructOfArrays().GetRealData(j);
+
1089  nbytes += rdata.capacity() * sizeof(ParticleReal);
+
1090  }
+
1091 
+
1092  for (int j = 0; j < NumIntComps(); ++j)
+
1093  {
+
1094  auto& idata = GetStructOfArrays().GetIntData(j);
+
1095  nbytes += idata.capacity()*sizeof(int);
1096  }
-
1097  for (int j = 0; j < NumRealComps(); ++j)
-
1098  {
-
1099  auto& rdata = GetStructOfArrays().GetRealData(j);
-
1100  rdata.swap(other.GetStructOfArrays().GetRealData(j));
-
1101  }
-
1102 
-
1103  for (int j = 0; j < NumIntComps(); ++j)
-
1104  {
-
1105  auto& idata = GetStructOfArrays().GetIntData(j);
-
1106  idata.swap(other.GetStructOfArrays().GetIntData(j));
-
1107  }
-
1108  }
-
1109 
-
1110  ParticleTileDataType getParticleTileData ()
-
1111  {
-
1112  m_runtime_r_ptrs.resize(m_soa_tile.NumRealComps() - NArrayReal);
-
1113  m_runtime_i_ptrs.resize(m_soa_tile.NumIntComps() - NArrayInt);
-
1114 #ifdef AMREX_USE_GPU
-
1115  bool copy_real = false;
-
1116  m_h_runtime_r_ptrs.resize(m_soa_tile.NumRealComps() - NArrayReal, nullptr);
-
1117  for (std::size_t i = 0; i < m_h_runtime_r_ptrs.size(); ++i) {
-
1118  if (m_h_runtime_r_ptrs[i] != m_soa_tile.GetRealData(i + NArrayReal).dataPtr()) {
-
1119  m_h_runtime_r_ptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
-
1120  copy_real = true;
-
1121  }
-
1122  }
-
1123  if (copy_real) {
-
1124  Gpu::htod_memcpy_async(m_runtime_r_ptrs.data(), m_h_runtime_r_ptrs.data(),
-
1125  m_h_runtime_r_ptrs.size()*sizeof(ParticleReal*));
-
1126  }
-
1127 
-
1128  bool copy_int = false;
-
1129  m_h_runtime_i_ptrs.resize(m_soa_tile.NumIntComps() - NArrayInt, nullptr);
-
1130  for (std::size_t i = 0; i < m_h_runtime_i_ptrs.size(); ++i) {
-
1131  if (m_h_runtime_i_ptrs[i] != m_soa_tile.GetIntData(i + NArrayInt).dataPtr()) {
-
1132  m_h_runtime_i_ptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
-
1133  copy_int = true;
-
1134  }
-
1135  }
-
1136  if (copy_int) {
-
1137  Gpu::htod_memcpy_async(m_runtime_i_ptrs.data(), m_h_runtime_i_ptrs.data(),
-
1138  m_h_runtime_i_ptrs.size()*sizeof(int*));
-
1139  }
-
1140 #else
-
1141  for (std::size_t i = 0; i < m_runtime_r_ptrs.size(); ++i) {
-
1142  m_runtime_r_ptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
-
1143  }
-
1144 
-
1145  for (std::size_t i = 0; i < m_runtime_i_ptrs.size(); ++i) {
-
1146  m_runtime_i_ptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
-
1147  }
-
1148 #endif
-
1149 
-
1150  ParticleTileDataType ptd;
-
1151  if constexpr (!ParticleType::is_soa_particle) {
-
1152  ptd.m_aos = m_aos_tile().dataPtr();
-
1153  } else {
-
1154  ptd.m_aos = nullptr;
-
1155  }
-
1156  if constexpr (ParticleType::is_soa_particle) {
-
1157  ptd.m_idcpu = m_soa_tile.GetIdCPUData().dataPtr();
-
1158  } else {
-
1159  ptd.m_idcpu = nullptr;
-
1160  }
-
1161  if constexpr(NArrayReal > 0) {
-
1162  for (int i = 0; i < NArrayReal; ++i) {
-
1163  ptd.m_rdata[i] = m_soa_tile.GetRealData(i).dataPtr();
-
1164  }
+
1097  return nbytes;
+
1098  }
+
1099 
+
1100  void swap (ParticleTile<ParticleType, NArrayReal, NArrayInt, Allocator>& other) noexcept
+
1101  {
+
1102  if constexpr (ParticleType::is_soa_particle) {
+
1103  GetStructOfArrays().GetIdCPUData().swap(other.GetStructOfArrays().GetIdCPUData());
+
1104  } else {
+
1105  m_aos_tile().swap(other.GetArrayOfStructs()());
+
1106  }
+
1107  for (int j = 0; j < NumRealComps(); ++j)
+
1108  {
+
1109  auto& rdata = GetStructOfArrays().GetRealData(j);
+
1110  rdata.swap(other.GetStructOfArrays().GetRealData(j));
+
1111  }
+
1112 
+
1113  for (int j = 0; j < NumIntComps(); ++j)
+
1114  {
+
1115  auto& idata = GetStructOfArrays().GetIntData(j);
+
1116  idata.swap(other.GetStructOfArrays().GetIntData(j));
+
1117  }
+
1118  }
+
1119 
+
1120  ParticleTileDataType getParticleTileData ()
+
1121  {
+
1122  m_runtime_r_ptrs.resize(m_soa_tile.NumRealComps() - NArrayReal);
+
1123  m_runtime_i_ptrs.resize(m_soa_tile.NumIntComps() - NArrayInt);
+
1124 #ifdef AMREX_USE_GPU
+
1125  bool copy_real = false;
+
1126  m_h_runtime_r_ptrs.resize(m_soa_tile.NumRealComps() - NArrayReal, nullptr);
+
1127  for (std::size_t i = 0; i < m_h_runtime_r_ptrs.size(); ++i) {
+
1128  if (m_h_runtime_r_ptrs[i] != m_soa_tile.GetRealData(i + NArrayReal).dataPtr()) {
+
1129  m_h_runtime_r_ptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
+
1130  copy_real = true;
+
1131  }
+
1132  }
+
1133  if (copy_real) {
+
1134  Gpu::htod_memcpy_async(m_runtime_r_ptrs.data(), m_h_runtime_r_ptrs.data(),
+
1135  m_h_runtime_r_ptrs.size()*sizeof(ParticleReal*));
+
1136  }
+
1137 
+
1138  bool copy_int = false;
+
1139  m_h_runtime_i_ptrs.resize(m_soa_tile.NumIntComps() - NArrayInt, nullptr);
+
1140  for (std::size_t i = 0; i < m_h_runtime_i_ptrs.size(); ++i) {
+
1141  if (m_h_runtime_i_ptrs[i] != m_soa_tile.GetIntData(i + NArrayInt).dataPtr()) {
+
1142  m_h_runtime_i_ptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
+
1143  copy_int = true;
+
1144  }
+
1145  }
+
1146  if (copy_int) {
+
1147  Gpu::htod_memcpy_async(m_runtime_i_ptrs.data(), m_h_runtime_i_ptrs.data(),
+
1148  m_h_runtime_i_ptrs.size()*sizeof(int*));
+
1149  }
+
1150 #else
+
1151  for (std::size_t i = 0; i < m_runtime_r_ptrs.size(); ++i) {
+
1152  m_runtime_r_ptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
+
1153  }
+
1154 
+
1155  for (std::size_t i = 0; i < m_runtime_i_ptrs.size(); ++i) {
+
1156  m_runtime_i_ptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
+
1157  }
+
1158 #endif
+
1159 
+
1160  ParticleTileDataType ptd;
+
1161  if constexpr (!ParticleType::is_soa_particle) {
+
1162  ptd.m_aos = m_aos_tile().dataPtr();
+
1163  } else {
+
1164  ptd.m_aos = nullptr;
1165  }
-
1166  if constexpr(NArrayInt > 0) {
-
1167  for (int i = 0; i < NArrayInt; ++i) {
-
1168  ptd.m_idata[i] = m_soa_tile.GetIntData(i).dataPtr();
-
1169  }
+
1166  if constexpr (ParticleType::is_soa_particle) {
+
1167  ptd.m_idcpu = m_soa_tile.GetIdCPUData().dataPtr();
+
1168  } else {
+
1169  ptd.m_idcpu = nullptr;
1170  }
-
1171  ptd.m_size = size();
-
1172  ptd.m_num_runtime_real = m_runtime_r_ptrs.size();
-
1173  ptd.m_num_runtime_int = m_runtime_i_ptrs.size();
-
1174  ptd.m_runtime_rdata = m_runtime_r_ptrs.dataPtr();
-
1175  ptd.m_runtime_idata = m_runtime_i_ptrs.dataPtr();
-
1176 
-
1177 #ifdef AMREX_USE_GPU
-
1178  if (copy_real || copy_int) {
-
1179  Gpu::streamSynchronize();
+
1171  if constexpr(NArrayReal > 0) {
+
1172  for (int i = 0; i < NArrayReal; ++i) {
+
1173  ptd.m_rdata[i] = m_soa_tile.GetRealData(i).dataPtr();
+
1174  }
+
1175  }
+
1176  if constexpr(NArrayInt > 0) {
+
1177  for (int i = 0; i < NArrayInt; ++i) {
+
1178  ptd.m_idata[i] = m_soa_tile.GetIntData(i).dataPtr();
+
1179  }
1180  }
-
1181 #endif
-
1182 
-
1183  return ptd;
-
1184  }
-
1185 
-
1186  ConstParticleTileDataType getConstParticleTileData () const
-
1187  {
-
1188  m_runtime_r_cptrs.resize(m_soa_tile.NumRealComps() - NArrayReal);
-
1189  m_runtime_i_cptrs.resize(m_soa_tile.NumIntComps() - NArrayInt);
-
1190 #ifdef AMREX_USE_GPU
-
1191  bool copy_real = false;
-
1192  m_h_runtime_r_cptrs.resize(m_soa_tile.NumRealComps() - NArrayReal, nullptr);
-
1193  for (std::size_t i = 0; i < m_h_runtime_r_cptrs.size(); ++i) {
-
1194  if (m_h_runtime_r_cptrs[i] != m_soa_tile.GetRealData(i + NArrayReal).dataPtr()) {
-
1195  m_h_runtime_r_cptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
-
1196  copy_real = true;
-
1197  }
-
1198  }
-
1199  if (copy_real) {
-
1200  Gpu::htod_memcpy_async(m_runtime_r_cptrs.data(), m_h_runtime_r_cptrs.data(),
-
1201  m_h_runtime_r_cptrs.size()*sizeof(ParticleReal*));
-
1202  }
-
1203 
-
1204  bool copy_int = false;
-
1205  m_h_runtime_i_cptrs.resize(m_soa_tile.NumIntComps() - NArrayInt, nullptr);
-
1206  for (std::size_t i = 0; i < m_h_runtime_i_cptrs.size(); ++i) {
-
1207  if (m_h_runtime_i_cptrs[i] != m_soa_tile.GetIntData(i + NArrayInt).dataPtr()) {
-
1208  m_h_runtime_i_cptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
-
1209  copy_int = true;
-
1210  }
-
1211  }
-
1212  if (copy_int) {
-
1213  Gpu::htod_memcpy_async(m_runtime_i_cptrs.data(), m_h_runtime_i_cptrs.data(),
-
1214  m_h_runtime_i_cptrs.size()*sizeof(int*));
-
1215  }
-
1216 #else
-
1217  for (std::size_t i = 0; i < m_runtime_r_cptrs.size(); ++i) {
-
1218  m_runtime_r_cptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
-
1219  }
-
1220 
-
1221  for (std::size_t i = 0; i < m_runtime_i_cptrs.size(); ++i) {
-
1222  m_runtime_i_cptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
-
1223  }
-
1224 #endif
-
1225 
-
1226  ConstParticleTileDataType ptd;
-
1227  if constexpr (!ParticleType::is_soa_particle) {
-
1228  ptd.m_aos = m_aos_tile().dataPtr();
-
1229  } else {
-
1230  ptd.m_aos = nullptr;
-
1231  }
-
1232  if constexpr (ParticleType::is_soa_particle) {
-
1233  ptd.m_idcpu = m_soa_tile.GetIdCPUData().dataPtr();
-
1234  } else {
-
1235  ptd.m_idcpu = nullptr;
-
1236  }
-
1237  if constexpr(NArrayReal > 0) {
-
1238  for (int i = 0; i < NArrayReal; ++i) {
-
1239  ptd.m_rdata[i] = m_soa_tile.GetRealData(i).dataPtr();
-
1240  }
+
1181  ptd.m_size = size();
+
1182  ptd.m_num_runtime_real = m_runtime_r_ptrs.size();
+
1183  ptd.m_num_runtime_int = m_runtime_i_ptrs.size();
+
1184  ptd.m_runtime_rdata = m_runtime_r_ptrs.dataPtr();
+
1185  ptd.m_runtime_idata = m_runtime_i_ptrs.dataPtr();
+
1186 
+
1187 #ifdef AMREX_USE_GPU
+
1188  if (copy_real || copy_int) {
+
1189  Gpu::streamSynchronize();
+
1190  }
+
1191 #endif
+
1192 
+
1193  return ptd;
+
1194  }
+
1195 
+
1196  ConstParticleTileDataType getConstParticleTileData () const
+
1197  {
+
1198  m_runtime_r_cptrs.resize(m_soa_tile.NumRealComps() - NArrayReal);
+
1199  m_runtime_i_cptrs.resize(m_soa_tile.NumIntComps() - NArrayInt);
+
1200 #ifdef AMREX_USE_GPU
+
1201  bool copy_real = false;
+
1202  m_h_runtime_r_cptrs.resize(m_soa_tile.NumRealComps() - NArrayReal, nullptr);
+
1203  for (std::size_t i = 0; i < m_h_runtime_r_cptrs.size(); ++i) {
+
1204  if (m_h_runtime_r_cptrs[i] != m_soa_tile.GetRealData(i + NArrayReal).dataPtr()) {
+
1205  m_h_runtime_r_cptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
+
1206  copy_real = true;
+
1207  }
+
1208  }
+
1209  if (copy_real) {
+
1210  Gpu::htod_memcpy_async(m_runtime_r_cptrs.data(), m_h_runtime_r_cptrs.data(),
+
1211  m_h_runtime_r_cptrs.size()*sizeof(ParticleReal*));
+
1212  }
+
1213 
+
1214  bool copy_int = false;
+
1215  m_h_runtime_i_cptrs.resize(m_soa_tile.NumIntComps() - NArrayInt, nullptr);
+
1216  for (std::size_t i = 0; i < m_h_runtime_i_cptrs.size(); ++i) {
+
1217  if (m_h_runtime_i_cptrs[i] != m_soa_tile.GetIntData(i + NArrayInt).dataPtr()) {
+
1218  m_h_runtime_i_cptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
+
1219  copy_int = true;
+
1220  }
+
1221  }
+
1222  if (copy_int) {
+
1223  Gpu::htod_memcpy_async(m_runtime_i_cptrs.data(), m_h_runtime_i_cptrs.data(),
+
1224  m_h_runtime_i_cptrs.size()*sizeof(int*));
+
1225  }
+
1226 #else
+
1227  for (std::size_t i = 0; i < m_runtime_r_cptrs.size(); ++i) {
+
1228  m_runtime_r_cptrs[i] = m_soa_tile.GetRealData(i + NArrayReal).dataPtr();
+
1229  }
+
1230 
+
1231  for (std::size_t i = 0; i < m_runtime_i_cptrs.size(); ++i) {
+
1232  m_runtime_i_cptrs[i] = m_soa_tile.GetIntData(i + NArrayInt).dataPtr();
+
1233  }
+
1234 #endif
+
1235 
+
1236  ConstParticleTileDataType ptd;
+
1237  if constexpr (!ParticleType::is_soa_particle) {
+
1238  ptd.m_aos = m_aos_tile().dataPtr();
+
1239  } else {
+
1240  ptd.m_aos = nullptr;
1241  }
-
1242  if constexpr(NArrayInt > 0) {
-
1243  for (int i = 0; i < NArrayInt; ++i) {
-
1244  ptd.m_idata[i] = m_soa_tile.GetIntData(i).dataPtr();
-
1245  }
+
1242  if constexpr (ParticleType::is_soa_particle) {
+
1243  ptd.m_idcpu = m_soa_tile.GetIdCPUData().dataPtr();
+
1244  } else {
+
1245  ptd.m_idcpu = nullptr;
1246  }
-
1247  ptd.m_size = size();
-
1248  ptd.m_num_runtime_real = m_runtime_r_cptrs.size();
-
1249  ptd.m_num_runtime_int = m_runtime_i_cptrs.size();
-
1250  ptd.m_runtime_rdata = m_runtime_r_cptrs.dataPtr();
-
1251  ptd.m_runtime_idata = m_runtime_i_cptrs.dataPtr();
-
1252 
-
1253 #ifdef AMREX_USE_GPU
-
1254  if (copy_real || copy_int) {
-
1255  Gpu::streamSynchronize();
+
1247  if constexpr(NArrayReal > 0) {
+
1248  for (int i = 0; i < NArrayReal; ++i) {
+
1249  ptd.m_rdata[i] = m_soa_tile.GetRealData(i).dataPtr();
+
1250  }
+
1251  }
+
1252  if constexpr(NArrayInt > 0) {
+
1253  for (int i = 0; i < NArrayInt; ++i) {
+
1254  ptd.m_idata[i] = m_soa_tile.GetIntData(i).dataPtr();
+
1255  }
1256  }
-
1257 #endif
-
1258 
-
1259  return ptd;
-
1260  }
-
1261 
-
1262 private:
-
1263 
-
1264  AoS m_aos_tile;
-
1265  SoA m_soa_tile;
-
1266 
-
1267  bool m_defined = false;
+
1257  ptd.m_size = size();
+
1258  ptd.m_num_runtime_real = m_runtime_r_cptrs.size();
+
1259  ptd.m_num_runtime_int = m_runtime_i_cptrs.size();
+
1260  ptd.m_runtime_rdata = m_runtime_r_cptrs.dataPtr();
+
1261  ptd.m_runtime_idata = m_runtime_i_cptrs.dataPtr();
+
1262 
+
1263 #ifdef AMREX_USE_GPU
+
1264  if (copy_real || copy_int) {
+
1265  Gpu::streamSynchronize();
+
1266  }
+
1267 #endif
1268 
-
1269  amrex::PODVector<ParticleReal*, Allocator<ParticleReal*> > m_runtime_r_ptrs;
-
1270  amrex::PODVector<int*, Allocator<int*> > m_runtime_i_ptrs;
+
1269  return ptd;
+
1270  }
1271 
-
1272  mutable amrex::PODVector<const ParticleReal*, Allocator<const ParticleReal*> > m_runtime_r_cptrs;
-
1273  mutable amrex::PODVector<const int*, Allocator<const int*> >m_runtime_i_cptrs;
-
1274 
-
1275  amrex::Gpu::HostVector<ParticleReal*> m_h_runtime_r_ptrs;
-
1276  amrex::Gpu::HostVector<int*> m_h_runtime_i_ptrs;
-
1277 
-
1278  mutable amrex::Gpu::HostVector<const ParticleReal*> m_h_runtime_r_cptrs;
-
1279  mutable amrex::Gpu::HostVector<const int*> m_h_runtime_i_cptrs;
-
1280 };
+
1272 private:
+
1273 
+
1274  AoS m_aos_tile;
+
1275  SoA m_soa_tile;
+
1276 
+
1277  bool m_defined = false;
+
1278 
+
1279  amrex::PODVector<ParticleReal*, Allocator<ParticleReal*> > m_runtime_r_ptrs;
+
1280  amrex::PODVector<int*, Allocator<int*> > m_runtime_i_ptrs;
1281 
-
1282 } // namespace amrex
-
1283 
-
1284 #endif // AMREX_PARTICLETILE_H_
+
1282  mutable amrex::PODVector<const ParticleReal*, Allocator<const ParticleReal*> > m_runtime_r_cptrs;
+
1283  mutable amrex::PODVector<const int*, Allocator<const int*> >m_runtime_i_cptrs;
+
1284 
+
1285  amrex::Gpu::HostVector<ParticleReal*> m_h_runtime_r_ptrs;
+
1286  amrex::Gpu::HostVector<int*> m_h_runtime_i_ptrs;
+
1287 
+
1288  mutable amrex::Gpu::HostVector<const ParticleReal*> m_h_runtime_r_cptrs;
+
1289  mutable amrex::Gpu::HostVector<const int*> m_h_runtime_i_cptrs;
+
1290 };
+
1291 
+
1292 } // namespace amrex
+
1293 
+
1294 #endif // AMREX_PARTICLETILE_H_
AMReX_ArrayOfStructs.H
AMREX_ASSERT
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
AMReX_Extension.H
@@ -1395,70 +1405,73 @@
amrex::ParticleTileData::id
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE id(const int index) const &
Definition: AMReX_ParticleTile.H:70
amrex::ParticleTile
Definition: AMReX_ParticleTile.H:690
amrex::ParticleTile::StorageParticleType
typename ParticleType::StorageParticleType StorageParticleType
Definition: AMReX_ParticleTile.H:716
-
amrex::ParticleTile::NumRealComps
int NumRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1040
-
amrex::ParticleTile::GetArrayOfStructs
const AoS & GetArrayOfStructs() const
Definition: AMReX_ParticleTile.H:794
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal > const &vec)
Definition: AMReX_ParticleTile.H:975
-
amrex::ParticleTile::NumIntComps
int NumIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1042
+
amrex::ParticleTile::NumRealComps
int NumRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1050
+
amrex::ParticleTile::GetArrayOfStructs
const AoS & GetArrayOfStructs() const
Definition: AMReX_ParticleTile.H:804
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal > const &vec)
Definition: AMReX_ParticleTile.H:985
+
amrex::ParticleTile::NumIntComps
int NumIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1052
amrex::ParticleTile::RealType
typename ParticleType::RealType RealType
Definition: AMReX_ParticleTile.H:697
amrex::ParticleTile::ParticleTile
ParticleTile()=default
-
amrex::ParticleTile::getNumNeighbors
int getNumNeighbors() const
Definition: AMReX_ParticleTile.H:874
-
amrex::ParticleTile::GetArrayOfStructs
AoS & GetArrayOfStructs()
Definition: AMReX_ParticleTile.H:793
-
amrex::ParticleTile::m_runtime_i_cptrs
amrex::PODVector< const int *, Allocator< const int * > > m_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1273
-
amrex::ParticleTile::push_back
void push_back(const ParticleType &p)
Definition: AMReX_ParticleTile.H:896
+
amrex::ParticleTile::getNumNeighbors
int getNumNeighbors() const
Definition: AMReX_ParticleTile.H:884
+
amrex::ParticleTile::GetArrayOfStructs
AoS & GetArrayOfStructs()
Definition: AMReX_ParticleTile.H:803
+
amrex::ParticleTile::m_runtime_i_cptrs
amrex::PODVector< const int *, Allocator< const int * > > m_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1283
+
amrex::ParticleTile::push_back
void push_back(const ParticleType &p)
Definition: AMReX_ParticleTile.H:906
+
amrex::ParticleTile::ParticleTile
ParticleTile(ParticleTile const &)=delete
amrex::ParticleTile::SoA
std::conditional_t< ParticleType::is_soa_particle, StructOfArrays< NArrayReal, NArrayInt, Allocator, true >, StructOfArrays< NArrayReal, NArrayInt, Allocator, false > > SoA
Definition: AMReX_ParticleTile.H:713
amrex::ParticleTile::NAI
static constexpr int NAI
Definition: AMReX_ParticleTile.H:696
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, const ParticleReal *beg, const ParticleReal *end)
Definition: AMReX_ParticleTile.H:958
+
amrex::ParticleTile::ParticleTile
ParticleTile(ParticleTile &&) noexcept=default
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, const ParticleReal *beg, const ParticleReal *end)
Definition: AMReX_ParticleTile.H:968
amrex::ParticleTile::NStructInt
static constexpr int NStructInt
Definition: AMReX_ParticleTile.H:700
-
amrex::ParticleTile::m_h_runtime_r_cptrs
amrex::Gpu::HostVector< const ParticleReal * > m_h_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1278
-
amrex::ParticleTile::setNumNeighbors
void setNumNeighbors(int num_neighbors)
Definition: AMReX_ParticleTile.H:866
-
amrex::ParticleTile::m_h_runtime_i_ptrs
amrex::Gpu::HostVector< int * > m_h_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1276
-
amrex::ParticleTile::capacity
Long capacity() const
Definition: AMReX_ParticleTile.H:1068
-
amrex::ParticleTile::numTotalParticles
int numTotalParticles() const
Returns the total number of particles, real and neighbor.
Definition: AMReX_ParticleTile.H:857
-
amrex::ParticleTile::m_aos_tile
AoS m_aos_tile
Definition: AMReX_ParticleTile.H:1264
-
amrex::ParticleTile::size
std::size_t size() const
Returns the total number of particles (real and neighbor)
Definition: AMReX_ParticleTile.H:805
-
amrex::ParticleTile::getParticleTileData
ParticleTileDataType getParticleTileData()
Definition: AMReX_ParticleTile.H:1110
-
amrex::ParticleTile::push_back
void push_back(const SuperParticleType &sp)
Definition: AMReX_ParticleTile.H:903
-
amrex::ParticleTile::numNeighborParticles
int numNeighborParticles() const
Returns the number of neighbor particles (excluding reals)
Definition: AMReX_ParticleTile.H:844
-
amrex::ParticleTile::m_runtime_r_ptrs
amrex::PODVector< ParticleReal *, Allocator< ParticleReal * > > m_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1269
+
amrex::ParticleTile::m_h_runtime_r_cptrs
amrex::Gpu::HostVector< const ParticleReal * > m_h_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1288
+
amrex::ParticleTile::setNumNeighbors
void setNumNeighbors(int num_neighbors)
Definition: AMReX_ParticleTile.H:876
+
amrex::ParticleTile::m_h_runtime_i_ptrs
amrex::Gpu::HostVector< int * > m_h_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1286
+
amrex::ParticleTile::capacity
Long capacity() const
Definition: AMReX_ParticleTile.H:1078
+
amrex::ParticleTile::numTotalParticles
int numTotalParticles() const
Returns the total number of particles, real and neighbor.
Definition: AMReX_ParticleTile.H:867
+
amrex::ParticleTile::m_aos_tile
AoS m_aos_tile
Definition: AMReX_ParticleTile.H:1274
+
amrex::ParticleTile::size
std::size_t size() const
Returns the total number of particles (real and neighbor)
Definition: AMReX_ParticleTile.H:815
+
amrex::ParticleTile::getParticleTileData
ParticleTileDataType getParticleTileData()
Definition: AMReX_ParticleTile.H:1120
+
amrex::ParticleTile::push_back
void push_back(const SuperParticleType &sp)
Definition: AMReX_ParticleTile.H:913
+
amrex::ParticleTile::numNeighborParticles
int numNeighborParticles() const
Returns the number of neighbor particles (excluding reals)
Definition: AMReX_ParticleTile.H:854
+
amrex::ParticleTile::~ParticleTile
~ParticleTile()=default
+
amrex::ParticleTile::m_runtime_r_ptrs
amrex::PODVector< ParticleReal *, Allocator< ParticleReal * > > m_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1279
amrex::ParticleTile::NAR
static constexpr int NAR
Definition: AMReX_ParticleTile.H:695
-
amrex::ParticleTile::getConstParticleTileData
ConstParticleTileDataType getConstParticleTileData() const
Definition: AMReX_ParticleTile.H:1186
-
amrex::ParticleTile::shrink_to_fit
void shrink_to_fit()
Definition: AMReX_ParticleTile.H:1048
+
amrex::ParticleTile::getConstParticleTileData
ConstParticleTileDataType getConstParticleTileData() const
Definition: AMReX_ParticleTile.H:1196
+
amrex::ParticleTile::shrink_to_fit
void shrink_to_fit()
Definition: AMReX_ParticleTile.H:1058
amrex::ParticleTile::ParticleType
T_ParticleType ParticleType
Definition: AMReX_ParticleTile.H:694
-
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:818
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, amrex::Vector< int > const &vec)
Definition: AMReX_ParticleTile.H:1027
-
amrex::ParticleTile::m_h_runtime_r_ptrs
amrex::Gpu::HostVector< ParticleReal * > m_h_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1275
-
amrex::ParticleTile::GetStructOfArrays
const SoA & GetStructOfArrays() const
Definition: AMReX_ParticleTile.H:797
-
amrex::ParticleTile::swap
void swap(ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > &other) noexcept
Definition: AMReX_ParticleTile.H:1090
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, amrex::Vector< int >::const_iterator beg, amrex::Vector< int >::const_iterator end)
Definition: AMReX_ParticleTile.H:1019
-
amrex::ParticleTile::push_back_real
void push_back_real(const std::array< ParticleReal, NArrayReal > &v)
Definition: AMReX_ParticleTile.H:948
-
amrex::ParticleTile::NumRuntimeRealComps
int NumRuntimeRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1044
-
amrex::ParticleTile::GetStructOfArrays
SoA & GetStructOfArrays()
Definition: AMReX_ParticleTile.H:796
-
amrex::ParticleTile::m_h_runtime_i_cptrs
amrex::Gpu::HostVector< const int * > m_h_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1279
-
amrex::ParticleTile::m_runtime_r_cptrs
amrex::PODVector< const ParticleReal *, Allocator< const ParticleReal * > > m_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1272
-
amrex::ParticleTile::pos
RealType & pos(int index, int position_index) &
Definition: AMReX_ParticleTile.H:770
-
amrex::ParticleTile::resize
void resize(std::size_t count)
Definition: AMReX_ParticleTile.H:884
+
amrex::ParticleTile::numParticles
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:828
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, amrex::Vector< int > const &vec)
Definition: AMReX_ParticleTile.H:1037
+
amrex::ParticleTile::m_h_runtime_r_ptrs
amrex::Gpu::HostVector< ParticleReal * > m_h_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1285
+
amrex::ParticleTile::GetStructOfArrays
const SoA & GetStructOfArrays() const
Definition: AMReX_ParticleTile.H:807
+
amrex::ParticleTile::swap
void swap(ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > &other) noexcept
Definition: AMReX_ParticleTile.H:1100
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, amrex::Vector< int >::const_iterator beg, amrex::Vector< int >::const_iterator end)
Definition: AMReX_ParticleTile.H:1029
+
amrex::ParticleTile::push_back_real
void push_back_real(const std::array< ParticleReal, NArrayReal > &v)
Definition: AMReX_ParticleTile.H:958
+
amrex::ParticleTile::NumRuntimeRealComps
int NumRuntimeRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1054
+
amrex::ParticleTile::GetStructOfArrays
SoA & GetStructOfArrays()
Definition: AMReX_ParticleTile.H:806
+
amrex::ParticleTile::m_h_runtime_i_cptrs
amrex::Gpu::HostVector< const int * > m_h_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1289
+
amrex::ParticleTile::m_runtime_r_cptrs
amrex::PODVector< const ParticleReal *, Allocator< const ParticleReal * > > m_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1282
+
amrex::ParticleTile::pos
RealType & pos(int index, int position_index) &
Definition: AMReX_ParticleTile.H:780
+
amrex::ParticleTile::resize
void resize(std::size_t count)
Definition: AMReX_ParticleTile.H:894
amrex::ParticleTile::IntVector
typename SoA::IntVector IntVector
Definition: AMReX_ParticleTile.H:715
-
amrex::ParticleTile::push_back_int
void push_back_int(const std::array< int, NArrayInt > &v)
Definition: AMReX_ParticleTile.H:1000
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal >::const_iterator beg, amrex::Vector< amrex::ParticleReal >::const_iterator end)
Definition: AMReX_ParticleTile.H:967
+
amrex::ParticleTile::push_back_int
void push_back_int(const std::array< int, NArrayInt > &v)
Definition: AMReX_ParticleTile.H:1010
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal >::const_iterator beg, amrex::Vector< amrex::ParticleReal >::const_iterator end)
Definition: AMReX_ParticleTile.H:977
amrex::ParticleTile::AllocatorType
Allocator< T > AllocatorType
Definition: AMReX_ParticleTile.H:692
-
amrex::ParticleTile::NumRuntimeIntComps
int NumRuntimeIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1046
-
amrex::ParticleTile::define
void define(int a_num_runtime_real, int a_num_runtime_int)
Definition: AMReX_ParticleTile.H:723
-
amrex::ParticleTile::empty
bool empty() const
Definition: AMReX_ParticleTile.H:799
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, int v)
Definition: AMReX_ParticleTile.H:992
-
amrex::ParticleTile::pos
RealType pos(int index, int position_index) const &
Definition: AMReX_ParticleTile.H:784
-
amrex::ParticleTile::cpu
decltype(auto) cpu(int index) &
Definition: AMReX_ParticleTile.H:752
-
amrex::ParticleTile::m_soa_tile
SoA m_soa_tile
Definition: AMReX_ParticleTile.H:1265
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, std::size_t npar, int v)
Definition: AMReX_ParticleTile.H:1035
-
amrex::ParticleTile::m_defined
bool m_defined
Definition: AMReX_ParticleTile.H:1267
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, std::size_t npar, ParticleReal v)
Definition: AMReX_ParticleTile.H:983
-
amrex::ParticleTile::push_back_int
void push_back_int(int comp, const int *beg, const int *end)
Definition: AMReX_ParticleTile.H:1010
+
amrex::ParticleTile::NumRuntimeIntComps
int NumRuntimeIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1056
+
amrex::ParticleTile::define
void define(int a_num_runtime_real, int a_num_runtime_int)
Definition: AMReX_ParticleTile.H:733
+
amrex::ParticleTile::empty
bool empty() const
Definition: AMReX_ParticleTile.H:809
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, int v)
Definition: AMReX_ParticleTile.H:1002
+
amrex::ParticleTile::pos
RealType pos(int index, int position_index) const &
Definition: AMReX_ParticleTile.H:794
+
amrex::ParticleTile::cpu
decltype(auto) cpu(int index) &
Definition: AMReX_ParticleTile.H:762
+
amrex::ParticleTile::m_soa_tile
SoA m_soa_tile
Definition: AMReX_ParticleTile.H:1275
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, std::size_t npar, int v)
Definition: AMReX_ParticleTile.H:1045
+
amrex::ParticleTile::m_defined
bool m_defined
Definition: AMReX_ParticleTile.H:1277
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, std::size_t npar, ParticleReal v)
Definition: AMReX_ParticleTile.H:993
+
amrex::ParticleTile::push_back_int
void push_back_int(int comp, const int *beg, const int *end)
Definition: AMReX_ParticleTile.H:1020
amrex::ParticleTile::RealVector
typename SoA::RealVector RealVector
Definition: AMReX_ParticleTile.H:714
-
amrex::ParticleTile::m_runtime_i_ptrs
amrex::PODVector< int *, Allocator< int * > > m_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1270
-
amrex::ParticleTile::numRealParticles
int numRealParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:831
+
amrex::ParticleTile::m_runtime_i_ptrs
amrex::PODVector< int *, Allocator< int * > > m_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1280
+
amrex::ParticleTile::numRealParticles
int numRealParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:841
amrex::ParticleTile::AoS
std::conditional_t< ParticleType::is_soa_particle, ThisParticleTileHasNoAoS, ArrayOfStructs< ParticleType, Allocator > > AoS
Definition: AMReX_ParticleTile.H:707
-
amrex::ParticleTile::id
decltype(auto) id(int index) &
Definition: AMReX_ParticleTile.H:734
+
amrex::ParticleTile::id
decltype(auto) id(int index) &
Definition: AMReX_ParticleTile.H:744
amrex::ParticleTile::NStructReal
static constexpr int NStructReal
Definition: AMReX_ParticleTile.H:699
-
amrex::ParticleTile::push_back_real
void push_back_real(int comp, ParticleReal v)
Definition: AMReX_ParticleTile.H:940
+
amrex::ParticleTile::push_back_real
void push_back_real(int comp, ParticleReal v)
Definition: AMReX_ParticleTile.H:950
amrex::Particle
The struct used to store particles.
Definition: AMReX_Particle.H:295
amrex::Particle::id
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper id() &
Definition: AMReX_Particle.H:315
amrex::Particle::pos
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_Particle.H:338
diff --git a/amrex/docs_html/doxygen/functions_a.html b/amrex/docs_html/doxygen/functions_a.html index 86ec2c1bd9..a25b44694e 100644 --- a/amrex/docs_html/doxygen/functions_a.html +++ b/amrex/docs_html/doxygen/functions_a.html @@ -118,7 +118,7 @@

- a -