Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
poly.h
Go to the documentation of this file.
1 #ifndef POLY_H
2 #define POLY_H
3 
4 #if !defined(NAME_H)
5 #warning "poly.h" requires "name.h"
6 #endif
7 
8 #define lagrange_size PREFIXED_NAME(lagrange_size )
9 #define lagrange_setup PREFIXED_NAME(lagrange_setup)
10 #define gauss_nodes PREFIXED_NAME(gauss_nodes )
11 #define gauss_quad PREFIXED_NAME(gauss_quad )
12 #define lobatto_nodes PREFIXED_NAME(lobatto_nodes )
13 #define lobatto_quad PREFIXED_NAME(lobatto_quad )
14 #define gll_lag_size PREFIXED_NAME(gll_lag_size )
15 #define gll_lag_setup PREFIXED_NAME(gll_lag_setup )
16 
17 /*--------------------------------------------------------------------------
18  Quadrature Nodes and Weights Calculation
19 
20  Gauss -> Gauss-Legendre quadrature (open)
21  Lobatto -> Gauss-Lobatto-Legendre quadrature (closed at both ends)
22 
23  the _quad functions compute both nodes and weights
24  --------------------------------------------------------------------------*/
25 
26 void gauss_nodes(double *restrict z, int n); /* n nodes (order = 2n-1) */
27 void lobatto_nodes(double *restrict z, int n); /* n nodes (order = 2n-3) */
28 
29 void gauss_quad(double *restrict z, double *restrict w, int n);
30 void lobatto_quad(double *restrict z, double *restrict w, int n);
31 
32 /*--------------------------------------------------------------------------
33  Lagrangian basis function evaluation
34 
35  Usage:
36 
37  double z[N] = ..., x = ...; // nodes and evaluation point
38  double p[3*N];
39  double *data = tmalloc(double, lagrange_size(N));
40  lagrange_fun *const lag = lagrange_setup(data, z, N);
41 
42  int d = ...; // 0, 1, or 2 --- the highest derivative to compute
43  lag(p, data,N,d, x);
44  // now p[i] = h_i(x), 0 <= i < N
45  // if d>=1, p[N+i] = h_i'(x)
46  // if d>=2, p[2*N+i] = h_i''(x)
47  free(data);
48 
49  gll_lag_* are similar, but are specialized for GLL nodes, and faster,
50  and also don't need to be given the nodal locations
51  --------------------------------------------------------------------------*/
52 
53 typedef void lagrange_fun(double *restrict p,
54  double *restrict data, unsigned n, int d, double x);
55 
56 unsigned lagrange_size(unsigned n);
58  double *restrict data, const double *restrict z, unsigned n);
59 
60 unsigned gll_lag_size(unsigned n);
61 lagrange_fun *gll_lag_setup(double *restrict data, int n);
62 
63 
64 #endif
65 
n
Definition: xxt_test.m:73
#define x
#define gauss_nodes
Definition: poly.h:10
#define lagrange_size
Definition: poly.h:8
void lagrange_fun(double *restrict p, double *restrict data, unsigned n, int d, double x)
Definition: poly.h:53
p
Definition: xxt_test2.m:1
#define lobatto_quad
Definition: poly.h:13
#define lobatto_nodes
Definition: poly.h:12
#define gauss_quad
Definition: poly.h:11
#define restrict
Definition: c99.h:11
#define gll_lag_setup
Definition: poly.h:15
#define lagrange_setup
Definition: poly.h:9
#define gll_lag_size
Definition: poly.h:14
static double z[NR *NS *NT *N]
Definition: obbox_test.c:31