Skip to content

Allow Diagnostic output at arbitrary steps using Parser#1334

Merged
MaxThevenet merged 5 commits into
Hi-PACE:developmentfrom
AlexanderSinn:Allow_Diagnostic_output_at_arbitrary_steps_using_Parser
Feb 23, 2026
Merged

Allow Diagnostic output at arbitrary steps using Parser#1334
MaxThevenet merged 5 commits into
Hi-PACE:developmentfrom
AlexanderSinn:Allow_Diagnostic_output_at_arbitrary_steps_using_Parser

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

This PR extends the diagnostic output period input parameters with parser support. Because with the current functionality, = 0 means no output and = 1 means output every step, it extends quite nicely to arbitrary conditions that can then return 0 or 1, while still having the old behavior with values > 1 as an easy-to-use default.

# Current functionality:

# output nothing
diagnostic.output_period = 0
# output every time step
diagnostic.output_period = 1
# output every 10 steps and the last step
diagnostic.output_period = 10

# New in this PR:

# output only max_step
diagnostic.output_period = current_step == max_step
# same is = 10, but remove first step
diagnostic.output_period = if(current_step == 0, 0, 10)
# same as above
diagnostic.output_period = 10 * (current_step != 0)
# output every 10 steps, not necessarily the last step
diagnostic.output_period = fmod(current_step, 10) == 0
# same as = 10
diagnostic.output_period = fmod(current_step, 10) == 0 or current_step == max_step or current_time == hipace.max_time
# nonuniform output period
diagnostic.output_period = if(current_time <= 350, 2, 10)
  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added the component: diagnostics About any types of diagnostics label Jan 6, 2026
Copy link
Copy Markdown
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! Could you update the documentation accordingly? It should contain a description of the new behaviour, but for the examples I think it's OK to link to the PR description.

@MaxThevenet MaxThevenet merged commit 6c5343c into Hi-PACE:development Feb 23, 2026
11 checks passed
@AlexanderSinn AlexanderSinn deleted the Allow_Diagnostic_output_at_arbitrary_steps_using_Parser branch April 8, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: diagnostics About any types of diagnostics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants