17 static PetscErrorCode
ierr;
20 int p,
double *
N,
double *diffN,
double *L2N,
double *diff_L2N,
int GDIM,
21 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
22 double *
L,
double *diffL,
29 double diff_ksiL01[2], diff_ksiL20[2];
31 for (;
dd < 2;
dd++) {
32 diff_ksiL01[
dd] = (diffN[1 * 2 +
dd] - diffN[0 * 2 +
dd]);
33 diff_ksiL20[
dd] = (diffN[2 * 2 +
dd] - diffN[0 * 2 +
dd]);
36 for (; ii != GDIM; ++ii) {
37 int node_shift = ii * 3;
38 double ksiL01 =
N[node_shift + 1] -
N[node_shift + 0];
39 double ksiL20 =
N[node_shift + 2] -
N[node_shift + 0];
40 double L01[p + 1], L20[p + 1];
41 double diffL01[2 * (p + 1)], diffL20[2 * (p + 1)];
42 ierr = base_polynomials(p, ksiL01, diff_ksiL01, L01, diffL01, 2);
44 ierr = base_polynomials(p, ksiL20, diff_ksiL20, L20, diffL20, 2);
49 for (; oo <= p; oo++) {
51 for (; pp0 <= oo; pp0++) {
55 L2N[shift + jj] = L01[pp0] * L20[pp1];
57 if (diff_L2N != NULL) {
59 for (;
dd < 2;
dd++) {
60 diff_L2N[2 * shift + 2 * jj +
dd] =
61 diffL01[
dd * (p + 1) + pp0] * L20[pp1] +
62 L01[pp0] * diffL20[
dd * (p + 1) + pp1];
70 SETERRQ1(PETSC_COMM_SELF, 1,
"wrong order %d", jj);
75 int p,
double *
N,
double *diffN,
double *L2N,
double *diff_L2N,
int GDIM,
76 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
77 double *
L,
double *diffL,
84 double diff_ksiL0[3], diff_ksiL1[3], diff_ksiL2[3];
87 for (;
dd < 3;
dd++) {
88 diff_ksiL0[
dd] = (diffN[1 * 3 +
dd] - diffN[0 * 3 +
dd]);
89 diff_ksiL1[
dd] = (diffN[2 * 3 +
dd] - diffN[0 * 3 +
dd]);
90 diff_ksiL2[
dd] = (diffN[3 * 3 +
dd] - diffN[0 * 3 +
dd]);
94 for (; ii != GDIM; ++ii) {
95 int node_shift = ii * 4;
96 double ksiL0 =
N[node_shift + 1] -
N[node_shift + 0];
97 double ksiL1 =
N[node_shift + 2] -
N[node_shift + 0];
98 double ksiL2 =
N[node_shift + 3] -
N[node_shift + 0];
99 double L0[p + 1], L1[p + 1],
L2[p + 1];
100 double diffL0[3 * (p + 1)], diffL1[3 * (p + 1)], diffL2[3 * (p + 1)];
102 ierr = base_polynomials(p, ksiL0, diff_ksiL0, L0, diffL0, 3);
104 ierr = base_polynomials(p, ksiL1, diff_ksiL1, L1, diffL1, 3);
106 ierr = base_polynomials(p, ksiL2, diff_ksiL2,
L2, diffL2, 3);
109 ierr = base_polynomials(p, ksiL0, NULL, L0, NULL, 3);
111 ierr = base_polynomials(p, ksiL1, NULL, L1, NULL, 3);
113 ierr = base_polynomials(p, ksiL2, NULL,
L2, NULL, 3);
119 for (; oo <= p; oo++) {
121 for (; pp0 <= oo; pp0++) {
123 for (; (pp0 + pp1) <= oo; pp1++) {
124 int pp2 = oo - pp0 - pp1;
127 L2N[shift + jj] = L0[pp0] * L1[pp1] *
L2[pp2];
129 if (diff_L2N != NULL) {
131 for (;
dd < 3;
dd++) {
132 diff_L2N[3 * shift + 3 * jj +
dd] =
133 diffL0[
dd * (p + 1) + pp0] * L1[pp1] *
L2[pp2] +
134 L0[pp0] * diffL1[
dd * (p + 1) + pp1] *
L2[pp2] +
135 L0[pp0] * L1[pp1] * diffL2[
dd * (p + 1) + pp2];
144 SETERRQ2(PETSC_COMM_SELF, 1,
"wrong order %d != %d", jj,
P);