Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_LinearSolverBuilderBase.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5// Copyright (2004) 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 Roscoe A. Bartlett (bartlettra@ornl.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42#ifndef THYRA_LINEAR_SOLVER_BUILDING_BASE
43#define THYRA_LINEAR_SOLVER_BUILDING_BASE
44
45#include "Teuchos_ParameterListAcceptor.hpp"
46#include "Thyra_LinearOpWithSolveFactoryBase.hpp"
47
48
49namespace Thyra {
50
51
59template<class Scalar>
61{
62public:
63
77 const std::string &linearSolveStrategyName ) const = 0;
78
93 const std::string &preconditioningStrategyName ) const = 0;
94
95 /* \brief Create a new LinearOpWithSolveFactory object given a typical
96 * forward linear operator and a typical solve criteria.
97 *
98 * \param typicalFwdOp
99 * [in] A typical forward linear operator that represents the types of
100 * operator that will be used to solve linear system.
101 * \param typicalSolveCriteria
102 * [in] A typical solve criteria that will be used to solve for linear
103 * systems.
104 * \param typicalSolveUse
105 * [in] Determines how the solver will be used.
106 * \param solveStrategy
107 * [out] The LOWSF object that was determined to be the best suited for solving
108 * the typical system given above.
109 * \param initialLOWS
110 * [out] The LOWS object that was created that is consistent with the returned
111 * solve strategy. If <tt>initialLOWS->get()==NULL</tt> on return then there is no
112 * such object returned.
113 * \param setupTime
114 * [out] The amount of time it took to setup the solver <tt>*initalLOWS</tt> before
115 * a solve was performed.
116 * \param solveTime
117 * [out] The amount of time it took to solve a typical linear system for the
118 * returned <tt>*initalLOWS</tt> object.
119 *
120 * ToDo: Finish documentation!
121 */
122 /*
123 virtual void createSmartSolveStrategy(
124 const Teuchos::RCP<LinearOpBase<Scalar> &typicalFwdOp
125 ,const SolveCritiera<Scalar> &typicalSolveCriteria
126 ,const ESupportSolveUse &typicalSolveUse
127 ,Teuchos::RCP<LinearOpWithSolveFactoryBase<Scalar> > *solveStrategy
128 ,Teuchos::RCP<Teuchos::ParameterList> *solveStrategyParameters
129 ,Teuchos::RCP<LinearOpWithSolveBase<Scalar> > *initialLOWS
130 ,double *setupTime
131 ,double *solveTime
132 ) const = 0;
133 */
134
135private:
136
137 // Not defined and not to be called
139 operator=(const LinearSolverBuilderBase<Scalar>&);
140
141};
142
143
148template<class Scalar>
151 const LinearSolverBuilderBase<Scalar> &linearSolverBuilder,
152 const std::string &linearSolveStrategyName = ""
153 )
154{
155 return linearSolverBuilder.createLinearSolveStrategy(
156 linearSolveStrategyName );
157}
158
159
164template<class Scalar>
167 const LinearSolverBuilderBase<Scalar> &linearSolverBuilder,
168 const std::string &preconditioningStrategyName = ""
169 )
170{
171 return linearSolverBuilder.createPreconditioningStrategy(
172 preconditioningStrategyName );
173}
174
175
176} // namespace Thyra
177
178#endif // THYRA_LINEAR_SOLVER_BUILDING_BASE
Abstract interface for an object that can create LinearOpWithSolveFactoryBase objects on demand.
virtual Teuchos::RCP< LinearOpWithSolveFactoryBase< Scalar > > createLinearSolveStrategy(const std::string &linearSolveStrategyName) const =0
Create a new LinearOpWithSolveFactoryBase object purely specified by the parameter list.
Teuchos::RCP< LinearOpWithSolveFactoryBase< Scalar > > createLinearSolveStrategy(const LinearSolverBuilderBase< Scalar > &linearSolverBuilder, const std::string &linearSolveStrategyName="")
virtual Teuchos::RCP< PreconditionerFactoryBase< Scalar > > createPreconditioningStrategy(const std::string &preconditioningStrategyName) const =0
Create a new PreconditionerFactoryBase object purely specified by the parameter list.
Teuchos::RCP< PreconditionerFactoryBase< Scalar > > createPreconditioningStrategy(const LinearSolverBuilderBase< Scalar > &linearSolverBuilder, const std::string &preconditioningStrategyName="")