2
/// This file is part of Rheolef.
4
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
6
/// Rheolef 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 2 of the License, or
9
/// (at your option) any later version.
11
/// Rheolef 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.
16
/// You should have received a copy of the GNU General Public License
17
/// along with Rheolef; if not, write to the Free Software
18
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
/// =========================================================================
21
#include "rheolef/quadrature.h"
22
#include "rheolef/gauss_jacobi.h"
23
using namespace rheolef;
27
quadrature_on_geo::init_prism (quadrature_option_type opt)
29
quadrature_option_type::family_type f = opt.get_family();
30
// -------------------------------------------------------------------------
31
// general case: Gauss
32
// -------------------------------------------------------------------------
33
assert_macro (f == quadrature_option_type::gauss,
34
"unsupported quadrature family \"" << opt.get_family_name() << "\"");
37
switch (opt.get_order()) {
41
// better than the general case
50
// Gauss-Legendre quadrature formulae
51
// where Legendre = Jacobi(alpha=0,beta=0) polynoms
52
size_t r = opt.get_order();
53
size_type n0 = n_node_gauss(r);
54
size_type n1 = n_node_gauss(r+1);
55
size_type n2 = n_node_gauss(r);
56
vector<Float> zeta0(n0), omega0(n0);
57
vector<Float> zeta1(n1), omega1(n1);
58
vector<Float> zeta2(n2), omega2(n2);
59
gauss_jacobi (n0, 0, 0, zeta0.begin(), omega0.begin());
60
gauss_jacobi (n1, 0, 0, zeta1.begin(), omega1.begin());
61
gauss_jacobi (n2, 0, 0, zeta2.begin(), omega2.begin());
63
for (size_type i = 0; i < n0; i++) {
64
for (size_type j = 0; j < n1; j++) {
65
for (size_type k = 0; k < n2; k++) {
66
// we transform the square into the triangle
67
Float eta_0 = (1+zeta0[i])*(1-zeta1[j])/4;
68
Float eta_1 = (1+zeta1[j])/2;
69
Float eta_2 = zeta2[k];
70
Float J = (1-zeta1[j])/8;
71
wx (x(eta_0,eta_1,eta_2), J*omega0[i]*omega1[j]*omega2[k]);