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

Multigrid support [drzisga/multigrid] #1097

Merged
merged 159 commits into from Apr 19, 2020
Merged

Multigrid support [drzisga/multigrid] #1097

merged 159 commits into from Apr 19, 2020

Conversation

drzisga
Copy link
Contributor

@drzisga drzisga commented Oct 3, 2019

This pull request adds general matrix-based and matrix-free multigrid support. Currently, only H1 spaces are supported.

PR Author Editor Reviewers Assignment Approval Merge
#1097 @drzisga @tzanio @delyank + @barker29 + @pazner 02/09/20 04/06/20 ⌛due 04/13/20

* Merged MultigridSolver into Multigrid class
* Moved as much as possible in to the Multigrid class in order to make DiffusionMultigrid smaller
* Changed interfaces such that they look like in the mockup from the 4/1/20 telecon
@drzisga
Copy link
Contributor Author

drzisga commented Apr 4, 2020

Thank you all again for the feedback. I have now added the following changes we discussed:

  • Switched to my implementation of RefinementOperator::Mult()
  • Renamed SpaceHierarchy to FiniteElementSpaceHierarchy
  • Moved TransferOperators inside FiniteElementSpaceHierarchy. The FiniteElementSpaceHierarchy now manages ownership of the prolongations.
  • Moved MultigridSolver into Multigrid
  • I tried to move as much as possible of the default functionality to Multigrid
  • Reduced code duplication in DiffusionMultigrid
  • Changed the interface according to the mockup from the telecon

@tzanio
Copy link
Member

tzanio commented Apr 7, 2020

Thank you all again for the feedback. I have now added the following changes we discussed:

  • Switched to my implementation of RefinementOperator::Mult()
  • Renamed SpaceHierarchy to FiniteElementSpaceHierarchy
  • Moved TransferOperators inside FiniteElementSpaceHierarchy. The FiniteElementSpaceHierarchy now manages ownership of the prolongations.
  • Moved MultigridSolver into Multigrid
  • I tried to move as much as possible of the default functionality to Multigrid
  • Reduced code duplication in DiffusionMultigrid
  • Changed the interface according to the mockup from the telecon

Thanks for addressing these @drzisga, the interface now looks good to me!

using namespace std;
using namespace mfem;

class DiffusionMultigrid : public Multigrid
Copy link
Member

Choose a reason for hiding this comment

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

Add a short description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a description here and in ex26p

}
};

int main(int argc, char *argv[])
Copy link
Member

Choose a reason for hiding this comment

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

Two lines between the class and main()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a newlines here and in ex26p

examples/ex26.cpp Outdated Show resolved Hide resolved
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this will be better in solvers.?pp... what do the reviewers think?

Copy link
Contributor

Choose a reason for hiding this comment

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

In this form, it "lives" in its own world. It doesn't inherit from the Solver class and does not follow any pre-existent interface. On the other hand, it is in a way a "solver".

Maybe it can be put in the terms of the Solver::Mult(...) interface and return also the eigenvector, but I'm not a big fan of that idea.

If we look at already existing eigenslover, they seem to be in the matrix files and classes. Notably, the class DenseMatrixEigensystem is in densemat.*. So if we follow that paradigm, this needs to move to operator.*

Copy link
Member

Choose a reason for hiding this comment

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

I don't think strongly about this either way...

Copy link
Member

Choose a reason for hiding this comment

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

There are eigensolvers also in hypre and the densemat files

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, yes, I'm for moving this to operator.*, but I also don't have strong opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the PowerMethod class to operator.*

@tzanio
Copy link
Member

tzanio commented Apr 7, 2020

LGTM

@tzanio
Copy link
Member

tzanio commented Apr 7, 2020

Re-merged in next for testing ...

Copy link
Member

@pazner pazner left a comment

Choose a reason for hiding this comment

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

Looks good to me, I think this will be very useful, and the new interface is very nice!

@v-dobrev
Copy link
Member

Re-merged in next.

Comment on lines 154 to 155
/// Get the assembly level
AssemblyLevel GetAssemblyLevel() {return assembly;}
/** Returns the assembly level */
AssemblyLevel GetAssemblyLevel() const { return assembly; }
Copy link
Member

Choose a reason for hiding this comment

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

There is a difference between /// ... and /** ... */ doxygen comments -- we probably should add a section about this in CONTRIBUTING.md.

In this case, we want the comment to become a "brief" documentation and since it fits on one line we can use /// ... comment. Alternatively, (or if the /// ... comment does not fit on one line) one can use /** @brief ... */ comment to create a "brief" documentation. The comment /** ... */ without @brief becomes a "long" documentation (and so does a multiline /// ... comment without @brief).

The "brief" documentation is shown next to the method when listed as part of all class methods. The "long" documentation (together with the "brief" documentation) is shown in the detailed method description which can be accessed by clicking the link "More ..." that is added by doxygen at the end of the "brief" documentation.

Doxygen has a number of such conventions that are not obvious, so it is always best to run make doc and look at the generated output, e.g. by opening doc/CodeDocumentation.html and then searching for the relevant class through the search box in the top right corner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much for the information @v-dobrev. I fixed the documentation according to your comments.

Copy link
Member

@tzanio tzanio left a comment

Choose a reason for hiding this comment

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

Thanks @drzisga for your patience and hard work on this!

@delyank + @barker29 + @pazner + @v-dobrev, thank you for your careful reviews!

@tzanio tzanio merged commit dcd2ed5 into master Apr 19, 2020
Pull Requests automation moved this from Review Now to Merged Apr 19, 2020
@tzanio tzanio deleted the drzisga/multigrid branch April 19, 2020 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Pull Requests
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

9 participants