From 746ddc2ae871e70cd50940c2cca03a17a9b7ec1a Mon Sep 17 00:00:00 2001 From: David Grote Date: Thu, 16 Dec 2021 10:12:57 -0800 Subject: 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 --- .../ParticleBoundaryProcess/PICMI_inputs_reflection.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 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 f6be14e5a..c9903ad22 100755 --- a/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py +++ b/Examples/Modules/ParticleBoundaryProcess/PICMI_inputs_reflection.py @@ -2,6 +2,7 @@ # # --- Input file to test particle reflection off an absorbing boundary +import pywarpx from pywarpx import picmi constants = picmi.constants @@ -114,22 +115,20 @@ sim.step(max_steps) # buffer functions as intended ################################################ -from pywarpx import _libwarpx - -n = _libwarpx.get_particle_boundary_buffer_size("electrons", 'z_hi') +n = pywarpx.get_particle_boundary_buffer_size("electrons", 'z_hi') print("Number of electrons in upper buffer:", n) assert n == 63 -n = _libwarpx.get_particle_boundary_buffer_size("electrons", 'z_lo') +n = pywarpx.get_particle_boundary_buffer_size("electrons", 'z_lo') print("Number of electrons in lower buffer:", n) assert n == 67 -scraped_steps = _libwarpx.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) +scraped_steps = pywarpx.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 4) -scraped_steps = _libwarpx.get_particle_boundary_buffer("electrons", 'z_lo', 'step_scraped', 0) +scraped_steps = pywarpx.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