BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
discrete_blocked_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_blocked_boundary_operator_hpp
22 #define bempp_discrete_blocked_boundary_operator_hpp
23 
24 #include "bempp/common/config_ahmed.hpp"
25 #include "bempp/common/config_trilinos.hpp"
26 
27 #include "discrete_boundary_operator.hpp"
28 
29 #include "../common/shared_ptr.hpp"
30 #include "../fiber/_2d_array.hpp"
31 
32 #ifdef WITH_TRILINOS
33 #include <Teuchos_RCP.hpp>
34 #endif // WITH_TRILINOS
35 
36 class blcluster;
37 
38 namespace Bempp
39 {
40 
54 template <typename ValueType>
56 {
57 public:
59 
75  const Fiber::_2dArray<shared_ptr<const Base> >& blocks,
76  const std::vector<size_t>& rowCounts,
77  const std::vector<size_t>& columnCounts);
78 
79  virtual unsigned int rowCount() const;
80  virtual unsigned int columnCount() const;
81 
83  virtual shared_ptr<const DiscreteBoundaryOperator<ValueType> > getComponent(int row, int col) const;
84 
85  virtual void addBlock(const std::vector<int>& rows,
86  const std::vector<int>& cols,
87  const ValueType alpha,
88  arma::Mat<ValueType>& block) const;
89 
110  shared_ptr<const DiscreteBlockedBoundaryOperator<ValueType> >
111  asDiscreteAcaBlockedBoundaryOperator(double eps=-1, int maximumRank=-1) const;
112 
113  virtual shared_ptr<const DiscreteBoundaryOperator<ValueType> >
114  asDiscreteAcaBoundaryOperator(double eps=-1, int maximumRank=-1,
115  bool interleave=false) const;
116 
117 #ifdef WITH_TRILINOS
118 public:
119  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > domain() const;
120  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > range() const;
121 
122 protected:
123  virtual bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
124 #endif
125 
126 private:
127  virtual void applyBuiltInImpl(const TranspositionMode trans,
128  const arma::Col<ValueType>& x_in,
129  arma::Col<ValueType>& y_inout,
130  const ValueType alpha,
131  const ValueType beta) const;
132 
133 #ifdef WITH_AHMED
134  void mergeHMatrices(
135  unsigned currentLevel,
136  const std::vector<Fiber::_2dArray<unsigned> >& rowSonSizes,
137  const std::vector<Fiber::_2dArray<unsigned> >& colSonSizes,
138  const Fiber::_2dArray<const blcluster*> clusters,
139  const Fiber::_2dArray<size_t> indexOffsets,
140  blcluster* result) const;
141 #endif // WITH_AHMED
142 
143 private:
146  std::vector<size_t> m_rowCounts;
147  std::vector<size_t> m_columnCounts;
148 #ifdef WITH_TRILINOS
149  Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > m_domainSpace;
150  Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > m_rangeSpace;
151 #endif
152 
153 };
154 
155 } // namespace Bempp
156 
157 #endif
virtual unsigned int rowCount() const
Number of rows of the operator.
Definition: discrete_blocked_boundary_operator.cpp:536
Discrete boundary operator composed of multiple blocks stored separately.
Definition: discrete_blocked_boundary_operator.hpp:55
virtual shared_ptr< const DiscreteBoundaryOperator< ValueType > > asDiscreteAcaBoundaryOperator(double eps=-1, int maximumRank=-1, bool interleave=false) const
Return a representation that can be cast to a DiscreteAcaBoundaryOperator.
Definition: discrete_blocked_boundary_operator.cpp:725
TranspositionMode
Enumeration determining how a discrete boundary operator is transformed before being applied...
Definition: transposition_mode.hpp:37
DiscreteBlockedBoundaryOperator(const Fiber::_2dArray< shared_ptr< const Base > > &blocks, const std::vector< size_t > &rowCounts, const std::vector< size_t > &columnCounts)
Constructor.
Definition: discrete_blocked_boundary_operator.cpp:500
virtual unsigned int columnCount() const
Number of columns of the operator.
Definition: discrete_blocked_boundary_operator.cpp:543
Discrete boundary operator.
Definition: assembled_potential_operator.hpp:33
virtual shared_ptr< const DiscreteBoundaryOperator< ValueType > > getComponent(int row, int col) const
return the block component at position (i,j) in the block operator matrix.
Definition: discrete_blocked_boundary_operator.cpp:550
Simple implementation of a 2D Fortran-ordered array.
Definition: _2d_array.hpp:41
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_blocked_boundary_operator.cpp:556
shared_ptr< const DiscreteBlockedBoundaryOperator< ValueType > > asDiscreteAcaBlockedBoundaryOperator(double eps=-1, int maximumRank=-1) const
Return a new DiscreteBlockedBoundaryOperator, in which every component is castable to a DiscreteAcaBo...
Definition: discrete_blocked_boundary_operator.cpp:569