Hermes2D
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
l2.h
1
// This file is part of Hermes2D.
2
//
3
// Hermes2D is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 2 of the License, or
6
// (at your option) any later version.
7
//
8
// Hermes2D is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15
16
#ifndef __H2D_INTEGRALS_L2_H
17
#define __H2D_INTEGRALS_L2_H
18
19
#include "../quadrature/limit_order.h"
20
#include "../weakform/weakform.h"
21
namespace
Hermes
22
{
23
namespace
Hermes2D
24
{
25
template
<
typename
Scalar>
26
class
MatrixFormVolL2
:
public
MatrixFormVol
<Scalar>
27
{
28
public
:
29
// One area.
30
MatrixFormVolL2
(
int
i,
int
j,
std::string
area = HERMES_ANY,
31
SymFlag
sym = HERMES_NONSYM) :
MatrixFormVol<Scalar>
(i, j) {
32
this->
set_area
(area);
33
this->setSymFlag(sym);
34
}
35
// Multiple areas.
36
MatrixFormVolL2
(
int
i,
int
j, Hermes::vector<std::string>
areas
,
37
SymFlag
sym = HERMES_NONSYM) :
MatrixFormVol<Scalar>
(i, j) {
38
this->set_areas(areas);
39
this->setSymFlag(sym);
40
}
41
42
virtual
Scalar value(
int
n,
double
*wt,
Func<Scalar>
*u_ext[],
Func<double>
*u,
Func<double>
*v,
43
Geom<double>
*e,
Func<Scalar>
**
ext
)
const
44
{
45
Scalar result = 0;
46
for
(
int
i = 0; i < n; i++)
47
result += wt[i] * (u->
val
[i] * conj(v->
val
[i]));
48
return
result;
49
}
50
51
virtual
Hermes::Ord ord(
int
n,
double
*wt,
Func<Hermes::Ord>
*u_ext[],
Func<Hermes::Ord>
*u,
Func<Hermes::Ord>
*v,
52
Geom<Hermes::Ord>
*e,
Func<Ord>
**ext)
const
53
{
54
Hermes::Ord result = Hermes::Ord(0);
55
for
(
int
i = 0; i < n; i++)
56
result += wt[i] * (u->
val
[i] * conj(v->
val
[i]));
57
return
result;
58
}
59
60
MatrixFormVol<Scalar>
* clone()
const
61
{
62
return
new
MatrixFormVolL2<Scalar>
(*this);
63
}
64
};
65
}
66
}
67
#endif
include
integrals
l2.h
Generated on Mon Feb 18 2013 14:36:13 for Hermes2D by
1.8.3.1