BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
numerical_quadrature_strategy.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 fiber_numerical_quadrature_strategy_hpp
22 #define fiber_numerical_quadrature_strategy_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "quadrature_strategy.hpp"
27 
28 #include "accuracy_options.hpp"
29 
30 namespace Fiber
31 {
32 
33 template <typename BasisFunctionType> class QuadratureDescriptorSelectorFactory;
34 template <typename CoordinateType> class DoubleQuadratureRuleFamily;
35 template <typename CoordinateType> class SingleQuadratureRuleFamily;
36 
82 template <typename BasisFunctionType, typename ResultType,
83 typename GeometryFactory, typename Enable>
85  public QuadratureStrategy<BasisFunctionType, ResultType,
86  GeometryFactory, Enable>
87 {
88 public:
89  typedef QuadratureStrategy<BasisFunctionType, ResultType,
90  GeometryFactory, Enable> Base;
91  typedef typename Base::CoordinateType CoordinateType;
92 
95  quadratureDescriptorSelectorFactory,
96  const shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >&
97  singleQuadratureRuleFamily,
98  const shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >&
99  doubleQuadratureRuleFamily);
100 
101 public:
102  virtual std::auto_ptr<LocalAssemblerForLocalOperators<ResultType> >
103  makeAssemblerForIdentityOperators(
104  const shared_ptr<const GeometryFactory>& geometryFactory,
105  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
106  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
107  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
108  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
109  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
110  const shared_ptr<const OpenClHandler>& openClHandler) const;
111 
112  virtual std::auto_ptr<LocalAssemblerForLocalOperators<ResultType> >
113  makeAssemblerForLocalOperators(
114  const shared_ptr<const GeometryFactory>& geometryFactory,
115  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
116  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
117  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
118  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
119  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
120  const shared_ptr<const TestTrialIntegral<BasisFunctionType, ResultType> >& integral,
121  const shared_ptr<const OpenClHandler>& openClHandler) const;
122 
123 private:
124  virtual std::auto_ptr<LocalAssemblerForIntegralOperators<ResultType> >
125  makeAssemblerForIntegralOperatorsImplRealKernel(
126  const shared_ptr<const GeometryFactory>& testGeometryFactory,
127  const shared_ptr<const GeometryFactory>& trialGeometryFactory,
128  const shared_ptr<const RawGridGeometry<CoordinateType> >& testRawGeometry,
129  const shared_ptr<const RawGridGeometry<CoordinateType> >& trialRawGeometry,
130  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
131  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
132  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
133  const shared_ptr<const CollectionOfKernels<CoordinateType> >& kernels,
134  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
136  const shared_ptr<const OpenClHandler>& openClHandler,
137  const ParallelizationOptions& parallelizationOptions,
138  VerbosityLevel::Level verbosityLevel,
139  bool cacheSingularIntegrals) const;
140 
141  virtual std::auto_ptr<LocalAssemblerForGridFunctions<ResultType> >
142  makeAssemblerForGridFunctionsImplRealUserFunction(
143  const shared_ptr<const GeometryFactory>& geometryFactory,
144  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
145  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
146  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
147  const shared_ptr<const Function<CoordinateType> >& function,
148  const shared_ptr<const OpenClHandler>& openClHandler) const;
149 
150  virtual std::auto_ptr<EvaluatorForIntegralOperators<ResultType> >
151  makeEvaluatorForIntegralOperatorsImplRealKernel(
152  const shared_ptr<const GeometryFactory>& geometryFactory,
153  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
154  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
155  const shared_ptr<const CollectionOfKernels<CoordinateType> >& kernels,
156  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
158  const shared_ptr<const std::vector<std::vector<ResultType> > >& argumentLocalCoefficients,
159  const shared_ptr<const OpenClHandler>& openClHandler,
160  const ParallelizationOptions& parallelizationOptions) const;
161 
162  virtual std::auto_ptr<LocalAssemblerForPotentialOperators<ResultType> >
163  makeAssemblerForPotentialOperatorsImplRealKernel(
164  const arma::Mat<CoordinateType>& evaluationPoints,
165  const shared_ptr<const GeometryFactory>& geometryFactory,
166  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
167  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
168  const shared_ptr<const CollectionOfKernels<CoordinateType> >& kernels,
169  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
171  const shared_ptr<const OpenClHandler>& openClHandler,
172  const ParallelizationOptions& parallelizationOptions,
173  VerbosityLevel::Level verbosityLevel) const;
174 
175 protected:
176  shared_ptr<const QuadratureDescriptorSelectorFactory<BasisFunctionType> >
177  quadratureDescriptorSelectorFactory() const;
178  shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >
179  singleQuadratureRuleFamily() const;
180  shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >
181  doubleQuadratureRuleFamily() const;
182 
183 private:
184  shared_ptr<const QuadratureDescriptorSelectorFactory<BasisFunctionType> >
185  m_quadratureDescriptorSelectorFactory;
186  shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >
187  m_singleQuadratureRuleFamily;
188  shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >
189  m_doubleQuadratureRuleFamily;
190 };
191 
192 // Complex ResultType
246 template <typename BasisFunctionType, typename ResultType,
247 typename GeometryFactory, typename Enable = void>
250  BasisFunctionType, ResultType, GeometryFactory, Enable>
251 {
253  BasisFunctionType, ResultType, GeometryFactory, Enable> Base;
254 public:
255  typedef typename Base::CoordinateType CoordinateType;
256 
263 
270  const AccuracyOptionsEx& accuracyOptions);
271 
278  const AccuracyOptionsEx& accuracyOptions,
279  const shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >&
280  singleQuadratureRuleFamily,
281  const shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >&
282  doubleQuadratureRuleFamily);
283 
291  quadratureDescriptorSelectorFactory,
292  const shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >&
293  singleQuadratureRuleFamily,
294  const shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >&
295  doubleQuadratureRuleFamily);
296 
297 private:
298  virtual std::auto_ptr<LocalAssemblerForIntegralOperators<ResultType> >
299  makeAssemblerForIntegralOperatorsImplComplexKernel(
300  const shared_ptr<const GeometryFactory>& testGeometryFactory,
301  const shared_ptr<const GeometryFactory>& trialGeometryFactory,
302  const shared_ptr<const RawGridGeometry<CoordinateType> >& testRawGeometry,
303  const shared_ptr<const RawGridGeometry<CoordinateType> >& trialRawGeometry,
304  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
305  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
306  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
307  const shared_ptr<const CollectionOfKernels<ResultType> >& kernels,
308  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
310  const shared_ptr<const OpenClHandler>& openClHandler,
311  const ParallelizationOptions& parallelizationOptions,
312  VerbosityLevel::Level verbosityLevel,
313  bool cacheSingularIntegrals) const;
314 
315  virtual std::auto_ptr<LocalAssemblerForGridFunctions<ResultType> >
316  makeAssemblerForGridFunctionsImplComplexUserFunction(
317  const shared_ptr<const GeometryFactory>& geometryFactory,
318  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
319  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& testShapesets,
320  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& testTransformations,
321  const shared_ptr<const Function<ResultType> >& function,
322  const shared_ptr<const OpenClHandler>& openClHandler) const;
323 
324  virtual std::auto_ptr<EvaluatorForIntegralOperators<ResultType> >
325  makeEvaluatorForIntegralOperatorsImplComplexKernel(
326  const shared_ptr<const GeometryFactory>& geometryFactory,
327  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
328  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
329  const shared_ptr<const CollectionOfKernels<ResultType> >& kernels,
330  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
331  const shared_ptr<const KernelTrialIntegral<BasisFunctionType, ResultType, ResultType> >& integral,
332  const shared_ptr<const std::vector<std::vector<ResultType> > >& argumentLocalCoefficients,
333  const shared_ptr<const OpenClHandler>& openClHandler,
334  const ParallelizationOptions& parallelizationOptions) const;
335 
336  virtual std::auto_ptr<LocalAssemblerForPotentialOperators<ResultType> >
337  makeAssemblerForPotentialOperatorsImplComplexKernel(
338  const arma::Mat<CoordinateType>& evaluationPoints,
339  const shared_ptr<const GeometryFactory>& geometryFactory,
340  const shared_ptr<const RawGridGeometry<CoordinateType> >& rawGeometry,
341  const shared_ptr<const std::vector<const Shapeset<BasisFunctionType>*> >& trialShapesets,
342  const shared_ptr<const CollectionOfKernels<ResultType> >& kernels,
343  const shared_ptr<const CollectionOfShapesetTransformations<CoordinateType> >& trialTransformations,
344  const shared_ptr<const KernelTrialIntegral<BasisFunctionType, ResultType, ResultType> >& integral,
345  const shared_ptr<const OpenClHandler>& openClHandler,
346  const ParallelizationOptions& parallelizationOptions,
347  VerbosityLevel::Level verbosityLevel) const;
348 };
349 
351 // RealResultType
352 template <typename BasisFunctionType, typename ResultType, typename GeometryFactory>
354  BasisFunctionType, ResultType, GeometryFactory,
355  typename boost::enable_if<boost::is_same<ResultType, typename ScalarTraits<ResultType>::RealType> >::type> :
357  BasisFunctionType, ResultType, GeometryFactory,
358  typename boost::enable_if<boost::is_same<ResultType, typename ScalarTraits<ResultType>::RealType> >::type>
359 {
360  typedef typename boost::enable_if<boost::is_same<ResultType, typename ScalarTraits<ResultType>::RealType> >::type Enable;
362  BasisFunctionType, ResultType, GeometryFactory, Enable> Base;
363 public:
364  typedef typename Base::CoordinateType CoordinateType;
365 
372 
379  const AccuracyOptionsEx& accuracyOptions);
380 
388  quadratureDescriptorSelectorFactory,
389  const shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >&
390  singleQuadratureRuleFamily,
391  const shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >&
392  doubleQuadratureRuleFamily);
393 
400  const AccuracyOptionsEx& accuracyOptions,
401  const shared_ptr<const SingleQuadratureRuleFamily<CoordinateType> >&
402  singleQuadratureRuleFamily,
403  const shared_ptr<const DoubleQuadratureRuleFamily<CoordinateType> >&
404  doubleQuadratureRuleFamily);
405 };
408 } // namespace Fiber
409 
410 #endif
An integral representing the weak form of an integral operator.
Definition: test_kernel_trial_integral.hpp:70
Collection of kernels.
Definition: collection_of_kernels.hpp:59
Base class for quadrature strategies.
Definition: quadrature_strategy.hpp:242
Parallel operation settings.
Definition: parallelization_options.hpp:32
Base class for NumericalQuadratureStrategy.
Definition: numerical_quadrature_strategy.hpp:84
Collection of shape functions defined on a reference element.
Definition: default_local_assembler_for_operators_on_surfaces_utilities.hpp:34
Function to be used as a source term.
Definition: function.hpp:39
Builder of quadrature descriptor selectors.
Definition: numerical_quadrature_strategy.hpp:33
Quadrature strategy according to which integrals are evaluated by numerical quadrature.
Definition: numerical_quadrature_strategy.hpp:248
New-style options controlling quadrature accuracy.
Definition: accuracy_options.hpp:53
Definition: default_local_assembler_for_operators_on_surfaces_utilities.hpp:35
Family of quadrature rules over single elements.
Definition: numerical_quadrature_strategy.hpp:35
Family of quadrature rules over pairs of elements.
Definition: double_quadrature_rule_family.hpp:52
Definition: kernel_trial_integral.hpp:42
NumericalQuadratureStrategy()
Construct a numerical quadrature strategy.
Definition: numerical_quadrature_strategy_imp.hpp:298