Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosSolverManager.hpp
Go to the documentation of this file.
1 
2 //@HEADER
3 // ************************************************************************
4 //
5 // Belos: Block Linear Solvers Package
6 // Copyright 2004 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
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 Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 
43 #ifndef BELOS_SOLVERMANAGER_HPP
44 #define BELOS_SOLVERMANAGER_HPP
45 
50 #include "BelosConfigDefs.hpp"
51 #include "BelosTypes.hpp"
52 #include "BelosLinearProblem.hpp"
53 
55 #include "Teuchos_RCP.hpp"
56 #include "Teuchos_Describable.hpp"
57 
63 namespace Belos {
64 
65 
66 template <class ScalarType, class MV, class OP>
67 class StatusTest;
68 
69 
70 template<class ScalarType, class MV, class OP>
71 class SolverManager : virtual public Teuchos::Describable {
72 
73  public:
74 
76 
77 
80 
82  virtual ~SolverManager() {};
84 
86 
87 
89  virtual const LinearProblem<ScalarType,MV,OP>& getProblem() const = 0;
90 
93 
96 
109  TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error, "achievedTol() not implemented");
110  }
111 
113  virtual int getNumIters() const = 0;
114 
118  virtual bool isLOADetected() const = 0;
119 
121 
123 
124 
126  virtual void setProblem( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem ) = 0;
127 
138  virtual void setParameters( const Teuchos::RCP<Teuchos::ParameterList> &params ) = 0;
139 
141  virtual void setUserConvStatusTest(
142  const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > &userConvStatusTest
143  )
144  {
145  TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Error, the function setUserConvStatusTest() has not been"
146  << " overridden for the class" << this->description() << " yet!");
147  }
148 
150 
152 
153 
160  virtual void reset( const ResetType type ) = 0;
162 
164 
165 
167  //
178  virtual ReturnType solve() = 0;
180 
181 };
182 
183 } // end Belos namespace
184 
185 #endif /* BELOS_SOLVERMANAGER_HPP */
Collection of types and exceptions used within the Belos solvers.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)=0
Set the linear problem that needs to be solved.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const =0
Return the current parameters being used for this solver manager.
virtual int getNumIters() const =0
Get the iteration count for the most recent call to solve().
SolverManager()
Empty constructor.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual ReturnType solve()=0
Iterate until the status test tells us to stop.
virtual void reset(const ResetType type)=0
Reset the solver manager.
A pure virtual class for defining the status tests for the Belos iterative solvers.
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &userConvStatusTest)
Set user-defined convergence status test.
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
Return a reference to the linear problem being solved by this solver manager.
ResetType
How to reset the solver.
Definition: BelosTypes.hpp:200
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
virtual std::string description() const
ReturnType
Whether the Belos solve converged for all linear systems.
Definition: BelosTypes.hpp:149
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &params)=0
Set the parameters to use when solving the linear problem.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const =0
Return the valid parameters for this solver manager.
virtual bool isLOADetected() const =0
Returns whether a loss of accuracy was detected in the solver.
Belos header file which uses auto-configuration information to include necessary C++ headers...
virtual ~SolverManager()
Destructor.