BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
aca_approximate_lu_inverse.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 
22 #ifndef bempp_aca_approximate_lu_inverse_hpp
23 #define bempp_aca_approximate_lu_inverse_hpp
24 
25 #include "../common/common.hpp"
26 
27 #include "bempp/common/config_trilinos.hpp"
28 #include "discrete_boundary_operator.hpp"
29 
30 #include "ahmed_aux_fwd.hpp"
31 #include "index_permutation.hpp"
32 #include "../fiber/scalar_traits.hpp"
33 #include "../fiber/verbosity_level.hpp"
34 
35 #ifdef WITH_TRILINOS
36 #include <Thyra_SpmdVectorSpaceBase_decl.hpp>
37 #endif
38 
40 
41 namespace Bempp
42 {
43 
45 template <typename ValueType> class DiscreteAcaBoundaryOperator;
51 template <typename ValueType>
53 {
54 public:
55  typedef typename Fiber::ScalarTraits<ValueType>::RealType MagnitudeType;
56 
64  MagnitudeType delta,
65  VerbosityLevel::Level verbosityLevel = VerbosityLevel::DEFAULT);
66 
67  virtual ~AcaApproximateLuInverse();
68 
69  virtual unsigned int rowCount() const;
70  virtual unsigned int columnCount() const;
71 
72  virtual void addBlock(const std::vector<int>& rows,
73  const std::vector<int>& cols,
74  const ValueType alpha,
75  arma::Mat<ValueType>& block) const;
76 
77 #ifdef WITH_TRILINOS
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 #endif
85 
86 private:
87  virtual void applyBuiltInImpl(const TranspositionMode trans,
88  const arma::Col<ValueType>& x_in,
89  arma::Col<ValueType>& y_inout,
90  const ValueType alpha,
91  const ValueType beta) const;
92 
93 
94 
95 private:
97  typedef typename Fiber::ScalarTraits<ValueType>::RealType CoordinateType;
98  typedef AhmedDofWrapper<CoordinateType> AhmedDofType;
99  typedef mblock<typename AhmedTypeTraits<ValueType>::Type> AhmedMblock;
100 
101 #ifdef WITH_TRILINOS
102  Teuchos::RCP<const Thyra::SpmdVectorSpaceBase<ValueType> > m_domainSpace;
103  Teuchos::RCP<const Thyra::SpmdVectorSpaceBase<ValueType> > m_rangeSpace;
104 #else
105  unsigned int m_rowCount;
106  unsigned int m_columnCount;
107 #endif
108 
109  blcluster* m_blockCluster;
110  AhmedMblock** m_blocksL;
111  AhmedMblock** m_blocksU;
112 
113  IndexPermutation m_domainPermutation;
114  IndexPermutation m_rangePermutation;
116 };
117 
118 } // namespace Bempp
119 
120 #endif
Traits of scalar types.
Definition: scalar_traits.hpp:40
virtual unsigned int rowCount() const
Number of rows of the operator.
Definition: aca_approximate_lu_inverse.cpp:133
Permutation of indices.
Definition: index_permutation.hpp:39
Approximate LU decomposition of a H-matrix.
Definition: aca_approximate_lu_inverse.hpp:52
Verbosity level.
Definition: verbosity_level.hpp:30
TranspositionMode
Enumeration determining how a discrete boundary operator is transformed before being applied...
Definition: transposition_mode.hpp:37
Discrete linear operator stored as a H-matrix.
Definition: discrete_aca_boundary_operator.hpp:144
Discrete boundary operator.
Definition: assembled_potential_operator.hpp:33
An Ahmed-compatible degree-of-freedom type.
Definition: ahmed_aux.hpp:89
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: aca_approximate_lu_inverse.cpp:153
AcaApproximateLuInverse(const DiscreteAcaBoundaryOperator< ValueType > &fwdOp, MagnitudeType delta, VerbosityLevel::Level verbosityLevel=VerbosityLevel::DEFAULT)
Construct an approximate LU decomposition of a H-matrix.
Definition: aca_approximate_lu_inverse.cpp:45
virtual unsigned int columnCount() const
Number of columns of the operator.
Definition: aca_approximate_lu_inverse.cpp:143