NiHu
2.0
interval_estimator.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
24
#ifndef INTERVAL_ESTIMATOR_HPP_INCLUDED
25
#define INTERVAL_ESTIMATOR_HPP_INCLUDED
26
27
#include "../core/complexity_estimator.hpp"
28
#include "../tmp/interval.hpp"
29
30
namespace
NiHu
31
{
32
37
template
<
class
Interval>
38
class
interval_estimator
39
{
40
public
:
42
typedef
interval_estimator
type
;
43
51
template
<
class
test_field_t,
class
trial_field_t>
52
static
unsigned
eval
(
53
field_base<test_field_t>
const
&test_field,
54
field_base<trial_field_t>
const
&trial_field
55
)
56
{
57
auto
x = test_field.
get_elem
().get_center();
58
auto
y = trial_field.
get_elem
().get_center();
59
auto
D = trial_field.
get_elem
().get_linear_size_estimate();
60
auto
distance = (y - x).norm();
61
return
tmp::eval_interval<Interval>(distance/D);
62
}
63
};
64
69
template
<
class
Interval1,
class
Interval2>
70
struct
merge_kernel_complexity_estimators
<
71
interval_estimator
<Interval1>,
72
interval_estimator
<Interval2>
73
> :
interval_estimator
<
74
typename tmp::merge_intervals<Interval1, Interval2>::type
75
> {};
76
77
}
78
79
80
#endif // INTERVAL_ESTIMATOR_HPP_INCLUDED
NiHu::interval_estimator
specialisation of NiHu::complexity_estimator for the interval case
Definition:
interval_estimator.hpp:38
NiHu::field_base::get_elem
const elem_t & get_elem() const
return underlying element
Definition:
field.hpp:149
NiHu::interval_estimator::eval
static unsigned eval(field_base< test_field_t > const &test_field, field_base< trial_field_t > const &trial_field)
evaluate estimation
Definition:
interval_estimator.hpp:52
NiHu::merge_kernel_complexity_estimators
merge at least two complexity estimators
Definition:
complexity_estimator.hpp:85
NiHu::field_base
CRTP base class of all fields.
Definition:
field.hpp:111
NiHu::interval_estimator::type
interval_estimator type
self returning
Definition:
interval_estimator.hpp:42
src
library
interval_estimator.hpp
Generated on Thu Feb 6 2025 01:00:21 for NiHu by
1.8.18