aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/InjectorDensity.cpp
diff options
context:
space:
mode:
authorGravatar WeiqunZhang <WeiqunZhang@lbl.gov> 2020-09-14 23:51:35 -0700
committerGravatar GitHub <noreply@github.com> 2020-09-14 23:51:35 -0700
commitbb5e5e5b3b605f5650f6257af796f16ebdfcda9a (patch)
treeee93a57529389153d19a3c34628fb4b5b1222825 /Source/Initialization/InjectorDensity.cpp
parent91837614c216f62b4b6cb23f82d5a23a94f5e4d8 (diff)
downloadWarpX-bb5e5e5b3b605f5650f6257af796f16ebdfcda9a.tar.gz
WarpX-bb5e5e5b3b605f5650f6257af796f16ebdfcda9a.tar.zst
WarpX-bb5e5e5b3b605f5650f6257af796f16ebdfcda9a.zip
Remove The_Managed_Arena (#1313)
* Remove the base class of InjectorPoisition, InjectorDensity and InjectorMomentum so that they no longer live in managed memory. * Have both host and device copies of Injector*. * Modify Parser classes so that they can work without unified memory. Add HostDeviceParser that is non-owning and therefore suitable for being value captured by device lambda.
Diffstat (limited to 'Source/Initialization/InjectorDensity.cpp')
-rw-r--r--Source/Initialization/InjectorDensity.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/Initialization/InjectorDensity.cpp b/Source/Initialization/InjectorDensity.cpp
index 3d52c3166..49b6852ce 100644
--- a/Source/Initialization/InjectorDensity.cpp
+++ b/Source/Initialization/InjectorDensity.cpp
@@ -11,7 +11,7 @@
using namespace amrex;
-InjectorDensity::~InjectorDensity ()
+void InjectorDensity::clear ()
{
switch (type)
{
@@ -42,11 +42,10 @@ InjectorDensityPredefined::InjectorDensityPredefined (
ParmParse pp(a_species_name);
std::vector<amrex::Real> v;
- // Read parameters for the predefined plasma profile,
- // and store them in managed memory
+ // Read parameters for the predefined plasma profile.
pp.getarr("predefined_profile_params", v);
- p = static_cast<amrex::Real*>
- (amrex::The_Managed_Arena()->alloc(sizeof(amrex::Real)*v.size()));
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(v.size() <= 6,
+ "Too many parameters for InjectorDensityPredefined");
for (int i = 0; i < static_cast<int>(v.size()); ++i) {
p[i] = v[i];
}
@@ -64,8 +63,7 @@ InjectorDensityPredefined::InjectorDensityPredefined (
}
// Note that we are not allowed to have non-trivial destructor.
-// So we rely on clear() to free memory.
+// So we rely on clear() to free memory if needed.
void InjectorDensityPredefined::clear ()
{
- amrex::The_Managed_Arena()->free(p);
}