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 --- Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py') diff --git a/Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py b/Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py index d71aa3fea..9cfe669ce 100755 --- a/Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py +++ b/Examples/Tests/ParticleDataPython/PICMI_inputs_prev_pos_2d.py @@ -3,7 +3,6 @@ # --- Input file to test the saving of old particle positions import numpy as np -import pywarpx from pywarpx import picmi constants = picmi.constants @@ -110,10 +109,10 @@ sim.step(max_steps - 1) # exist ########################## -assert (pywarpx.get_particle_comp_index('electrons', 'prev_x') > 0) -assert (pywarpx.get_particle_comp_index('electrons', 'prev_z') > 0) +assert (sim.extension.get_particle_comp_index('electrons', 'prev_x') > 0) +assert (sim.extension.get_particle_comp_index('electrons', 'prev_z') > 0) -prev_z_vals = pywarpx.get_particle_arrays( +prev_z_vals = sim.extension.get_particle_arrays( 'electrons', 'prev_z', 0 ) for z_vals in prev_z_vals: -- cgit v1.2.3