Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_LinearOpWithSolveFactoryBase_def.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_OP_WITH_SOLVE_FACTORY_BASE_DEF_HPP
43 #define THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DEF_HPP
44 
45 
46 #include "Thyra_LinearOpWithSolveFactoryBase_decl.hpp"
47 
48 
49 namespace Thyra {
50 
51 
52 template<class Scalar>
54 {
55  return false;
56 }
57 
58 
59 template<class Scalar>
61  const RCP<PreconditionerFactoryBase<Scalar> > &/* precFactory */
62  ,const std::string &/* precFactoryName */
63  )
64 {
66  true,std::logic_error
67  ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
68  "setPreconditionerFactory(...) function and the default implementation throws this exception!"
69  );
70 }
71 
72 
73 template<class Scalar>
76 {
77  return Teuchos::null;
78 }
79 
80 
81 template<class Scalar>
84  ,std::string *precFactoryName
85  )
86 {
87  if(precFactory) *precFactory = Teuchos::null;
88  if(precFactoryName) *precFactoryName = "";
89 }
90 
91 
92 template<class Scalar>
94  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
96  ) const
97 {
98  this->initializeOp(fwdOpSrc,Op);
99 }
100 
101 
102 template<class Scalar>
104  const EPreconditionerInputType /* precOpType */
105  ) const
106 {
107  return false;
108 }
109 
110 
111 template<class Scalar>
113  const RCP<const LinearOpSourceBase<Scalar> > &/* fwdOpSrc */
114  ,const RCP<const PreconditionerBase<Scalar> > &/* prec */
116  ,const ESupportSolveUse /* supportSolveUse */
117  ) const
118 {
120  true,std::logic_error
121  ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
122  "initializePreconditionedOp(...) function and the default implementation throws this exception!"
123  );
124 }
125 
126 
127 template<class Scalar>
129  const RCP<const LinearOpSourceBase<Scalar> > &/* fwdOpSrc */
130  ,const RCP<const LinearOpSourceBase<Scalar> > &/* approxFwdOpSrc */
132  ,const ESupportSolveUse /* supportSolveUse */
133  ) const
134 {
136  true,std::logic_error
137  ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
138  "initializePreconditionedOp(...) function and the default implementation throws this exception!"
139  );
140 }
141 
142 
143 } // namespace Thyra
144 
145 
146 #endif // THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DEF_HPP
Base class for all linear operators that can support a high-level solve operation.
virtual void initializePreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
Initialize a pre-created LinearOpWithSolveBase object given a &quot;compatible&quot; LinearOpBase object and an...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual bool acceptsPreconditionerFactory() const
Determines if *this accepts external preconditioner factories.
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
virtual void unsetPreconditionerFactory(RCP< PreconditionerFactoryBase< Scalar > > *precFactory=NULL, std::string *precFactoryName=NULL)
Unset the preconditioner factory (if one is set).
virtual void initializeAndReuseOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op) const
Initialize a pre-created LinearOpWithSolveBase object given a &quot;compatible&quot; LinearOpBase object but al...
virtual void initializeApproxPreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
Initialize a pre-created LinearOpWithSolveBase object given a &quot;compatible&quot; forward LinearOpBase objec...
Factory interface for creating preconditioner objects from LinearOpBase objects.
Base interface for objects that can return a linear operator.
ESupportSolveUse
Enum that specifies how a LinearOpWithSolveBase object will be used for solves after it is constructe...
EPreconditionerInputType
Enum defining the status of a preconditioner object.
virtual bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
Determines if *this supports given preconditioner type.
virtual RCP< PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
Get a preconditioner factory object.
virtual void setPreconditionerFactory(const RCP< PreconditionerFactoryBase< Scalar > > &precFactory, const std::string &precFactoryName)
Set a preconditioner factory object.