Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_KLReducedMatrixFreeOperator.hpp
Go to the documentation of this file.
1 // $Id: Stokhos_MatrixFreeEpetraOp.hpp,v 1.7 2009/09/14 18:35:48 etphipp Exp $
2 // $Source: /space/CVS/Trilinos/packages/stokhos/src/Stokhos_MatrixFreeEpetraOp.hpp,v $
3 // @HEADER
4 // ***********************************************************************
5 //
6 // Stokhos Package
7 // Copyright (2009) Sandia Corporation
8 //
9 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10 // license for use of this work by or on behalf of the U.S. Government.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
40 //
41 // ***********************************************************************
42 // @HEADER
43 
44 #ifndef STOKHOS_KL_REDUCED_MATRIX_FREE_OPERATOR_HPP
45 #define STOKHOS_KL_REDUCED_MATRIX_FREE_OPERATOR_HPP
46 
47 #include "Stokhos_SGOperator.hpp"
48 #include "EpetraExt_MultiComm.h"
51 #include "Epetra_Map.h"
53 #include "Teuchos_Array.hpp"
54 
55 #include "Epetra_MultiVector.h"
60 
61 namespace Stokhos {
62 
68 
69  public:
70 
81 
84 
87 
89  virtual void setupOperator(
91 
95 
98  getSGPolynomial() const;
99 
101 
104 
106  virtual int SetUseTranspose(bool UseTranspose);
107 
112  virtual int Apply(const Epetra_MultiVector& Input,
113  Epetra_MultiVector& Result) const;
114 
119  virtual int ApplyInverse(const Epetra_MultiVector& X,
120  Epetra_MultiVector& Y) const;
121 
123  virtual double NormInf() const;
124 
126  virtual const char* Label () const;
127 
129  virtual bool UseTranspose() const;
130 
135  virtual bool HasNormInf() const;
136 
141  virtual const Epetra_Comm & Comm() const;
142 
147  virtual const Epetra_Map& OperatorDomainMap () const;
148 
153  virtual const Epetra_Map& OperatorRangeMap () const;
154 
156 
157  protected:
158 
160  void setup();
161 
162  private:
163 
166 
169 
170  protected:
171 
173  std::string label;
174 
177 
180 
183 
186 
189 
192 
195 
198 
201 
204 
207 
210 
213 
216 
218  int num_KL;
219 
222 
225 
228 
231 
234 
237 
240 
243 
246 
249 
252 
253  }; // class KLReducedMatrixFreeOperator
254 
255 } // namespace Stokhos
256 
257 #endif // STOKHOS_KL_REDUCED_MATRIX_FREE_OPERATOR_HPP
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain 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 ...
KLReducedMatrixFreeOperator & operator=(const KLReducedMatrixFreeOperator &)
Private to prohibit copying.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual const char * Label() const
Returns a character string describing the operator.
Teuchos::RCP< Stokhos::MatrixFreeOperator > kl_mat_free_op
Matrix-Free operator using KL operators.
bool useTranspose
Flag indicating whether transpose was selected.
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > kl_ops
KL blocks as operators.
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.
Teuchos::RCP< const EpetraExt::MultiComm > sg_comm
Stores SG parallel communicator.
Teuchos::RCP< const Cijk_type > Cijk
Stores triple product tensor.
virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > getSGPolynomial()
Get SG polynomial.
bool do_error_tests
Whether to do KL error tests (can be expensive)
KLReducedMatrixFreeOperator(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 > &domain_base_map, const Teuchos::RCP< const Epetra_Map > &range_base_map, const Teuchos::RCP< const Epetra_Map > &domain_sg_map, const Teuchos::RCP< const Epetra_Map > &range_sg_map, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor.
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > sparse_kl_coeffs
Sparse KL coefficients.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
An abstract class to represent a generic stochastic Galerkin operator as an Epetra_Operator.
Teuchos::RCP< Epetra_CrsMatrix > mean
Mean block.
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > epetraCijk
Stores Epetra Cijk tensor.
double drop_tolerance
Tolerance for dropping entries in sparse 3 tensor.
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.
Teuchos::RCP< const Epetra_Map > range_sg_map
Stores range SG map.
Teuchos::RCP< Epetra_Map > block_vec_map
Block map for vectorized-matrices.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > sg_basis
Stochastic Galerking basis.
Teuchos::RCP< Stokhos::EpetraVectorOrthogPoly > block_vec_poly
Polynomial sorting vectorized matrix coefficients.
Stokhos::Sparse3Tensor< int, double > Cijk_type
Short-hand for Cijk.
Teuchos::RCP< const Epetra_Map > domain_base_map
Stores domain base map.
Teuchos::RCP< Teuchos::ParameterList > params
Algorithmic parameters.
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
An Epetra operator representing the block stochastic Galerkin operator.
Teuchos::Array< Teuchos::Array< double > > dot_products
Dot products of KL eigenvectors and Jacobian blocks.
Teuchos::Array< Teuchos::RCP< Epetra_CrsMatrix > > kl_blocks
KL blocks.
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > block_ops
Stores operators.
Teuchos::RCP< const Epetra_Map > domain_sg_map
Stores domain SG map.
Teuchos::RCP< const Epetra_Map > range_base_map
Stores range base map.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.