Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Stokhos_GaussSeidelPreconditioner.hpp
Go to the documentation of this file.
1// $Id$
2// $Source$
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_GAUSS_SEIDEL_PRECONDITIONER_HPP
45#define STOKHOS_GAUSS_SEIDEL_PRECONDITIONER_HPP
46
47#include "Stokhos_ConfigDefs.h"
48
49#ifdef HAVE_STOKHOS_NOX
50
51#include "NOX_Config.h"
52
53#ifdef HAVE_NOX_EPETRAEXT
54
55#include "Teuchos_RCP.hpp"
56
58#include "EpetraExt_MultiComm.h"
61#include "Epetra_Map.h"
62#include "Epetra_Export.h"
63#include "NOX_Epetra_LinearSystem.H"
64#include "Teuchos_ParameterList.hpp"
65#include "EpetraExt_BlockMultiVector.h"
66
67namespace Stokhos {
68
73 class GaussSeidelPreconditioner : public Stokhos::SGPreconditioner {
74
75 public:
76
78 GaussSeidelPreconditioner(
79 const Teuchos::RCP<const EpetraExt::MultiComm>& sg_comm,
80 const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& sg_basis,
81 const Teuchos::RCP<const Stokhos::EpetraSparse3Tensor>& epetraCijk,
82 const Teuchos::RCP<const Epetra_Map>& base_map,
83 const Teuchos::RCP<const Epetra_Map>& sg_map,
84 const Teuchos::RCP<NOX::Epetra::LinearSystem>& det_solver,
85 const Teuchos::RCP<Teuchos::ParameterList>& params);
86
88 virtual ~GaussSeidelPreconditioner();
89
92
94 virtual void
95 setupPreconditioner(const Teuchos::RCP<Stokhos::SGOperator>& sg_op,
96 const Epetra_Vector& x);
97
99
102
104 virtual int SetUseTranspose(bool UseTranspose);
105
110 virtual int Apply(const Epetra_MultiVector& Input,
111 Epetra_MultiVector& Result) const;
112
117 virtual int ApplyInverse(const Epetra_MultiVector& X,
118 Epetra_MultiVector& Y) const;
119
121 virtual double NormInf() const;
122
124 virtual const char* Label () const;
125
127 virtual bool UseTranspose() const;
128
133 virtual bool HasNormInf() const;
134
139 virtual const Epetra_Comm & Comm() const;
140
145 virtual const Epetra_Map& OperatorDomainMap () const;
146
151 virtual const Epetra_Map& OperatorRangeMap () const;
152
154
155 private:
156
158 GaussSeidelPreconditioner(const GaussSeidelPreconditioner&);
159
161 GaussSeidelPreconditioner& operator=(const GaussSeidelPreconditioner&);
162
163 protected:
164
166 std::string label;
167
169 Teuchos::RCP<const EpetraExt::MultiComm> sg_comm;
170
172 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis;
173
175 Teuchos::RCP<const Stokhos::EpetraSparse3Tensor> epetraCijk;
176
178 Teuchos::RCP<const Epetra_Map> base_map;
179
181 Teuchos::RCP<const Epetra_Map> sg_map;
182
184 bool is_stoch_parallel;
185
187 Teuchos::RCP<const Epetra_BlockMap> stoch_row_map;
188
190 Teuchos::RCP<NOX::Epetra::LinearSystem> det_solver;
191
193 Teuchos::RCP<Teuchos::ParameterList> params;
194
196 bool useTranspose;
197
199 Teuchos::RCP<Stokhos::SGOperator> sg_op;
200
202 Teuchos::RCP<Stokhos::EpetraOperatorOrthogPoly > sg_poly;
203
206
208 Teuchos::RCP<const Cijk_type > Cijk;
209
211 mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_df_block;
212
214 mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_y_block;
215
217 mutable Teuchos::RCP<Epetra_MultiVector> kx;
218
220 bool is_parallel;
221
223 Teuchos::RCP<const Epetra_BlockMap> sg_col_map;
224
226 Teuchos::RCP<Epetra_Export> col_exporter;
227
229 mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_df_col;
230
232 mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_df_tmp;
233
234
235 }; // class GaussSeidelPreconditioner
236
237} // namespace Stokhos
238
239#endif
240
241#endif
242
243#endif // STOKHOS_GAUSS_SEIDEL_PRECONDITIONER_HPP
Abstract base class for multivariate orthogonal polynomials.
An abstract class to represent a generic stochastic Galerkin preconditioner as an Epetra_Operator.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Stokhos::Sparse3Tensor< int, double > Cijk_type
Top-level namespace for Stokhos classes and functions.