From d411310e45a370cfde872b25baa7a9f20bcf4966 Mon Sep 17 00:00:00 2001 From: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com> Date: Wed, 22 Dec 2021 15:32:36 -0800 Subject: 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 --- .../Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py') diff --git a/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py b/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py index c9903ad22..d7d023ef6 100755 --- a/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py +++ b/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py @@ -2,7 +2,6 @@ # # --- Input file to test particle reflection off an absorbing boundary -import pywarpx from pywarpx import picmi constants = picmi.constants @@ -115,20 +114,20 @@ sim.step(max_steps) # buffer functions as intended ################################################ -n = pywarpx.get_particle_boundary_buffer_size("electrons", 'z_hi') +n = sim.extension.get_particle_boundary_buffer_size("electrons", 'z_hi') print("Number of electrons in upper buffer:", n) assert n == 63 -n = pywarpx.get_particle_boundary_buffer_size("electrons", 'z_lo') +n = sim.extension.get_particle_boundary_buffer_size("electrons", 'z_lo') print("Number of electrons in lower buffer:", n) assert n == 67 -scraped_steps = pywarpx.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) +scraped_steps = sim.extension.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 4) -scraped_steps = pywarpx.get_particle_boundary_buffer("electrons", 'z_lo', 'step_scraped', 0) +scraped_steps = sim.extension.get_particle_boundary_buffer("electrons", 'z_lo', 'step_scraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 8) -- cgit v1.2.3