Flow123d
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
quadrature
quadrature_lib.cc
Go to the documentation of this file.
1
/*!
2
*
3
* Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4
*
5
* Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6
* especially for academic research:
7
* Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8
*
9
* This program is free software; you can redistribute it and/or modify it under the terms
10
* of the GNU General Public License version 3 as published by the Free Software Foundation.
11
*
12
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
* See the GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along with this program; if not,
17
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18
*
19
*
20
* $Id$
21
* $Revision$
22
* $LastChangedBy$
23
* $LastChangedDate$
24
*
25
* @file
26
* @brief Definitions of particular quadrature rules on simplices.
27
* @author Jan Stebel
28
*/
29
30
#include "
system/global_defs.h
"
31
#include "
system/system.hh
"
32
#include "
quadrature/quadrature_lib.hh
"
33
34
35
#define FLOAT double
36
#define SHORT int
37
#define _F(n) n
38
#include "
quad.c
"
39
#undef FLOAT
40
#undef SHORT
41
#undef _F
42
43
44
using namespace
arma;
45
46
47
template
<
unsigned
int
dim>
48
QGauss<dim>::QGauss
(
const
unsigned
int
order)
49
{
50
typedef
QUAD
* pQUAD;
51
52
static
const
pQUAD
53
q1d[] = {
QUAD_1D_P1
,
54
QUAD_1D_P1
,
QUAD_1D_P2
,
QUAD_1D_P3
,
55
QUAD_1D_P4
,
QUAD_1D_P5
,
QUAD_1D_P6
,
56
QUAD_1D_P7
,
QUAD_1D_P8
,
QUAD_1D_P9
,
57
QUAD_1D_P10
,
QUAD_1D_P11
,
QUAD_1D_P12
,
58
QUAD_1D_P13
,
QUAD_1D_P14
,
QUAD_1D_P15
,
59
QUAD_1D_P16
,
QUAD_1D_P17
,
QUAD_1D_P18
,
60
QUAD_1D_P19
,
QUAD_1D_P20
,
QUAD_1D_P21
61
},
62
q2d[] = {
QUAD_2D_P1
,
63
QUAD_2D_P1
,
QUAD_2D_P2
,
QUAD_2D_P3
,
QUAD_2D_P4
,
64
QUAD_2D_P5
,
QUAD_2D_P6
,
QUAD_2D_P7
,
QUAD_2D_P8
,
65
QUAD_2D_P9
,
QUAD_2D_P10
,
QUAD_2D_P11
,
QUAD_2D_P12
,
66
QUAD_2D_P13
,
QUAD_2D_P14
,
QUAD_2D_P15
,
QUAD_2D_P16
,
67
QUAD_2D_P17
,
QUAD_2D_P18
,
QUAD_2D_P19
,
QUAD_2D_P20
,
68
QUAD_2D_P21
69
},
70
q3d[] = {
QUAD_3D_P1
,
71
QUAD_3D_P1
,
QUAD_3D_P2
,
QUAD_3D_P3
,
QUAD_3D_P4
,
72
QUAD_3D_P5
,
QUAD_3D_P6
,
QUAD_3D_P7
,
QUAD_3D_P8
,
73
QUAD_3D_P9
,
QUAD_3D_P10
,
QUAD_3D_P11
,
QUAD_3D_P12
,
74
QUAD_3D_P13
,
QUAD_3D_P14
75
};
76
static
const
double
unit_cell_volume[] = { 1, 1, 0.5, 1./6 };
77
const
pQUAD *q;
78
unsigned
int
nquads;
79
vec::fixed<dim> p;
80
81
switch
(dim)
82
{
83
case
0:
84
this->quadrature_points.push_back(p);
85
this->weights.push_back(1);
86
return
;
87
case
1:
88
q = q1d;
89
nquads =
sizeof
(q1d) /
sizeof
(pQUAD);
90
break
;
91
case
2:
92
q = q2d;
93
nquads =
sizeof
(q2d) /
sizeof
(pQUAD);
94
break
;
95
case
3:
96
q = q3d;
97
nquads =
sizeof
(q3d) /
sizeof
(pQUAD);
98
break
;
99
}
100
101
ASSERT
(order < nquads,
"Quadrature of given order is not implemented."
);
102
103
for
(
int
i=0; i<q[order]->npoints; i++)
104
{
105
for
(
unsigned
int
j=0; j<dim; j++)
106
p(j) = q[order]->points[i*(dim+1)+j];
107
108
this->quadrature_points.push_back(p);
109
// The weights must be adjusted according to the volume of the unit cell:
110
// 1D cell: volume 1
111
// 2D cell: volume 1/2
112
// 3D cell: volume 1/6
113
this->weights.push_back(q[order]->weights[i]*unit_cell_volume[dim]);
114
}
115
}
116
117
118
template
class
QGauss<0>
;
119
template
class
QGauss<1>
;
120
template
class
QGauss<2>
;
121
template
class
QGauss<3>
;
Generated on Thu May 29 2014 23:14:49 for Flow123d by
1.8.4