BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
discrete_dense_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 #include "bempp/common/config_trilinos.hpp"
22 
23 #ifndef bempp_discrete_dense_boundary_operator_hpp
24 #define bempp_discrete_dense_boundary_operator_hpp
25 
26 #include "../common/common.hpp"
27 
28 #include "discrete_boundary_operator.hpp"
29 
30 #include "../common/shared_ptr.hpp"
31 
32 #ifdef WITH_TRILINOS
33 #include <Teuchos_RCP.hpp>
34 #include <Thyra_SpmdVectorSpaceBase_decl.hpp>
35 #endif
36 
37 namespace Bempp
38 {
39 
42 template <typename ValueType>
44  public DiscreteBoundaryOperator<ValueType>
45 {
46 public:
50  explicit DiscreteDenseBoundaryOperator(const arma::Mat<ValueType>& mat);
51 
52  virtual void dump() const;
53 
54  virtual arma::Mat<ValueType> asMatrix() const;
55 
56  virtual unsigned int rowCount() const;
57  virtual unsigned int columnCount() const;
58 
59  virtual void addBlock(const std::vector<int>& rows,
60  const std::vector<int>& cols,
61  const ValueType alpha,
62  arma::Mat<ValueType>& block) const;
63 
64 #ifdef WITH_TRILINOS
65 public:
66  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > domain() const;
67  virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ValueType> > range() const;
68 
69 protected:
70  virtual bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
71 #endif
72 
73 private:
74  virtual void applyBuiltInImpl(const TranspositionMode trans,
75  const arma::Col<ValueType>& x_in,
76  arma::Col<ValueType>& y_inout,
77  const ValueType alpha,
78  const ValueType beta) const;
79 
80 private:
82  arma::Mat<ValueType> m_mat;
83 #ifdef WITH_TRILINOS
84  Teuchos::RCP<const Thyra::SpmdVectorSpaceBase<ValueType> > m_domainSpace;
85  Teuchos::RCP<const Thyra::SpmdVectorSpaceBase<ValueType> > m_rangeSpace;
86 #endif
87 
88 };
89 
93 template <typename ValueType>
94 shared_ptr<DiscreteDenseBoundaryOperator<ValueType> > discreteDenseBoundaryOperator(
95  const arma::Mat<ValueType>& mat);
96 
97 } // namespace Bempp
98 
99 #endif
Discrete boundary operator stored as a dense matrix.
Definition: discrete_dense_boundary_operator.hpp:43
virtual unsigned int columnCount() const
Number of columns of the operator.
Definition: discrete_dense_boundary_operator.cpp:67
shared_ptr< DiscreteDenseBoundaryOperator< ValueType > > discreteDenseBoundaryOperator(const arma::Mat< ValueType > &mat)
Return a shared pointer to newly constructed DiscreteDenseBoundaryOperator wrapping a specified matri...
Definition: discrete_dense_boundary_operator.cpp:147
DiscreteDenseBoundaryOperator(const arma::Mat< ValueType > &mat)
Constructor.
Definition: discrete_dense_boundary_operator.cpp:39
virtual arma::Mat< ValueType > asMatrix() const
Matrix representation of the operator.
Definition: discrete_dense_boundary_operator.cpp:55
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_dense_boundary_operator.cpp:73
Discrete boundary operator.
Definition: assembled_potential_operator.hpp:33
virtual void dump() const
Write a textual representation of the operator to standard output.
Definition: discrete_dense_boundary_operator.cpp:49
virtual unsigned int rowCount() const
Number of rows of the operator.
Definition: discrete_dense_boundary_operator.cpp:61