-
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
Draft
knarfnitram
wants to merge
1
commit into
4C-multiphysics:main
Choose a base branch
from
knarfnitram:remove-epetra-operator-from-sparse-operator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // This file is part of 4C multiphysics licensed under the | ||
| // GNU Lesser General Public License v3.0 or later. | ||
| // | ||
| // See the LICENSE.md file in the top-level for license information. | ||
| // | ||
| // SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
|
||
| #include "4C_linalg_sparseoperator.hpp" | ||
|
|
||
| FOUR_C_NAMESPACE_OPEN | ||
|
|
||
| namespace Core::LinAlg | ||
| { | ||
| SparseOperator::~SparseOperator() {} | ||
| } // namespace Core::LinAlg | ||
|
|
||
| FOUR_C_NAMESPACE_CLOSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -70,7 +70,7 @@ namespace Core::LinAlg | |||
| is BlockSparseMatrix, a block matrix build from a list of SparseMatrix. | ||||
|
|
||||
| */ | ||||
| class SparseOperator : public Epetra_Operator | ||||
| class SparseOperator | ||||
| { | ||||
| public: | ||||
| /// return the internal Epetra_Operator | ||||
|
|
@@ -81,14 +81,17 @@ namespace Core::LinAlg | |||
| \warning Only low level solver routines are interested in the internal | ||||
| Epetra_Operator. | ||||
| */ | ||||
| virtual Epetra_Operator& epetra_operator() { return *this; } | ||||
| virtual ~SparseOperator(); // declaration only | ||||
| virtual Epetra_Operator& epetra_operator() = 0; | ||||
|
|
||||
| /// set matrix to zero | ||||
| virtual void zero() = 0; | ||||
|
|
||||
| /// throw away the matrix and its graph and start anew | ||||
| virtual void reset() = 0; | ||||
|
|
||||
| virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const = 0; | ||||
|
|
||||
| /// Assemble a Core::LinAlg::SerialDenseMatrix into a matrix with striding | ||||
| /*! | ||||
|
|
||||
|
|
@@ -211,6 +214,9 @@ namespace Core::LinAlg | |||
| /// Returns the Epetra_Map object associated with the (full) domain of this operator. | ||||
| virtual const Map& domain_map() const = 0; | ||||
|
|
||||
| /// Returns the Epetra_Map object associated with the (full) range of this operator. | ||||
| virtual const Map& range_map() const = 0; | ||||
|
|
||||
| /// Add one operator to another | ||||
| virtual void add(const Core::LinAlg::SparseOperator& A, const bool transposeA, | ||||
| const double scalarA, const double scalarB) = 0; | ||||
|
|
@@ -237,4 +243,4 @@ namespace Core::LinAlg | |||
| FOUR_C_NAMESPACE_CLOSE | ||||
|
|
||||
| #endif | ||||
| /*LINALG_SPARSEOPERATOR_H_*/ | ||||
| /*LINALG_SPARSEOPERATOR_H_*/ | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,15 +33,16 @@ NOX::FSI::LinearSystem::LinearSystem(Teuchos::ParameterList& printParams, | |
| std::shared_ptr<Core::LinAlg::Solver> solver, const std::shared_ptr<NOX::Nln::Scaling> s) | ||
| : utils_(printParams), | ||
| jac_interface_ptr_(iJac), | ||
| jac_ptr_(J), | ||
| // jac_ptr_(Teuchos::rcp:_(J->epetra_operator())), | ||
| operator_(J), | ||
| scaling_(s), | ||
| callcount_(0), | ||
| solver_(solver), | ||
| timer_("", true) | ||
| { | ||
| tmp_vector_ptr_ = std::make_shared<NOX::Nln::Vector>(cloneVector); | ||
|
|
||
| // TODO: Potential error here? | ||
| jac_ptr_ = std::shared_ptr<Epetra_Operator>(J, &J->epetra_operator()); | ||
|
Comment on lines
+44
to
+45
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| reset(linearSolverParams); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
and remove the corresponding cpp file.