Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
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
Stokhos::MatrixFreeOperator::OperatorDomainMap
virtual const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator.
Definition: Stokhos_MatrixFreeOperator.cpp:395
Teuchos_ParameterList.hpp
Stokhos::MatrixFreeOperator::expansion_size
int expansion_size
Number of terms in expansion.
Definition: Stokhos_MatrixFreeOperator.hpp:230
Stokhos::MatrixFreeOperator::HasNormInf
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
Definition: Stokhos_MatrixFreeOperator.cpp:384
Stokhos::SparseArrayIterator
Bi-directional iterator for traversing a sparse array.
Definition: Stokhos_SparseArray.hpp:56
Stokhos::MatrixFreeOperator::Cijk_type
Stokhos::Sparse3Tensor< int, double > Cijk_type
Short-hand for Cijk.
Definition: Stokhos_MatrixFreeOperator.hpp:206
Stokhos::MatrixFreeOperator::global_col_map_trans
Teuchos::RCP< Epetra_Map > global_col_map_trans
Stores operator column SG map for transpose.
Definition: Stokhos_MatrixFreeOperator.hpp:194
Stokhos::MatrixFreeOperator::OperatorRangeMap
virtual const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
Definition: Stokhos_MatrixFreeOperator.cpp:403
Stokhos::MatrixFreeOperator::input_col_trans
Teuchos::RCP< Epetra_MultiVector > input_col_trans
Temporary to store result of importing input into column map (transpose)
Definition: Stokhos_MatrixFreeOperator.hpp:242
Stokhos::MatrixFreeOperator::UseTranspose
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
Definition: Stokhos_MatrixFreeOperator.cpp:378
Stokhos_EpetraSparse3Tensor.hpp
Stokhos::MatrixFreeOperator::stoch_col_map
Teuchos::RCP< const Epetra_BlockMap > stoch_col_map
Stores stochastic part of column map.
Definition: Stokhos_MatrixFreeOperator.hpp:197
Stokhos::MatrixFreeOperator::useTranspose
bool useTranspose
Flag indicating whether transpose was selected.
Definition: Stokhos_MatrixFreeOperator.hpp:224
Stokhos::MatrixFreeOperator::Cijk
Teuchos::RCP< const Cijk_type > Cijk
Stores triple product tensor.
Definition: Stokhos_MatrixFreeOperator.hpp:209
Stokhos::MatrixFreeOperator::~MatrixFreeOperator
virtual ~MatrixFreeOperator()
Destructor.
Definition: Stokhos_MatrixFreeOperator.cpp:141
Stokhos::MatrixFreeOperator::tmp_trans
Teuchos::RCP< Epetra_MultiVector > tmp_trans
Temporary multivector used in Apply() for transpose.
Definition: Stokhos_MatrixFreeOperator.hpp:254
Stokhos::MatrixFreeOperator::countApplyFlops
double countApplyFlops() const
Return number of FLOPS for each call to Apply()
Definition: Stokhos_MatrixFreeOperator.cpp:147
Stokhos_SGOperator.hpp
Stokhos::MatrixFreeOperator::SetUseTranspose
virtual int SetUseTranspose(bool UseTranspose)
Set to true if the transpose of the operator is requested.
Definition: Stokhos_MatrixFreeOperator.cpp:198
Stokhos::MatrixFreeOperator::k_begin
Cijk_type::k_iterator k_begin
Starting k iterator.
Definition: Stokhos_MatrixFreeOperator.hpp:257
Epetra_Comm
Teuchos_Array.hpp
Stokhos::MatrixFreeOperator::Label
virtual const char * Label() const
Returns a character string describing the operator.
Definition: Stokhos_MatrixFreeOperator.cpp:372
Stokhos::MatrixFreeOperator::epetraCijk
Teuchos::RCP< const Stokhos::EpetraSparse3Tensor > epetraCijk
Stores Epetra Cijk tensor.
Definition: Stokhos_MatrixFreeOperator.hpp:173
Stokhos::Sparse3Tensor< int, double >
Stokhos::MatrixFreeOperator::range_base_map
Teuchos::RCP< const Epetra_Map > range_base_map
Stores range base map.
Definition: Stokhos_MatrixFreeOperator.hpp:179
Stokhos::MatrixFreeOperator::k_end
Cijk_type::k_iterator k_end
Ending k iterator.
Definition: Stokhos_MatrixFreeOperator.hpp:260
Stokhos::MatrixFreeOperator::is_stoch_parallel
bool is_stoch_parallel
Whether we have parallelism over stochastic blocks.
Definition: Stokhos_MatrixFreeOperator.hpp:188
Teuchos::RCP< const EpetraExt::MultiComm >
Stokhos::MatrixFreeOperator::input_col
Teuchos::RCP< Epetra_MultiVector > input_col
Temporary to store result of importing input into column map.
Definition: Stokhos_MatrixFreeOperator.hpp:239
Stokhos::MatrixFreeOperator::block_ops
Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > block_ops
Stores operators.
Definition: Stokhos_MatrixFreeOperator.hpp:212
Stokhos::MatrixFreeOperator::sg_basis
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > sg_basis
Stochastic Galerking basis.
Definition: Stokhos_MatrixFreeOperator.hpp:170
Stokhos::MatrixFreeOperator::max_num_mat_vec
int max_num_mat_vec
Maximum number of matvecs in Apply.
Definition: Stokhos_MatrixFreeOperator.hpp:236
Teuchos::Array
Stokhos::MatrixFreeOperator::col_importer
Teuchos::RCP< Epetra_Import > col_importer
Importer from domain map to column map.
Definition: Stokhos_MatrixFreeOperator.hpp:200
Stokhos::MatrixFreeOperator::scale_op
bool scale_op
Flag indicating whether operator be scaled with <\psi_i^2>
Definition: Stokhos_MatrixFreeOperator.hpp:215
Stokhos::MatrixFreeOperator::num_blocks
int num_blocks
Number of Jacobian blocks (not necessarily equal to expansion_size)
Definition: Stokhos_MatrixFreeOperator.hpp:233
Stokhos::SGOperator
An abstract class to represent a generic stochastic Galerkin operator as an Epetra_Operator.
Definition: Stokhos_SGOperator.hpp:57
Stokhos::MatrixFreeOperator::Comm
virtual const Epetra_Comm & Comm() const
Returns a reference to the Epetra_Comm communicator associated with this operator.
Definition: Stokhos_MatrixFreeOperator.cpp:390
Stokhos::MatrixFreeOperator::NormInf
virtual double NormInf() const
Returns an approximate infinity norm of the operator matrix.
Definition: Stokhos_MatrixFreeOperator.cpp:365
Stokhos
Top-level namespace for Stokhos classes and functions.
Definition: Stokhos_AbstractPreconditionerFactory.hpp:48
Stokhos::MatrixFreeOperator::domain_base_map
Teuchos::RCP< const Epetra_Map > domain_base_map
Stores domain base map.
Definition: Stokhos_MatrixFreeOperator.hpp:176
Stokhos::MatrixFreeOperator::domain_sg_map
Teuchos::RCP< const Epetra_Map > domain_sg_map
Stores domain SG map.
Definition: Stokhos_MatrixFreeOperator.hpp:182
Stokhos::MatrixFreeOperator::global_col_map
Teuchos::RCP< Epetra_Map > global_col_map
Stores operator column SG map.
Definition: Stokhos_MatrixFreeOperator.hpp:191
Stokhos::MatrixFreeOperator::range_sg_map
Teuchos::RCP< const Epetra_Map > range_sg_map
Stores range SG map.
Definition: Stokhos_MatrixFreeOperator.hpp:185
Stokhos::MatrixFreeOperator::ApplyInverse
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 ...
Definition: Stokhos_MatrixFreeOperator.cpp:357
Stokhos::MatrixFreeOperator::getSGPolynomial
virtual Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > getSGPolynomial()
Get SG polynomial.
Definition: Stokhos_MatrixFreeOperator.cpp:184
Stokhos::MatrixFreeOperator::result_block
Teuchos::Array< Teuchos::RCP< Epetra_MultiVector > > result_block
MultiVectors for each block for Apply() result.
Definition: Stokhos_MatrixFreeOperator.hpp:248
Epetra_Import.h
Stokhos::MatrixFreeOperator::include_mean
bool include_mean
Flag indicating whether to include mean term.
Definition: Stokhos_MatrixFreeOperator.hpp:218
Stokhos::MatrixFreeOperator::Apply
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 ...
Definition: Stokhos_MatrixFreeOperator.cpp:209
Epetra_MultiVector
Stokhos::MatrixFreeOperator::sg_comm
Teuchos::RCP< const EpetraExt::MultiComm > sg_comm
Stores SG parallel communicator.
Definition: Stokhos_MatrixFreeOperator.hpp:167
Stokhos_OrthogPolyBasis.hpp
Stokhos::MatrixFreeOperator::label
std::string label
Label for operator.
Definition: Stokhos_MatrixFreeOperator.hpp:164
Stokhos::MatrixFreeOperator::setupOperator
virtual void setupOperator(const Teuchos::RCP< Stokhos::EpetraOperatorOrthogPoly > &poly)
Setup operator.
Definition: Stokhos_MatrixFreeOperator.cpp:173
Epetra_Map.h
Stokhos::MatrixFreeOperator::use_block_apply
bool use_block_apply
Flag indicating whether to use block Epetra_MultiVector apply.
Definition: Stokhos_MatrixFreeOperator.hpp:227
Stokhos::MatrixFreeOperator::only_use_linear
bool only_use_linear
Flag indicating whether to only use linear terms.
Definition: Stokhos_MatrixFreeOperator.hpp:221
Stokhos::MatrixFreeOperator::col_importer_trans
Teuchos::RCP< Epetra_Import > col_importer_trans
Importer from range map to column map.
Definition: Stokhos_MatrixFreeOperator.hpp:203
Stokhos::MatrixFreeOperator::input_block
Teuchos::Array< Teuchos::RCP< const Epetra_MultiVector > > input_block
MultiVectors for each block for Apply() input.
Definition: Stokhos_MatrixFreeOperator.hpp:245
Epetra_Map
Stokhos::MatrixFreeOperator
An Epetra operator representing the block stochastic Galerkin operator.
Definition: Stokhos_MatrixFreeOperator.hpp:60
Stokhos::MatrixFreeOperator::tmp
Teuchos::RCP< Epetra_MultiVector > tmp
Temporary multivector used in Apply()
Definition: Stokhos_MatrixFreeOperator.hpp:251
Stokhos::MatrixFreeOperator::operator=
MatrixFreeOperator & operator=(const MatrixFreeOperator &)
Private to prohibit copying.
Stokhos::OrthogPolyBasis< int, double >
Stokhos::MatrixFreeOperator::MatrixFreeOperator
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.
Definition: Stokhos_MatrixFreeOperator.cpp:48