Skip to content

Commit

Permalink
Merge pull request #5912 from gassmoeller/fix_particle_update
Browse files Browse the repository at this point in the history
Fix particle update script
  • Loading branch information
MFraters authored Jun 15, 2024
2 parents 59d55a9 + f1e4960 commit bb315cc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions contrib/utilities/update_scripts/prm_files/move_particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,26 @@
def move_particle_parameters_to_own_subsection(parameters):
""" Move the particle parameters to their own subsection. """

# Find the particle parameters and move
# Collect existing parameters and delete old entries
particle_params = dict({})
if "Postprocess" in parameters:
if "Particles" in parameters["Postprocess"]["value"]:
parameters["Particles"] = parameters["Postprocess"]["value"]["Particles"]
particle_params = parameters["Postprocess"]["value"]["Particles"]
del parameters["Postprocess"]["value"]["Particles"]

# If there are any particle parameters
if "value" in particle_params:
# Make global section if necessary
if not "Particles" in parameters:
parameters["Particles"] = {"comment": "", "value" : dict({}), "type": "subsection"}

# Move parameters one by one, throw an error if it already exists
for parameter in particle_params["value"]:
if not parameter in parameters["Particles"]["value"]:
parameters["Particles"]["value"][parameter] = particle_params["value"][parameter]
else:
assert False, "Error: Duplicated parameter found with name: " + str(parameter)

return parameters


Expand Down

0 comments on commit bb315cc

Please sign in to comment.