11 #include "EpetraExt_BlockMultiVector.h"
22 label(
"Stokhos Block Diagonal Operator"),
24 num_mp_blocks(num_mp_blocks_),
25 domain_base_map(domain_base_map_),
26 range_base_map(range_base_map_),
27 domain_mp_map(domain_mp_map_),
28 range_mp_map(range_mp_map_),
65 useTranspose = UseTheTranspose;
66 for (
int i=0; i<num_mp_blocks; i++)
67 (*block_ops)[i].SetUseTranspose(useTranspose);
78 input_base_map = range_base_map;
79 result_base_map = domain_base_map;
82 input_base_map = domain_base_map;
83 result_base_map = range_base_map;
85 EpetraExt::BlockMultiVector mp_input(
View, *input_base_map, Input);
86 EpetraExt::BlockMultiVector mp_result(
View, *result_base_map, Result);
87 for (
int i=0; i<num_mp_blocks; i++) {
88 (*block_ops)[i].Apply(*(mp_input.GetBlock(i)), *(mp_result.GetBlock(i)));
100 input_base_map = domain_base_map;
101 result_base_map = range_base_map;
104 input_base_map = range_base_map;
105 result_base_map = domain_base_map;
107 EpetraExt::BlockMultiVector mp_input(
View, *input_base_map, Input);
108 EpetraExt::BlockMultiVector mp_result(
View, *range_base_map, Result);
109 for (
int i=0; i<num_mp_blocks; i++) {
110 (*block_ops)[i].ApplyInverse(*(mp_input.GetBlock(i)),
111 *(mp_result.GetBlock(i)));
120 double product_nrm = 0.0;
121 for (
int i=0; i<num_mp_blocks; i++) {
122 double nrm = (*block_ops)[i].NormInf();
123 if (nrm > product_nrm)
134 return const_cast<char*
>(label.c_str());
146 if (num_mp_blocks == 0)
148 return (*block_ops)[0].HasNormInf();
160 return *range_mp_map;
161 return *domain_mp_map;
168 return *domain_mp_map;
169 return *range_mp_map;
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
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 int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
BlockDiagonalOperator(const Teuchos::RCP< const EpetraExt::MultiComm > &mp_comm, int num_mp_blocks, const Teuchos::RCP< const Epetra_Map > &domain_base_map, const Teuchos::RCP< const Epetra_Map > &range_base_map, const Teuchos::RCP< const Epetra_Map > &domain_mp_map, const Teuchos::RCP< const Epetra_Map > &range_mp_map)
Constructor.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
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 double NormInf() const
Returns an approximate infinity norm of the operator matrix.
virtual void setupOperator(const Teuchos::RCP< Stokhos::ProductEpetraOperator > &ops)
Setup operator.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual Teuchos::RCP< Stokhos::ProductEpetraOperator > getMPOps()
Get multi-point ops.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
virtual const char * Label() const
Returns a character string describing the operator.
virtual ~BlockDiagonalOperator()
Destructor.
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.