00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iomanip>
00019 #include "colarray/linalg.h"
00020 #include "nedelecelement.h"
00021
00022 #define CROSS(A,B,k) (A((k+1)%3,0)*B((k+2)%3,0) - A((k+2)%3,0)*B((k+1)%3,0))
00023 #define CROSS2(A,B,c,k) (A((k+1)%3,c)*B((k+2)%3,0) - A((k+2)%3,c)*B((k+1)%3,0))
00024
00025 using namespace colarray;
00026 using namespace mesh;
00027
00028 #ifndef GAUSSIANQUADRATURE
00029 NedelecElement::NedelecElement()
00030 { }
00031
00032 #else
00033 NedelecElement::NedelecElement() :
00034 _mu(3,3),
00035 _eps(3,3),
00036 _Cur(3,24),
00037 _Ned(3,24)
00038 {
00039 _intOrder = 0;
00040
00041
00042
00043 constructGQ(4);
00044 }
00045 #endif
00046
00047
00048 NedelecElement::~NedelecElement()
00049 { }
00050
00051
00052
00053
00055
00056
00057
00058
00059 void NedelecElement::constructGQ(int order)
00060 {
00061 _intOrder = order;
00062 Matrix<double> J(order, order);
00063 Matrix<double> Q(order, order);
00064 ColumnVector<double> xi1D(order);
00065 ColumnVector<double> w1D(order);
00066
00067
00068 J.fill(0.0);
00069 J(0,0) = 0.5;
00070 for(int i=1; i<order; i++){
00071 J(i,i) = 0.5;
00072 J(i-1,i) = (double)i/sqrt(16.0*i*i - 4.0);
00073 J(i,i-1) = (double)i/sqrt(16.0*i*i - 4.0);
00074 }
00075 linalg::eigenvalueDecomp(J, Q, xi1D);
00076 for(int i=0; i<order; i++){
00077 w1D[i] = Q(0,i)*Q(0,i);
00078 }
00079
00080
00081
00082
00083 _w.resize(order*order*order);
00084 _xi.resize(order*order*order);
00085 _eta.resize(order*order*order);
00086 _zeta.resize(order*order*order);
00087 int l = 0;
00088 for(int i=0; i<order; i++){
00089 for(int j=0; j<order; j++){
00090 for(int k=0; k<order; k++){
00091 _w[l] = w1D[i]*w1D[j]*w1D[k]*(1.0 - xi1D[i])*(1.0 - xi1D[i])*(1.0 - xi1D[j]);
00092 _xi[l] = xi1D[i];
00093 _eta[l] = xi1D[j]*(1.0 - xi1D[i]);
00094 _zeta[l] = xi1D[k]*(1.0 - xi1D[j])*(1.0 - xi1D[i]);
00095 l++;
00096 }
00097 }
00098 }
00099
00100 }
00101
00102
00103 void NedelecElement::evalElementFunctions(Matrix<double>& xi, Matrix<double>& iM,
00104 Matrix<double>& Cur, Matrix<double>& Ned)
00105 {
00106
00107
00108 double L[4];
00109 Matrix<double> G1(3,1), G2(3,1), G3(3,1), G4(3,1);
00110 L[0] = 1.0 - xi(0,0) - xi(1,0) - xi(2,0);
00111 L[1] = xi(0,0);
00112 L[2] = xi(1,0);
00113 L[3] = xi(2,0);
00114 for(int i=0; i<3; i++){
00115 G1(i,0) = -iM(0,i) - iM(1,i) - iM(2,i);
00116 G2(i,0) = iM(0,i);
00117 G3(i,0) = iM(1,i);
00118 G4(i,0) = iM(2,i);
00119 }
00120
00121
00122
00123 for(int i=0; i<3; i++){
00124 Ned(i,0) = L[0]*G2(i,0) - L[1]*G1(i,0);
00125 Ned(i,1) = L[0]*G3(i,0) - L[2]*G1(i,0);
00126 Ned(i,2) = L[0]*G4(i,0) - L[3]*G1(i,0);
00127 Ned(i,3) = L[1]*G3(i,0) - L[2]*G2(i,0);
00128 Ned(i,4) = L[1]*G4(i,0) - L[3]*G2(i,0);
00129 Ned(i,5) = L[2]*G4(i,0) - L[3]*G3(i,0);
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 for(int i=0; i<3; i++){
00143 Cur(i,0) = CROSS(G1,G2,i) - CROSS(G2,G1,i);
00144 Cur(i,1) = CROSS(G1,G3,i) - CROSS(G3,G1,i);
00145 Cur(i,2) = CROSS(G1,G4,i) - CROSS(G4,G1,i);
00146 Cur(i,3) = CROSS(G2,G3,i) - CROSS(G3,G2,i);
00147 Cur(i,4) = CROSS(G2,G4,i) - CROSS(G4,G2,i);
00148 Cur(i,5) = CROSS(G3,G4,i) - CROSS(G4,G3,i);
00149 }
00150
00151
00152
00153 for(int i=0; i<3; i++){
00154 Ned(i,6) = L[0]*G2(i,0) + L[1]*G1(i,0);
00155 Ned(i,7) = L[0]*G3(i,0) + L[2]*G1(i,0);
00156 Ned(i,8) = L[0]*G4(i,0) + L[3]*G1(i,0);
00157 Ned(i,9) = L[1]*G3(i,0) + L[2]*G2(i,0);
00158 Ned(i,10) = L[1]*G4(i,0) + L[3]*G2(i,0);
00159 Ned(i,11) = L[2]*G4(i,0) + L[3]*G3(i,0);
00160 }
00161
00162
00163
00164 for(int i=0; i<3; i++){
00165 Ned(i,12) = L[1]*L[2]*G1(i,0);
00166 Ned(i,13) = L[2]*L[3]*G2(i,0);
00167 Ned(i,14) = L[3]*L[0]*G3(i,0);
00168 Ned(i,15) = L[0]*L[1]*G4(i,0);
00169
00170 Ned(i,16) = L[2]*L[0]*G2(i,0);
00171 Ned(i,17) = L[3]*L[1]*G3(i,0);
00172 Ned(i,18) = L[0]*L[2]*G4(i,0);
00173 Ned(i,19) = L[1]*L[3]*G1(i,0);
00174
00175 Ned(i,20) = L[0]*L[1]*G3(i,0);
00176 Ned(i,21) = L[1]*L[2]*G4(i,0);
00177 Ned(i,22) = L[2]*L[3]*G1(i,0);
00178 Ned(i,23) = L[3]*L[0]*G2(i,0);
00179 }
00180
00181
00182
00183 for(int i=0; i<3; i++){
00184 Cur(i,6) = CROSS(G1,G2,i) + CROSS(G2,G1,i);
00185 Cur(i,7) = CROSS(G1,G3,i) + CROSS(G3,G1,i);
00186 Cur(i,8) = CROSS(G1,G4,i) + CROSS(G4,G1,i);
00187 Cur(i,9) = CROSS(G2,G3,i) + CROSS(G3,G2,i);
00188 Cur(i,10) = CROSS(G2,G4,i) + CROSS(G4,G2,i);
00189 Cur(i,11) = CROSS(G3,G4,i) + CROSS(G4,G3,i);
00190 }
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 for(int i=0; i<3; i++){
00204 Cur(i,12) = CROSS2(Ned,G1, 9,i);
00205 Cur(i,13) = CROSS2(Ned,G2,11,i);
00206 Cur(i,14) = CROSS2(Ned,G3, 8,i);
00207 Cur(i,15) = CROSS2(Ned,G4, 6,i);
00208
00209 Cur(i,16) = CROSS2(Ned,G2, 7,i);
00210 Cur(i,17) = CROSS2(Ned,G3,10,i);
00211 Cur(i,18) = CROSS2(Ned,G4, 7,i);
00212 Cur(i,19) = CROSS2(Ned,G1,10,i);
00213
00214 Cur(i,20) = CROSS2(Ned,G3, 6,i);
00215 Cur(i,21) = CROSS2(Ned,G4, 9,i);
00216 Cur(i,22) = CROSS2(Ned,G1,11,i);
00217 Cur(i,23) = CROSS2(Ned,G2, 8,i);
00218 }
00219 }
00220
00221
00222 void NedelecElement::get_AeMe(Tet* tet,
00223 int order,
00224 Matrix<double>& A, Matrix<double>& M) {
00225
00226 assert(_intOrder > 0);
00227
00228
00229 TetMesh* tetMesh = tet->get_mesh();
00230
00231
00232 int size;
00233 if (order==1) {
00234 size = 6;
00235 }else{
00236 size = 24;
00237 }
00238
00239
00240 Matrix<double> Map(3,3), iMap(3,3);
00241 double detMap;
00242 Vector3 v0, vi;
00243 Matrix<double> xi(3,1);
00244
00245 v0 = tet->get_corner(0)->get_coord();
00246 for(int i=1; i<4; i++){
00247 vi = tet->get_corner(i)->get_coord();
00248 Map(0,i-1) = vi.x - v0.x;
00249 Map(1,i-1) = vi.y - v0.y;
00250 Map(2,i-1) = vi.z - v0.z;
00251 }
00252 detMap = linalg::determinant(Map);
00253 linalg::inverse(Map, iMap);
00254
00255
00256 A.fill(0.0);
00257 M.fill(0.0);
00258
00259
00260
00261 for(int i=0; i<_intOrder*_intOrder*_intOrder; i++){
00262
00263
00264 xi(0,0) = _xi[i];
00265 xi(1,0) = _eta[i];
00266 xi(2,0) = _zeta[i];
00267
00268
00269 evalElementFunctions(xi, iMap, _Cur, _Ned);
00270
00271
00272 tetMesh->get_materials()->getParameters(tet->get_material_ID(), xi, _mu, _eps);
00273
00274
00275 for(int ii=0; ii<size; ii++){
00276 for(int jj=0; jj<size; jj++){
00277 A(ii,jj) += detMap*_w[i]*(
00278 _Cur(0,ii)*(1.0/_mu(0,0))*_Cur(0,jj) +
00279 _Cur(1,ii)*(1.0/_mu(1,1))*_Cur(1,jj) +
00280 _Cur(2,ii)*(1.0/_mu(2,2))*_Cur(2,jj)
00281 );
00282
00283 M(ii,jj) += detMap*_w[i]*(
00284 _Ned(0,ii)*_eps(0,0)*_Ned(0,jj) +
00285 _Ned(1,ii)*_eps(1,1)*_Ned(1,jj) +
00286 _Ned(2,ii)*_eps(2,2)*_Ned(2,jj)
00287 );
00288 }
00289 }
00290 }
00291
00292
00293
00294 for (int k = 0; k < 6; k ++) {
00295 if (!tet->get_edge_orientation(k)) {
00296 for (int j = 0; j < A.get_m(); j ++){
00297 A(k,j) = -A(k,j);
00298 M(k,j) = -M(k,j);
00299 }
00300 for (int i = 0; i < A.get_m(); i ++){
00301 A(i,k) = -A(i,k);
00302 M(i,k) = -M(i,k);
00303 }
00304 }
00305 }
00306 }
00307
00308
00309
00311
00312
00313
00367 void NedelecElement::get_Ae(Tet* tet,
00368 int order,
00369 const Tet::GradientMatrix& J,
00370 Matrix<double>& A) {
00371
00372 static const int ind1[] = {0, 0, 0, 1, 1, 2};
00373 static const int ind2[] = {1, 2, 3, 2, 3, 3};
00374 Matrix<double> c(3, 6);
00375 for (int ii = 0; ii < 6; ii ++) {
00376 int i = ind1[ii];
00377 int j = ind2[ii];
00378 c(0,ii) = J(1,i)*J(2,j) - J(2,i)*J(1,j);
00379 c(1,ii) = J(2,i)*J(0,j) - J(0,i)*J(2,j);
00380 c(2,ii) = J(0,i)*J(1,j) - J(1,i)*J(0,j);
00381 }
00382
00383
00384 Matrix<double> C(6, 6);
00385 blas::gemm('t', 'n', c, c, C, 1.0, 0.0);
00386
00387 double volume = tet->get_volume();
00388
00389
00390 for (int i = 0; i < 6; i ++)
00391 for (int j = 0; j < 6; j ++)
00392 A(i,j) = C(i,j) * (4.0*volume);
00393
00394 if (order == 2) {
00395
00396 for (int i = 6; i < 12; i ++)
00397 for (int j = 0; j < 24; j ++)
00398 A(i,j) = 0.0;
00399
00400 for (int i = 0; i < 24; i ++)
00401 for (int j = 6; j < 12; j ++)
00402 A(i,j) = 0.0;
00403
00404 for (int i = 0; i < 6; i ++) {
00405 A(i,12) = (-C(i,0) - C(i,1))*(volume/2);
00406 A(i,13) = (-C(i,3) - C(i,4))*(volume/2);
00407 A(i,14) = (-C(i,5) + C(i,1))*(volume/2);
00408 A(i,15) = ( C(i,2) + C(i,4))*(volume/2);
00409 A(i,16) = (-C(i,3) + C(i,0))*(volume/2);
00410 A(i,17) = (-C(i,5) + C(i,3))*(volume/2);
00411 A(i,18) = ( C(i,2) + C(i,5))*(volume/2);
00412 A(i,19) = (-C(i,0) - C(i,2))*(volume/2);
00413 A(i,20) = ( C(i,1) + C(i,3))*(volume/2);
00414 A(i,21) = ( C(i,4) + C(i,5))*(volume/2);
00415 A(i,22) = (-C(i,1) - C(i,2))*(volume/2);
00416 A(i,23) = (-C(i,4) + C(i,0))*(volume/2);
00417 }
00418
00419 for (int i = 0; i < 6; i ++)
00420 for (int j = 12; j < 24; j ++)
00421 A(j,i) = A(i,j);
00422
00423 A(12,12) = 2*C(0,0) + 2*C(0,1) + 2*C(1,1);
00424 A(12,13) = C(0,3) + 2*C(0,4) + C(1,3) + C(1,4);
00425 A(12,14) = C(0,5) - C(0,1) + C(1,5) - C(1,1);
00426 A(12,15) = - C(0,2) - C(0,4) - 2*C(1,2) - C(1,4);
00427 A(12,16) = C(0,3) - 2*C(0,0) + C(1,3) - C(1,0);
00428 A(12,17) = C(0,5) - C(0,3) + 2*C(1,5) - C(1,3);
00429 A(12,18) = -2*C(0,2) - C(0,5) - C(1,2) - C(1,5);
00430 A(12,19) = C(0,0) + C(0,2) + C(1,0) + 2*C(1,2);
00431 A(12,20) = -C(0,1) - C(0,3) - 2*C(1,1) - C(1,3);
00432 A(12,21) = -2*C(0,4) - C(0,5) - C(1,4) - 2*C(1,5);
00433 A(12,22) = C(0,1) + 2*C(0,2) + C(1,1) + C(1,2);
00434 A(12,23) = C(0,4) - C(0,0) + C(1,4) - C(1,0);
00435 ;
00436 A(13,13) = 2*C(3,3) + 2*C(3,4) + 2*C(4,4);
00437 A(13,14) = C(3,5) - 2*C(3,1) + C(4,5) - C(4,1);
00438 A(13,15) = - C(3,2) - C(3,4) - C(4,2) - C(4,4);
00439 A(13,16) = C(3,3) - C(3,0) + C(4,3) - 2*C(4,0);
00440 A(13,17) = C(3,5) - 2*C(3,3) + C(4,5) - C(4,3);
00441 A(13,18) = -C(3,2) - C(3,5) - 2*C(4,2) - C(4,5);
00442 A(13,19) = 2*C(3,0) + C(3,2) + C(4,0) + C(4,2);
00443 A(13,20) = -C(3,1) - C(3,3) - C(4,1) - C(4,3);
00444 A(13,21) = -C(3,4) - C(3,5) - 2*C(4,4) - C(4,5);
00445 A(13,22) = 2*C(3,1) + C(3,2) + C(4,1) + 2*C(4,2);
00446 A(13,23) = C(3,4) - 2*C(3,0) + C(4,4) - C(4,0);
00447 ;
00448 A(14,14) = 2*C(5,5) - 2*C(5,1) + 2*C(1,1);
00449 A(14,15) = - C(5,2) - 2*C(5,4) + C(1,2) + C(1,4);
00450 A(14,16) = 2*C(5,3) - C(5,0) - C(1,3) + C(1,0);
00451 A(14,17) = C(5,5) - C(5,3) - C(1,5) + 2*C(1,3);
00452 A(14,18) = -C(5,2) - 2*C(5,5) + C(1,2) + C(1,5);
00453 A(14,19) = C(5,0) + C(5,2) - 2*C(1,0) - C(1,2);
00454 A(14,20) = -C(5,1) - 2*C(5,3) + C(1,1) + C(1,3);
00455 A(14,21) = -C(5,4) - C(5,5) + C(1,4) + C(1,5);
00456 A(14,22) = C(5,1) + C(5,2) - 2*C(1,1) - C(1,2);
00457 A(14,23) = 2*C(5,4) - C(5,0) - C(1,4) + 2*C(1,0);
00458 ;
00459 A(15,15) = 2*C(2,2) + 2*C(2,4) + 2*C(4,4);
00460 A(15,16) = - C(2,3) + C(2,0) - 2*C(4,3) + C(4,0);
00461 A(15,17) = - 2*C(2,5) + C(2,3) - C(4,5) + C(4,3);
00462 A(15,18) = C(2,2) + C(2,5) + C(4,2) + 2*C(4,5);
00463 A(15,19) = - C(2,0) - 2*C(2,2) - C(4,0) - C(4,2);
00464 A(15,20) = 2*C(2,1) + C(2,3) + C(4,1) + 2*C(4,3);
00465 A(15,21) = C(2,4) + 2*C(2,5) + C(4,4) + C(4,5);
00466 A(15,22) = -C(2,1) - C(2,2) - C(4,1) - C(4,2);
00467 A(15,23) = -C(2,4) + C(2,0) - 2*C(4,4) + C(4,0);
00468 ;
00469 A(16,16) = 2*C(3,3) - 2*C(0,3) + 2*C(0,0);
00470 A(16,17) = C(3,5) - C(3,3) - C(0,5) + C(0,3);
00471 A(16,18) = - C(3,2) - 2*C(3,5) + 2*C(0,2) + C(0,5);
00472 A(16,19) = C(3,0) + C(3,2) - C(0,0) - C(0,2);
00473 A(16,20) = -C(3,1) - 2*C(3,3) + C(0,1) + C(0,3);
00474 A(16,21) = -C(3,4) - C(3,5) + 2*C(0,4) + C(0,5);
00475 A(16,22) = C(3,1) + C(3,2) - C(0,1) - 2*C(0,2);
00476 A(16,23) = 2*C(3,4) - C(3,0) - C(0,4) + C(0,0);
00477 ;
00478 A(17,17) = 2*C(5,5) - 2*C(5,3) + 2*C(3,3);
00479 A(17,18) = - C(5,2) - C(5,5) + C(3,2) + C(3,5);
00480 A(17,19) = C(5,0) + 2*C(5,2) - 2*C(3,0) - C(3,2);
00481 A(17,20) = -2*C(5,1) - C(5,3) + C(3,1) + C(3,3);
00482 A(17,21) = -C(5,4) - 2*C(5,5) + C(3,4) + C(3,5);
00483 A(17,22) = C(5,1) + C(5,2) - 2*C(3,1) - C(3,2);
00484 A(17,23) = C(5,4) - C(5,0) - C(3,4) + 2*C(3,0);
00485 ;
00486 A(18,18) = 2*C(2,2) + 2*C(2,5) + 2*C(5,5);
00487 A(18,19) = - C(2,0) - C(2,2) - C(5,0) - C(5,2);
00488 A(18,20) = C(2,1) + C(2,3) + C(5,1) + 2*C(5,3);
00489 A(18,21) = 2*C(2,4) + C(2,5) + C(5,4) + C(5,5);
00490 A(18,22) = -C(2,1) - 2*C(2,2) - C(5,1) - C(5,2);
00491 A(18,23) = -C(2,4) + C(2,0) - 2*C(5,4) + C(5,0);
00492 ;
00493 A(19,19) = 2*C(0,0) + 2*C(0,2) + 2*C(2,2);
00494 A(19,20) = -C(0,1) - C(0,3) - 2*C(2,1) - C(2,3);
00495 A(19,21) = -C(0,4) - C(0,5) - C(2,4) - 2*C(2,5);
00496 A(19,22) = 2*C(0,1) + C(0,2) + C(2,1) + C(2,2);
00497 A(19,23) = C(0,4) - 2*C(0,0) + C(2,4) - C(2,0);
00498 ;
00499 A(20,20) = 2*C(1,1) + 2*C(1,3) + 2*C(3,3);
00500 A(20,21) = C(1,4) + 2*C(1,5) + C(3,4) + C(3,5);
00501 A(20,22) = -C(1,1) - C(1,2) - C(3,1) - C(3,2);
00502 A(20,23) = -C(1,4) + C(1,0) - 2*C(3,4) + C(3,0);
00503 ;
00504 A(21,21) = 2*C(4,4) + 2*C(4,5) + 2*C(5,5);
00505 A(21,22) = -C(4,1) - 2*C(4,2) - C(5,1) - C(5,2);
00506 A(21,23) = -C(4,4) + C(4,0) - C(5,4) + C(5,0);
00507 ;
00508 A(22,22) = 2*C(1,1) + 2*C(1,2) + 2*C(2,2);
00509 A(22,23) = C(1,4) - 2*C(1,0) + C(2,4) - C(2,0);
00510 ;
00511 A(23,23) = 2*C(4,4) - 2*C(4,0) + 2*C(0,0);
00512
00513 for (int i = 13; i < 24; i ++)
00514 for (int j = 12; j < i; j ++)
00515 A(i,j) = A(j,i);
00516
00517 for (int i = 12; i < 24; i ++)
00518 for (int j = 12; j < 24; j ++)
00519 A(i,j) *= volume/20.0;
00520 }
00521
00522
00523 for (int k = 0; k < 6; k ++) {
00524 if (!tet->get_edge_orientation(k)) {
00525 for (int j = 0; j < A.get_m(); j ++)
00526 A(k,j) = -A(k,j);
00527 for (int i = 0; i < A.get_m(); i ++)
00528 A(i,k) = -A(i,k);
00529 }
00530 }
00531
00532 }
00533
00534 void NedelecElement::get_Me(Tet* tet,
00535 int order,
00536 const Tet::GradientMatrix& J,
00537 Matrix<double>& M) {
00538
00539 Matrix<double> G(4, 4);
00540 blas::gemm('t', 'n', J, J, G, 1.0, 0.0);
00541
00542
00543 M(0,0) = (G(0,0)+G(1,1)-G(0,1))*84;
00544 M(0,1) = (G(0,0)-G(0,1)-G(0,2)+2*G(1,2))*42;
00545 M(0,2) = (G(0,0)-G(0,1)-G(0,3)+2*G(1,3))*42;
00546 M(0,3) = (-G(1,1)+G(0,1)+G(1,2)-2*G(0,2))*42;
00547 M(0,4) = (-G(1,1)+G(0,1)+G(1,3)-2*G(0,3))*42;
00548 M(0,5) = (G(0,2)+G(1,3)-G(0,3)-G(1,2))*42;
00549 ;
00550 M(1,1) = (G(0,0)+G(2,2)-G(0,2))*84;
00551 M(1,2) = (G(0,0)-G(0,2)-G(0,3)+2*G(2,3))*42;
00552 M(1,3) = (G(2,2)-G(0,2)-G(1,2)+2*G(0,1))*42;
00553 M(1,4) = (G(0,1)+G(2,3)-G(0,3)-G(1,2))*42;
00554 M(1,5) = (-G(2,2)+G(0,2)+G(2,3)-2*G(0,3))*42;
00555 ;
00556 M(2,2) = (G(0,0)+G(3,3)-G(0,3))*84;
00557 M(2,3) = (G(0,1)+G(2,3)-G(0,2)-G(1,3))*42;
00558 M(2,4) = (G(3,3)-G(0,3)-G(1,3)+2*G(0,1))*42;
00559 M(2,5) = (G(3,3)-G(0,3)-G(2,3)+2*G(0,2))*42;
00560 ;
00561 M(3,3) = (G(1,1)+G(2,2)-G(1,2))*84;
00562 M(3,4) = (G(1,1)-G(1,2)-G(1,3)+2*G(2,3))*42;
00563 M(3,5) = (-G(2,2)+G(1,2)+G(2,3)-2*G(1,3))*42;
00564 ;
00565 M(4,4) = (G(1,1)+G(3,3)-G(1,3))*84;
00566 M(4,5) = (G(3,3)-G(1,3)-G(2,3)+2*G(1,2))*42;
00567 ;
00568 M(5,5) = (G(2,2)+G(3,3)-G(2,3))*84;
00569 ;
00570
00571 if (order == 2) {
00572 M(0,6) = (G(1,1)-G(0,0))*84;
00573 M(0,7) = (-G(0,0)+G(0,1)-G(0,2)+2*G(1,2))*42;
00574 M(0,8) = (-G(0,0)+G(0,1)-G(0,3)+2*G(1,3))*42;
00575 M(0,9) = (G(1,1)-G(0,1)+G(1,2)-2*G(0,2))*42;
00576 M(0,10) = (G(1,1)-G(0,1)+G(1,3)-2*G(0,3))*42;
00577 M(0,11) = (-G(0,2)-G(0,3)+G(1,2)+G(1,3))*42;
00578 ;
00579 M(0,12) = (G(0,1)-2*G(0,0))*7;
00580 M(0,13) = (G(1,1)-G(0,1))*7;
00581 M(0,14) = (-G(0,2)+2*G(1,2))*7;
00582 M(0,15) = (-G(0,3)+G(1,3))*14;
00583 M(0,16) = (2*G(1,1)-G(0,1))*7;
00584 M(0,17) = (-2*G(0,2)+G(1,2))*7;
00585 M(0,18) = (-G(0,3)+2*G(1,3))*7;
00586 M(0,19) = (-2*G(0,0)+G(0,1))*7;
00587 ;
00588 M(0,20) = (2*G(1,2)-2*G(0,2))*7;
00589 M(0,21) = (G(1,3)-2*G(0,3))*7;
00590 M(0,22) = (G(0,1)-G(0,0))*7;
00591 M(0,23) = (2*G(1,1)-G(0,1))*7;
00592 ;
00593 M(1,6) = (-G(0,0)-G(0,1)+G(0,2)+2*G(1,2))*42;
00594 M(1,7) = (G(2,2)-G(0,0))*84;
00595 M(1,8) = (-G(0,0)+G(0,2)-G(0,3)+2*G(2,3))*42;
00596 M(1,9) = (G(2,2)-G(0,2)+G(1,2)-2*G(0,1))*42;
00597 M(1,10) = (-G(0,1)-G(0,3)+G(1,2)+G(2,3))*42;
00598 M(1,11) = (G(2,2)-G(0,2)+G(2,3)-2*G(0,3))*42;
00599 ;
00600 M(1,12) = (-2*G(0,0)+G(0,2))*7;
00601 M(1,13) = (-2*G(0,1)+G(1,2))*7;
00602 M(1,14) = (2*G(2,2)-G(0,2))*7;
00603 M(1,15) = (-G(0,3)+2*G(2,3))*7;
00604 M(1,16) = (-G(0,1)+G(1,2))*14;
00605 M(1,17) = (G(2,2)-G(0,2))*7;
00606 M(1,18) = (-G(0,3)+G(2,3))*14;
00607 M(1,19) = (-G(0,0)+G(0,2))*7;
00608 ;
00609 M(1,20) = (2*G(2,2)-G(0,2))*7;
00610 M(1,21) = (G(2,3)-2*G(0,3))*7;
00611 M(1,22) = (G(2,0)-2*G(0,0))*7;
00612 M(1,23) = (2*G(1,2)-G(0,1))*7;
00613 ;
00614 M(2,6) = (-G(0,0)-G(0,1)+G(0,3)+2*G(1,3))*42;
00615 M(2,7) = (-G(0,0)-G(0,2)+G(0,3)+2*G(2,3))*42;
00616 M(2,8) = (G(3,3)-G(0,0))*84;
00617 M(2,9) = (-G(0,2)-G(0,1)+G(2,3)+G(1,3))*42;
00618 M(2,10) = (G(3,3)-G(0,3)+G(1,3)-2*G(0,1))*42;
00619 M(2,11) = (G(3,3)-G(0,3)+G(2,3)-2*G(0,2))*42;
00620 ;
00621 M(2,12) = (-G(0,0)+G(0,3))*7;
00622 M(2,13) = (-2*G(0,1)+G(1,3))*7;
00623 M(2,14) = (-G(0,2)+G(2,3))*14;
00624 M(2,15) = (2*G(3,3)-G(0,3))*7;
00625 M(2,16) = (-G(0,1)+2*G(1,3))*7;
00626 M(2,17) = (-2*G(0,2)+G(2,3))*7;
00627 M(2,18) = (2*G(3,3)-G(0,3))*7;
00628 M(2,19) = (-2*G(0,0)+G(0,3))*7;
00629 ;
00630 M(2,20) = (2*G(2,3)-G(0,2))*7;
00631 M(2,21) = (G(3,3)-G(0,3))*7;
00632 M(2,22) = (G(3,0)-2*G(0,0))*7;
00633 M(2,23) = (2*G(1,3)-2*G(0,1))*7;
00634 ;
00635 M(3,6) = (-G(1,1)-G(0,1)+G(1,2)+2*G(0,2))*42;
00636 M(3,7) = (G(2,2)+G(0,2)-G(1,2)-2*G(0,1))*42;
00637 M(3,8) = (-G(0,1)+G(0,2)-G(1,3)+G(2,3))*42;
00638 M(3,9) = (G(2,2)-G(1,1))*84;
00639 M(3,10) = (-G(1,1)+G(1,2)-G(1,3)+2*G(2,3))*42;
00640 M(3,11) = (G(2,2)-G(1,2)+G(2,3)-2*G(1,3))*42;
00641 ;
00642 M(3,12) = (-G(0,1)+G(0,2))*14;
00643 M(3,13) = (-2*G(1,1)+G(1,2))*7;
00644 M(3,14) = (G(2,2)-G(1,2))*7;
00645 M(3,15) = (-G(1,3)+2*G(2,3))*7;
00646 M(3,16) = (-2*G(1,1)+G(1,2))*7;
00647 M(3,17) = (2*G(2,2)-G(1,2))*7;
00648 M(3,18) = (-2*G(1,3)+G(2,3))*7;
00649 M(3,19) = (-G(0,1)+2*G(0,2))*7;
00650 ;
00651 M(3,20) = (2*G(2,2)-G(1,2))*7;
00652 M(3,21) = (2*G(2,3)-2*G(1,3))*7;
00653 M(3,22) = (G(2,0)-2*G(0,1))*7;
00654 M(3,23) = (G(1,2)-G(1,1))*7;
00655 ;
00656 M(4,6) = (-G(1,1)+G(1,3)-G(0,1)+2*G(0,3))*42;
00657 M(4,7) = (-G(0,1)+G(0,3)-G(1,2)+G(2,3))*42;
00658 M(4,8) = (G(3,3)+G(0,3)-G(1,3)-2*G(0,1))*42;
00659 M(4,9) = (-G(1,1)-G(1,2)+G(1,3)+2*G(2,3))*42;
00660 M(4,10) = (G(3,3)-G(1,1))*84;
00661 M(4,11) = (G(3,3)+G(2,3)-G(1,3)-2*G(1,2))*42;
00662 ;
00663 M(4,12) = (-G(0,1)+2*G(0,3))*7;
00664 M(4,13) = (-2*G(1,1)+G(1,3))*7;
00665 M(4,14) = (-2*G(1,2)+G(2,3))*7;
00666 M(4,15) = (2*G(3,3)-G(1,3))*7;
00667 M(4,16) = (-G(1,1)+G(1,3))*7;
00668 M(4,17) = (-G(1,2)+G(2,3))*14;
00669 M(4,18) = (G(3,3)-G(1,3))*7;
00670 M(4,19) = (-G(0,1)+G(0,3))*14;
00671 ;
00672 M(4,20) = (2*G(3,2)-G(1,2))*7;
00673 M(4,21) = (2*G(3,3)-G(1,3))*7;
00674 M(4,22) = (G(3,0)-2*G(0,1))*7;
00675 M(4,23) = (G(3,1)-2*G(1,1))*7;
00676 ;
00677 M(5,6) = (-G(0,2)+G(0,3)-G(1,2)+G(1,3))*42;
00678 M(5,7) = (-G(2,2)+G(2,3)-G(0,2)+2*G(0,3))*42;
00679 M(5,8) = (G(3,3)+G(0,3)-G(2,3)-2*G(0,2))*42;
00680 M(5,9) = (-G(2,2)+G(2,3)-G(1,2)+2*G(1,3))*42;
00681 M(5,10) = (G(3,3)+G(1,3)-G(2,3)-2*G(1,2))*42;
00682 M(5,11) = (G(3,3)-G(2,2))*84;
00683 ;
00684 M(5,12) = (-G(0,2)+2*G(0,3))*7;
00685 M(5,13) = (-G(1,2)+G(1,3))*14;
00686 M(5,14) = (-2*G(2,2)+G(2,3))*7;
00687 M(5,15) = (G(3,3)-G(2,3))*7;
00688 M(5,16) = (2*G(1,3)-G(1,2))*7;
00689 M(5,17) = (-2*G(2,2)+G(2,3))*7;
00690 M(5,18) = (2*G(3,3)-G(2,3))*7;
00691 M(5,19) = (-2*G(0,2)+G(0,3))*7;
00692 ;
00693 M(5,20) = (G(3,2)-G(2,2))*7;
00694 M(5,21) = (2*G(3,3)-G(2,3))*7;
00695 M(5,22) = (2*G(3,0)-2*G(0,2))*7;
00696 M(5,23) = (G(3,1)-2*G(1,2))*7;
00697 ;
00698 M(6,6) = (G(0,0)+G(1,1)+G(0,1))*84;
00699 M(6,7) = (G(0,0)+G(0,1)+G(0,2)+2*G(1,2))*42;
00700 M(6,8) = (G(0,0)+G(0,1)+G(0,3)+2*G(1,3))*42;
00701 M(6,9) = (G(1,1)+G(0,1)+G(1,2)+2*G(0,2))*42;
00702 M(6,10)= (G(1,1)+G(0,1)+G(1,3)+2*G(0,3))*42;
00703 M(6,11) =(G(0,2)+G(0,3)+G(1,2)+G(1,3))*42;
00704 ;
00705 M(6,12) = (G(0,1)+2*G(0,0))*7;
00706 M(6,13) = (G(1,1)+G(0,1))*7;
00707 M(6,14) = (G(0,2)+2*G(1,2))*7;
00708 M(6,15) = (G(0,3)+G(1,3))*14;
00709 M(6,16) = (2*G(1,1)+G(0,1))*7;
00710 M(6,17) = (2*G(0,2)+G(1,2))*7;
00711 M(6,18) = (G(0,3)+2*G(1,3))*7;
00712 M(6,19) = (2*G(0,0)+G(0,1))*7;
00713 ;
00714 M(6,20) = (2*G(1,2)+2*G(0,2))*7;
00715 M(6,21) = (G(1,3)+2*G(0,3))*7;
00716 M(6,22) = (G(0,1)+G(0,0))*7;
00717 M(6,23) = (2*G(1,1)+G(0,1))*7;
00718 ;
00719 M(7,7) = (G(0,0)+G(2,2)+G(0,2))*84;
00720 M(7,8) = (G(0,0)+G(0,2)+G(0,3)+2*G(2,3))*42;
00721 M(7,9) = (G(2,2)+G(0,2)+G(1,2)+2*G(0,1))*42;
00722 M(7,10) = (G(0,1)+G(0,3)+G(1,2)+G(2,3))*42;
00723 M(7,11) = (G(2,2)+G(0,2)+G(2,3)+2*G(0,3))*42;
00724 ;
00725 M(7,12) = (2*G(0,0)+G(0,2))*7;
00726 M(7,13) = (2*G(0,1)+G(1,2))*7;
00727 M(7,14) = (2*G(2,2)+G(0,2))*7;
00728 M(7,15) = (G(0,3)+2*G(2,3))*7;
00729 M(7,16) = (G(0,1)+G(1,2))*14;
00730 M(7,17) = (G(2,2)+G(0,2))*7;
00731 M(7,18) = (G(0,3)+G(2,3))*14;
00732 M(7,19) = (G(0,0)+G(0,2))*7;
00733 ;
00734 M(7,20) = (2*G(2,2)+G(0,2))*7;
00735 M(7,21) = (G(2,3)+2*G(0,3))*7;
00736 M(7,22) = (G(2,0)+2*G(0,0))*7;
00737 M(7,23) = (2*G(1,2)+G(0,1))*7;
00738 ;
00739 M(8,8) = (G(0,0)+G(3,3)+G(0,3))*84;
00740 M(8,9) = (G(0,1)+G(0,2)+G(1,3)+G(2,3))*42;
00741 M(8,10) = (G(3,3)+G(0,3)+G(1,3)+2*G(0,1))*42;
00742 M(8,11) = (G(3,3)+G(0,3)+G(2,3)+2*G(0,2))*42;
00743 ;
00744 M(8,12) = (G(0,0)+G(0,3))*7;
00745 M(8,13) = (2*G(0,1)+G(1,3))*7;
00746 M(8,14) = (G(0,2)+G(2,3))*14;
00747 M(8,15) = (2*G(3,3)+G(0,3))*7;
00748 M(8,16) = (G(0,1)+2*G(1,3))*7;
00749 M(8,17) = (2*G(0,2)+G(2,3))*7;
00750 M(8,18) = (2*G(3,3)+G(0,3))*7;
00751 M(8,19) = (2*G(0,0)+G(0,3))*7;
00752 ;
00753 M(8,20) = (2*G(2,3)+G(0,2))*7;
00754 M(8,21) = (G(3,3)+G(0,3))*7;
00755 M(8,22) = (G(3,0)+2*G(0,0))*7;
00756 M(8,23) = (2*G(1,3)+2*G(0,1))*7;
00757 ;
00758 M(9,9) = (G(1,1)+G(2,2)+G(1,2))*84;
00759 M(9,10) = (G(1,1)+G(1,2)+G(1,3)+2*G(2,3))*42;
00760 M(9,11) = (G(2,2)+G(1,2)+G(2,3)+2*G(1,3))*42;
00761 ;
00762 M(9,12) = (G(0,1)+G(0,2))*14;
00763 M(9,13) = (2*G(1,1)+G(1,2))*7;
00764 M(9,14) = (G(2,2)+G(1,2))*7;
00765 M(9,15) = (G(1,3)+2*G(2,3))*7;
00766 M(9,16) = (2*G(1,1)+G(1,2))*7;
00767 M(9,17) = (2*G(2,2)+G(1,2))*7;
00768 M(9,18) = (2*G(1,3)+G(2,3))*7;
00769 M(9,19) = (G(0,1)+2*G(0,2))*7;
00770 ;
00771 M(9,20) = (2*G(2,2)+G(1,2))*7;
00772 M(9,21) = (2*G(2,3)+2*G(1,3))*7;
00773 M(9,22) = (G(2,0)+2*G(0,1))*7;
00774 M(9,23) = (G(1,2)+G(1,1))*7;
00775 ;
00776 M(10,10) = (G(1,1)+G(3,3)+G(1,3))*84;
00777 M(10,11) = (G(3,3)+G(1,3)+G(2,3)+2*G(1,2))*42;
00778 ;
00779 M(10,12) = (G(0,1)+2*G(0,3))*7;
00780 M(10,13) = (2*G(1,1)+G(1,3))*7;
00781 M(10,14) = (2*G(1,2)+G(2,3))*7;
00782 M(10,15) = (2*G(3,3)+G(1,3))*7;
00783 M(10,16) = (G(1,1)+G(1,3))*7;
00784 M(10,17) = (G(1,2)+G(2,3))*14;
00785 M(10,18) = (G(3,3)+G(1,3))*7;
00786 M(10,19) = (G(0,1)+G(0,3))*14;
00787 ;
00788 M(10,20) = (2*G(3,2)+G(1,2))*7;
00789 M(10,21) = (2*G(3,3)+G(1,3))*7;
00790 M(10,22) = (G(3,0)+2*G(0,1))*7;
00791 M(10,23) = (G(3,1)+2*G(1,1))*7;
00792 ;
00793 M(11,11) = (G(2,2)+G(3,3)+G(2,3))*84;
00794 ;
00795 M(11,12) = (G(0,2)+2*G(0,3))*7;
00796 M(11,13) = (G(1,2)+G(1,3))*14;
00797 M(11,14) = (2*G(2,2)+G(2,3))*7;
00798 M(11,15) = (G(3,3)+G(2,3))*7;
00799 M(11,16) = (2*G(1,3)+G(1,2))*7;
00800 M(11,17) = (2*G(2,2)+G(2,3))*7;
00801 M(11,18) = (2*G(3,3)+G(2,3))*7;
00802 M(11,19) = (2*G(0,2)+G(0,3))*7;
00803 ;
00804 M(11,20) = (G(3,2)+G(2,2))*7;
00805 M(11,21) = (2*G(3,3)+G(2,3))*7;
00806 M(11,22) = (2*G(3,0)+2*G(0,2))*7;
00807 M(11,23) = (G(3,1)+2*G(1,2))*7;
00808 ;
00809 M(12,12) = G(0,0)*4;
00810 M(12,13) = G(0,1)*2;
00811 M(12,14) = G(0,2);
00812 M(12,15) = G(0,3)*2;
00813 M(12,16) = G(0,1)*2;
00814 M(12,17) = G(0,2)*2;
00815 M(12,18) = G(0,3)*2;
00816 M(12,19) = G(0,0)*2;
00817 M(12,20) = G(0,2)*2;
00818 M(12,21) = G(0,3)*4;
00819 M(12,22) = G(0,0)*2;
00820 M(12,23) = G(0,1);
00821 ;
00822 ;
00823 M(13,13) = G(1,1)*4;
00824 M(13,14) = G(1,2)*2;
00825 M(13,15) = G(1,3);
00826 M(13,16) = G(1,1)*2;
00827 M(13,17) = G(1,2)*2;
00828 M(13,18) = G(1,3)*2;
00829 M(13,19) = G(0,1)*2;
00830 M(13,20) = G(1,2);
00831 M(13,21) = G(1,3)*2;
00832 M(13,22) = G(1,0)*4;
00833 M(13,23) = G(1,1)*2;
00834 ;
00835 M(14,14) = G(2,2)*4;
00836 M(14,15) = G(2,3)*2;
00837 M(14,16) = G(1,2)*2;
00838 M(14,17) = G(2,2)*2;
00839 M(14,18) = G(2,3)*2;
00840 M(14,19) = G(0,2)*2;
00841 M(14,20) = G(2,2)*2;
00842 M(14,21) = G(2,3);
00843 M(14,22) = G(2,0)*2;
00844 M(14,23) = G(2,1)*4;
00845 ;
00846 M(15,15) = G(3,3)*4;
00847 M(15,16) = G(1,3)*2;
00848 M(15,17) = G(2,3)*2;
00849 M(15,18) = G(3,3)*2;
00850 M(15,19) = G(0,3)*2;
00851 M(15,20) = G(3,2)*4;
00852 M(15,21) = G(3,3)*2;
00853 M(15,22) = G(3,0);
00854 M(15,23) = G(3,1)*2;
00855 ;
00856 M(16,16) = G(1,1)*4;
00857 M(16,17) = G(1,2);
00858 M(16,18) = G(1,3)*4;
00859 M(16,19) = G(0,1);
00860 M(16,20) = G(1,2)*2;
00861 M(16,21) = G(1,3)*2;
00862 M(16,22) = G(1,0)*2;
00863 M(16,23) = G(1,1)*2;
00864 ;
00865 M(17,17) = G(2,2)*4;
00866 M(17,18) = G(2,3);
00867 M(17,19) = G(0,2)*4;
00868 M(17,20) = G(2,2)*2;
00869 M(17,21) = G(2,3)*2;
00870 M(17,22) = G(2,0)*2;
00871 M(17,23) = G(2,1)*2;
00872 ;
00873 M(18,18) = G(3,3)*4;
00874 M(18,19) = G(0,3);
00875 M(18,20) = G(3,2)*2;
00876 M(18,21) = G(3,3)*2;
00877 M(18,22) = G(3,0)*2;
00878 M(18,23) = G(3,1)*2;
00879 ;
00880 M(19,19) = G(0,0)*4;
00881 M(19,20) = G(0,2)*2;
00882 M(19,21) = G(0,3)*2;
00883 M(19,22) = G(0,0)*2;
00884 M(19,23) = G(0,1)*2;
00885 ;
00886 M(20,20) = G(2,2)*4;
00887 M(20,21) = G(2,3)*2;
00888 M(20,22) = G(2,0);
00889 M(20,23) = G(2,1)*2;
00890 ;
00891 M(21,21) = G(3,3)*4;
00892 M(21,22) = G(3,0)*2;
00893 M(21,23) = G(3,1);
00894 ;
00895 M(22,22) = G(0,0)*4;
00896 M(22,23) = G(0,1)*2;
00897 ;
00898 M(23,23) = G(1,1)*4;
00899 }
00900
00901 double volume = tet->get_volume();
00902
00903 for (int i = 0; i < M.get_m(); i ++)
00904 for (int j = i; j < M.get_n(); j ++)
00905 M(i,j) *= volume/840.0;
00906
00907 for (int i = 0; i < M.get_m(); i ++)
00908 for (int j = 0; j < i; j ++)
00909 M(i,j) = M(j,i);
00910
00911
00912 for (int k = 0; k < 6; k ++) {
00913 if (!tet->get_edge_orientation(k)) {
00914 for (int j = 0; j < M.get_m(); j ++)
00915 M(k,j) = -M(k,j);
00916 for (int i = 0; i < M.get_m(); i ++)
00917 M(i,k) = -M(i,k);
00918 }
00919 }
00920 }
00921
00922
00923 Vector3 NedelecElement::eval_cartesian(mesh::Tet* tet,
00924 int order,
00925 const Vector<double>& dof,
00926 const mesh::Tet::GradientMatrix& J,
00927 const Vector3& x) {
00928 Vector4 xi;
00929 tet->cartesian_to_simplex(x, xi);
00930 return eval_simplex(tet, order, dof, J, xi);
00931 }
00932 Vector3 NedelecElement::eval_curl_cartesian(mesh::Tet* tet,
00933 int order,
00934 const Vector<double>& dof,
00935 const mesh::Tet::GradientMatrix& J,
00936 const Vector3& x) {
00937 Vector4 xi;
00938 tet->cartesian_to_simplex(x, xi);
00939 return eval_curl_simplex(tet, order, dof, J, xi);
00940 }
00941
00942 Vector3 NedelecElement::eval_simplex(mesh::Tet* tet,
00943 int order,
00944 const Vector<double>& dof,
00945 const mesh::Tet::GradientMatrix& J,
00946 const Vector4& xi) {
00947 Vector3 f(Vector3::ZERO);
00948 double coeff;
00949
00950 #define DOF_LIN_1(DOF, IND0, IND1) \
00951 coeff = (tet->get_edge_orientation(DOF) ? 1.0 : -1.0) * dof(DOF); \
00952 f.x += coeff * (xi[IND0] * J(0, IND1) - xi[IND1] * J(0, IND0)); \
00953 f.y += coeff * (xi[IND0] * J(1, IND1) - xi[IND1] * J(1, IND0)); \
00954 f.z += coeff * (xi[IND0] * J(2, IND1) - xi[IND1] * J(2, IND0));
00955
00956 #define DOF_LIN_2(DOF, IND0, IND1) \
00957 coeff = dof(DOF); \
00958 f.x += coeff * (xi[IND0] * J(0, IND1) + xi[IND1] * J(0, IND0)); \
00959 f.y += coeff * (xi[IND0] * J(1, IND1) + xi[IND1] * J(1, IND0)); \
00960 f.z += coeff * (xi[IND0] * J(2, IND1) + xi[IND1] * J(2, IND0));
00961
00962 #define DOF_QUAD(DOF, IND0, IND1, IND2) \
00963 coeff = dof(DOF); \
00964 f.x += coeff * J(0, IND0) * xi[IND1] * xi[IND2]; \
00965 f.y += coeff * J(1, IND0) * xi[IND1] * xi[IND2]; \
00966 f.z += coeff * J(2, IND0) * xi[IND1] * xi[IND2];
00967
00968 DOF_LIN_1(0, 0, 1);
00969 DOF_LIN_1(1, 0, 2);
00970 DOF_LIN_1(2, 0, 3);
00971 DOF_LIN_1(3, 1, 2);
00972 DOF_LIN_1(4, 1, 3);
00973 DOF_LIN_1(5, 2, 3);
00974
00975 if (order > 1) {
00976
00977 DOF_LIN_2(6, 0, 1);
00978 DOF_LIN_2(7, 0, 2);
00979 DOF_LIN_2(8, 0, 3);
00980 DOF_LIN_2(9, 1, 2);
00981 DOF_LIN_2(10, 1, 3);
00982 DOF_LIN_2(11, 2, 3);
00983
00984 DOF_QUAD(12, 0, 1, 2);
00985 DOF_QUAD(13, 1, 2, 3);
00986 DOF_QUAD(14, 2, 3, 0);
00987 DOF_QUAD(15, 3, 0, 1);
00988
00989 DOF_QUAD(16, 1, 2, 0);
00990 DOF_QUAD(17, 2, 3, 1);
00991 DOF_QUAD(18, 3, 0, 2);
00992 DOF_QUAD(19, 0, 1, 3);
00993
00994 DOF_QUAD(20, 2, 0, 1);
00995 DOF_QUAD(21, 3, 1, 2);
00996 DOF_QUAD(22, 0, 2, 3);
00997 DOF_QUAD(23, 1, 3, 0);
00998
00999 }
01000
01001 #undef DOF_LIN_1
01002 #undef DOF_LIN_2
01003 #undef DOF_QUAD
01004
01005 return f;
01006 }
01007
01008 Vector3 NedelecElement::eval_curl_simplex(mesh::Tet* tet,
01009 int order,
01010 const Vector<double>& dof,
01011 const mesh::Tet::GradientMatrix& J,
01012 const Vector4& xi) {
01013
01014
01015 Matrix<Vector3> C(4, 4);
01016 for (int i = 0; i < 4; i ++)
01017 for (int j = 0; j < 4; j ++) {
01018 C(i,j).x = J(1,i)*J(2,j) - J(2,i)*J(1,j);
01019 C(i,j).y = J(2,i)*J(0,j) - J(0,i)*J(2,j);
01020 C(i,j).z = J(0,i)*J(1,j) - J(1,i)*J(0,j);
01021 }
01022
01023 Vector3 f(Vector3::ZERO);
01024 double coeff;
01025
01026 #define CURL_DOF_LIN_1(DOF, IND0, IND1) \
01027 coeff = (tet->get_edge_orientation(DOF) ? 1.0 : -1.0) * dof[DOF]; \
01028 f.x += coeff * 2 * C(IND0,IND1).x; \
01029 f.y += coeff * 2 * C(IND0,IND1).y; \
01030 f.z += coeff * 2 * C(IND0,IND1).z;
01031 #define CURL_DOF_QUAD(DOF, IND0, IND1, IND2) \
01032 coeff = dof[DOF]; \
01033 f.x += coeff * (xi[IND1] * C(IND2,IND0).x + xi[IND2] * C(IND1,IND0).x); \
01034 f.y += coeff * (xi[IND1] * C(IND2,IND0).y + xi[IND2] * C(IND1,IND0).y); \
01035 f.z += coeff * (xi[IND1] * C(IND2,IND0).z + xi[IND2] * C(IND1,IND0).z);
01036
01037 CURL_DOF_LIN_1(0, 0, 1);
01038 CURL_DOF_LIN_1(1, 0, 2);
01039 CURL_DOF_LIN_1(2, 0, 3);
01040 CURL_DOF_LIN_1(3, 1, 2);
01041 CURL_DOF_LIN_1(4, 1, 3);
01042 CURL_DOF_LIN_1(5, 2, 3);
01043
01044 if (order > 1) {
01045
01046 CURL_DOF_QUAD(12, 0, 1, 2);
01047 CURL_DOF_QUAD(13, 1, 2, 3);
01048 CURL_DOF_QUAD(14, 2, 3, 0);
01049 CURL_DOF_QUAD(15, 3, 0, 1);
01050
01051 CURL_DOF_QUAD(16, 1, 2, 0);
01052 CURL_DOF_QUAD(17, 2, 3, 1);
01053 CURL_DOF_QUAD(18, 3, 0, 2);
01054 CURL_DOF_QUAD(19, 0, 1, 3);
01055
01056 CURL_DOF_QUAD(20, 2, 0, 1);
01057 CURL_DOF_QUAD(21, 3, 1, 2);
01058 CURL_DOF_QUAD(22, 0, 2, 3);
01059 CURL_DOF_QUAD(23, 1, 3, 0);
01060
01061 }
01062
01063 #undef CURL_DOF_LIN_1
01064 #undef CURL_DOF_QUAD
01065
01066 return f;
01067 }
01068
01069 double NedelecElement::surface_integral_curl(mesh::Tet* tet,
01070 mesh::Face* face,
01071 const colarray::Vector<double>& dofs) {
01072
01073 colarray::Matrix<double> A(get_nof_dofs(), get_nof_dofs());
01074 A = 0.0;
01075
01076
01077 mesh::Tet::GradientMatrix J(*tet);
01078
01079
01080 static const int ind1[] = {0, 0, 0, 1, 1, 2};
01081 static const int ind2[] = {1, 2, 3, 2, 3, 3};
01082 colarray::Matrix<double> c(3, 6);
01083 for (int ii = 0; ii < 6; ii ++) {
01084 int i = ind1[ii];
01085 int j = ind2[ii];
01086 c(0,ii) = J(1,i)*J(2,j) - J(2,i)*J(1,j);
01087 c(1,ii) = J(2,i)*J(0,j) - J(0,i)*J(2,j);
01088 c(2,ii) = J(0,i)*J(1,j) - J(1,i)*J(0,j);
01089 }
01090
01091
01092 colarray::Matrix<double> C(6, 6);
01093 blas::gemm('t', 'n', c, c, C, 1.0, 0.0);
01094
01095
01096 mesh::Vector3 p0(face->get_corner(0)->get_coord());
01097 mesh::Vector3 p1(face->get_corner(1)->get_coord());
01098 mesh::Vector3 p2(face->get_corner(2)->get_coord());
01099 mesh::Vector3 u = p1 - p0;
01100 mesh::Vector3 v = p2 - p0;
01101 double E = u.dot_product(u);
01102 double F = u.dot_product(v);
01103 double G = v.dot_product(v);
01104 double S = sqrt(E*G - F*F);
01105
01106
01107 int face_id_local;
01108 for (face_id_local = 0; face_id_local < 4; ++ face_id_local)
01109 if (tet->get_face_id(face_id_local) == face->get_id())
01110 break;
01111 assert(face_id_local < 4);
01112
01113
01114 colarray::Matrix<double> A1(A, 0, 6, 0, 6);
01115 A1.inject(C);
01116 A1 *= 2.0*S;
01117
01118
01119 if (get_order() == 2) {
01120 switch (face_id_local) {
01121 case 0:
01122 A(0,12) = -S*(C(0,0)+C(0,1))/3.0;
01123 A(0,13) = -S*C(0,4)/3.0;
01124 A(0,14) = -S*C(0,5)/3.0;
01125 A(0,15) = S*(C(0,2)+C(0,4))/3.0;
01126 A(0,16) = S*(-C(0,3)+C(0,0))/3.0;
01127 A(0,17) = -S*C(0,5)/3.0;
01128 A(0,18) = S*(C(0,2)+C(0,5))/3.0;
01129 A(0,19) = -S*C(0,2)/3.0;
01130 A(0,20) = S*(C(0,1)+C(0,3))/3.0;
01131 A(0,21) = S*(C(0,4)+C(0,5))/3.0;
01132 A(0,22) = -S*C(0,2)/3.0;
01133 A(0,23) = -S*C(0,4)/3.0;
01134
01135 A(1,12) = -S*(C(1,0)+C(1,1))/3.0;
01136 A(1,13) = -S*C(1,4)/3.0;
01137 A(1,14) = -S*C(1,5)/3.0;
01138 A(1,15) = S*(C(1,2)+C(1,4))/3.0;
01139 A(1,16) = S*(-C(1,3)+C(1,0))/3.0;
01140 A(1,17) = -S*C(1,5)/3.0;
01141 A(1,18) = S*(C(1,2)+C(1,5))/3.0;
01142 A(1,19) = -S*C(1,2)/3.0;
01143 A(1,20) = S*(C(1,1)+C(1,3))/3.0;
01144 A(1,21) = S*(C(1,4)+C(1,5))/3.0;
01145 A(1,22) = -S*C(1,2)/3.0;
01146 A(1,23) = -S*C(1,4)/3.0;
01147
01148 A(2,12) = -S*(C(2,0)+C(2,1))/3.0;
01149 A(2,13) = -S*C(2,4)/3.0;
01150 A(2,14) = -S*C(2,5)/3.0;
01151 A(2,15) = S*(C(2,2)+C(2,4))/3.0;
01152 A(2,16) = S*(-C(2,3)+C(2,0))/3.0;
01153 A(2,17) = -S*C(2,5)/3.0;
01154 A(2,18) = S*(C(2,2)+C(2,5))/3.0;
01155 A(2,19) = -S*C(2,2)/3.0;
01156 A(2,20) = S*(C(2,1)+C(2,3))/3.0;
01157 A(2,21) = S*(C(2,4)+C(2,5))/3.0;
01158 A(2,22) = -S*C(2,2)/3.0;
01159 A(2,23) = -S*C(2,4)/3.0;
01160
01161 A(3,12) = -S*(C(3,0)+C(3,1))/3.0;
01162 A(3,13) = -S*C(3,4)/3.0;
01163 A(3,14) = -S*C(3,5)/3.0;
01164 A(3,15) = S*(C(3,2)+C(3,4))/3.0;
01165 A(3,16) = S*(-C(3,3)+C(3,0))/3.0;
01166 A(3,17) = -S*C(3,5)/3.0;
01167 A(3,18) = S*(C(3,2)+C(3,5))/3.0;
01168 A(3,19) = -S*C(3,2)/3.0;
01169 A(3,20) = S*(C(3,1)+C(3,3))/3.0;
01170 A(3,21) = S*(C(3,4)+C(3,5))/3.0;
01171 A(3,22) = -S*C(3,2)/3.0;
01172 A(3,23) = -S*C(3,4)/3.0;
01173
01174 A(4,12) = -S*(C(4,0)+C(4,1))/3.0;
01175 A(4,13) = -S*C(4,4)/3.0;
01176 A(4,14) = -S*C(4,5)/3.0;
01177 A(4,15) = S*(C(4,2)+C(4,4))/3.0;
01178 A(4,16) = S*(-C(4,3)+C(4,0))/3.0;
01179 A(4,17) = -S*C(4,5)/3.0;
01180 A(4,18) = S*(C(4,2)+C(4,5))/3.0;
01181 A(4,19) = -S*C(4,2)/3.0;
01182 A(4,20) = S*(C(4,1)+C(4,3))/3.0;
01183 A(4,21) = S*(C(4,4)+C(4,5))/3.0;
01184 A(4,22) = -S*C(4,2)/3.0;
01185 A(4,23) = -S*C(4,4)/3.0;
01186
01187 A(5,12) = -S*(C(5,0)+C(5,1))/3.0;
01188 A(5,13) = -S*C(5,4)/3.0;
01189 A(5,14) = -S*C(5,5)/3.0;
01190 A(5,15) = S*(C(5,2)+C(5,4))/3.0;
01191 A(5,16) = S*(-C(5,3)+C(5,0))/3.0;
01192 A(5,17) = -S*C(5,5)/3.0;
01193 A(5,18) = S*(C(5,2)+C(5,5))/3.0;
01194 A(5,19) = -S*C(5,2)/3.0;
01195 A(5,20) = S*(C(5,1)+C(5,3))/3.0;
01196 A(5,21) = S*(C(5,4)+C(5,5))/3.0;
01197 A(5,22) = -S*C(5,2)/3.0;
01198 A(5,23) = -S*C(5,4)/3.0;
01199
01200 A(12,12) = S*(C(0,0)+C(0,1)+C(1,1))/12.0;
01201
01202 A(13,12) = S*(2.0*C(0,4)+C(1,4))/24.0;
01203 A(13,13) = S*C(4,4)/12.0;
01204
01205 A(14,12) = S*(C(0,5)+C(1,5))/24.0;
01206 A(14,13) = S*C(4,5)/24.0;
01207 A(14,14) = S*C(5,5)/12.0;
01208
01209 A(15,12) = -S*(C(0,2)+2.0*C(1,2)+C(0,4)+C(1,4))/24.0;
01210 A(15,13) = -S*(C(2,4)+C(4,4))/24.0;
01211 A(15,14) = -S*(C(2,5)+2.0*C(4,5))/24.0;
01212 A(15,15) = S*(C(2,2)+C(2,4)+C(4,4))/12.0;
01213
01214 A(16,12) = -S*(-C(0,3)-C(1,3)+2.0*C(0,0)+C(0,1))/24.0;
01215 A(16,13) = -S*(-C(3,4)+2.0*C(0,4))/24.0;
01216 A(16,14) = -S*(-2.0*C(3,5)+C(0,5))/24.0;
01217 A(16,15) = S*(-C(2,3)-2.0*C(3,4)+C(0,2)+C(0,4))/24.0;
01218 A(16,16) = S*(C(3,3)-C(0,3)+C(0,0))/12.0;
01219
01220 A(17,12) = S*(C(0,5)+2.0*C(1,5))/24.0;
01221 A(17,13) = S*C(4,5)/24.0;
01222 A(17,14) = S*C(5,5)/24.0;
01223 A(17,15) = -S*(2.0*C(2,5)+C(4,5))/24.0;
01224 A(17,16) = -S*(-C(3,5)+C(0,5))/24.0;
01225 A(17,17) = S*C(5,5)/12.0;
01226
01227 A(18,12) = -S*(2.0*C(0,2)+C(1,2)+C(0,5)+C(1,5))/24.0;
01228 A(18,13) = -S*(2.0*C(2,4)+C(4,5))/24.0;
01229 A(18,14) = -S*(C(2,5)+2.0*C(5,5))/24.0;
01230 A(18,15) = S*(C(2,2)+C(2,4)+C(2,5)+2.0*C(4,5))/24.0;
01231 A(18,16) = -S*(C(2,3)-2.0*C(0,2)+2.0*C(3,5)-C(0,5))/24.0;
01232 A(18,17) = -S*(C(2,5)+C(5,5))/24.0;
01233 A(18,18) = S*(C(2,2)+C(2,5)+C(5,5))/12.0;
01234
01235 A(19,12) = S*(C(0,2)+2.0*C(1,2))/24.0;
01236 A(19,13) = S*C(2,4)/24.0;
01237 A(19,14) = S*C(2,5)/24.0;
01238 A(19,15) = -S*(2.0*C(2,2)+C(2,4))/24.0;
01239 A(19,16) = S*(C(2,3)-C(0,2))/24.0;
01240 A(19,17) = S*C(2,5)/12.0;
01241 A(19,18) = -S*(C(2,2)+C(2,5))/24.0;
01242 A(19,19) = S*C(2,2)/12.0;
01243
01244 A(20,12) = -S*(C(0,1)+2.0*C(1,1)+C(0,3)+C(1,3))/24.0;
01245 A(20,13) = -S*(C(1,4)+C(3,4))/24.0;
01246 A(20,14) = -S*(C(1,5)+2.0*C(3,5))/24.0;
01247 A(20,15) = S*(2.0*C(1,2)+C(1,4)+C(2,3)+2.0*C(3,4))/24.0;
01248 A(20,16) = S*(-C(1,3)+C(0,1)-2.0*C(3,3)+C(0,3))/24.0;
01249 A(20,17) = -S*(2.0*C(1,5)+C(3,5))/24.0;
01250 A(20,18) = S*(C(1,2)+C(1,5)+C(2,3)+2.0*C(3,5))/24.0;
01251 A(20,19) = -S*(2.0*C(1,2)+C(2,3))/24.0;
01252 A(20,20) = S*(C(1,1)+C(1,3)+C(3,3))/12.0;
01253
01254 A(21,12) = -S*(2.0*C(0,4)+C(1,4)+C(0,5)+2.0*C(1,5))/24.0;
01255 A(21,13) = -S*(2.0*C(4,4)+C(4,5))/24.0;
01256 A(21,14) = -S*(C(4,5)+C(5,5))/24.0;
01257 A(21,15) = S*(C(2,4)+C(4,4)+2.0*C(2,5)+C(4,5))/24.0;
01258 A(21,16) = S*(-C(3,4)+2.0*C(0,4)-C(3,5)+C(0,5))/24.0;
01259 A(21,17) = -S*(C(4,5)+2.0*C(5,5))/24.0;
01260 A(21,18) = S*(2.0*C(2,4)+C(4,5)+C(2,5)+C(5,5))/24.0;
01261 A(21,19) = -S*(C(2,4)+2.0*C(2,5))/24.0;
01262 A(21,20) = S*(C(1,4)+C(3,4)+2.0*C(1,5)+C(3,5))/24.0;
01263 A(21,21) = S*(C(4,4)+C(4,5)+C(5,5))/12.0;
01264
01265 A(22,12) = S*(2.0*C(0,2)+C(1,2))/24.0;
01266 A(22,13) = S*C(2,4)/12.0;
01267 A(22,14) = S*C(2,5)/24.0;
01268 A(22,15) = -S*(C(2,2)+C(2,4))/24.0;
01269 A(22,16) = S*(C(2,3)-2.0*C(0,2))/24.0;
01270 A(22,17) = S*C(2,5)/24.0;
01271 A(22,18) = -S*(2.0*C(2,2)+C(2,5))/24.0;
01272 A(22,19) = S*C(2,2)/24.0;
01273 A(22,20) = -S*(C(1,2)+C(2,3))/24.0;
01274 A(22,21) = -S*(2.0*C(2,4)+C(2,5))/24.0;
01275 A(22,22) = S*C(2,2)/12.0;
01276
01277 A(23,12) = S*(C(0,4)+C(1,4))/24.0;
01278 A(23,13) = S*C(4,4)/24.0;
01279 A(23,14) = S*C(4,5)/12.0;
01280 A(23,15) = -S*(C(2,4)+2.0*C(4,4))/24.0;
01281 A(23,16) = -S*(-2.0*C(3,4)+C(0,4))/24.0;
01282 A(23,17) = S*C(4,5)/24.0;
01283 A(23,18) = -S*(C(2,4)+2.0*C(4,5))/24.0;
01284 A(23,19) = S*C(2,4)/24.0;
01285 A(23,20) = -S*(C(1,4)+2.0*C(3,4))/24.0;
01286 A(23,21) = -S*(C(4,4)+C(4,5))/24.0;
01287 A(23,22) = S*C(2,4)/24.0;
01288 A(23,23) = S*C(4,4)/12.0;
01289 break;
01290 case 1:
01291 A(0,12) = -S*(C(0,0)+C(0,1))/3.0;
01292 A(0,13) = -S*(C(0,3)+C(0,4))/3.0;
01293 A(0,14) = S*C(0,1)/3.0;
01294 A(0,15) = S*C(0,2)/3.0;
01295 A(0,16) = S*C(0,0)/3.0;
01296 A(0,17) = S*(-C(0,5)+C(0,3))/3.0;
01297 A(0,18) = S*C(0,2)/3.0;
01298 A(0,19) = -S*(C(0,0)+C(0,2))/3.0;
01299 A(0,20) = S*C(0,1)/3.0;
01300 A(0,21) = S*(C(0,4)+C(0,5))/3.0;
01301 A(0,22) = -S*(C(0,1)+C(0,2))/3.0;
01302 A(0,23) = S*C(0,0)/3.0;
01303
01304 A(1,12) = -S*(C(1,0)+C(1,1))/3.0;
01305 A(1,13) = -S*(C(1,3)+C(1,4))/3.0;
01306 A(1,14) = S*C(1,1)/3.0;
01307 A(1,15) = S*C(1,2)/3.0;
01308 A(1,16) = S*C(1,0)/3.0;
01309 A(1,17) = S*(-C(1,5)+C(1,3))/3.0;
01310 A(1,18) = S*C(1,2)/3.0;
01311 A(1,19) = -S*(C(1,0)+C(1,2))/3.0;
01312 A(1,20) = S*C(1,1)/3.0;
01313 A(1,21) = S*(C(1,4)+C(1,5))/3.0;
01314 A(1,22) = -S*(C(1,1)+C(1,2))/3.0;
01315 A(1,23) = S*C(1,0)/3.0;
01316
01317 A(2,12) = -S*(C(2,0)+C(2,1))/3.0;
01318 A(2,13) = -S*(C(2,3)+C(2,4))/3.0;
01319 A(2,14) = S*C(2,1)/3.0;
01320 A(2,15) = S*C(2,2)/3.0;
01321 A(2,16) = S*C(2,0)/3.0;
01322 A(2,17) = S*(-C(2,5)+C(2,3))/3.0;
01323 A(2,18) = S*C(2,2)/3.0;
01324 A(2,19) = -S*(C(2,0)+C(2,2))/3.0;
01325 A(2,20) = S*C(2,1)/3.0;
01326 A(2,21) = S*(C(2,4)+C(2,5))/3.0;
01327 A(2,22) = -S*(C(2,1)+C(2,2))/3.0;
01328 A(2,23) = S*C(2,0)/3.0;
01329
01330 A(3,12) = -S*(C(3,0)+C(3,1))/3.0;
01331 A(3,13) = -S*(C(3,3)+C(3,4))/3.0;
01332 A(3,14) = S*C(3,1)/3.0;
01333 A(3,15) = S*C(3,2)/3.0;
01334 A(3,16) = S*C(3,0)/3.0;
01335 A(3,17) = S*(-C(3,5)+C(3,3))/3.0;
01336 A(3,18) = S*C(3,2)/3.0;
01337 A(3,19) = -S*(C(3,0)+C(3,2))/3.0;
01338 A(3,20) = S*C(3,1)/3.0;
01339 A(3,21) = S*(C(3,4)+C(3,5))/3.0;
01340 A(3,22) = -S*(C(3,1)+C(3,2))/3.0;
01341 A(3,23) = S*C(3,0)/3.0;
01342
01343 A(4,12) = -S*(C(4,0)+C(4,1))/3.0;
01344 A(4,13) = -S*(C(4,3)+C(4,4))/3.0;
01345 A(4,14) = S*C(4,1)/3.0;
01346 A(4,15) = S*C(4,2)/3.0;
01347 A(4,16) = S*C(4,0)/3.0;
01348 A(4,17) = S*(-C(4,5)+C(4,3))/3.0;
01349 A(4,18) = S*C(4,2)/3.0;
01350 A(4,19) = -S*(C(4,0)+C(4,2))/3.0;
01351 A(4,20) = S*C(4,1)/3.0;
01352 A(4,21) = S*(C(4,4)+C(4,5))/3.0;
01353 A(4,22) = -S*(C(4,1)+C(4,2))/3.0;
01354 A(4,23) = S*C(4,0)/3.0;
01355
01356 A(5,12) = -S*(C(5,0)+C(5,1))/3.0;
01357 A(5,13) = -S*(C(5,3)+C(5,4))/3.0;
01358 A(5,14) = S*C(5,1)/3.0;
01359 A(5,15) = S*C(5,2)/3.0;
01360 A(5,16) = S*C(5,0)/3.0;
01361 A(5,17) = S*(-C(5,5)+C(5,3))/3.0;
01362 A(5,18) = S*C(5,2)/3.0;
01363 A(5,19) = -S*(C(5,0)+C(5,2))/3.0;
01364 A(5,20) = S*C(5,1)/3.0;
01365 A(5,21) = S*(C(5,4)+C(5,5))/3.0;
01366 A(5,22) = -S*(C(5,1)+C(5,2))/3.0;
01367 A(5,23) = S*C(5,0)/3.0;
01368
01369 A(12,12) = S*(C(0,0)+C(0,1)+C(1,1))/12.0;
01370
01371 A(13,12) = S*(C(0,3)+C(1,3)+2.0*C(0,4)+C(1,4))/24.0;
01372 A(13,13) = S*(C(3,3)+C(3,4)+C(4,4))/12.0;
01373
01374 A(14,12) = -S*(C(0,1)+C(1,1))/24.0;
01375 A(14,13) = -S*(2.0*C(1,3)+C(1,4))/24.0;
01376 A(14,14) = S*C(1,1)/12.0;
01377
01378 A(15,12) = -S*(C(0,2)+2.0*C(1,2))/24.0;
01379 A(15,13) = -S*(C(2,3)+C(2,4))/24.0;
01380 A(15,14) = S*C(1,2)/24.0;
01381 A(15,15) = S*C(2,2)/12.0;
01382
01383 A(16,12) = -S*(2.0*C(0,0)+C(0,1))/24.0;
01384 A(16,13) = -S*(C(0,3)+2.0*C(0,4))/24.0;
01385 A(16,14) = S*C(0,1)/24.0;
01386 A(16,15) = S*C(0,2)/24.0;
01387 A(16,16) = S*C(0,0)/12.0;
01388
01389 A(17,12) = -S*(-C(0,5)-2.0*C(1,5)+C(0,3)+C(1,3))/24.0;
01390 A(17,13) = -S*(-C(3,5)-C(4,5)+2.0*C(3,3)+C(3,4))/24.0;
01391 A(17,14) = S*(-C(1,5)+2.0*C(1,3))/24.0;
01392 A(17,15) = S*(-2.0*C(2,5)+C(2,3))/24.0;
01393 A(17,16) = S*(-C(0,5)+C(0,3))/24.0;
01394 A(17,17) = S*(C(5,5)-C(3,5)+C(3,3))/12.0;
01395
01396 A(18,12) = -S*(2.0*C(0,2)+C(1,2))/24.0;
01397 A(18,13) = -S*(C(2,3)+2.0*C(2,4))/24.0;
01398 A(18,14) = S*C(1,2)/24.0;
01399 A(18,15) = S*C(2,2)/24.0;
01400 A(18,16) = S*C(0,2)/12.0;
01401 A(18,17) = S*(-C(2,5)+C(2,3))/24.0;
01402 A(18,18) = S*C(2,2)/12.0;
01403
01404 A(19,12) = S*(C(0,0)+C(0,1)+C(0,2)+2.0*C(1,2))/24.0;
01405 A(19,13) = S*(2.0*C(0,3)+C(0,4)+C(2,3)+C(2,4))/24.0;
01406 A(19,14) = -S*(2.0*C(0,1)+C(1,2))/24.0;
01407 A(19,15) = -S*(C(0,2)+2.0*C(2,2))/24.0;
01408 A(19,16) = -S*(C(0,0)+C(0,2))/24.0;
01409 A(19,17) = -S*(-C(0,5)+2.0*C(0,3)-2.0*C(2,5)+C(2,3))/24.0;
01410 A(19,18) = -S*(C(0,2)+C(2,2))/24.0;
01411 A(19,19) = S*(C(0,0)+C(0,2)+C(2,2))/12.0;
01412
01413 A(20,12) = -S*(C(0,1)+2.0*C(1,1))/24.0;
01414 A(20,13) = -S*(C(1,3)+C(1,4))/24.0;
01415 A(20,14) = S*C(1,1)/24.0;
01416 A(20,15) = S*C(1,2)/12.0;
01417 A(20,16) = S*C(0,1)/24.0;
01418 A(20,17) = S*(-2.0*C(1,5)+C(1,3))/24.0;
01419 A(20,18) = S*C(1,2)/24.0;
01420 A(20,19) = -S*(C(0,1)+2.0*C(1,2))/24.0;
01421 A(20,20) = S*C(1,1)/12.0;
01422
01423 A(21,12) = -S*(2.0*C(0,4)+C(1,4)+C(0,5)+2.0*C(1,5))/24.0;
01424 A(21,13) = -S*(C(3,4)+2.0*C(4,4)+C(3,5)+C(4,5))/24.0;
01425 A(21,14) = S*(C(1,4)+C(1,5))/24.0;
01426 A(21,15) = S*(C(2,4)+2.0*C(2,5))/24.0;
01427 A(21,16) = S*(2.0*C(0,4)+C(0,5))/24.0;
01428 A(21,17) = S*(-C(4,5)+C(3,4)-2.0*C(5,5)+C(3,5))/24.0;
01429 A(21,18) = S*(2.0*C(2,4)+C(2,5))/24.0;
01430 A(21,19) = -S*(C(0,4)+C(2,4)+C(0,5)+2.0*C(2,5))/24.0;
01431 A(21,20) = S*(C(1,4)+2.0*C(1,5))/24.0;
01432 A(21,21) = S*(C(4,4)+C(4,5)+C(5,5))/12.0;
01433
01434 A(22,12) = S*(C(0,1)+C(1,1)+2.0*C(0,2)+C(1,2))/24.0;
01435 A(22,13) = S*(2.0*C(1,3)+C(1,4)+C(2,3)+2.0*C(2,4))/24.0;
01436 A(22,14) = -S*(2.0*C(1,1)+C(1,2))/24.0;
01437 A(22,15) = -S*(C(1,2)+C(2,2))/24.0;
01438 A(22,16) = -S*(C(0,1)+2.0*C(0,2))/24.0;
01439 A(22,17) = -S*(-C(1,5)+2.0*C(1,3)-C(2,5)+C(2,3))/24.0;
01440 A(22,18) = -S*(C(1,2)+2.0*C(2,2))/24.0;
01441 A(22,19) = S*(2.0*C(0,1)+C(1,2)+C(0,2)+C(2,2))/24.0;
01442 A(22,20) = -S*(C(1,1)+C(1,2))/24.0;
01443 A(22,21) = -S*(C(1,4)+C(1,5)+2.0*C(2,4)+C(2,5))/24.0;
01444 A(22,22) = S*(C(1,1)+C(1,2)+C(2,2))/12.0;
01445
01446 A(23,12) = -S*(C(0,0)+C(0,1))/24.0;
01447 A(23,13) = -S*(2.0*C(0,3)+C(0,4))/24.0;
01448 A(23,14) = S*C(0,1)/12.0;
01449 A(23,15) = S*C(0,2)/24.0;
01450 A(23,16) = S*C(0,0)/24.0;
01451 A(23,17) = S*(-C(0,5)+2.0*C(0,3))/24.0;
01452 A(23,18) = S*C(0,2)/24.0;
01453 A(23,19) = -S*(2.0*C(0,0)+C(0,2))/24.0;
01454 A(23,20) = S*C(0,1)/24.0;
01455 A(23,21) = S*(C(0,4)+C(0,5))/24.0;
01456 A(23,22) = -S*(2.0*C(0,1)+C(0,2))/24.0;
01457 A(23,23) = S*C(0,0)/12.0;
01458 break;
01459 case 2:
01460 A(0,12) = -S*C(0,0)/3.0;
01461 A(0,13) = -S*(C(0,3)+C(0,4))/3.0;
01462 A(0,14) = S*(-C(0,5)+C(0,1))/3.0;
01463 A(0,15) = S*C(0,4)/3.0;
01464 A(0,16) = S*(-C(0,3)+C(0,0))/3.0;
01465 A(0,17) = S*C(0,3)/3.0;
01466 A(0,18) = S*(C(0,2)+C(0,5))/3.0;
01467 A(0,19) = -S*C(0,0)/3.0;
01468 A(0,20) = S*C(0,3)/3.0;
01469 A(0,21) = S*C(0,4)/3.0;
01470 A(0,22) = -S*(C(0,1)+C(0,2))/3.0;
01471 A(0,23) = S*(-C(0,4)+C(0,0))/3.0;
01472
01473 A(1,12) = -S*C(1,0)/3.0;
01474 A(1,13) = -S*(C(1,3)+C(1,4))/3.0;
01475 A(1,14) = S*(-C(1,5)+C(1,1))/3.0;
01476 A(1,15) = S*C(1,4)/3.0;
01477 A(1,16) = S*(-C(1,3)+C(1,0))/3.0;
01478 A(1,17) = S*C(1,3)/3.0;
01479 A(1,18) = S*(C(1,2)+C(1,5))/3.0;
01480 A(1,19) = -S*C(1,0)/3.0;
01481 A(1,20) = S*C(1,3)/3.0;
01482 A(1,21) = S*C(1,4)/3.0;
01483 A(1,22) = -S*(C(1,1)+C(1,2))/3.0;
01484 A(1,23) = S*(-C(1,4)+C(1,0))/3.0;
01485
01486 A(2,12) = -S*C(2,0)/3.0;
01487 A(2,13) = -S*(C(2,3)+C(2,4))/3.0;
01488 A(2,14) = S*(-C(2,5)+C(2,1))/3.0;
01489 A(2,15) = S*C(2,4)/3.0;
01490 A(2,16) = S*(-C(2,3)+C(2,0))/3.0;
01491 A(2,17) = S*C(2,3)/3.0;
01492 A(2,18) = S*(C(2,2)+C(2,5))/3.0;
01493 A(2,19) = -S*C(2,0)/3.0;
01494 A(2,20) = S*C(2,3)/3.0;
01495 A(2,21) = S*C(2,4)/3.0;
01496 A(2,22) = -S*(C(2,1)+C(2,2))/3.0;
01497 A(2,23) = S*(-C(2,4)+C(2,0))/3.0;
01498
01499 A(3,12) = -S*C(3,0)/3.0;
01500 A(3,13) = -S*(C(3,3)+C(3,4))/3.0;
01501 A(3,14) = S*(-C(3,5)+C(3,1))/3.0;
01502 A(3,15) = S*C(3,4)/3.0;
01503 A(3,16) = S*(-C(3,3)+C(3,0))/3.0;
01504 A(3,17) = S*C(3,3)/3.0;
01505 A(3,18) = S*(C(3,2)+C(3,5))/3.0;
01506 A(3,19) = -S*C(3,0)/3.0;
01507 A(3,20) = S*C(3,3)/3.0;
01508 A(3,21) = S*C(3,4)/3.0;
01509 A(3,22) = -S*(C(3,1)+C(3,2))/3.0;
01510 A(3,23) = S*(-C(3,4)+C(3,0))/3.0;
01511
01512 A(4,12) = -S*C(4,0)/3.0;
01513 A(4,13) = -S*(C(4,3)+C(4,4))/3.0;
01514 A(4,14) = S*(-C(4,5)+C(4,1))/3.0;
01515 A(4,15) = S*C(4,4)/3.0;
01516 A(4,16) = S*(-C(4,3)+C(4,0))/3.0;
01517 A(4,17) = S*C(4,3)/3.0;
01518 A(4,18) = S*(C(4,2)+C(4,5))/3.0;
01519 A(4,19) = -S*C(4,0)/3.0;
01520 A(4,20) = S*C(4,3)/3.0;
01521 A(4,21) = S*C(4,4)/3.0;
01522 A(4,22) = -S*(C(4,1)+C(4,2))/3.0;
01523 A(4,23) = S*(-C(4,4)+C(4,0))/3.0;
01524
01525 A(5,12) = -S*C(5,0)/3.0;
01526 A(5,13) = -S*(C(5,3)+C(5,4))/3.0;
01527 A(5,14) = S*(-C(5,5)+C(5,1))/3.0;
01528 A(5,15) = S*C(5,4)/3.0;
01529 A(5,16) = S*(-C(5,3)+C(5,0))/3.0;
01530 A(5,17) = S*C(5,3)/3.0;
01531 A(5,18) = S*(C(5,2)+C(5,5))/3.0;
01532 A(5,19) = -S*C(5,0)/3.0;
01533 A(5,20) = S*C(5,3)/3.0;
01534 A(5,21) = S*C(5,4)/3.0;
01535 A(5,22) = -S*(C(5,1)+C(5,2))/3.0;
01536 A(5,23) = S*(-C(5,4)+C(5,0))/3.0;
01537
01538 A(12,12) = S*C(0,0)/12.0;
01539
01540 A(13,12) = S*(C(0,3)+2.0*C(0,4))/24.0;
01541 A(13,13) = S*(C(3,3)+C(3,4)+C(4,4))/12.0;
01542
01543 A(14,12) = -S*(-C(0,5)+C(0,1))/24.0;
01544 A(14,13) = -S*(-C(3,5)-C(4,5)+2.0*C(1,3)+C(1,4))/24.0;
01545 A(14,14) = S*(C(5,5)-C(1,5)+C(1,1))/12.0;
01546
01547 A(15,12) = -S*C(0,4)/24.0;
01548 A(15,13) = -S*(C(3,4)+C(4,4))/24.0;
01549 A(15,14) = S*(-2.0*C(4,5)+C(1,4))/24.0;
01550 A(15,15) = S*C(4,4)/12.0;
01551
01552 A(16,12) = -S*(-C(0,3)+2.0*C(0,0))/24.0;
01553 A(16,13) = -S*(-C(3,3)-C(3,4)+C(0,3)+2.0*C(0,4))/24.0;
01554 A(16,14) = S*(2.0*C(3,5)-C(1,3)-C(0,5)+C(0,1))/24.0;
01555 A(16,15) = S*(-2.0*C(3,4)+C(0,4))/24.0;
01556 A(16,16) = S*(C(3,3)-C(0,3)+C(0,0))/12.0;
01557
01558 A(17,12) = -S*C(0,3)/24.0;
01559 A(17,13) = -S*(2.0*C(3,3)+C(3,4))/24.0;
01560 A(17,14) = S*(-C(3,5)+2.0*C(1,3))/24.0;
01561 A(17,15) = S*C(3,4)/24.0;
01562 A(17,16) = S*(-C(3,3)+C(0,3))/24.0;
01563 A(17,17) = S*C(3,3)/12.0;
01564
01565 A(18,12) = -S*(2.0*C(0,2)+C(0,5))/24.0;
01566 A(18,13) = -S*(C(2,3)+2.0*C(2,4)+C(3,5)+C(4,5))/24.0;
01567 A(18,14) = S*(-C(2,5)+C(1,2)-2.0*C(5,5)+C(1,5))/24.0;
01568 A(18,15) = S*(C(2,4)+2.0*C(4,5))/24.0;
01569 A(18,16) = -S*(C(2,3)-2.0*C(0,2)+2.0*C(3,5)-C(0,5))/24.0;
01570 A(18,17) = S*(C(2,3)+C(3,5))/24.0;
01571 A(18,18) = S*(C(2,2)+C(2,5)+C(5,5))/12.0;
01572
01573 A(19,12) = S*C(0,0)/24.0;
01574 A(19,13) = S*(2.0*C(0,3)+C(0,4))/24.0;
01575 A(19,14) = -S*(-C(0,5)+2.0*C(0,1))/24.0;
01576 A(19,15) = -S*C(0,4)/24.0;
01577 A(19,16) = -S*(-C(0,3)+C(0,0))/24.0;
01578 A(19,17) = -S*C(0,3)/12.0;
01579 A(19,18) = -S*(C(0,2)+C(0,5))/24.0;
01580 A(19,19) = S*C(0,0)/12.0;
01581
01582 A(20,12) = -S*C(0,3)/24.0;
01583 A(20,13) = -S*(C(3,3)+C(3,4))/24.0;
01584 A(20,14) = S*(-2.0*C(3,5)+C(1,3))/24.0;
01585 A(20,15) = S*C(3,4)/12.0;
01586 A(20,16) = S*(-2.0*C(3,3)+C(0,3))/24.0;
01587 A(20,17) = S*C(3,3)/24.0;
01588 A(20,18) = S*(C(2,3)+2.0*C(3,5))/24.0;
01589 A(20,19) = -S*C(0,3)/24.0;
01590 A(20,20) = S*C(3,3)/12.0;
01591
01592 A(21,12) = -S*C(0,4)/12.0;
01593 A(21,13) = -S*(C(3,4)+2.0*C(4,4))/24.0;
01594 A(21,14) = S*(-C(4,5)+C(1,4))/24.0;
01595 A(21,15) = S*C(4,4)/24.0;
01596 A(21,16) = S*(-C(3,4)+2.0*C(0,4))/24.0;
01597 A(21,17) = S*C(3,4)/24.0;
01598 A(21,18) = S*(2.0*C(2,4)+C(4,5))/24.0;
01599 A(21,19) = -S*C(0,4)/24.0;
01600 A(21,20) = S*C(3,4)/24.0;
01601 A(21,21) = S*C(4,4)/12.0;
01602
01603 A(22,12) = S*(C(0,1)+2.0*C(0,2))/24.0;
01604 A(22,13) = S*(2.0*C(1,3)+C(1,4)+C(2,3)+2.0*C(2,4))/24.0;
01605 A(22,14) = -S*(-C(1,5)+2.0*C(1,1)-C(2,5)+C(1,2))/24.0;
01606 A(22,15) = -S*(C(1,4)+C(2,4))/24.0;
01607 A(22,16) = -S*(-C(1,3)+C(0,1)-C(2,3)+2.0*C(0,2))/24.0;
01608 A(22,17) = -S*(2.0*C(1,3)+C(2,3))/24.0;
01609 A(22,18) = -S*(C(1,2)+C(1,5)+2.0*C(2,2)+C(2,5))/24.0;
01610 A(22,19) = S*(2.0*C(0,1)+C(0,2))/24.0;
01611 A(22,20) = -S*(C(1,3)+C(2,3))/24.0;
01612 A(22,21) = -S*(C(1,4)+2.0*C(2,4))/24.0;
01613 A(22,22) = S*(C(1,1)+C(1,2)+C(2,2))/12.0;
01614
01615 A(23,12) = -S*(-C(0,4)+C(0,0))/24.0;
01616 A(23,13) = -S*(-C(3,4)-C(4,4)+2.0*C(0,3)+C(0,4))/24.0;
01617 A(23,14) = S*(2.0*C(4,5)-C(1,4)-C(0,5)+2.0*C(0,1))/24.0;
01618 A(23,15) = S*(-2.0*C(4,4)+C(0,4))/24.0;
01619 A(23,16) = S*(2.0*C(3,4)-C(0,4)-C(0,3)+C(0,0))/24.0;
01620 A(23,17) = S*(-C(3,4)+2.0*C(0,3))/24.0;
01621 A(23,18) = -S*(C(2,4)+2.0*C(4,5)-C(0,2)-C(0,5))/24.0;
01622 A(23,19) = -S*(-C(0,4)+2.0*C(0,0))/24.0;
01623 A(23,20) = S*(-2.0*C(3,4)+C(0,3))/24.0;
01624 A(23,21) = S*(-C(4,4)+C(0,4))/24.0;
01625 A(23,22) = -S*(-C(1,4)-C(2,4)+2.0*C(0,1)+C(0,2))/24.0;
01626 A(23,23) = S*(C(4,4)-C(0,4)+C(0,0))/12.0;
01627 break;
01628 case 3:
01629 A(0,12) = -S*C(0,1)/3.0;
01630 A(0,13) = -S*C(0,3)/3.0;
01631 A(0,14) = S*(-C(0,5)+C(0,1))/3.0;
01632 A(0,15) = S*(C(0,2)+C(0,4))/3.0;
01633 A(0,16) = -S*C(0,3)/3.0;
01634 A(0,17) = S*(-C(0,5)+C(0,3))/3.0;
01635 A(0,18) = S*C(0,5)/3.0;
01636 A(0,19) = -S*(C(0,0)+C(0,2))/3.0;
01637 A(0,20) = S*(C(0,1)+C(0,3))/3.0;
01638 A(0,21) = S*C(0,5)/3.0;
01639 A(0,22) = -S*C(0,1)/3.0;
01640 A(0,23) = S*(-C(0,4)+C(0,0))/3.0;
01641
01642 A(1,12) = -S*C(1,1)/3.0;
01643 A(1,13) = -S*C(1,3)/3.0;
01644 A(1,14) = S*(-C(1,5)+C(1,1))/3.0;
01645 A(1,15) = S*(C(1,2)+C(1,4))/3.0;
01646 A(1,16) = -S*C(1,3)/3.0;
01647 A(1,17) = S*(-C(1,5)+C(1,3))/3.0;
01648 A(1,18) = S*C(1,5)/3.0;
01649 A(1,19) = -S*(C(1,0)+C(1,2))/3.0;
01650 A(1,20) = S*(C(1,1)+C(1,3))/3.0;
01651 A(1,21) = S*C(1,5)/3.0;
01652 A(1,22) = -S*C(1,1)/3.0;
01653 A(1,23) = S*(-C(1,4)+C(1,0))/3.0;
01654
01655 A(2,12) = -S*C(2,1)/3.0;
01656 A(2,13) = -S*C(2,3)/3.0;
01657 A(2,14) = S*(-C(2,5)+C(2,1))/3.0;
01658 A(2,15) = S*(C(2,2)+C(2,4))/3.0;
01659 A(2,16) = -S*C(2,3)/3.0;
01660 A(2,17) = S*(-C(2,5)+C(2,3))/3.0;
01661 A(2,18) = S*C(2,5)/3.0;
01662 A(2,19) = -S*(C(2,0)+C(2,2))/3.0;
01663 A(2,20) = S*(C(2,1)+C(2,3))/3.0;
01664 A(2,21) = S*C(2,5)/3.0;
01665 A(2,22) = -S*C(2,1)/3.0;
01666 A(2,23) = S*(-C(2,4)+C(2,0))/3.0;
01667
01668 A(3,12) = -S*C(3,1)/3.0;
01669 A(3,13) = -S*C(3,3)/3.0;
01670 A(3,14) = S*(-C(3,5)+C(3,1))/3.0;
01671 A(3,15) = S*(C(3,2)+C(3,4))/3.0;
01672 A(3,16) = -S*C(3,3)/3.0;
01673 A(3,17) = S*(-C(3,5)+C(3,3))/3.0;
01674 A(3,18) = S*C(3,5)/3.0;
01675 A(3,19) = -S*(C(3,0)+C(3,2))/3.0;
01676 A(3,20) = S*(C(3,1)+C(3,3))/3.0;
01677 A(3,21) = S*C(3,5)/3.0;
01678 A(3,22) = -S*C(3,1)/3.0;
01679 A(3,23) = S*(-C(3,4)+C(3,0))/3.0;
01680
01681 A(4,12) = -S*C(4,1)/3.0;
01682 A(4,13) = -S*C(4,3)/3.0;
01683 A(4,14) = S*(-C(4,5)+C(4,1))/3.0;
01684 A(4,15) = S*(C(4,2)+C(4,4))/3.0;
01685 A(4,16) = -S*C(4,3)/3.0;
01686 A(4,17) = S*(-C(4,5)+C(4,3))/3.0;
01687 A(4,18) = S*C(4,5)/3.0;
01688 A(4,19) = -S*(C(4,0)+C(4,2))/3.0;
01689 A(4,20) = S*(C(4,1)+C(4,3))/3.0;
01690 A(4,21) = S*C(4,5)/3.0;
01691 A(4,22) = -S*C(4,1)/3.0;
01692 A(4,23) = S*(-C(4,4)+C(4,0))/3.0;
01693
01694 A(5,12) = -S*C(5,1)/3.0;
01695 A(5,13) = -S*C(5,3)/3.0;
01696 A(5,14) = S*(-C(5,5)+C(5,1))/3.0;
01697 A(5,15) = S*(C(5,2)+C(5,4))/3.0;
01698 A(5,16) = -S*C(5,3)/3.0;
01699 A(5,17) = S*(-C(5,5)+C(5,3))/3.0;
01700 A(5,18) = S*C(5,5)/3.0;
01701 A(5,19) = -S*(C(5,0)+C(5,2))/3.0;
01702 A(5,20) = S*(C(5,1)+C(5,3))/3.0;
01703 A(5,21) = S*C(5,5)/3.0;
01704 A(5,22) = -S*C(5,1)/3.0;
01705 A(5,23) = S*(-C(5,4)+C(5,0))/3.0;
01706
01707 A(12,12) = S*C(1,1)/12.0;
01708
01709 A(13,12) = S*C(1,3)/24.0;
01710 A(13,13) = S*C(3,3)/12.0;
01711
01712 A(14,12) = -S*(-C(1,5)+C(1,1))/24.0;
01713 A(14,13) = -S*(-C(3,5)+2.0*C(1,3))/24.0;
01714 A(14,14) = S*(C(5,5)-C(1,5)+C(1,1))/12.0;
01715
01716 A(15,12) = -S*(2.0*C(1,2)+C(1,4))/24.0;
01717 A(15,13) = -S*(C(2,3)+C(3,4))/24.0;
01718 A(15,14) = S*(-C(2,5)-2.0*C(4,5)+C(1,2)+C(1,4))/24.0;
01719 A(15,15) = S*(C(2,2)+C(2,4)+C(4,4))/12.0;
01720
01721 A(16,12) = S*C(1,3)/24.0;
01722 A(16,13) = S*C(3,3)/24.0;
01723 A(16,14) = -S*(-2.0*C(3,5)+C(1,3))/24.0;
01724 A(16,15) = -S*(C(2,3)+2.0*C(3,4))/24.0;
01725 A(16,16) = S*C(3,3)/12.0;
01726
01727 A(17,12) = -S*(-2.0*C(1,5)+C(1,3))/24.0;
01728 A(17,13) = -S*(-C(3,5)+2.0*C(3,3))/24.0;
01729 A(17,14) = S*(C(5,5)-C(1,5)-C(3,5)+2.0*C(1,3))/24.0;
01730 A(17,15) = S*(-2.0*C(2,5)-C(4,5)+C(2,3)+C(3,4))/24.0;
01731 A(17,16) = -S*(-C(3,5)+C(3,3))/24.0;
01732 A(17,17) = S*(C(5,5)-C(3,5)+C(3,3))/12.0;
01733
01734 A(18,12) = -S*C(1,5)/24.0;
01735 A(18,13) = -S*C(3,5)/24.0;
01736 A(18,14) = S*(-2.0*C(5,5)+C(1,5))/24.0;
01737 A(18,15) = S*(C(2,5)+2.0*C(4,5))/24.0;
01738 A(18,16) = -S*C(3,5)/12.0;
01739 A(18,17) = S*(-C(5,5)+C(3,5))/24.0;
01740 A(18,18) = S*C(5,5)/12.0;
01741
01742 A(19,12) = S*(C(0,1)+2.0*C(1,2))/24.0;
01743 A(19,13) = S*(2.0*C(0,3)+C(2,3))/24.0;
01744 A(19,14) = -S*(-C(0,5)+2.0*C(0,1)-C(2,5)+C(1,2))/24.0;
01745 A(19,15) = -S*(C(0,2)+C(0,4)+2.0*C(2,2)+C(2,4))/24.0;
01746 A(19,16) = S*(C(0,3)+C(2,3))/24.0;
01747 A(19,17) = -S*(-C(0,5)+2.0*C(0,3)-2.0*C(2,5)+C(2,3))/24.0;
01748 A(19,18) = -S*(C(0,5)+C(2,5))/24.0;
01749 A(19,19) = S*(C(0,0)+C(0,2)+C(2,2))/12.0;
01750
01751 A(20,12) = -S*(2.0*C(1,1)+C(1,3))/24.0;
01752 A(20,13) = -S*(C(1,3)+C(3,3))/24.0;
01753 A(20,14) = S*(-C(1,5)+C(1,1)-2.0*C(3,5)+C(1,3))/24.0;
01754 A(20,15) = S*(2.0*C(1,2)+C(1,4)+C(2,3)+2.0*C(3,4))/24.0;
01755 A(20,16) = -S*(C(1,3)+2.0*C(3,3))/24.0;
01756 A(20,17) = S*(-2.0*C(1,5)+C(1,3)-C(3,5)+C(3,3))/24.0;
01757 A(20,18) = S*(C(1,5)+2.0*C(3,5))/24.0;
01758 A(20,19) = -S*(C(0,1)+2.0*C(1,2)+C(0,3)+C(2,3))/24.0;
01759 A(20,20) = S*(C(1,1)+C(1,3)+C(3,3))/12.0;
01760
01761 A(21,12) = -S*C(1,5)/12.0;
01762 A(21,13) = -S*C(3,5)/24.0;
01763 A(21,14) = S*(-C(5,5)+C(1,5))/24.0;
01764 A(21,15) = S*(2.0*C(2,5)+C(4,5))/24.0;
01765 A(21,16) = -S*C(3,5)/24.0;
01766 A(21,17) = S*(-2.0*C(5,5)+C(3,5))/24.0;
01767 A(21,18) = S*C(5,5)/24.0;
01768 A(21,19) = -S*(C(0,5)+2.0*C(2,5))/24.0;
01769 A(21,20) = S*(2.0*C(1,5)+C(3,5))/24.0;
01770 A(21,21) = S*C(5,5)/12.0;
01771
01772 A(22,12) = S*C(1,1)/24.0;
01773 A(22,13) = S*C(1,3)/12.0;
01774 A(22,14) = -S*(-C(1,5)+2.0*C(1,1))/24.0;
01775 A(22,15) = -S*(C(1,2)+C(1,4))/24.0;
01776 A(22,16) = S*C(1,3)/24.0;
01777 A(22,17) = -S*(-C(1,5)+2.0*C(1,3))/24.0;
01778 A(22,18) = -S*C(1,5)/24.0;
01779 A(22,19) = S*(2.0*C(0,1)+C(1,2))/24.0;
01780 A(22,20) = -S*(C(1,1)+C(1,3))/24.0;
01781 A(22,21) = -S*C(1,5)/24.0;
01782 A(22,22) = S*C(1,1)/12.0;
01783
01784 A(23,12) = -S*(-C(1,4)+C(0,1))/24.0;
01785 A(23,13) = -S*(-C(3,4)+2.0*C(0,3))/24.0;
01786 A(23,14) = S*(2.0*C(4,5)-C(1,4)-C(0,5)+2.0*C(0,1))/24.0;
01787 A(23,15) = S*(-C(2,4)-2.0*C(4,4)+C(0,2)+C(0,4))/24.0;
01788 A(23,16) = -S*(-2.0*C(3,4)+C(0,3))/24.0;
01789 A(23,17) = S*(C(4,5)-C(3,4)-C(0,5)+2.0*C(0,3))/24.0;
01790 A(23,18) = S*(-2.0*C(4,5)+C(0,5))/24.0;
01791 A(23,19) = -S*(-C(0,4)-C(2,4)+2.0*C(0,0)+C(0,2))/24.0;
01792 A(23,20) = S*(-C(1,4)-2.0*C(3,4)+C(0,1)+C(0,3))/24.0;
01793 A(23,21) = S*(-C(4,5)+C(0,5))/24.0;
01794 A(23,22) = -S*(-C(1,4)+2.0*C(0,1))/24.0;
01795 A(23,23) = S*(C(4,4)-C(0,4)+C(0,0))/12.0;
01796 break;
01797 }
01798 }
01799
01800
01801 Vector<double> ddofs(dofs._n);
01802 ddofs.inject(dofs);
01803 for (int k = 0; k < 6; ++ k) {
01804 if (!tet->get_edge_orientation(k))
01805 ddofs(k) = -ddofs(k);
01806 }
01807
01808
01809 double I = 0.0;
01810 for (int i = 0; i < 6; ++ i) {
01811 for (int j = 0; j < i; ++ j) {
01812 I += 2*ddofs(i)*ddofs(j)*A(i,j);
01813 }
01814 I += ddofs(i)*ddofs(i)*A(i,i);
01815 }
01816
01817 if (get_order() == 2) {
01818 for (int i = 0; i < 6; ++ i)
01819 for (int j = 12; j < 24; ++ j)
01820 I += 2*ddofs(i)*ddofs(j)*A(i,j);
01821 for (int i = 12; i < 24; ++ i) {
01822 for (int j = 12; j < i; ++ j) {
01823 I += 2*ddofs(i)*ddofs(j)*A(i,j);
01824 }
01825 I += ddofs(i)*ddofs(i)*A(i,i);
01826 }
01827 }
01828
01829 return I;
01830 }