BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
discrete_inverse_sparse_boundary_operator.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_discrete_inverse_sparse_boundary_operator_hpp
22 #define bempp_discrete_inverse_sparse_boundary_operator_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "bempp/common/config_trilinos.hpp"
27 
28 #ifdef WITH_TRILINOS
29 #include "discrete_boundary_operator.hpp"
30 
31 #include "symmetry.hpp"
32 #include "../common/shared_ptr.hpp"
33 
34 #include <memory>
35 
36 #include <Teuchos_RCP.hpp>
37 #include <Thyra_SpmdVectorSpaceBase_decl.hpp>
38 
40 class Amesos_BaseSolver;
41 class Epetra_LinearProblem;
42 class Epetra_CrsMatrix;
45 namespace Bempp
46 {
47 
52 template <typename ValueType>
54  public DiscreteBoundaryOperator<ValueType>
55 {
56 public:
66  const shared_ptr<const Epetra_CrsMatrix>& mat,
67  int symmetry = NO_SYMMETRY);
69 
70  virtual unsigned int rowCount() const;
71  virtual unsigned int columnCount() const;
72 
73  virtual void addBlock(const std::vector<int>& rows,
74  const std::vector<int>& cols,
75  const ValueType alpha,
76  arma::Mat<ValueType>& block) const;
77 
78 public:
79  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > domain() const;
80  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > range() const;
81 
82 protected:
83  virtual bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
84 
85 private:
86  virtual void applyBuiltInImpl(const TranspositionMode trans,
87  const arma::Col<ValueType>& x_in,
88  arma::Col<ValueType>& y_inout,
89  const ValueType alpha,
90  const ValueType beta) const;
91 
92 private:
94  shared_ptr<const Epetra_CrsMatrix> m_mat;
95  std::auto_ptr<Epetra_LinearProblem> m_problem;
96  Teuchos::RCP<const Thyra::SpmdVectorSpaceBase<ValueType> > m_space;
97  int m_symmetry;
98  std::auto_ptr<Amesos_BaseSolver> m_solver;
100 };
101 
111 template <typename ValueType>
112 shared_ptr<const DiscreteBoundaryOperator<ValueType> >
113 discreteSparseInverse(const shared_ptr<const DiscreteBoundaryOperator<ValueType> >& discreteOp);
114 
115 } // namespace Bempp
116 
117 #endif // WITH_TRILINOS
118 
119 #endif
virtual unsigned int columnCount() const
Number of columns of the operator.
Definition: discrete_inverse_sparse_boundary_operator.cpp:223
Discrete boundary operator representing the inverse of another operator and stored as a sparse LU dec...
Definition: discrete_inverse_sparse_boundary_operator.hpp:53
DiscreteInverseSparseBoundaryOperator(const shared_ptr< const Epetra_CrsMatrix > &mat, int symmetry=NO_SYMMETRY)
Definition: discrete_inverse_sparse_boundary_operator.cpp:167
TranspositionMode
Enumeration determining how a discrete boundary operator is transformed before being applied...
Definition: transposition_mode.hpp:37
virtual void addBlock(const std::vector< int > &rows, const std::vector< int > &cols, const ValueType alpha, arma::Mat< ValueType > &block) const
Add a subblock of this operator to a matrix.
Definition: discrete_inverse_sparse_boundary_operator.cpp:229
Discrete boundary operator.
Definition: assembled_potential_operator.hpp:33
virtual unsigned int rowCount() const
Number of rows of the operator.
Definition: discrete_inverse_sparse_boundary_operator.cpp:217