aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2022-04-19 17:40:53 -0700
committerGravatar GitHub <noreply@github.com> 2022-04-19 17:40:53 -0700
commite538399d99121d37ece3d23f4444342117a9a723 (patch)
tree418045efa6009eff78df101952eb1394e7722d88 /Python/pywarpx
parenta45bc79affbcefc939fd783ec74d0e43d0807fce (diff)
downloadWarpX-e538399d99121d37ece3d23f4444342117a9a723.tar.gz
WarpX-e538399d99121d37ece3d23f4444342117a9a723.tar.zst
WarpX-e538399d99121d37ece3d23f4444342117a9a723.zip
add after diagnostic python callback (#3043)
Diffstat (limited to 'Python/pywarpx')
-rw-r--r--Python/pywarpx/callbacks.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/pywarpx/callbacks.py b/Python/pywarpx/callbacks.py
index 8fa08e6ef..cb9293c5a 100644
--- a/Python/pywarpx/callbacks.py
+++ b/Python/pywarpx/callbacks.py
@@ -29,6 +29,7 @@ Functions can be called at the following times:
- afterdeposition <installafterdeposition>: after particle deposition (for charge and/or current)
- beforestep <installbeforestep>: before the time step
- afterstep <installafterstep>: after the time step
+ - afterdiagnostics <installafterdiagnostics>: after diagnostic output
- particlescraper <installparticlescraper>: just after the particle boundary conditions are applied
but before lost particles are processed
- particleloader <installparticleloader>: at the time that the standard particle loader is called
@@ -261,6 +262,7 @@ _particlescraper = CallbackFunctions('particlescraper')
_particleloader = CallbackFunctions('particleloader')
_beforestep = CallbackFunctions('beforestep')
_afterstep = CallbackFunctions('afterstep')
+_afterdiagnostics = CallbackFunctions('afterdiagnostics')
_afterrestart = CallbackFunctions('afterrestart',lcallonce=1)
_particleinjection = CallbackFunctions('particleinjection')
_appliedfields = CallbackFunctions('appliedfields')
@@ -279,6 +281,7 @@ def printcallbacktimers(tmin=1.,lminmax=False,ff=None):
_particlescraper,
_particleloader,
_beforestep,_afterstep,
+ _afterdiagnostics,
_afterrestart,
_particleinjection,
_appliedfields]:
@@ -472,6 +475,20 @@ def isinstalledafterstep(f):
return _afterstep.isinstalledfuncinlist(f)
# ----------------------------------------------------------------------------
+def callfromafterdiagnostics(f):
+ installafterdiagnostics(f)
+ return f
+def installafterdiagnostics(f):
+ "Adds a function to the list of functions called after diagnostic output"
+ _afterdiagnostics.installfuncinlist(f)
+def uninstallafterdiagnostics(f):
+ "Removes the function from the list of functions called after diagnostic output"
+ _afterdiagnostics.uninstallfuncinlist(f)
+def isinstalledafterdiagnostics(f):
+ "Checks if the function is called after diagnostic output"
+ return _afterdiagnostics.isinstalledfuncinlist(f)
+
+# ----------------------------------------------------------------------------
def callfromafterrestart(f):
raise Exception('restart call back not implemented yet')
installafterrestart(f)