-
Notifications
You must be signed in to change notification settings - Fork 90
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
LaplaceHypre3d statistics output #2260
LaplaceHypre3d statistics output #2260
Conversation
Allows Laplacian implementations to define monitors and add output to dump files if users pass a Solver and a Datafile to the Laplacian::create() method.
If the Laplacian is constructed with Solver and Datafile arguments, it will write an average iteration count to the Datafile.
public: | ||
static constexpr auto type_name = "Laplacian"; | ||
static constexpr auto section_name = "laplace"; | ||
static constexpr auto option_name = "type"; | ||
static constexpr auto default_type = LAPLACE_CYCLIC; | ||
|
||
ReturnType create(Options* options = nullptr, CELL_LOC loc = CELL_CENTRE, | ||
Mesh* mesh = nullptr) { | ||
Mesh* mesh = nullptr, Solver* solver = nullptr, | ||
Datafile* dump = nullptr) { |
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.
Just a note that when we get the output refactoring in, this will be a bit nicer as we'd be able to drop the Datafile
I'm always a little cautious about adding more arguments to constructors, but I think this is probably the best way of doing things. Another option might be to just make the monitor available and then up to the user to add it. That would end up looking something like: auto laplacian = Laplacian::create(options);
laplacian.monitor.outputVars(dump); // This would need to be added
solver->addMonitor(&laplacian.monitor); which is not a terrible amount of boilerplate for user code, but still, maybe not quite as nice as just auto laplacian = Laplacian::create(options, CELL_CENTRE, mesh, solver, dump); With the warning in the constructor, this feature is actually discoverable, where it wouldn't be with the user-side monitor registration. |
A slightly different approach (while we can still break interfaces for v5) might be to pass a |
Definitely something to consider! I'm happy with this approach though |
I would prefer to not require a full physics model to use the Laplacian. I have used the Laplacian in the past without actually having a physics model, although I used only one mesh, so maybe that would be fine for that use case. At least for the python interface, I think three separate pointers are much nicer 👍 |
Good points @ZedThree @dschwoerer. Lets stick with the interface in this PR 👍 |
could be simplified to:
and in the case that |
@bendudson - I'm not sure if the branch in this PR ever got merged in to anything - if not I think it would be useful to merge into whatever the current GPU branch is... |
…loop-cuda-hypre3d-stats-output
Squash some warnings about unused variables (Solver and Datafile) in Laplacian constructors.
Writes an average iteration count from
LaplaceHypre3d
to the dump files, ifLaplacian::create()
is called withSolver
andDatafile
arguments. The average iteration count for each output step will also be printed if the command line flag--verbose
(or-v
) is passed.@ZedThree @bendudson I've added extra arguments to the
Laplacian
constructor to implement this. What do you think of the design?