Flow123d
release_3.0.0-968-gc87a28e79
flow123d
src
quadrature
quadrature_lib.cc
Go to the documentation of this file.
1
/*!
2
*
3
* Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4
*
5
* This program is free software; you can redistribute it and/or modify it under
6
* the terms of the GNU General Public License version 3 as published by the
7
* Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
*
13
*
14
* @file quadrature_lib.cc
15
* @brief Definitions of particular quadrature rules on simplices.
16
* @author Jan Stebel
17
*/
18
19
#include "
system/global_defs.h
"
20
#include "
system/system.hh
"
21
#include "
quadrature/quadrature_lib.hh
"
22
23
24
#define FLOAT double
25
#define SHORT int
26
#define _F(n) n
27
#include "
quad.c
"
28
#undef FLOAT
29
#undef SHORT
30
#undef _F
31
32
33
using namespace
arma
;
34
35
36
template
<
unsigned
int
dim>
37
QGauss<dim>::QGauss
(
const
unsigned
int
order)
38
{
39
typedef
QUAD
* pQUAD;
40
41
static
const
pQUAD
42
q1d[] = {
QUAD_1D_P1
,
43
QUAD_1D_P1
,
QUAD_1D_P2
,
QUAD_1D_P3
,
44
QUAD_1D_P4
,
QUAD_1D_P5
,
QUAD_1D_P6
,
45
QUAD_1D_P7
,
QUAD_1D_P8
,
QUAD_1D_P9
,
46
QUAD_1D_P10
,
QUAD_1D_P11
,
QUAD_1D_P12
,
47
QUAD_1D_P13
,
QUAD_1D_P14
,
QUAD_1D_P15
,
48
QUAD_1D_P16
,
QUAD_1D_P17
,
QUAD_1D_P18
,
49
QUAD_1D_P19
,
QUAD_1D_P20
,
QUAD_1D_P21
50
},
51
q2d[] = {
QUAD_2D_P1
,
52
QUAD_2D_P1
,
QUAD_2D_P2
,
QUAD_2D_P3
,
QUAD_2D_P4
,
53
QUAD_2D_P5
,
QUAD_2D_P6
,
QUAD_2D_P7
,
QUAD_2D_P8
,
54
QUAD_2D_P9
,
QUAD_2D_P10
,
QUAD_2D_P11
,
QUAD_2D_P12
,
55
QUAD_2D_P13
,
QUAD_2D_P14
,
QUAD_2D_P15
,
QUAD_2D_P16
,
56
QUAD_2D_P17
,
QUAD_2D_P18
,
QUAD_2D_P19
,
QUAD_2D_P20
,
57
QUAD_2D_P21
58
},
59
q3d[] = {
QUAD_3D_P1
,
60
QUAD_3D_P1
,
QUAD_3D_P2
,
QUAD_3D_P3
,
QUAD_3D_P4
,
61
QUAD_3D_P5
,
QUAD_3D_P6
,
QUAD_3D_P7
,
QUAD_3D_P8
,
62
QUAD_3D_P9
,
QUAD_3D_P10
,
QUAD_3D_P11
,
QUAD_3D_P12
,
63
QUAD_3D_P13
,
QUAD_3D_P14
64
};
65
static
const
double
unit_cell_volume[] = { 1, 1, 0.5, 1./6 };
66
const
pQUAD *q;
67
unsigned
int
nquads;
68
vec::fixed<dim> p;
69
70
switch
(dim)
71
{
72
case
0:
73
this->quadrature_points.push_back(p);
74
this->weights.push_back(1);
75
return
;
76
case
1:
77
q = q1d;
78
nquads =
sizeof
(q1d) /
sizeof
(pQUAD);
79
break
;
80
case
2:
81
q = q2d;
82
nquads =
sizeof
(q2d) /
sizeof
(pQUAD);
83
break
;
84
case
3:
85
q = q3d;
86
nquads =
sizeof
(q3d) /
sizeof
(pQUAD);
87
break
;
88
}
89
90
OLD_ASSERT
(order < nquads,
"Quadrature of given order is not implemented."
);
91
92
for
(
int
i=0; i<q[order]->npoints; i++)
93
{
94
for
(
unsigned
int
j=0; j<dim; j++)
95
p(j) = q[order]->points[i*(dim+1)+j];
96
97
this->quadrature_points.push_back(p);
98
// The weights must be adjusted according to the volume of the unit cell:
99
// 1D cell: volume 1
100
// 2D cell: volume 1/2
101
// 3D cell: volume 1/6
102
this->weights.push_back(q[order]->weights[i]*unit_cell_volume[dim]);
103
}
104
}
105
106
107
template
class
QGauss<0>
;
108
template
class
QGauss<1>
;
109
template
class
QGauss<2>
;
110
template
class
QGauss<3>
;
QUAD_2D_P17
#define QUAD_2D_P17
Definition:
quad.h:109
QUAD_2D_P7
#define QUAD_2D_P7
Definition:
quad.h:89
QUAD_2D_P10
#define QUAD_2D_P10
Definition:
quad.h:95
QUAD_1D_P12
#define QUAD_1D_P12
Definition:
quad.h:60
QUAD_2D_P15
#define QUAD_2D_P15
Definition:
quad.h:105
QUAD_1D_P3
#define QUAD_1D_P3
Definition:
quad.h:46
QUAD_3D_P8
#define QUAD_3D_P8
Definition:
quad.h:135
QUAD_1D_P20
#define QUAD_1D_P20
Definition:
quad.h:72
QUAD_2D_P3
#define QUAD_2D_P3
Definition:
quad.h:81
QUAD_3D_P14
#define QUAD_3D_P14
Definition:
quad.h:147
quad.c
QUAD_
Definition:
quad.h:29
QUAD_1D_P19
#define QUAD_1D_P19
Definition:
quad.h:70
QUAD_2D_P6
#define QUAD_2D_P6
Definition:
quad.h:87
QUAD_1D_P6
#define QUAD_1D_P6
Definition:
quad.h:51
QUAD_2D_P19
#define QUAD_2D_P19
Definition:
quad.h:113
QUAD_2D_P14
#define QUAD_2D_P14
Definition:
quad.h:103
QUAD_3D_P10
#define QUAD_3D_P10
Definition:
quad.h:139
QUAD_1D_P13
#define QUAD_1D_P13
Definition:
quad.h:61
QUAD_3D_P4
#define QUAD_3D_P4
Definition:
quad.h:127
QUAD_2D_P12
#define QUAD_2D_P12
Definition:
quad.h:99
QUAD_3D_P2
#define QUAD_3D_P2
Definition:
quad.h:123
QUAD_2D_P18
#define QUAD_2D_P18
Definition:
quad.h:111
QUAD_1D_P8
#define QUAD_1D_P8
Definition:
quad.h:54
QUAD_2D_P1
#define QUAD_2D_P1
Definition:
quad.h:77
QUAD_1D_P1
#define QUAD_1D_P1
Definition:
quad.h:43
system.hh
arma
Definition:
doxy_dummy_defs.hh:15
QUAD_3D_P7
#define QUAD_3D_P7
Definition:
quad.h:133
QUAD_1D_P16
#define QUAD_1D_P16
Definition:
quad.h:66
QUAD_1D_P14
#define QUAD_1D_P14
Definition:
quad.h:63
QUAD_3D_P5
#define QUAD_3D_P5
Definition:
quad.h:129
QUAD_1D_P2
#define QUAD_1D_P2
Definition:
quad.h:45
QUAD_2D_P13
#define QUAD_2D_P13
Definition:
quad.h:101
QUAD_2D_P4
#define QUAD_2D_P4
Definition:
quad.h:83
QUAD_1D_P4
#define QUAD_1D_P4
Definition:
quad.h:48
QUAD_2D_P2
#define QUAD_2D_P2
Definition:
quad.h:79
quadrature_lib.hh
Definitions of particular quadrature rules on simplices.
QGauss::QGauss
QGauss(const unsigned int order)
Create a formula of given order.
Definition:
quadrature_lib.cc:37
QUAD_1D_P5
#define QUAD_1D_P5
Definition:
quad.h:49
QUAD_3D_P13
#define QUAD_3D_P13
Definition:
quad.h:145
QUAD_3D_P9
#define QUAD_3D_P9
Definition:
quad.h:137
QUAD_3D_P11
#define QUAD_3D_P11
Definition:
quad.h:141
QUAD_2D_P9
#define QUAD_2D_P9
Definition:
quad.h:93
QUAD_2D_P11
#define QUAD_2D_P11
Definition:
quad.h:97
QGauss
Symmetric Gauss-Legendre quadrature formulae on simplices.
Definition:
quadrature_lib.hh:33
QUAD_1D_P21
#define QUAD_1D_P21
Definition:
quad.h:73
QUAD_3D_P1
#define QUAD_3D_P1
Definition:
quad.h:121
QUAD_2D_P20
#define QUAD_2D_P20
Definition:
quad.h:115
OLD_ASSERT
#define OLD_ASSERT(...)
Definition:
global_defs.h:131
global_defs.h
Global macros to enhance readability and debugging, general constants.
QUAD_1D_P7
#define QUAD_1D_P7
Definition:
quad.h:52
QUAD_2D_P16
#define QUAD_2D_P16
Definition:
quad.h:107
QUAD_2D_P8
#define QUAD_2D_P8
Definition:
quad.h:91
QUAD_3D_P3
#define QUAD_3D_P3
Definition:
quad.h:125
QUAD_1D_P15
#define QUAD_1D_P15
Definition:
quad.h:64
QUAD_1D_P11
#define QUAD_1D_P11
Definition:
quad.h:58
QUAD_1D_P9
#define QUAD_1D_P9
Definition:
quad.h:55
QUAD_2D_P5
#define QUAD_2D_P5
Definition:
quad.h:85
QUAD_1D_P10
#define QUAD_1D_P10
Definition:
quad.h:57
QUAD_3D_P6
#define QUAD_3D_P6
Definition:
quad.h:131
QUAD_3D_P12
#define QUAD_3D_P12
Definition:
quad.h:143
QUAD_1D_P17
#define QUAD_1D_P17
Definition:
quad.h:67
QUAD_2D_P21
#define QUAD_2D_P21
Definition:
quad.h:117
QUAD_1D_P18
#define QUAD_1D_P18
Definition:
quad.h:69
Generated by
1.8.17