Stratimikos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Thyra_AmesosLinearOpWithSolveFactory.hpp
1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 // Stratimikos: Thyra-based strategies for linear solvers
6 // Copyright (2006) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 */
43 
44 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
45 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
46 
47 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
48 #include "Thyra_AmesosTypes.hpp"
49 #include "Amesos_BaseSolver.h"
50 #include "Thyra_EpetraOperatorViewExtractorBase.hpp"
51 #include "Teuchos_StandardMemberCompositionMacros.hpp"
52 #include "Teuchos_StandardCompositionMacros.hpp"
53 
54 namespace Thyra {
55 
83 public:
84 
87 
89  static const std::string SolverType_name;
91  static const std::string RefactorizationPolicy_name;
93  static const std::string ThrowOnPreconditionerInput_name;
95  static const std::string Amesos_Settings_name;
96 
98 
101 
104 
108  const Amesos::ESolverType solverType
109 #ifdef HAVE_AMESOS_KLU
110  = Amesos::KLU
111 #else
112  = Amesos::LAPACK
113 #endif
114  ,const Amesos::ERefactorizationPolicy refactorizationPolicy = Amesos::REPIVOT_ON_REFACTORIZATION
115  ,const bool throwOnPrecInput = true
116  );
117 
127 
129 
132 
136  bool isCompatible( const LinearOpSourceBase<double> &fwdOpSrc ) const;
137 
140 
142  void initializeOp(
143  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc
145  ,const ESupportSolveUse supportSolveUse
146  ) const;
147 
149  bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
150 
155  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc
156  ,const Teuchos::RCP<const PreconditionerBase<double> > &prec
158  ,const ESupportSolveUse supportSolveUse
159  ) const;
160 
165  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc
166  ,const Teuchos::RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc
168  ,const ESupportSolveUse supportSolveUse
169  ) const;
170 
172  void uninitializeOp(
174  ,Teuchos::RCP<const LinearOpSourceBase<double> > *fwdOpSrc
176  ,Teuchos::RCP<const LinearOpSourceBase<double> > *approxFwdOpSrc
177  ,ESupportSolveUse *supportSolveUse
178  ) const;
179 
181 
184 
195 
197 
200 
202  std::string description() const;
203 
205 
206 private:
207 
208  // /////////////////////////
209  // Private data members
210 
211  Amesos::ESolverType solverType_;
212  Amesos::ERefactorizationPolicy refactorizationPolicy_;
213  bool throwOnPrecInput_;
215 
216  // /////////////////////////
217  // Private member functions
218 
220  generateAndGetValidParameters();
221 
222 };
223 
224 } // namespace Thyra
225 
226 #endif // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
Concrete LinearOpWithSolveFactoryBase adapter subclass that uses Amesos direct solvers.
bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
Returns false .
bool isCompatible(const LinearOpSourceBase< double > &fwdOpSrc) const
Returns true if dynamic_cast&lt;const EpetraLinearOpBase*&gt;(fwdOpSrc)!=NULL .
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
void uninitializeOp(LinearOpWithSolveBase< double > *Op, Teuchos::RCP< const LinearOpSourceBase< double > > *fwdOpSrc, Teuchos::RCP< const PreconditionerBase< double > > *prec, Teuchos::RCP< const LinearOpSourceBase< double > > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse) const
ESupportSolveUse
Teuchos::RCP< LinearOpWithSolveBase< double > > createOp() const
void initializeOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, LinearOpWithSolveBase< double > *Op, const ESupportSolveUse supportSolveUse) const
void initializePreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, const Teuchos::RCP< const PreconditionerBase< double > > &prec, LinearOpWithSolveBase< double > *Op, const ESupportSolveUse supportSolveUse) const
Throws exception if this-&gt;throwOnPrecInput()==true and calls this-&gt;initializeOp(fwdOpSrc,Op) otherwise.
AmesosLinearOpWithSolveFactory(const Amesos::ESolverType solverType=Amesos::LAPACK, const Amesos::ERefactorizationPolicy refactorizationPolicy=Amesos::REPIVOT_ON_REFACTORIZATION, const bool throwOnPrecInput=true)
Constructor which sets the defaults.
EPreconditionerInputType
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
STANDARD_COMPOSITION_MEMBERS(EpetraOperatorViewExtractorBase, epetraFwdOpViewExtractor)
Set the strategy object used to extract an Epetra_Operator view of an input forward operator...
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()

Generated on Thu Nov 21 2024 09:38:38 for Stratimikos by doxygen 1.8.5