BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
solver.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_solver_hpp
22 #define bempp_solver_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "solution.hpp"
27 #include "blocked_solution.hpp"
28 
29 #include <vector>
30 
31 namespace Bempp
32 {
33 
35 template <typename BasisFunctionType, typename ResultType> class BoundaryOperator;
36 template <typename BasisFunctionType, typename ResultType> class BlockedBoundaryOperator;
37 template <typename BasisFunctionType, typename ResultType> class GridFunction;
41  enum Mode {
42  TEST_CONVERGENCE_IN_DUAL_TO_RANGE,
43  TEST_CONVERGENCE_IN_RANGE
44  };
45 };
46 
49 template <typename BasisFunctionType, typename ResultType>
50 class Solver
51 {
52 public:
53 
54  virtual ~Solver();
55 
73  return solveImplNonblocked(rhs);
74  }
75 
91  rhs) const {
92  return solveImplBlocked(rhs);
93  }
94 
95 protected:
96  static void checkConsistency(
99  ConvergenceTestMode::Mode mode);
100  static void checkConsistency(
102  const std::vector<GridFunction<BasisFunctionType, ResultType> >& rhs,
103  ConvergenceTestMode::Mode mode);
104  static std::vector<GridFunction<BasisFunctionType, ResultType> >
105  canonicalizeBlockedRhs(
107  const std::vector<GridFunction<BasisFunctionType, ResultType> >& rhs,
108  ConvergenceTestMode::Mode mode);
109 
110  static void constructBlockedGridFunction(
111  const arma::Col<ResultType>& solution,
113  std::vector<GridFunction<BasisFunctionType, ResultType> >& solutionFunctions);
114 
115 private:
116  virtual Solution<BasisFunctionType, ResultType> solveImplNonblocked(
117  const GridFunction<BasisFunctionType, ResultType>& rhs) const = 0;
118  virtual BlockedSolution<BasisFunctionType, ResultType> solveImplBlocked(
120  rhs) const = 0;
121 };
122 
123 } // namespace Bempp
124 
125 #endif
The abstract interface of solvers of boundary integral equations.
Definition: solver.hpp:50
Boundary operator consisting of multiple blocks arranged in a matrix.
Definition: blocked_boundary_operator.hpp:46
Solution< BasisFunctionType, ResultType > solve(const GridFunction< BasisFunctionType, ResultType > &rhs) const
Solve a standard (non-blocked) boundary integral equation.
Definition: solver.hpp:71
Operator acting on functions defined on a surface.
Definition: boundary_operator.hpp:63
This class holds the solution of a BEM computation together with various associated information...
Definition: solution.hpp:38
Function defined on a grid.
Definition: assembled_potential_operator.hpp:34
Definition: solver.hpp:40
BlockedSolution< BasisFunctionType, ResultType > solve(const std::vector< GridFunction< BasisFunctionType, ResultType > > &rhs) const
Solve a block-operator system of boundary integral equations.
Definition: solver.hpp:89
This class holds the solution of a block operator system together with various information about the ...
Definition: blocked_solution.hpp:41