diff options
Diffstat (limited to 'Source/Diagnostics/WarpXIO.cpp')
-rw-r--r-- | Source/Diagnostics/WarpXIO.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp index c944c464d..4dfe9b3e3 100644 --- a/Source/Diagnostics/WarpXIO.cpp +++ b/Source/Diagnostics/WarpXIO.cpp @@ -459,6 +459,7 @@ WarpX::UpdateInSitu () const #endif #ifdef AMREX_USE_ASCENT + // wrap mesh data conduit::Node bp_mesh; MultiLevelToBlueprint(finest_level+1, amrex::GetVecOfConstPtrs(mf_avg), @@ -469,6 +470,61 @@ WarpX::UpdateInSitu () const refRatio(), bp_mesh); + // wrap particle data for each species + // we prefix the fields with "particle_{species_name}" b/c we + // want to to uniquely name all the fields that can be plotted + + std::vector<std::string> species_names = mypc->GetSpeciesNames(); + + for (unsigned i = 0, n = species_names.size(); i < n; ++i) + { + + Vector<std::string> particle_varnames; + Vector<std::string> particle_int_varnames; + std::string prefix = "particle_" + species_names[i]; + + // Get pc for species + auto& pc = mypc->GetParticleContainer(i); + + // get names of real comps + std::map<std::string, int> real_comps_map = pc.getParticleComps(); + std::map<std::string, int>::const_iterator r_itr = real_comps_map.begin(); + + // TODO: Looking at other code paths, I am not sure compile time + // QED field is included in getParticleComps()? + while (r_itr != real_comps_map.end()) + { + // get next real particle name + std::string varname = r_itr->first; + particle_varnames.push_back(prefix + "_" + varname); + r_itr++; + } + + // get names of int comps + std::map<std::string, int> int_comps_map = pc.getParticleiComps(); + std::map<std::string, int>::const_iterator i_itr = int_comps_map.begin(); + + while (i_itr != int_comps_map.end()) + { + // get next real particle name + std::string varname = i_itr->first; + particle_int_varnames.push_back(prefix + "_" + varname); + i_itr++; + } + + // wrap pc for current species into a blueprint topology + amrex::ParticleContainerToBlueprint(pc, + particle_varnames, + particle_int_varnames, + bp_mesh, + prefix); + } + + // // If you want to save blueprint HDF5 files w/o using an Ascent + // // extract, you can call the following AMReX helper: + // const auto step = istep[0]; + // WriteBlueprintFiles(bp_mesh,"bp_export",step,"hdf5"); + ascent::Ascent ascent; conduit::Node opts; opts["exceptions"] = "catch"; |