10 #ifndef AMESOS2_SOLVER_MP_VECTOR_HPP
11 #define AMESOS2_SOLVER_MP_VECTOR_HPP
13 #include "Amesos2_Solver.hpp"
14 #include "Amesos2_Factory.hpp"
20 template <
class S,
class LO,
class GO,
class NO>
45 template<
class,
class>
class ConcreteSolver>
47 public Solver< Tpetra::CrsMatrix<Sacado::MP::Vector<Storage>,
51 Tpetra::MultiVector<Sacado::MP::Vector<Storage>,
60 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
Matrix;
61 typedef Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>
Vector;
64 typedef Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>
Map;
65 typedef Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>
FlatGraph;
66 typedef Tpetra::CrsMatrix<BaseScalar,LocalOrdinal,GlobalOrdinal,Node>
FlatMatrix;
67 typedef Tpetra::MultiVector<BaseScalar,LocalOrdinal,GlobalOrdinal,Node>
FlatVector;
72 typedef typename solver_type::type
type;
92 create_solver_with_supported_type<ConcreteSolver,FlatMatrix,FlatVector>::apply(
flat_A,
flat_X,
flat_B);
267 EPhase keep_phase = CLEAN ) {
272 if (keep_phase <= CLEAN) {
281 if (keep_phase <= SYMBFACT)
306 virtual void setA(
const Matrix* a, EPhase keep_phase = CLEAN ) {
404 virtual std::string
name(
void )
const {
470 template <
template <
class,
class>
class ConcreteSolver,
471 class ST,
class LO,
class GO,
class NO >
474 typedef Tpetra::CrsMatrix<SC,LO,GO,NO>
Matrix;
475 typedef Tpetra::MultiVector<SC,LO,GO,NO>
Vector;
482 typename MatrixTraits<Matrix>::scalar_t,
483 typename MultiVecAdapter<Vector>::scalar_t
485 > same_scalar_assertion;
486 (void)same_scalar_assertion;
496 template <
template <
class,
class>
class ConcreteSolver,
497 class ST,
class LO,
class GO,
class NO >
498 struct create_solver_with_supported_type<
500 Tpetra::CrsMatrix<Sacado::MP::Vector<ST>,LO,GO,NO>,
501 Tpetra::MultiVector<Sacado::MP::Vector<ST>,LO,GO,NO> > :
507 template <
template <
class,
class>
class ConcreteSolver,
509 struct solver_supports_scalar<ConcreteSolver, Sacado::MP::Vector<Storage> > {
513 static const bool value =
514 std::conditional_t<std::is_same_v<supported_scalars, Meta::nil_t>,
522 #endif // AMESOS2_SOLVER_MP_VECTOR_HPP
Teuchos::RCP< Tpetra::CrsMatrix< typename Storage::value_type, LocalOrdinal, GlobalOrdinal, Node > > create_flat_matrix(const Tpetra::CrsMatrix< Sacado::UQ::PCE< Storage >, LocalOrdinal, GlobalOrdinal, Node > &mat, const Teuchos::RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &flat_graph, const Teuchos::RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &cijk_graph, const CijkType &cijk_dev)
Teuchos::RCP< const Matrix > A
virtual void setX(Vector *x)
Sets the LHS vector X using a raw pointer.
Stokhos::StandardStorage< int, double > Storage
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
virtual std::string description(void) const
Returns a short description of this Solver.
Teuchos::RCP< const Map > flat_B_map
virtual std::string name(void) const
Return the name of this solver.
virtual void setA(const Teuchos::RCP< const Matrix > a, EPhase keep_phase=CLEAN)
Sets the matrix A of this solver.
virtual void solve(void)
Solves (or )
virtual type & preOrdering(void)
Pre-orders the matrix.
virtual const Teuchos::RCP< Vector > getX(void)
Returns the vector that is the LHS of the linear system.
virtual const Vector * getBRaw(void)
Returns a raw pointer to the RHS of the linear system.
Scalar::value_type BaseScalar
Scalar::value_type BaseScalar
virtual void setB(const Vector *b)
Sets the RHS vector B using a raw pointer.
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > FlatGraph
Solver< FlatMatrix, FlatVector > FlatSolver
virtual void solve(Vector *XX, const Vector *BB) const
Solve using the given XX and BB (multi)vectors.
Teuchos::RCP< const Tpetra::MultiVector< typename Storage::value_type, LocalOrdinal, GlobalOrdinal, Node > > create_flat_vector_view(const Tpetra::MultiVector< Sacado::UQ::PCE< Storage >, LocalOrdinal, GlobalOrdinal, Node > &vec, const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &flat_map)
Teuchos::RCP< const Map > flat_X_map
Teuchos::RCP< const FlatGraph > flat_graph
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< View< T, P...> >::value, unsigned >::type dimension_scalar(const View< T, P...> &view)
Teuchos::RCP< FlatSolver > flat_solver
virtual type & symbolicFactorization(void)
Performs symbolic factorization on the matrix.
Sacado::MP::Vector< Storage > Scalar
virtual Status & getStatus() const
Returns a reference to this solver's internal status object.
virtual void getTiming(Teuchos::ParameterList &timingParameterList) const
Extracts timing information from the current solver.
static Teuchos::RCP< Solver< Matrix, Vector > > apply(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Teuchos::RCP< const FlatMatrix > flat_A
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > Matrix
Teuchos::RCP< FlatVector > flat_X
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
ConcreteSolver< FlatMatrix, FlatVector > FlatConcreteSolver
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters(void) const
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
virtual void setX(const Teuchos::RCP< Vector > x)
Sets the LHS vector X.
Teuchos::RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > create_flat_mp_graph(const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > &graph, Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &flat_domain_map, Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &flat_range_map, const LocalOrdinal block_size)
virtual void printTiming(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Prints timing information about the current solver.
Tpetra::MultiVector< BaseScalar, LocalOrdinal, GlobalOrdinal, Node > FlatVector
virtual void setA(const Matrix *a, EPhase keep_phase=CLEAN)
Sets the matrix A of this solver.
virtual bool matrixShapeOK(void)
Returns true if the solver can handle the matrix shape.
static const EVerbosityLevel verbLevel_default
Teuchos::RCP< const Vector > B
virtual void setB(const Teuchos::RCP< const Vector > b)
Sets the RHS vector B.
LO get_mp_vector_size(const Teuchos::RCP< const Tpetra::CrsMatrix< Sacado::MP::Vector< S >, LO, GO, NO > > &A=Teuchos::null, const Teuchos::RCP< Tpetra::MultiVector< Sacado::MP::Vector< S >, LO, GO, NO > > &X=Teuchos::null, const Teuchos::RCP< const Tpetra::MultiVector< Sacado::MP::Vector< S >, LO, GO, NO > > &B=Teuchos::null)
Sacado::MP::Vector< ST > SC
Tpetra::MultiVector< SC, LO, GO, NO > Vector
MPVectorSolverAdapter(const Teuchos::RCP< const Matrix > &A_, const Teuchos::RCP< Vector > &X_, const Teuchos::RCP< const Vector > &B_)
Constructor.
virtual void solve(const Teuchos::Ptr< Vector > XX, const Teuchos::Ptr< const Vector > BB) const
Solve using the given XX and BB (multi)vectors.
Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > Vector
Tpetra::CrsMatrix< SC, LO, GO, NO > Matrix
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType Node
Amesos2 solver adapter for MP::Vector scalar type.
virtual type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Set/update internal variables and solver options.
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > Map
Solver< Matrix, Vector > solver_type
solver_traits< ConcreteSolver >::supported_scalars supported_scalars
Teuchos::RCP< const FlatVector > flat_B
virtual type & numericFactorization(void)
Performs numeric factorization on the matrix.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm(void) const
Returns a pointer to the Teuchos::Comm communicator with this matrix.
Tpetra::CrsMatrix< BaseScalar, LocalOrdinal, GlobalOrdinal, Node > FlatMatrix
virtual Vector * getXRaw(void)
Returns a raw pointer to the LHS of the linear system.
virtual const Teuchos::RCP< const Vector > getB(void)
Returns the vector that is the RHS of the linear system.
Sacado::MP::Vector< Storage > Scalar