Nek5000
SEM for Incompressible NS
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
jl
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
);
57
lagrange_fun
*
lagrange_setup
(
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
n
Definition:
xxt_test.m:73
x
#define x
gauss_nodes
#define gauss_nodes
Definition:
poly.h:10
lagrange_size
#define lagrange_size
Definition:
poly.h:8
lagrange_fun
void lagrange_fun(double *restrict p, double *restrict data, unsigned n, int d, double x)
Definition:
poly.h:53
p
p
Definition:
xxt_test2.m:1
lobatto_quad
#define lobatto_quad
Definition:
poly.h:13
lobatto_nodes
#define lobatto_nodes
Definition:
poly.h:12
gauss_quad
#define gauss_quad
Definition:
poly.h:11
restrict
#define restrict
Definition:
c99.h:11
gll_lag_setup
#define gll_lag_setup
Definition:
poly.h:15
lagrange_setup
#define lagrange_setup
Definition:
poly.h:9
gll_lag_size
#define gll_lag_size
Definition:
poly.h:14
z
static double z[NR *NS *NT *N]
Definition:
obbox_test.c:31
Generated on Tue Jul 14 2015 10:52:58 for Nek5000 by
1.8.8