aboutsummaryrefslogtreecommitdiff
path: root/Source/Python
diff options
context:
space:
mode:
authorGravatar Dave Grote <grote1@llnl.gov> 2019-09-27 13:58:28 -0700
committerGravatar Dave Grote <grote1@llnl.gov> 2019-09-27 13:58:28 -0700
commit66885c39fd0f58d7e4ad7398ea6a595391ca60c5 (patch)
tree554173d4bf99cc0a46a0f1029882d3700a6a19a9 /Source/Python
parent3052787173ae746445fba2575c7835959f184b63 (diff)
parent46e29ba5d4ac5d745e3d6c3dc2b9408a2a3753de (diff)
downloadWarpX-66885c39fd0f58d7e4ad7398ea6a595391ca60c5.tar.gz
WarpX-66885c39fd0f58d7e4ad7398ea6a595391ca60c5.tar.zst
WarpX-66885c39fd0f58d7e4ad7398ea6a595391ca60c5.zip
Merge branch 'dev' into generalize_nodal_deposition
Diffstat (limited to 'Source/Python')
-rw-r--r--Source/Python/WarpXWrappers.cpp62
-rw-r--r--Source/Python/WarpXWrappers.h44
2 files changed, 51 insertions, 55 deletions
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index a60efd498..c6d7dfdb8 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -8,7 +8,7 @@
#include <WarpXUtil.H>
#include <WarpX_py.H>
-namespace
+namespace
{
double** getMultiFabPointers(const amrex::MultiFab& mf, int *num_boxes, int *ncomps, int *ngrow, int **shapes)
{
@@ -19,7 +19,7 @@ namespace
if (mf.nComp() > 1) shapesize += 1;
*shapes = (int*) malloc(shapesize * (*num_boxes) * sizeof(int));
double** data = (double**) malloc((*num_boxes) * sizeof(double*));
-
+
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -27,7 +27,7 @@ namespace
int i = mfi.LocalIndex();
data[i] = (double*) mf[mfi].dataPtr();
for (int j = 0; j < AMREX_SPACEDIM; ++j) {
- (*shapes)[shapesize*i+j] = mf[mfi].box().length(j);
+ (*shapes)[shapesize*i+j] = mf[mfi].box().length(j);
}
if (mf.nComp() > 1) (*shapes)[shapesize*i+AMREX_SPACEDIM] = mf.nComp();
}
@@ -55,58 +55,58 @@ extern "C"
int warpx_nSpecies()
{
- auto & mypc = WarpX::GetInstance().GetPartContainer();
+ auto & mypc = WarpX::GetInstance().GetPartContainer();
return mypc.nSpecies();
}
bool warpx_use_fdtd_nci_corr()
{
- return WarpX::use_fdtd_nci_corr;
+ return WarpX::use_fdtd_nci_corr;
}
int warpx_l_lower_order_in_v()
{
- return WarpX::l_lower_order_in_v;
+ return WarpX::l_lower_order_in_v;
}
- int warpx_nComps()
+ int warpx_nComps()
{
- return PIdx::nattribs;
+ return PIdx::nattribs;
}
- int warpx_SpaceDim()
+ int warpx_SpaceDim()
{
return AMREX_SPACEDIM;
}
void amrex_init (int argc, char* argv[])
{
- amrex::Initialize(argc,argv);
+ amrex::Initialize(argc,argv);
}
#ifdef BL_USE_MPI
void amrex_init_with_inited_mpi (int argc, char* argv[], MPI_Comm mpicomm)
{
- amrex::Initialize(argc,argv,true,mpicomm);
+ amrex::Initialize(argc,argv,true,mpicomm);
}
#endif
void amrex_finalize (int finalize_mpi)
{
- amrex::Finalize();
+ amrex::Finalize();
}
void warpx_init ()
{
- WarpX& warpx = WarpX::GetInstance();
- warpx.InitData();
+ WarpX& warpx = WarpX::GetInstance();
+ warpx.InitData();
if (warpx_py_afterinit) warpx_py_afterinit();
if (warpx_py_particleloader) warpx_py_particleloader();
}
void warpx_finalize ()
{
- WarpX::ResetInstance();
+ WarpX::ResetInstance();
}
void warpx_set_callback_py_afterinit (WARPX_CALLBACK_PY_FUNC_0 callback)
@@ -160,8 +160,8 @@ extern "C"
void warpx_evolve (int numsteps)
{
- WarpX& warpx = WarpX::GetInstance();
- warpx.Evolve(numsteps);
+ WarpX& warpx = WarpX::GetInstance();
+ warpx.Evolve(numsteps);
}
void warpx_addNParticles(int speciesnumber, int lenx,
@@ -169,10 +169,10 @@ extern "C"
double* vx, double* vy, double* vz,
int nattr, double* attr, int uniqueparticles)
{
- auto & mypc = WarpX::GetInstance().GetPartContainer();
- auto & myspc = mypc.GetParticleContainer(speciesnumber);
+ auto & mypc = WarpX::GetInstance().GetPartContainer();
+ auto & myspc = mypc.GetParticleContainer(speciesnumber);
const int lev = 0;
- myspc.AddNParticles(lev, lenx, x, y, z, vx, vy, vz, nattr, attr, uniqueparticles);
+ myspc.AddNParticles(lev, lenx, x, y, z, vx, vy, vz, nattr, attr, uniqueparticles);
}
void warpx_ConvertLabParamsToBoost()
@@ -308,23 +308,21 @@ extern "C"
return getMultiFabLoVects(mf, return_size, ngrow);
}
- double** warpx_getParticleStructs(int speciesnumber,
+ double** warpx_getParticleStructs(int speciesnumber, int lev,
int* num_tiles, int** particles_per_tile) {
auto & mypc = WarpX::GetInstance().GetPartContainer();
auto & myspc = mypc.GetParticleContainer(speciesnumber);
- const int level = 0;
-
int i = 0;
- for (WarpXParIter pti(myspc, level); pti.isValid(); ++pti, ++i) {}
+ for (WarpXParIter pti(myspc, lev); pti.isValid(); ++pti, ++i) {}
- // *num_tiles = myspc.numLocalTilesAtLevel(level);
+ // *num_tiles = myspc.numLocalTilesAtLevel(lev);
*num_tiles = i;
*particles_per_tile = (int*) malloc(*num_tiles*sizeof(int));
double** data = (double**) malloc(*num_tiles*sizeof(typename WarpXParticleContainer::ParticleType*));
i = 0;
- for (WarpXParIter pti(myspc, level); pti.isValid(); ++pti, ++i) {
+ for (WarpXParIter pti(myspc, lev); pti.isValid(); ++pti, ++i) {
auto& aos = pti.GetArrayOfStructs();
data[i] = (double*) aos.data();
(*particles_per_tile)[i] = pti.numParticles();
@@ -332,23 +330,21 @@ extern "C"
return data;
}
- double** warpx_getParticleArrays(int speciesnumber, int comp,
+ double** warpx_getParticleArrays(int speciesnumber, int comp, int lev,
int* num_tiles, int** particles_per_tile) {
auto & mypc = WarpX::GetInstance().GetPartContainer();
auto & myspc = mypc.GetParticleContainer(speciesnumber);
- const int level = 0;
-
int i = 0;
- for (WarpXParIter pti(myspc, level); pti.isValid(); ++pti, ++i) {}
+ for (WarpXParIter pti(myspc, lev); pti.isValid(); ++pti, ++i) {}
- // *num_tiles = myspc.numLocalTilesAtLevel(level);
+ // *num_tiles = myspc.numLocalTilesAtLevel(lev);
*num_tiles = i;
*particles_per_tile = (int*) malloc(*num_tiles*sizeof(int));
double** data = (double**) malloc(*num_tiles*sizeof(double*));
i = 0;
- for (WarpXParIter pti(myspc, level); pti.isValid(); ++pti, ++i) {
+ for (WarpXParIter pti(myspc, lev); pti.isValid(); ++pti, ++i) {
auto& soa = pti.GetStructOfArrays();
data[i] = (double*) soa.GetRealData(comp).dataPtr();
(*particles_per_tile)[i] = pti.numParticles();
@@ -448,7 +444,7 @@ extern "C"
}
void mypc_Redistribute () {
- auto & mypc = WarpX::GetInstance().GetPartContainer();
+ auto & mypc = WarpX::GetInstance().GetPartContainer();
mypc.Redistribute();
}
diff --git a/Source/Python/WarpXWrappers.h b/Source/Python/WarpXWrappers.h
index 44e0ed4e1..233a0b930 100644
--- a/Source/Python/WarpXWrappers.h
+++ b/Source/Python/WarpXWrappers.h
@@ -26,9 +26,9 @@ extern "C" {
#endif
void amrex_finalize (int finalize_mpi);
-
+
void warpx_init ();
-
+
void warpx_finalize ();
typedef void(*WARPX_CALLBACK_PY_FUNC_0)();
@@ -47,42 +47,42 @@ extern "C" {
void warpx_set_callback_py_appliedfields (WARPX_CALLBACK_PY_FUNC_0);
void warpx_evolve (int numsteps); // -1 means the inputs parameter will be used.
-
+
void warpx_addNParticles(int speciesnumber, int lenx,
double* x, double* y, double* z,
double* vx, double* vy, double* vz,
int nattr, double* attr, int uniqueparticles);
void warpx_ConvertLabParamsToBoost();
-
+
double warpx_getProbLo(int dir);
-
+
double warpx_getProbHi(int dir);
-
+
long warpx_getNumParticles(int speciesnumber);
-
- double** warpx_getEfield(int lev, int direction,
+
+ double** warpx_getEfield(int lev, int direction,
int *return_size, int* ncomps, int* ngrow, int **shapes);
-
- int* warpx_getEfieldLoVects(int lev, int direction,
+
+ int* warpx_getEfieldLoVects(int lev, int direction,
int *return_size, int* ngrow);
-
- double** warpx_getBfield(int lev, int direction,
+
+ double** warpx_getBfield(int lev, int direction,
int *return_size, int* ncomps, int* ngrow, int **shapes);
-
- int* warpx_getBfieldLoVects(int lev, int direction,
+
+ int* warpx_getBfieldLoVects(int lev, int direction,
int *return_size, int* ngrow);
-
- double** warpx_getCurrentDensity(int lev, int direction,
+
+ double** warpx_getCurrentDensity(int lev, int direction,
int *return_size, int* ncomps, int* ngrow, int **shapes);
-
- int* warpx_getCurrentDensityLoVects(int lev, int direction,
+
+ int* warpx_getCurrentDensityLoVects(int lev, int direction,
int *return_size, int* ngrow);
-
- double** warpx_getParticleStructs(int speciesnumber,
+
+ double** warpx_getParticleStructs(int speciesnumber, int lev,
int* num_tiles, int** particles_per_tile);
-
- double** warpx_getParticleArrays(int speciesnumber, int comp,
+
+ double** warpx_getParticleArrays(int speciesnumber, int comp, int lev,
int* num_tiles, int** particles_per_tile);
void warpx_ComputeDt ();