Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimerOutput::get_summary_data() returns wrong type for n_calls #16570

Open
marcfehling opened this issue Jan 30, 2024 · 1 comment
Open

TimerOutput::get_summary_data() returns wrong type for n_calls #16570

marcfehling opened this issue Jan 30, 2024 · 1 comment

Comments

@marcfehling
Copy link
Member

marcfehling commented Jan 30, 2024

TimerOutput::get_summary_data() can get called with any option of TimerOutput::OutputData, but always returns the value as a double.

For TimerOutput::OutputData::n_calls this should be an unsigned int.

Do you have an idea for a nice way how to make this right? We can introduce a template parameter for this function which defaults to double, and then the user could specify the data type he wants.

@bangerth
Copy link
Member

That's unnecessarily complicated. It's also not backward compatible unless you default the template argument to double. You could use std::variant<double,unsigned int> if necessary, though then you have to decide whether it should really be an unsigned int of perhaps something larger.

In practice, I cannot think of a different usage for this function than to just output the result. In that case, the return type doesn't matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants