aboutsummaryrefslogtreecommitdiff
path: root/Source/Python/WarpXWrappers.cpp
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-03-16 19:18:19 -0700
committerGravatar GitHub <noreply@github.com> 2020-03-16 19:18:19 -0700
commitd467faaf1fd0ceca9753f09334338686c412e495 (patch)
treea1a7e3d8457efc4a2ede32603887d4ccde34a130 /Source/Python/WarpXWrappers.cpp
parent719b596d71802a9f8e3d2ca7c158266ab7f94ec6 (diff)
downloadWarpX-d467faaf1fd0ceca9753f09334338686c412e495.tar.gz
WarpX-d467faaf1fd0ceca9753f09334338686c412e495.tar.zst
WarpX-d467faaf1fd0ceca9753f09334338686c412e495.zip
Added Python wrapper of charge density arrays (#783)
Diffstat (limited to 'Source/Python/WarpXWrappers.cpp')
-rw-r--r--Source/Python/WarpXWrappers.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index 201af45c0..5c1964b1a 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -257,6 +257,26 @@ extern "C"
WARPX_GET_LOVECTS(warpx_getCurrentDensityCPLoVects, WarpX::GetInstance().getcurrent_cp);
WARPX_GET_LOVECTS(warpx_getCurrentDensityFPLoVects, WarpX::GetInstance().getcurrent_fp);
+#define WARPX_GET_SCALAR(SCALAR, GETTER) \
+ amrex::Real** SCALAR(int lev, \
+ int *return_size, int *ncomps, int *ngrow, int **shapes) { \
+ auto & mf = GETTER(lev); \
+ return getMultiFabPointers(mf, return_size, ncomps, ngrow, shapes); \
+ }
+
+#define WARPX_GET_LOVECTS_SCALAR(SCALAR, GETTER) \
+ int* SCALAR(int lev, \
+ int *return_size, int *ngrow) { \
+ auto & mf = GETTER(lev); \
+ return getMultiFabLoVects(mf, return_size, ngrow); \
+ }
+
+ WARPX_GET_SCALAR(warpx_getChargeDensityCP, WarpX::GetInstance().getrho_cp);
+ WARPX_GET_SCALAR(warpx_getChargeDensityFP, WarpX::GetInstance().getrho_fp);
+
+ WARPX_GET_LOVECTS_SCALAR(warpx_getChargeDensityCPLoVects, WarpX::GetInstance().getrho_cp);
+ WARPX_GET_LOVECTS_SCALAR(warpx_getChargeDensityFPLoVects, WarpX::GetInstance().getrho_fp);
+
#define WARPX_GET_FIELD_PML(FIELD, GETTER) \
amrex::Real** FIELD(int lev, int direction, \
int *return_size, int *ncomps, int *ngrow, int **shapes) { \