-
Notifications
You must be signed in to change notification settings - Fork 239
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
Componentwise norm computation #1349
Conversation
Jenkins: OGS-6/Linux-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs/2521/ |
Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/744/ |
// TODO that also includes ghost nodes. | ||
std::size_t const n_nodes = mesh.getNumberOfNodes(); | ||
|
||
// TODO for PETSc some global accumulation is necessary. |
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.
If x is a PETSc vector, PETSc routine can be called to compute the norms, which collects the distributed data. How about to add members to global vector classes for computing the norms?
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.
For the norms of whole vectors there are already functions in MathLib/LinAlg/LinAlg.h
, which use the PETSc routines in the respective case.
The norm function introduced here, however, only picks, e.g., every third element of the vector and computes a norm involving only those elements. Therefore I think this function should not be moved to the vector classes.
And I didn't check if PETSc supports such "masked" norm computations out of the box.
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.
I see.
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.
FYI PETSc provides VecGetSubVector ()
based on Index Set which basically stores mapping information. see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecGetSubVector.html
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.
@norihiro-w Thanks for the info. I'd like to make the PETSc information later on. I'm a bit skeptical concerning the index set, because it takes additional storage and one has to build it first of all. (Maybe a manual gather is not more complicated)
Jenkins: OGS-6/Mac-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Mac-PRs/2432/ |
Jenkins: OGS-6/Gui/Gui-Linux-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Gui/job/Gui-Linux-PRs/2513/ |
Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/791/ |
Jenkins: OGS-6/Linux-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs/2568/ |
Jenkins: OGS-6/Gui/Mac-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Gui/job/Mac-PRs/2417/ |
fe049c0
to
532b616
Compare
Rebased and squashed as requested. |
double norm(MatrixOrVector const& x, MathLib::VecNormType type) | ||
{ | ||
switch (type) { | ||
case MathLib::VecNormType::NORM1: |
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.
indentation... ✅
Nice! |
👍 |
function has been moved to DOFTableUtil.h
OpenGeoSys development has been moved to GitLab. |
Used by the convergence criteria of #1342.
Predecessor of #1342.
This PR also removes some old norm-related code.
Note: The provided code will not work with PETSc. To be done later on.