|
Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
|
Go to the documentation of this file.
43 #include "EpetraExt_BlockMultiVector.h"
54 label(
"Stokhos Mean-Based Preconditioner"),
57 epetraCijk(epetraCijk_),
61 prec_factory(prec_factory_),
80 "Error! setupPreconditioner() cannot be called when " <<
81 "prec_factory is null!" << std::endl);
85 mean_prec = prec_factory->compute(sg_poly->
getCoeffPtr(0));
86 label = std::string(
"Stokhos Mean-Based Preconditioner:\n") +
87 std::string(
" ***** ") +
88 std::string(mean_prec->Label());
89 num_blocks = sg_basis()->
size();
96 useTranspose = UseTheTranspose;
97 mean_prec->SetUseTranspose(useTranspose);
106 int myBlockRows = epetraCijk->numMyRows();
108 if (!use_block_apply) {
109 EpetraExt::BlockMultiVector sg_input(
View, *base_map, Input);
110 EpetraExt::BlockMultiVector sg_result(
View, *base_map, Result);
111 for (
int i=0; i<myBlockRows; i++) {
112 mean_prec->Apply(*(sg_input.GetBlock(i)), *(sg_result.GetBlock(i)));
119 View, *base_map, Input.
Values(), base_map->NumMyElements(),
122 View, *base_map, Result.
Values(), base_map->NumMyElements(),
124 mean_prec->Apply(input_block, result_block);
134 int myBlockRows = epetraCijk->numMyRows();
136 if (!use_block_apply) {
137 EpetraExt::BlockMultiVector sg_input(
View, *base_map, Input);
138 EpetraExt::BlockMultiVector sg_result(
View, *base_map, Result);
139 for (
int i=0; i<myBlockRows; i++) {
140 mean_prec->ApplyInverse(*(sg_input.GetBlock(i)),
141 *(sg_result.GetBlock(i)));
148 View, *base_map, Input.
Values(), base_map->NumMyElements(),
151 View, *base_map, Result.
Values(), base_map->NumMyElements(),
153 mean_prec->ApplyInverse(input_block, result_block);
163 return mean_prec->NormInf();
171 return const_cast<char*>(label.c_str());
virtual const char * Label() const
Returns a character string describing the operator.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
Teuchos::RCP< coeff_type > getCoeffPtr(ordinal_type i)
Return ref-count pointer to coefficient i.
T & get(ParameterList &l, const std::string &name)
bool use_block_apply
Flag indicating whether to use apply all vectors simultaneously.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
virtual void setupPreconditioner(const Teuchos::RCP< Stokhos::SGOperator > &sg_op, const Epetra_Vector &x)
Setup preconditioner.
virtual double NormInf() const
Returns an approximate infinity norm of the operator matrix.
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of the inverse of the operator applied to a Epetra_MultiVector Input in Result as ...
virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > getSGPolynomial()=0
Get SG polynomial.
ordinal_type size() const
Return size.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.
virtual int Apply(const Epetra_MultiVector &Input, Epetra_MultiVector &Result) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector Input in Result as described ...
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator.
virtual ~MeanBasedPreconditioner()
Destructor.
MeanBasedPreconditioner(const Teuchos::RCP< const EpetraExt::MultiComm > &sg_comm, const Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > &sg_basis, const Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > &epetraCijk, const Teuchos::RCP< const Epetra_Map > &base_map, const Teuchos::RCP< const Epetra_Map > &sg_map, const Teuchos::RCP< Stokhos::AbstractPreconditionerFactory > &prec_factory, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Constructor.