Skip to content

Commit

Permalink
python callback at restart
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Jan 10, 2025
1 parent 17b0c3d commit d5aa155
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Python/pywarpx/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def callfuncsinlist(self, *args, **kw):
"loadExternalFields": {},
"beforeInitEsolve": {},
"afterInitEsolve": {},
"afterInitatRestart": {},
"afterinit": {},
"beforecollisions": {},
"aftercollisions": {},
Expand Down Expand Up @@ -405,6 +406,13 @@ def callfromafterInitEsolve(f):
def installafterInitEsolve(f):
installcallback("afterInitEsolve", f)

# ----------------------------------------------------------------------------
def callfromafterInitatRestart(f):
installcallback("afterInitatRestart", f)
return f

def installafterInitatRestart(f):
installcallback("afterInitatRestart", f)

# ----------------------------------------------------------------------------
def callfromafterinit(f):
Expand Down
3 changes: 3 additions & 0 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ WarpX::InitData ()
AddExternalFields(lev);
}
}
else {
ExecutePythonCallback("afterInitatRestart");
}

if (restart_chkfile.empty() || write_diagnostics_on_restart) {
// Write full diagnostics before the first iteration.
Expand Down

0 comments on commit d5aa155

Please sign in to comment.