aboutsummaryrefslogtreecommitdiff
path: root/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2021-12-16 10:12:57 -0800
committerGravatar GitHub <noreply@github.com> 2021-12-16 10:12:57 -0800
commit746ddc2ae871e70cd50940c2cca03a17a9b7ec1a (patch)
tree37ba15e42ada9f89378894156214ab7b05699e66 /Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
parentb0b03f6bc5e7768c4ecbcb4e4a2c505d9e4aad91 (diff)
downloadWarpX-746ddc2ae871e70cd50940c2cca03a17a9b7ec1a.tar.gz
WarpX-746ddc2ae871e70cd50940c2cca03a17a9b7ec1a.tar.zst
WarpX-746ddc2ae871e70cd50940c2cca03a17a9b7ec1a.zip
Wrap shared object in a class to control its loading (#2637)
* Wrap shared object in a class to control its loading * Fix libwarpx attribute references * Updated callbacks.py for updated libwarpx * Removed the wx module plus other clean up * Further revision of how to use the pywarpx module. Now, _libwarpx should not be imported by external scripts except in special circumstances. * Updated documentation * Clean up end of line whitespace * Added more wrapping routines plus some clean up * Fixed use of pywarpx in two examples * Fix for getistep * Fixed for the EB Python interface * Silence a warning for our wrapper Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py')
-rwxr-xr-xExamples/Tests/restart/PICMI_inputs_runtime_component_analyze.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
index 524913335..bc1cd9217 100755
--- a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
+++ b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
@@ -4,9 +4,10 @@
# then performs checkpoint / restart and compares the result
# to the original simulation.
-from pywarpx import picmi
-import numpy as np
import sys
+import numpy as np
+import pywarpx
+from pywarpx import picmi, callbacks
##########################
# physics parameters
@@ -110,9 +111,8 @@ sim.initialize_warpx()
# python particle data access
##########################
-from pywarpx import _libwarpx, callbacks
-_libwarpx.add_real_comp('electrons', 'newPid')
+pywarpx.add_real_comp('electrons', 'newPid')
def add_particles():
@@ -126,7 +126,7 @@ def add_particles():
w = np.ones(nps) * 2.0
newPid = 5.0
- _libwarpx.add_particles(
+ pywarpx.add_particles(
species_name='electrons', x=x, y=y, z=z, ux=ux, uy=uy, uz=uz,
w=w, newPid=newPid
)
@@ -137,18 +137,18 @@ callbacks.installbeforestep(add_particles)
# simulation run
##########################
-step_number = _libwarpx.libwarpx.warpx_getistep(0)
+step_number = pywarpx.getistep(0)
sim.step(max_steps - 1 - step_number)
##########################
# check that the new PIDs are properly set
##########################
-assert(_libwarpx.get_particle_count('electrons') == 90)
-assert (_libwarpx.get_particle_comp_index('electrons', 'w') == 0)
-assert (_libwarpx.get_particle_comp_index('electrons', 'newPid') == 4)
+assert(pywarpx.get_particle_count('electrons') == 90)
+assert (pywarpx.get_particle_comp_index('electrons', 'w') == 0)
+assert (pywarpx.get_particle_comp_index('electrons', 'newPid') == 4)
-new_pid_vals = _libwarpx.get_particle_arrays(
+new_pid_vals = pywarpx.get_particle_arrays(
'electrons', 'newPid', 0
)
for vals in new_pid_vals: