-
Notifications
You must be signed in to change notification settings - Fork 55
Discussion: Remove the inheritance of Epetra_Operator from SparseOperator? #1524
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
base: main
Are you sure you want to change the base?
Discussion: Remove the inheritance of Epetra_Operator from SparseOperator? #1524
Conversation
|
I think this is a good first approach due to several reasons:
|
|
|
||
| #endif | ||
| /*LINALG_SPARSEOPERATOR_H_*/ | ||
| /*LINALG_SPARSEOPERATOR_H_*/ |
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.
| /*LINALG_SPARSEOPERATOR_H_*/ |
| Epetra_Operator. | ||
| */ | ||
| virtual Epetra_Operator& epetra_operator() { return *this; } | ||
| virtual ~SparseOperator(); // declaration only |
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.
| virtual ~SparseOperator(); // declaration only | |
| virtual ~SparseOperator() = default; |
and remove the corresponding cpp file.
| // TODO: Potential error here? | ||
| jac_ptr_ = std::shared_ptr<Epetra_Operator>(J, &J->epetra_operator()); |
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.
This is correct AFAICT, however, aliasing shared_ptrs is complicated enough that it might warrant its own helper function.
|
@vovannikov What's your take on the nonlinear solver? From the linear solver perspective I'm pretty confident, that we can get rid of the inheritance by using the |
|
@knarfnitram Thank you for this effort! In my opinion, Similarly here, this inheritance from It is possible to make NOX independent from @maxfirmbach I think you are right. |
|
Thanks for the update @vovannikov. Good to hear, that we are on the same page. Just let us know if you need any help regarding the matrix interfaces or once the NOX interface is ready such that we can continue here. |
Description and Context
The
SparseOperatorwhich is the the general virtual Interface for the 4c matrices, inherits directly from theEpetra_Operator, offering to access functions from Epetra directly within our codebase.I tried to remove the inheritance in a first step, but came up with some issues related to nox.
Since the inheritance is removed, the still necessary
Epetra_Operatorcould be reused from the stored matrix as done with theSparseMatrixor for our custom implementations (BlockSparseMatrixBase), where we overwrite methods of theEpetra_Operatorwe would still need to directly inherit from theEpetra_Operator(according to @maxfirmbach we could probably also remove this inheritance by switching from the belos interface to thyra for the iterative solver interface).This PR is meant as discussion with some code example.
Open questions:
Epetra_Operatoris used there.How is it planed to be used?
Related Issues and Pull Requests