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