-
Notifications
You must be signed in to change notification settings - Fork 707
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
add Event signals for GMG #5913
Conversation
Why not use separate signal variables like we do in |
} | ||
|
||
/** | ||
* Implementation of the multigrid method. The implementation supports both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably did not need to indent this comment so that git
does not show it as a diff.
I guess the reason is that you don't know in advance how many levels you have in GMG and you may want to track operations on each level separately (i.e. get timing for different levels). |
Interesting point. I guess one of the reasons to do it this way is that one of the use cases I have in mind is subscribing to everything and logging all events including time stamps (see the included test as an example). That would be annoying to do if I had to write a lambda for every single event type. |
I like the idea. Currently, we are using a lot of |
I find the use of an |
I am not totally opposed to it, but I think it is a bit more fragile. One of Conrad's use cases is something like this:
Of course I can do everything with string comparisons, but I like having as much of the information in a structured way. I don't really want to parse log strings/files... |
Then make the event take 3 arguments: one string to identify what it is, a bool for start/stop, and a level. |
int K; | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it simple and not have varying coefficients
Dear all, @masterleinad and @jwitte08 just discussed the issue. We prefer a solution which is closer to
We add a code sample, which illustrates using timers and outputting a vector
Note: Daniel prefers a reference to the multigrid object in the function calls, thus
|
I don't know too much about MG, but to me this seems like a perfectly reasonable and flexible solution to the issue at hand. I see there's a mixed opinion on the matter in the preceding discussion, but @guidokanschat's clearly demonstrated that with such an interface its possible to treat events on a per-level basis. Retaining implementation consistency by mirroring the existing signals mechanism for the |
If you define the lambda at the same location where you also attach it to the multigrid object, then you can achieve the same effect by passing this as a capture argument:
This way, the But I think the additional argument also has merits for cases where one wants to call larger functions not as well suited to lambdas from a signal. Not sure we do this anywhere, but I can think of cases -- in fact, on second thought, So one can argue either way. I'd argue for being consistent, taking into account what we already do in such places. |
It seems that we don't pass the object as argument for the |
Superceded by #6129 |
Before going further with this, I am hoping to get some feedback (@kronbichler, @davydden, others?) on an implementation of specific events inside the library for the user to hook into (for logging, timing, debugging, etc.). See #2298 for the original question.
The current implementation here does what I need (see the test for an example). I assume we want this to be a more generic thing, so it makes sense to move the declaration of the events into a header in base/ ?
Any other comments?