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

Silence p4est output #624

Closed
efaulhaber opened this issue Jun 1, 2021 · 5 comments
Closed

Silence p4est output #624

efaulhaber opened this issue Jun 1, 2021 · 5 comments

Comments

@efaulhaber
Copy link
Member

Right now, there is a lot of output from p4est when running bigger AMR examples with P4estMesh (not merged yet, see #584).
I don't see how this could be done without using sc_package_is_registered and sc_package_set_verbosity, so it seems like trixi-framework/P4est.jl#32 needs to be resolved first.

@efaulhaber efaulhaber self-assigned this Jun 1, 2021
@sloede
Copy link
Member

sloede commented Jun 1, 2021

Can you do a workaround for now, e.g., by directly calling p4est_init without checking for an existing initialization?

@efaulhaber
Copy link
Member Author

This will crash Julia if P4est.jl has been used before in the same session.

@sloede
Copy link
Member

sloede commented Jun 1, 2021

Can you maybe put it in the __init__() method of Trixi as a workaround for now? That should ensure that it is only run at most once when using Trixi, unless someone uses Trixi and another package together that also initializes P4est without checking whether it is initialized.

@efaulhaber
Copy link
Member Author

Can we somehow check in the init function if P4est.jl has been used before? Otherwise

using P4est
using Trixi

would crash Julia.

@efaulhaber
Copy link
Member Author

I solved it like this now:

if p4est_package_id()[] < 0
  p4est_init(C_NULL, SC_LP_ERROR)
end

p4est_package_id reliably returns -1 if p4est hasn't been initialized (at least in the current p4est version).
This initializes p4est if it hasn't been done before. If a user initialized p4est with a different log level before using Trixi, we won't touch the log level.

@efaulhaber efaulhaber removed their assignment Jun 1, 2021
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