42 #ifndef AMESOS2_SOLVER_MP_VECTOR_HPP
43 #define AMESOS2_SOLVER_MP_VECTOR_HPP
45 #include "Amesos2_Solver.hpp"
46 #include "Amesos2_Factory.hpp"
52 template <
class S,
class LO,
class GO,
class N>
59 return S::static_size;
62 #if defined(TPETRA_HAVE_KOKKOS_REFACTOR)
63 template <
class S,
class LO,
class GO,
class D>
89 template<
class,
class>
class ConcreteSolver>
91 public Solver< Tpetra::CrsMatrix<Sacado::MP::Vector<Storage>,
95 Tpetra::MultiVector<Sacado::MP::Vector<Storage>,
104 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
Matrix;
105 typedef Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>
Vector;
108 typedef Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>
Map;
109 typedef Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>
FlatGraph;
110 typedef Tpetra::CrsMatrix<BaseScalar,LocalOrdinal,GlobalOrdinal,Node>
FlatMatrix;
111 typedef Tpetra::MultiVector<BaseScalar,LocalOrdinal,GlobalOrdinal,Node>
FlatVector;
116 typedef typename solver_type::type
type;
123 A(A_),
X(X_),
B(B_) {
136 create_solver_with_supported_type<ConcreteSolver,FlatMatrix,FlatVector>::apply(
flat_A,
flat_X,
flat_B);
311 EPhase keep_phase = CLEAN ) {
316 if (keep_phase <= CLEAN) {
325 if (keep_phase <= SYMBFACT)
350 virtual void setA(
const Matrix* a, EPhase keep_phase = CLEAN ) {
448 virtual std::string
name(
void )
const {
514 template <
template <
class,
class>
class ConcreteSolver,
515 class ST,
class LO,
class GO,
class NO >
518 typedef Tpetra::CrsMatrix<SC,LO,GO,NO>
Matrix;
519 typedef Tpetra::MultiVector<SC,LO,GO,NO>
Vector;
526 typename MatrixTraits<Matrix>::scalar_t,
527 typename MultiVecAdapter<Vector>::scalar_t
529 > same_scalar_assertion;
530 (void)same_scalar_assertion;
540 template <
template <
class,
class>
class ConcreteSolver,
541 class ST,
class LO,
class GO,
class NO >
542 struct create_solver_with_supported_type<
544 Tpetra::CrsMatrix<Sacado::MP::Vector<ST>,LO,GO,NO>,
545 Tpetra::MultiVector<Sacado::MP::Vector<ST>,LO,GO,NO> > :
551 template <
template <
class,
class>
class ConcreteSolver,
553 struct solver_supports_scalar<ConcreteSolver, Sacado::MP::Vector<Storage> > {
557 static const bool value =
558 Meta::if_then_else<Meta::is_same<supported_scalars, Meta::nil_t>::value,
566 #endif // AMESOS2_SOLVER_MP_VECTOR_HPP
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 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)
Teuchos::RCP< const Tpetra::MultiVector< typename Storage::value_type, LocalOrdinal, GlobalOrdinal, Node > > create_flat_vector_view(const Tpetra::MultiVector< Sacado::MP::Vector< Storage >, LocalOrdinal, GlobalOrdinal, Node > &vec_const, const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &flat_map)
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.
virtual void printTiming(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Prints timing information about the current solver.
KokkosClassic::DefaultNode::DefaultNodeType Node
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)
Tpetra::MultiVector< BaseScalar, LocalOrdinal, GlobalOrdinal, Node > FlatVector
Teuchos::RCP< Tpetra::CrsMatrix< typename Storage::value_type, LocalOrdinal, GlobalOrdinal, Node > > create_flat_matrix(const Tpetra::CrsMatrix< Sacado::MP::Vector< Storage >, LocalOrdinal, GlobalOrdinal, Node > &mat, const Teuchos::RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &flat_graph, const LocalOrdinal block_size)
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.
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
Amesos2 solver adapter for MP::Vector scalar type.
virtual type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Set/update internal variables and solver options.
LO get_mp_vector_size(const Teuchos::RCP< const Tpetra::CrsMatrix< Sacado::MP::Vector< S >, LO, GO, N > > &A=Teuchos::null, const Teuchos::RCP< Tpetra::MultiVector< Sacado::MP::Vector< S >, LO, GO, N > > &X=Teuchos::null, const Teuchos::RCP< const Tpetra::MultiVector< Sacado::MP::Vector< S >, LO, GO, N > > &B=Teuchos::null)
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