-
Notifications
You must be signed in to change notification settings - Fork 20
Add Trilinos for linear solver #69
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?
Changes from all commits
a376e0d
8f0210a
31539bb
03fc84f
aafaf46
8ab068d
f920ea4
8641536
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
if(TARGET Trilinos::Trilinos) | ||
return() | ||
endif() | ||
|
||
message(STATUS "Third-party: creating target 'Trilinos::Trilinos'") | ||
|
||
find_package(Trilinos COMPONENTS ML Epetra) | ||
|
||
if(NOT Trilinos_FOUND) | ||
set(POLYSOLVE_WITH_TRILINOS OFF) | ||
message("Trilinos not found.") | ||
endif() | ||
|
||
find_package(MPI) | ||
|
||
if(NOT MPI_FOUND) | ||
set(POLYSOLVE_WITH_TRILINOS OFF) | ||
message("MPI not found.") | ||
endif() | ||
|
||
if(Trilinos_FOUND) | ||
if(MPI_FOUND) | ||
MESSAGE("\nFound Trilinos! Here are the details: ") | ||
MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}") | ||
MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}") | ||
MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}") | ||
MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES} ") | ||
MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS} ") | ||
MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}") | ||
MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}") | ||
MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}") | ||
MESSAGE("End of Trilinos details\n") | ||
# include(trilinos) | ||
if(TARGET Trilinos::Trilinos) | ||
else() | ||
add_library(trilinos INTERFACE) | ||
add_library(Trilinos::Trilinos ALIAS trilinos) | ||
target_include_directories(trilinos INTERFACE ${Trilinos_INCLUDE_DIRS} ) | ||
target_link_libraries(trilinos INTERFACE ${Trilinos_LIBRARIES} ) | ||
target_link_libraries(trilinos INTERFACE MPI::MPI_C MPI::MPI_CXX ) | ||
endif() | ||
endif() | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
"Eigen::MINRES", | ||
"Pardiso", | ||
"Hypre", | ||
"AMGCL" | ||
"AMGCL", | ||
"Trilinos" | ||
], | ||
"doc": "Settings for the linear solver." | ||
}, | ||
|
@@ -42,6 +43,7 @@ | |
"Pardiso", | ||
"Hypre", | ||
"AMGCL", | ||
"Trilinos", | ||
"Eigen::LeastSquaresConjugateGradient", | ||
"Eigen::DGMRES", | ||
"Eigen::ConjugateGradient", | ||
|
@@ -153,6 +155,17 @@ | |
], | ||
"doc": "Settings for the AMGCL solver." | ||
}, | ||
{ | ||
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. i dont think you need any of these, there are no options for trilinos 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. you need to add the options from trilinos 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. Fixed. |
||
"pointer": "/Trilinos", | ||
"default": null, | ||
"type": "object", | ||
"optional": [ | ||
"max_iter", | ||
"tolerance", | ||
"block_size" | ||
], | ||
"doc": "Settings for the Trilinos solver." | ||
}, | ||
{ | ||
"pointer": "/Eigen::LeastSquaresConjugateGradient/max_iter", | ||
"default": 1000, | ||
|
@@ -421,5 +434,29 @@ | |
"default": 0, | ||
"type": "float", | ||
"doc": "Aggregation epsilon strong." | ||
}, | ||
{ | ||
"pointer": "/Trilinos/max_iter", | ||
"default": 1000, | ||
"type": "int", | ||
"doc": "Maximum number of iterations." | ||
}, | ||
{ | ||
"pointer": "/Trilinos/block_size", | ||
"default": 3, | ||
"type": "int", | ||
"doc": "Aggregation epsilon strong." | ||
}, | ||
{ | ||
"pointer": "/Trilinos/tolerance", | ||
"default": 1e-8, | ||
"type": "float", | ||
"doc": "Convergence tolerance." | ||
}, | ||
{ | ||
"pointer": "/Trilinos/is_nullspace", | ||
"default": false, | ||
"type": "bool", | ||
"doc": "Is nullspace or not." | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
#include <memory> | ||
|
||
|
||
#define POLYSOLVE_DELETE_MOVE_COPY(Base) \ | ||
Base(Base &&) = delete; \ | ||
Base &operator=(Base &&) = delete; \ | ||
|
@@ -34,6 +35,7 @@ namespace polysolve::linear | |
public: | ||
// Shortcut alias | ||
typedef Eigen::VectorXd VectorXd; | ||
typedef Eigen::MatrixXd MatrixXd; | ||
template <typename T> | ||
using Ref = Eigen::Ref<T>; | ||
|
||
|
@@ -123,6 +125,7 @@ namespace polysolve::linear | |
/// and initialized. } | ||
/// | ||
virtual void solve(const Ref<const VectorXd> b, Ref<VectorXd> x) = 0; | ||
virtual void solve(const Ref<const VectorXd> b, const Ref<const MatrixXd> nullspace, Ref<VectorXd> x) {} | ||
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 should call the other solve |
||
|
||
/// @brief Name of the solver type (for debugging purposes) | ||
virtual std::string name() const { return ""; } | ||
|
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.
on