1 #ifndef AMReX_AmrParticleInSituBridge_H
2 #define AMReX_AmrParticleInSituBridge_H
4 #include <AMReX_Config.H>
9 #ifdef AMREX_USE_SENSEI_INSITU
12 #include <AnalysisAdaptor.h>
21 class AmrParticleInSituBridge :
public InSituBridge
24 AmrParticleInSituBridge() {}
25 ~AmrParticleInSituBridge() {}
27 AmrParticleInSituBridge(
const AmrParticleInSituBridge&) =
delete;
28 void operator=(
const AmrParticleInSituBridge&) =
delete;
33 template<
typename ParticleType,
int NArrayReal,
int NArrayInt>
36 const std::map<std::string, std::vector<int>> & particles_rStructs = {},
37 const std::map<std::string, int> & particles_iStructs = {},
38 const std::map<std::string, std::vector<int>> & particles_rArrays = {},
39 const std::map<std::string, int> & particles_iArrays = {});
42 template<
typename ParticleType,
int NArrayReal,
int NArrayInt>
43 int AmrParticleInSituBridge::update(
46 const std::map<std::string, std::vector<int>> & particles_rStructs,
47 const std::map<std::string, int> & particles_iStructs,
48 const std::map<std::string, std::vector<int>> & particles_rArrays,
49 const std::map<std::string, int> & particles_iArrays)
52 #if defined(AMREX_USE_SENSEI_INSITU)
55 sensei::TimeEvent<64> event(
"AmrParticleInSituBridge::update");
57 amrex::Print() <<
"SENSEI Particles Begin update..." << std::endl;
58 auto t0 = std::chrono::high_resolution_clock::now();
62 SENSEI_ERROR(
"no particles presented at update call");
66 amrex::AmrParticleDataAdaptor<ParticleType, NArrayReal, NArrayInt> *data_adaptor
67 = amrex::AmrParticleDataAdaptor<ParticleType, NArrayReal, NArrayInt>::New();
70 data_adaptor->SetCommunicator(comm);
72 data_adaptor->SetDataSource(amr, particles, particles_rStructs,
73 particles_iStructs, particles_rArrays, particles_iArrays);
75 data_adaptor->SetDataTime(amr->
cumTime());
76 data_adaptor->SetDataTimeStep(amr->
levelSteps(0));
77 ret = analysis_adaptor->Execute(data_adaptor,
nullptr) ? 0 : -1;
78 data_adaptor->ReleaseData();
79 data_adaptor->Delete();
81 auto t1 = std::chrono::high_resolution_clock::now();
82 auto dt = std::chrono::duration_cast<std::chrono::duration<double>>(t1 - t0);
83 amrex::Print() <<
"SENSEI update complete (" << dt.count() <<
" sec)" << std::endl;
static constexpr int MPI_COMM_NULL
Definition: AMReX_ccse-mpi.H:55
Manage hierarchy of levels for time-dependent AMR computations.
Definition: AMReX_Amr.H:35
int levelSteps(int lev) const noexcept
Number of time steps at specified level.
Definition: AMReX_Amr.H:103
Real cumTime() const noexcept
Physical time.
Definition: AMReX_Amr.H:89
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