48 template<
class Scalar>
51 Scalar &an , Scalar &bn, Scalar &cn )
53 an = (2.0 * n + 1.0 + alpha + beta) * ( 2.0 * n + 2.0 + alpha + beta )
54 / ( 2.0 * ( n + 1 ) * ( n + 1 + alpha + beta ) );
55 bn = (alpha*alpha-beta*beta)*(2.0*n+1.0+alpha+beta)
56 / ( 2.0*(n+1.0)*(2.0*n+alpha+beta)*(n+1.0+alpha+beta) );
57 cn = (n+alpha)*(n+beta)*(2.0*n+2.0+alpha+beta)
58 / ( (n+1.0)*(n+1.0+alpha+beta)*(2.0*n+alpha+beta) );
64 template<
class Scalar,
class ScalarArray1,
class ScalarArray2>
67 ScalarArray2 & poly_val )
69 const int np = z.dimension( 0 );
77 int idx_curp1,idx_curm1;
80 for (
int i=0;i<np;i++) {
81 poly_val(idx_cur,i) = 1.0;
84 Teuchos::Array<Scalar> f1(np),f2(np),f3(np);
86 for (
int i=0;i<np;i++) {
87 f1[i] = 0.5 * (1.0+2.0*(2.0*z(i,0)-1.0)+(2.0*z(i,1)-1.0));
88 f2[i] = 0.5 * (1.0-(2.0*z(i,1)-1.0));
89 f3[i] = f2[i] * f2[i];
94 for (
int i=0;i<np;i++) {
95 poly_val(idx_cur,i) = f1[i];
99 for (
int p=1;p<n;p++) {
103 Scalar a = (2.0*p+1.0)/(1.0+p);
104 Scalar b = p / (p+1.0);
106 for (
int i=0;i<np;i++) {
107 poly_val(idx_curp1,i) = a * f1[i] * poly_val(idx_cur,i)
108 - b * f3[i] * poly_val(idx_curm1,i);
113 for (
int p=0;p<n;p++) {
116 for (
int i=0;i<np;i++) {
117 poly_val(idxp1,i) = poly_val(idxp0,i)
118 *0.5*(1.0+2.0*p+(3.0+2.0*p)*(2.0*z(i,1)-1.0));
123 for (
int p=0;p<n-1;p++) {
124 for (
int q=1;q<n-p;q++) {
129 jrc((Scalar)(2*p+1),(Scalar)0,q,a,b,c);
130 for (
int i=0;i<np;i++) {
132 = (a*(2.0*z(i,1)-1.0)+b)*poly_val(idxpq,i)
133 - c*poly_val(idxpqm1,i);
141 template<
class Scalar,
class ScalarArray1,
class ScalarArray2>
144 ScalarArray2 &poly_val )
146 const int np = z.dimension( 0 );
154 Teuchos::Array<Scalar> f1(np),f2(np),f3(np),f4(np),f5(np);
156 for (
int i=0;i<np;i++) {
157 f1[i] = 0.5 * ( 2.0 + 2.0*(2.0*z(i,0)-1.0) + (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) );
158 f2[i] = pow( 0.5 * ( (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) ) , 2 );
159 f3[i] = 0.5 * ( 1.0 + 2.0 * (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) );
160 f4[i] = 0.5 * ( 1.0 - (2.0*z(i,2)-1.0) );
161 f5[i] = f4[i] * f4[i];
166 for (
int i=0;i<np;i++) {
167 poly_val(idxcur,i) = 1.0;
172 for (
int i=0;i<np;i++) {
173 poly_val(idxcur,i) = f1[i];
177 for (
int p=1;p<n;p++) {
178 Scalar a1 = (2.0 * p + 1.0) / ( p + 1.0);
179 Scalar a2 = p / ( p + 1.0 );
181 int idxpp1 =
idxtet(p+1,0,0);
182 int idxpm1 =
idxtet(p-1,0,0);
184 for (
int i=0;i<np;i++) {
185 poly_val(idxpp1,i) = a1 * f1[i] * poly_val(idxp,i) - a2 * f2[i] * poly_val(idxpm1,i);
189 for (
int p=0;p<n;p++) {
192 for (
int i=0;i<np;i++) {
193 poly_val(idx1,i) = poly_val(idx0,i) * ( p * ( 1.0 + (2.0*z(i,1)-1.0) ) + 0.5 * ( 2.0 + 3.0 * (2.0*z(i,1)-1.0) + (2.0*z(i,2)-1.0) ) );
198 for (
int p=0;p<n-1;p++) {
199 for (
int q=1;q<n-p;q++) {
201 jrc((Scalar)(2.0*p+1.0),(Scalar)(0),q,aq,bq,cq);
202 int idxpqp1 =
idxtet(p,q+1,0);
203 int idxpq =
idxtet(p,q,0);
204 int idxpqm1 =
idxtet(p,q-1,0);
205 for (
int i=0;i<np;i++) {
206 poly_val(idxpqp1,i) = ( aq * f3[i] + bq * f4[i] ) * poly_val(idxpq,i)
207 - ( cq * f5[i] ) * poly_val(idxpqm1,i);
213 for (
int p=0;p<n;p++) {
214 for (
int q=0;q<n-p;q++) {
215 int idxpq1 =
idxtet(p,q,1);
216 int idxpq0 =
idxtet(p,q,0);
217 for (
int i=0;i<np;i++) {
218 poly_val(idxpq1,i) = poly_val(idxpq0,i) * ( 1.0 + p + q + ( 2.0 + q + p ) * (2.0*z(i,2)-1.0) );
224 for (
int p=0;p<n-1;p++) {
225 for (
int q=0;q<n-p-1;q++) {
226 for (
int r=1;r<n-p-q;r++) {
228 int idxpqrp1 =
idxtet(p,q,r+1);
229 int idxpqr =
idxtet(p,q,r);
230 int idxpqrm1 =
idxtet(p,q,r-1);
231 jrc(2.0*p+2.0*q+2.0,0.0,r,ar,br,cr);
232 for (
int i=0;i<np;i++) {
233 poly_val(idxpqrp1,i) = (ar * (2.0*z(i,2)-1.0) + br) * poly_val( idxpqr , i ) - cr * poly_val(idxpqrm1,i);
245 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
247 #warning "The Intrepid package is deprecated"
static int idxtet(int p, int q, int r)
Given indices p,q,r, computes the linear index of the tetrahedral polynomial D^{p,q,r}.
static void tabulateTriangle(const ScalarArray1 &z, const int n, ScalarArray2 &poly_val)
Calculates triangular orthogonal expansions (e.g. Dubiner basis) at a range of input points...
static int idxtri(int p, int q)
Given indices p,q, computes the linear index of the Dubiner polynomial D^{p,q}.
static void tabulateTetrahedron(const ScalarArray1 &z, const int n, ScalarArray2 &poly_val)
Calculates triangular orthogonal expansions (e.g. Dubiner basis) at a range of input points...
static void jrc(const Scalar &alpha, const Scalar &beta, const int &n, Scalar &an, Scalar &bn, Scalar &cn)
computes Jacobi recurrence coefficients of order n with weights a,b so that P^{alpha,beta}_{n+1}(x) = (an x + bn) P^{alpha,beta}_n(x) - cn P^{alpha,beta}_{n-1}(x)