Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_MatrixFreeOperator.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef STOKHOS_MATRIX_FREE_OPERATOR_HPP
43 #define STOKHOS_MATRIX_FREE_OPERATOR_HPP
44 
45 #include "Stokhos_SGOperator.hpp"
46 #include "EpetraExt_MultiComm.h"
49 #include "Epetra_Map.h"
50 #include "Epetra_Import.h"
52 #include "Teuchos_Array.hpp"
53 
54 namespace Stokhos {
55 
61 
62  public:
63 
74 
76  virtual ~MatrixFreeOperator();
77 
79  double countApplyFlops() const;
80 
83 
85  virtual void setupOperator(
87 
91 
94  getSGPolynomial() const;
95 
97 
100 
102  virtual int SetUseTranspose(bool UseTranspose);
103 
108  virtual int Apply(const Epetra_MultiVector& Input,
109  Epetra_MultiVector& Result) const;
110 
115  virtual int ApplyInverse(const Epetra_MultiVector& X,
116  Epetra_MultiVector& Y) const;
117 
119  virtual double NormInf() const;
120 
122  virtual const char* Label () const;
123 
125  virtual bool UseTranspose() const;
126 
131  virtual bool HasNormInf() const;
132 
137  virtual const Epetra_Comm & Comm() const;
138 
143  virtual const Epetra_Map& OperatorDomainMap () const;
144 
149  virtual const Epetra_Map& OperatorRangeMap () const;
150 
152 
153  private:
154 
157 
160 
161  protected:
162 
164  std::string label;
165 
168 
171 
174 
177 
180 
183 
186 
189 
192 
195 
198 
201 
204 
207 
210 
213 
215  bool scale_op;
216 
219 
222 
225 
228 
231 
234 
237 
240 
243 
246 
249 
252 
255 
258 
261 
262  }; // class MatrixFreeOperator
263 
264 } // namespace Stokhos
265 
266 #endif // STOKHOS_MATRIX_FREE_OPERATOR_HPP
MatrixFreeOperator & operator=(const MatrixFreeOperator &)
Private to prohibit copying.
MatrixFreeOperator(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.
An Epetra operator representing the block stochastic Galerkin operator.
Teuchos::RCP< const Cijk_type > Cijk
Stores triple product tensor.
Teuchos::RCP< Epetra_MultiVector > tmp
Temporary multivector used in Apply()
virtual double NormInf() const
Returns an approximate infinity norm of the operator matrix.
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 const char * Label() const
Returns a character string describing the operator.
Cijk_type::k_iterator k_end
Ending k iterator.
int expansion_size
Number of terms in expansion.
Stokhos::Sparse3Tensor< int, double > Cijk_type
Short-hand for Cijk.
Teuchos::RCP< Epetra_Map > global_col_map_trans
Stores operator column SG map for transpose.
Teuchos::RCP< const Epetra_BlockMap > stoch_col_map
Stores stochastic part of column map.
Teuchos::RCP< Epetra_MultiVector > input_col_trans
Temporary to store result of importing input into column map (transpose)
bool useTranspose
Flag indicating whether transpose was selected.
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
Teuchos::RCP< Epetra_MultiVector > input_col
Temporary to store result of importing input into column map.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > sg_basis
Stochastic Galerking basis.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
Bi-directional iterator for traversing a sparse array.
Teuchos::RCP< Epetra_MultiVector > tmp_trans
Temporary multivector used in Apply() for transpose.
bool is_stoch_parallel
Whether we have parallelism over stochastic blocks.
Teuchos::RCP< Epetra_Map > global_col_map
Stores operator column SG map.
An abstract class to represent a generic stochastic Galerkin operator as an Epetra_Operator.
int max_num_mat_vec
Maximum number of matvecs in Apply.
Cijk_type::k_iterator k_begin
Starting k iterator.
Teuchos::RCP< const Epetra_Map > range_base_map
Stores range base map.
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > epetraCijk
Stores Epetra Cijk tensor.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
bool include_mean
Flag indicating whether to include mean term.
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > block_ops
Stores operators.
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.
Teuchos::RCP< const EpetraExt::MultiComm > sg_comm
Stores SG parallel communicator.
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 ...
Teuchos::Array< Teuchos::RCP< Epetra_MultiVector > > result_block
MultiVectors for each block for Apply() result.
virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > getSGPolynomial()
Get SG polynomial.
Teuchos::RCP< Epetra_Import > col_importer
Importer from domain map to column map.
Teuchos::RCP< const Epetra_Map > domain_base_map
Stores domain base map.
bool scale_op
Flag indicating whether operator be scaled with &lt;^2&gt;
Teuchos::RCP< const Epetra_Map > domain_sg_map
Stores domain SG map.
int num_blocks
Number of Jacobian blocks (not necessarily equal to expansion_size)
bool use_block_apply
Flag indicating whether to use block Epetra_MultiVector apply.
bool only_use_linear
Flag indicating whether to only use linear terms.
double countApplyFlops() const
Return number of FLOPS for each call to Apply()
Teuchos::RCP< const Epetra_Map > range_sg_map
Stores range SG map.
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
Teuchos::RCP< Epetra_Import > col_importer_trans
Importer from range map to column map.
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
std::string label
Label for operator.
Teuchos::Array< Teuchos::RCP< const Epetra_MultiVector > > input_block
MultiVectors for each block for Apply() input.