NiHu  2.0
unit_kernel.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
25 #ifndef UNIT_KERNEL_HPP_INCLUDED
26 #define UNIT_KERNEL_HPP_INCLUDED
27 
28 #include "../core/kernel.hpp"
29 #include "../core/gaussian_quadrature.hpp"
30 
31 namespace NiHu
32 {
33 
35 template <class Scalar>
37 
39 template<class Scalar>
40 struct kernel_traits<unit_kernel<Scalar> >
41 {
43  typedef empty_wall test_input_t;
45  typedef empty_wall trial_input_t;
47  typedef Scalar result_t;
51  static bool const is_symmetric = true;
53  static unsigned const singularity_order = 0;
55  static unsigned const singular_quadrature_order = 0;
56 };
57 
59 template <class Scalar>
60 class unit_kernel :
61  public kernel_base<unit_kernel<Scalar> >
62 {
63 public:
67  typedef typename base_t::scalar_t scalar_t;
69  typedef typename base_t::result_t result_t;
74 
79  constexpr result_t operator()(
80  test_input_t const &, trial_input_t const &) const
81  {
82  return result_t(1.0);
83  }
84 
89  constexpr unsigned estimate_complexity(
90  test_input_t const &, trial_input_t const &, scalar_t const &) const
91  {
92  return 0;
93  }
94 };
95 
96 }
97 
98 #endif // UNIT_KERNEL_HPP_INCLUDED
99 
NiHu::unit_kernel::result_t
base_t::result_t result_t
the result type
Definition: unit_kernel.hpp:69
NiHu::unit_kernel::test_input_t
base_t::test_input_t test_input_t
the test input type
Definition: unit_kernel.hpp:71
NiHu::unit_kernel::operator()
constexpr result_t operator()(test_input_t const &, trial_input_t const &) const
evaluate kernel at test and trial positions
Definition: unit_kernel.hpp:79
NiHu::kernel_traits< unit_kernel< Scalar > >::test_input_t
empty_wall test_input_t
test input type
Definition: unit_kernel.hpp:43
NiHu::kernel_traits< unit_kernel< Scalar > >::trial_input_t
empty_wall trial_input_t
trial input type
Definition: unit_kernel.hpp:45
NiHu::kernel_traits< unit_kernel< Scalar > >::result_t
Scalar result_t
kernel result type
Definition: unit_kernel.hpp:47
NiHu::kernel_base
CRTP base class of all BEM kernels.
Definition: kernel.hpp:133
NiHu::kernel_base::scalar_t
space_t::scalar_t scalar_t
type of the scalar coordinate in the kernel's domain
Definition: kernel.hpp:156
NiHu::unit_kernel::trial_input_t
base_t::trial_input_t trial_input_t
the trial input type
Definition: unit_kernel.hpp:73
NiHu::kernel_traits
traits class of a kernel
Definition: kernel.hpp:71
NiHu::kernel_traits::is_symmetric
@ is_symmetric
indicates if the kernel is symmetric
Definition: kernel.hpp:89
NiHu::unit_kernel
the unit kernel returning K(x,y) = 1 for all inputs
Definition: unit_kernel.hpp:36
NiHu::unit_kernel::estimate_complexity
constexpr unsigned estimate_complexity(test_input_t const &, trial_input_t const &, scalar_t const &) const
evaluate kernel complexity
Definition: unit_kernel.hpp:89
NiHu::kernel_base::trial_input_t
traits_t::trial_input_t trial_input_t
type of the second (trial) kernel input
Definition: kernel.hpp:144
NiHu::kernel_base::test_input_t
traits_t::test_input_t test_input_t
type of the first (test) kernel input
Definition: kernel.hpp:142
NiHu::unit_kernel::base_t
kernel_base< unit_kernel< Scalar > > base_t
the crtp base type
Definition: unit_kernel.hpp:65
NiHu::kernel_base::result_t
traits_t::result_t result_t
compile time check if the two kernel inputs are compatible
Definition: kernel.hpp:147
NiHu::kernel_traits< unit_kernel< Scalar > >::quadrature_family_t
gauss_family_tag quadrature_family_t
quadrature family tag
Definition: unit_kernel.hpp:49
NiHu::gauss_family_tag
tag for the family of Gaussian quadratures
Definition: gaussian_quadrature.hpp:517
NiHu::unit_kernel::scalar_t
base_t::scalar_t scalar_t
the scalar type
Definition: unit_kernel.hpp:67