BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
preconditioner.hpp
1 // Copyright (C) 2011-2012 by the BEM++ Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef bempp_preconditioner_factory_hpp
22 #define bempp_preconditioner_factory_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "bempp/common/config_trilinos.hpp"
27 
28 #ifdef WITH_TRILINOS
29 
30 #include "Teuchos_RCP.hpp"
31 #include "Thyra_PreconditionerBase.hpp"
32 #include "../assembly/discrete_boundary_operator.hpp"
33 #include "../assembly/discrete_blocked_boundary_operator.hpp"
34 #include "../assembly/boundary_operator.hpp"
35 #include "../common/shared_ptr.hpp"
36 #include "../fiber/scalar_traits.hpp"
37 
38 #include <vector>
39 
40 namespace Bempp
41 {
42 
47 template<typename ValueType>
49 {
50 public:
51  typedef Teuchos::RCP<const Thyra::PreconditionerBase<ValueType> >
52  TeuchosPreconditionerPtr;
53  typedef shared_ptr<const DiscreteBoundaryOperator<ValueType> >
54  DiscreteBoundaryOperatorPtr;
55  typedef typename Fiber::ScalarTraits<ValueType>::RealType MagnitudeType;
56 
57  explicit Preconditioner(TeuchosPreconditionerPtr precPtr);
58 
59  virtual ~Preconditioner();
60 
61  /* \brief Return pointer to the actual preconditoner */
62  inline const TeuchosPreconditionerPtr& get() const { return m_precPtr;}
63 
64 private:
65  TeuchosPreconditionerPtr m_precPtr;
66 };
67 
70 template<typename ValueType>
73  const shared_ptr<const DiscreteBoundaryOperator<ValueType> >&
74  discreteOperator);
75 
76 template<typename ValueType>
78 discreteBlockDiagonalPreconditioner(
79  const std::vector<shared_ptr<
80  const DiscreteBoundaryOperator<ValueType> > >& opVector);
81 
82 } // namespace Bempp
83 
84 #endif /* WITH_TRILINOS */
85 
86 #endif
Traits of scalar types.
Definition: scalar_traits.hpp:40
Discrete boundary operator.
Definition: assembled_potential_operator.hpp:33
A simple container class to hold pointers to preconditioners.
Definition: preconditioner.hpp:48
Preconditioner< ValueType > discreteOperatorToPreconditioner(const shared_ptr< const DiscreteBoundaryOperator< ValueType > > &discreteOperator)
Create a preconditioner from a discrete operator.
Definition: preconditioner.cpp:56