11 #ifndef __Panzer_TpetraLinearObjContainer_hpp__
12 #define __Panzer_TpetraLinearObjContainer_hpp__
14 #include "PanzerDiscFE_config.hpp"
19 #include "Tpetra_Vector.hpp"
20 #include "Tpetra_CrsMatrix.hpp"
22 #include "Thyra_TpetraThyraWrappers.hpp"
32 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT=panzer::TpetraNodeType>
40 typedef Tpetra::Vector<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>
VectorType;
41 typedef Tpetra::CrsMatrix<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>
CrsMatrixType;
42 typedef Tpetra::CrsGraph<LocalOrdinalT,GlobalOrdinalT,NodeT>
CrsGraphType;
43 typedef Tpetra::Map<LocalOrdinalT,GlobalOrdinalT,NodeT>
MapType;
44 typedef Tpetra::Import<LocalOrdinalT,GlobalOrdinalT,NodeT>
ImportType;
45 typedef Tpetra::Export<LocalOrdinalT,GlobalOrdinalT,NodeT>
ExportType;
48 const Teuchos::RCP<
const Tpetra::Map<LocalOrdinalT,GlobalOrdinalT,NodeT> > & range)
50 domainSpace = Thyra::createVectorSpace<ScalarT>(domain);
51 rangeSpace = Thyra::createVectorSpace<ScalarT>(range);
56 if(
get_x()!=Teuchos::null)
get_x()->putScalar(0.0);
58 if(
get_f()!=Teuchos::null)
get_f()->putScalar(0.0);
59 if(
get_A()!=Teuchos::null) {
61 mat->setAllToScalar(0.0);
88 A->setAllToScalar(value);
93 if(in==Teuchos::null) {
x = Teuchos::null;
return; }
96 = TOE::getConstTpetraVector(in);
97 x = Teuchos::rcp_const_cast<Tpetra::Vector<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT> >(x_const);
100 {
return (
x==Teuchos::null) ? Teuchos::null : Thyra::createVector(
x,
domainSpace); }
104 if(in==Teuchos::null) {
dxdt = Teuchos::null;
return; }
107 = TOE::getConstTpetraVector(in);
108 dxdt = Teuchos::rcp_const_cast<Tpetra::Vector<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT> >(dxdt_const);
114 {
f = (in==Teuchos::null) ? Teuchos::null : TOE::getTpetraVector(in); }
116 {
return (
f==Teuchos::null) ? Teuchos::null : Thyra::createVector(
f,
rangeSpace); }
119 {
A = (in==Teuchos::null) ? Teuchos::null : Teuchos::rcp_dynamic_cast<CrsMatrixType>(TOE::getTpetraOperator(in),
true); }
121 {
return (
A==Teuchos::null) ? Teuchos::null : Thyra::createLinearOp<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>(
A,
rangeSpace,
domainSpace); }
124 typedef Thyra::TpetraOperatorVectorExtraction<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>
TOE;
TpetraLinearObjContainer(const Teuchos::RCP< const Tpetra::Map< LocalOrdinalT, GlobalOrdinalT, NodeT > > &domain, const Teuchos::RCP< const Tpetra::Map< LocalOrdinalT, GlobalOrdinalT, NodeT > > &range)
const Teuchos::RCP< CrsMatrixType > get_A() const
const Teuchos::RCP< VectorType > get_x() const
Teuchos::RCP< Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > > f
Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > VectorType
Teuchos::RCP< Tpetra::CrsMatrix< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > > A
Tpetra::Map< LocalOrdinalT, GlobalOrdinalT, NodeT > MapType
void clear()
Wipe out stored data.
virtual void set_A_th(const Teuchos::RCP< Thyra::LinearOpBase< ScalarT > > &in)
const Teuchos::RCP< VectorType > get_dxdt() const
virtual Teuchos::RCP< Thyra::VectorBase< ScalarT > > get_x_th() const
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > domainSpace
Tpetra::Export< LocalOrdinalT, GlobalOrdinalT, NodeT > ExportType
Tpetra::CrsMatrix< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > CrsMatrixType
virtual Teuchos::RCP< Thyra::VectorBase< ScalarT > > get_dxdt_th() const
void set_x(const Teuchos::RCP< VectorType > &in)
virtual void set_dxdt_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)
Tpetra::CrsGraph< LocalOrdinalT, GlobalOrdinalT, NodeT > CrsGraphType
Teuchos::RCP< Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > > x
Tpetra::Import< LocalOrdinalT, GlobalOrdinalT, NodeT > ImportType
void set_dxdt(const Teuchos::RCP< VectorType > &in)
Teuchos::RCP< Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > > dxdt
virtual void set_f_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)
virtual Teuchos::RCP< Thyra::LinearOpBase< ScalarT > > get_A_th() const
void set_A(const Teuchos::RCP< CrsMatrixType > &in)
Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > rangeSpace
void set_f(const Teuchos::RCP< VectorType > &in)
Thyra::TpetraOperatorVectorExtraction< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > TOE
LinearObjContainer::Members Members
virtual void set_x_th(const Teuchos::RCP< Thyra::VectorBase< ScalarT > > &in)
const Teuchos::RCP< VectorType > get_f() const
void initializeMatrix(ScalarT value)
Put a particular scalar in the matrix.
virtual void initialize()
virtual Teuchos::RCP< Thyra::VectorBase< ScalarT > > get_f_th() const
TpetraLinearObjContainer()