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 --- Python/pywarpx/WarpX.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Python/pywarpx/WarpX.py') diff --git a/Python/pywarpx/WarpX.py b/Python/pywarpx/WarpX.py index 8c4900fab..ece837816 100644 --- a/Python/pywarpx/WarpX.py +++ b/Python/pywarpx/WarpX.py @@ -5,7 +5,7 @@ # # License: BSD-3-Clause-LBNL -from . import Particles, _libwarpx +from . import Particles from .Algo import algo from .Amr import amr from .Boundary import boundary @@ -19,6 +19,7 @@ from .Langmuirwave import langmuirwave from .Lasers import lasers, lasers_list from .PSATD import psatd from .Particles import particles, particles_list +from ._libwarpx import libwarpx class WarpX(Bucket): @@ -75,19 +76,19 @@ class WarpX(Bucket): def init(self, mpi_comm=None): argv = ['warpx'] + self.create_argv_list() - _libwarpx.initialize(argv, mpi_comm=mpi_comm) + libwarpx.initialize(argv, mpi_comm=mpi_comm) def evolve(self, nsteps=-1): - _libwarpx.evolve(nsteps) + libwarpx.evolve(nsteps) def finalize(self, finalize_mpi=1): - _libwarpx.finalize(finalize_mpi) + libwarpx.finalize(finalize_mpi) def getProbLo(self, direction): - return _libwarpx.libwarpx.libwarpx_so.warpx_getProbLo(direction) + return libwarpx.libwarpx_so.warpx_getProbLo(direction) def getProbHi(self, direction): - return _libwarpx.libwarpx.libwarpx_so.warpx_getProbHi(direction) + return libwarpx.libwarpx_so.warpx_getProbHi(direction) def write_inputs(self, filename='inputs', **kw): argv = self.create_argv_list() -- cgit v1.2.3