|
36 | 36 | #ifdef POLYSOLVE_WITH_AMGCL |
37 | 37 | #include "AMGCL.hpp" |
38 | 38 | #endif |
| 39 | +#ifdef POLYSOLVE_WITH_TRILINOS |
| 40 | +#include "TrilinosSolver.hpp" |
| 41 | +#endif |
39 | 42 | #ifdef POLYSOLVE_WITH_CUSOLVER |
40 | 43 | #include "CuSolverDN.cuh" |
41 | 44 | #endif |
42 | 45 | #include <unsupported/Eigen/IterativeSolvers> |
43 | 46 |
|
44 | 47 | //////////////////////////////////////////////////////////////////////////////// |
| 48 | +Eigen::MatrixXd test_vertices; |
| 49 | +Eigen::MatrixXd init_vertices; |
| 50 | +std::vector<int> test_boundary_nodes; |
| 51 | +Eigen::MatrixXd remove_boundary_vertices(const Eigen::MatrixXd &vertices, const std::vector<int> &boundary_nodes) |
| 52 | +{ |
| 53 | + // Remove boundary vertices |
| 54 | + if (boundary_nodes.empty()) |
| 55 | + { |
| 56 | + return vertices; |
| 57 | + } |
| 58 | + else |
| 59 | + { |
| 60 | + std::vector<int> order_nodes = boundary_nodes; |
| 61 | + std::sort(order_nodes.begin(), order_nodes.end()); |
| 62 | + Eigen::MatrixXd out_vertices; |
| 63 | + std::vector<int> keep; |
| 64 | + for (int i = 0; i < vertices.rows(); i++) |
| 65 | + { |
| 66 | + if (!std::binary_search(order_nodes.begin(), order_nodes.end(),i)) |
| 67 | + { |
| 68 | + keep.push_back(i); |
| 69 | + } |
| 70 | + } |
| 71 | + out_vertices = vertices(keep, Eigen::all); |
| 72 | + return out_vertices; |
| 73 | + } |
| 74 | +} |
45 | 75 |
|
46 | 76 | namespace polysolve::linear |
47 | 77 | { |
@@ -377,6 +407,12 @@ namespace polysolve::linear |
377 | 407 | { |
378 | 408 | return std::make_unique<AMGCL>(); |
379 | 409 | #endif |
| 410 | +#ifdef POLYSOLVE_WITH_TRILINOS |
| 411 | + } |
| 412 | + else if (solver == "Trilinos") |
| 413 | + { |
| 414 | + return std::make_unique<TrilinosSolver>(); |
| 415 | +#endif |
380 | 416 | #if EIGEN_VERSION_AT_LEAST(3, 3, 0) |
381 | 417 | // Available only with Eigen 3.3.0 and newer |
382 | 418 | #ifndef POLYSOLVE_LARGE_INDEX |
@@ -499,6 +535,9 @@ namespace polysolve::linear |
499 | 535 | #ifdef POLYSOLVE_WITH_AMGCL |
500 | 536 | "AMGCL", |
501 | 537 | #endif |
| 538 | +#ifdef POLYSOLVE_WITH_TRILINOS |
| 539 | + "Trilinos", |
| 540 | +#endif |
502 | 541 | #if EIGEN_VERSION_AT_LEAST(3, 3, 0) |
503 | 542 | #ifndef POLYSOLVE_LARGE_INDEX |
504 | 543 | "Eigen::LeastSquaresConjugateGradient", |
|
0 commit comments