aboutsummaryrefslogtreecommitdiff
path: root/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
diff options
context:
space:
mode:
authorGravatar Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com> 2021-12-22 15:32:36 -0800
committerGravatar GitHub <noreply@github.com> 2021-12-22 23:32:36 +0000
commitd411310e45a370cfde872b25baa7a9f20bcf4966 (patch)
treecbb12f8fc9ba701a9d2a08701aaf46a99ea9ba31 /Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
parentf73b3cd49c430c59b6750d5e65dfd19dcf44c752 (diff)
downloadWarpX-d411310e45a370cfde872b25baa7a9f20bcf4966.tar.gz
WarpX-d411310e45a370cfde872b25baa7a9f20bcf4966.tar.zst
WarpX-d411310e45a370cfde872b25baa7a9f20bcf4966.zip
Change _libwarpx.py functions to LibWarpX class methods (#2696)
* Initial attempt at moving function into LibWarpX * Bugfix - undefined structs in get_particle_theta This is untested, identified by IDE/visual inspection only * Unify newlines * Delete libwarpx.clight (duplicated picmi.py) See picmi.constants.c * Change function descriptive comment to docstring Also remove extra newline in __init__ beginning. * Replace pywarpx/_libwarpx calls appropriately * Fix atexit register of finalize function * Reorder WarpX.py imports for pre-commit * Use picmi.Simulation.extension = libwarpx alias This will hopefully preempt user script changes if we restructure things to allow multiple WarpX runs to be done within a single Python script. * Fix libwarpx ref in WarpX.getProbLo/getProbHi * Update get_particle_boundary_buffer doc reference
Diffstat (limited to 'Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py')
-rwxr-xr-xExamples/Tests/restart/PICMI_inputs_runtime_component_analyze.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
index ffb820fed..1fa8862f0 100755
--- a/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
+++ b/Examples/Tests/restart/PICMI_inputs_runtime_component_analyze.py
@@ -7,7 +7,6 @@
import sys
import numpy as np
-import pywarpx
from pywarpx import callbacks, picmi
##########################
@@ -113,7 +112,7 @@ sim.initialize_warpx()
##########################
-pywarpx.add_real_comp('electrons', 'newPid')
+sim.extension.add_real_comp('electrons', 'newPid')
def add_particles():
@@ -127,7 +126,7 @@ def add_particles():
w = np.ones(nps) * 2.0
newPid = 5.0
- pywarpx.add_particles(
+ sim.extension.add_particles(
species_name='electrons', x=x, y=y, z=z, ux=ux, uy=uy, uz=uz,
w=w, newPid=newPid
)
@@ -138,18 +137,18 @@ callbacks.installbeforestep(add_particles)
# simulation run
##########################
-step_number = pywarpx.getistep(0)
+step_number = sim.extension.getistep(0)
sim.step(max_steps - 1 - step_number)
##########################
# check that the new PIDs are properly set
##########################
-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)
+assert(sim.extension.get_particle_count('electrons') == 90)
+assert (sim.extension.get_particle_comp_index('electrons', 'w') == 0)
+assert (sim.extension.get_particle_comp_index('electrons', 'newPid') == 4)
-new_pid_vals = pywarpx.get_particle_arrays(
+new_pid_vals = sim.extension.get_particle_arrays(
'electrons', 'newPid', 0
)
for vals in new_pid_vals: