1 #ifndef AMReX_AmrMeshParticleInSituBridge_H
2 #define AMReX_AmrMeshParticleInSituBridge_H
3 #include <AMReX_Config.H>
14 #ifdef AMREX_USE_SENSEI_INSITU
15 #include <AnalysisAdaptor.h>
25 class AmrMeshParticleInSituBridge :
public InSituBridge
28 AmrMeshParticleInSituBridge() {}
29 ~AmrMeshParticleInSituBridge() {}
31 AmrMeshParticleInSituBridge(
const AmrMeshParticleInSituBridge&) =
delete;
32 void operator=(
const AmrMeshParticleInSituBridge&) =
delete;
36 template<
typename ParticleType,
int NArrayReal,
int NArrayInt>
38 long step,
double time,
41 const std::vector<std::vector<std::string>> &mesh_names,
43 const std::map<std::string, std::vector<int>> & particles_rStructs = {},
44 const std::map<std::string, int> & particles_iStructs = {},
45 const std::map<std::string, std::vector<int>> & particles_rArrays = {},
46 const std::map<std::string, int> & particles_iArrays = {});
49 template<
typename ParticleType,
int NArrayReal,
int NArrayInt>
50 int AmrMeshParticleInSituBridge::update(
51 long step,
double time,
54 const std::vector<std::vector<std::string>> &mesh_names,
56 const std::map<std::string, std::vector<int>> & particles_rStructs,
57 const std::map<std::string, int> & particles_iStructs,
58 const std::map<std::string, std::vector<int>> & particles_rArrays,
59 const std::map<std::string, int> & particles_iArrays)
62 #if defined(AMREX_USE_SENSEI_INSITU)
65 amrex::Print() <<
"SENSEI AmrMesh+Particles Begin update..." << std::endl;
66 auto t0 = std::chrono::high_resolution_clock::now();
68 sensei::TimeEvent<64> event(
"AmrMeshParticleInSituBridge::update");
72 SENSEI_ERROR(
"no particles presented at update call");
76 amrex::AmrMeshParticleDataAdaptor<ParticleType, NArrayReal, NArrayInt> *data_adaptor
77 = amrex::AmrMeshParticleDataAdaptor<ParticleType, NArrayReal, NArrayInt>::New();
80 data_adaptor->SetCommunicator(comm);
82 data_adaptor->SetDataSource(
83 mesh, mesh_states, mesh_names,
84 particles, particles_rStructs, particles_iStructs,
85 particles_rArrays, particles_iArrays);
87 data_adaptor->SetDataTime(time);
88 data_adaptor->SetDataTimeStep(step);
89 ret = analysis_adaptor->Execute(data_adaptor,
nullptr) ? 0 : -1;
90 data_adaptor->ReleaseData();
91 data_adaptor->Delete();
93 auto t1 = std::chrono::high_resolution_clock::now();
94 auto dt = std::chrono::duration_cast<std::chrono::duration<double>>(t1 - t0);
95 amrex::Print() <<
"SENSEI update complete (" << dt.count() <<
" sec)" << std::endl;
static constexpr int MPI_COMM_NULL
Definition: AMReX_ccse-mpi.H:55
Definition: AMReX_AmrMesh.H:62
A distributed container for Particles sorted onto the levels, grids, and tiles of a block-structured ...
Definition: AMReX_ParticleContainer.H:145
This class provides the user with a few print options.
Definition: AMReX_Print.H:35
Definition: AMReX_Amr.cpp:49