Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
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
48#include "EpetraExt_MultiComm.h"
51#include "Epetra_Map.h"
52#include "Teuchos_ParameterList.hpp"
53#include "Teuchos_Array.hpp"
54
55#include "Epetra_MultiVector.h"
60
61namespace Stokhos {
62
68
69 public:
70
73 const Teuchos::RCP<const EpetraExt::MultiComm>& sg_comm,
74 const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& sg_basis,
75 const Teuchos::RCP<const Stokhos::EpetraSparse3Tensor>& epetraCijk,
76 const Teuchos::RCP<const Epetra_Map>& domain_base_map,
77 const Teuchos::RCP<const Epetra_Map>& range_base_map,
78 const Teuchos::RCP<const Epetra_Map>& domain_sg_map,
79 const Teuchos::RCP<const Epetra_Map>& range_sg_map,
80 const Teuchos::RCP<Teuchos::ParameterList>& params);
81
84
87
89 virtual void setupOperator(
90 const Teuchos::RCP<Stokhos::EpetraOperatorOrthogPoly >& poly);
91
93 virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly >
95
97 virtual Teuchos::RCP<const Stokhos::EpetraOperatorOrthogPoly >
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
176 Teuchos::RCP<const EpetraExt::MultiComm> sg_comm;
177
179 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis;
180
182 Teuchos::RCP<const Stokhos::EpetraSparse3Tensor> epetraCijk;
183
185 Teuchos::RCP<const Epetra_Map> domain_base_map;
186
188 Teuchos::RCP<const Epetra_Map> range_base_map;
189
191 Teuchos::RCP<const Epetra_Map> domain_sg_map;
192
194 Teuchos::RCP<const Epetra_Map> range_sg_map;
195
198
200 Teuchos::RCP<const Cijk_type> Cijk;
201
203 Teuchos::RCP<Stokhos::EpetraOperatorOrthogPoly > block_ops;
204
206 Teuchos::RCP<Teuchos::ParameterList> params;
207
210
213
216
219
222
224 Teuchos::RCP<Epetra_CrsMatrix> mean;
225
227 Teuchos::RCP<Epetra_Map> block_vec_map;
228
230 Teuchos::RCP< Stokhos::EpetraVectorOrthogPoly> block_vec_poly;
231
233 Teuchos::Array< Teuchos::Array<double> > dot_products;
234
236 Teuchos::RCP< Stokhos::Sparse3Tensor<int,double> > sparse_kl_coeffs;
237
239 Teuchos::Array< Teuchos::RCP<Epetra_CrsMatrix> > kl_blocks;
240
242 Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > kl_ops;
243
245 Teuchos::RCP< Stokhos::MatrixFreeOperator > kl_mat_free_op;
246
249
252
253 }; // class KLReducedMatrixFreeOperator
254
255} // namespace Stokhos
256
257#endif // STOKHOS_KL_REDUCED_MATRIX_FREE_OPERATOR_HPP
An Epetra operator representing the block stochastic Galerkin operator.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
double drop_tolerance
Tolerance for dropping entries in sparse 3 tensor.
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::Sparse3Tensor< int, double > > sparse_kl_coeffs
Sparse KL coefficients.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
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 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 ...
Teuchos::RCP< Teuchos::ParameterList > params
Algorithmic parameters.
Teuchos::RCP< const Cijk_type > Cijk
Stores triple product tensor.
Teuchos::RCP< Stokhos::EpetraVectorOrthogPoly > block_vec_poly
Polynomial sorting vectorized matrix coefficients.
Stokhos::Sparse3Tensor< int, double > Cijk_type
Short-hand for Cijk.
KLReducedMatrixFreeOperator(const KLReducedMatrixFreeOperator &)
Private to prohibit copying.
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > block_ops
Stores operators.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator.
Teuchos::RCP< const Epetra_Map > range_base_map
Stores range base map.
Teuchos::Array< Teuchos::Array< double > > dot_products
Dot products of KL eigenvectors and Jacobian blocks.
Teuchos::RCP< const EpetraExt::MultiComm > sg_comm
Stores SG parallel communicator.
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > epetraCijk
Stores Epetra Cijk tensor.
bool do_error_tests
Whether to do KL error tests (can be expensive)
virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > getSGPolynomial()
Get SG polynomial.
virtual double NormInf() const
Returns an approximate infinity norm of the operator matrix.
Teuchos::RCP< Stokhos::MatrixFreeOperator > kl_mat_free_op
Matrix-Free operator using KL operators.
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
KLReducedMatrixFreeOperator & operator=(const KLReducedMatrixFreeOperator &)
Private to prohibit copying.
bool useTranspose
Flag indicating whether transpose was selected.
virtual const char * Label() const
Returns a character string describing the operator.
Teuchos::RCP< const Epetra_Map > range_sg_map
Stores range SG map.
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > kl_ops
KL blocks as operators.
Teuchos::RCP< const Epetra_Map > domain_base_map
Stores domain base map.
Teuchos::RCP< Epetra_CrsMatrix > mean
Mean block.
Teuchos::Array< Teuchos::RCP< Epetra_CrsMatrix > > kl_blocks
KL blocks.
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
Teuchos::RCP< const Epetra_Map > domain_sg_map
Stores domain SG map.
Abstract base class for multivariate orthogonal polynomials.
An abstract class to represent a generic stochastic Galerkin operator as an Epetra_Operator.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Top-level namespace for Stokhos classes and functions.