65 "order in 'a' direction is higher than order "
68 "order in 'a' direction is higher than order "
71 "order in 'b' direction is higher than order "
107 const Array<OneD, const NekDouble>& inarray,
108 Array<OneD, NekDouble>& out_dxi0,
109 Array<OneD, NekDouble>& out_dxi1,
110 Array<OneD, NekDouble>& out_dxi2 )
112 int Q0 =
m_base[0]->GetNumPoints();
113 int Q1 =
m_base[1]->GetNumPoints();
114 int Q2 =
m_base[2]->GetNumPoints();
118 Array<OneD, NekDouble> out_dEta0(3*Qtot,0.0);
119 Array<OneD, NekDouble> out_dEta1 = out_dEta0 + Qtot;
120 Array<OneD, NekDouble> out_dEta2 = out_dEta1 + Qtot;
122 bool Do_2 = (out_dxi2.num_elements() > 0)?
true:
false;
123 bool Do_1 = (out_dxi1.num_elements() > 0)?
true:
false;
139 Array<OneD, const NekDouble> eta_0, eta_1, eta_2;
140 eta_0 =
m_base[0]->GetZ();
141 eta_1 =
m_base[1]->GetZ();
142 eta_2 =
m_base[2]->GetZ();
148 for(
int k=0; k< Q2; ++k)
150 for(
int j=0; j<Q1; ++j,dEta0+=Q0)
152 Vmath::Smul(Q0,2.0/(1.0-eta_1[j]),dEta0,1,dEta0,1);
154 fac = 1.0/(1.0-eta_2[k]);
155 Vmath::Smul(Q0*Q1,fac,&out_dEta0[0]+k*Q0*Q1,1,&out_dEta0[0]+k*Q0*Q1,1);
158 if (out_dxi0.num_elements() > 0)
166 Array<OneD, NekDouble> Fac0(Q0);
171 for(
int k = 0; k < Q1*Q2; ++k)
173 Vmath::Vmul(Q0,&Fac0[0],1,&out_dEta0[0]+k*Q0,1,&out_dEta0[0]+k*Q0,1);
176 for(
int k = 0; k < Q2; ++k)
178 Vmath::Smul(Q0*Q1,2.0/(1.0-eta_2[k]),&out_dEta1[0]+k*Q0*Q1,1,
179 &out_dEta1[0]+k*Q0*Q1,1);
186 Vmath::Vadd(Qtot,out_dEta0,1,out_dEta1,1,out_dxi1,1);
194 for(
int k=0; k< Q2; ++k)
196 for(
int j=0; j<Q1; ++j,dEta1+=Q0)
198 Vmath::Smul(Q0,(1.0+eta_1[j])/2.0,dEta1,1,dEta1,1);
205 Vmath::Vadd(Qtot,out_dEta0,1,out_dEta1,1,out_dxi2,1);
206 Vmath::Vadd(Qtot,out_dEta2,1,out_dxi2 ,1,out_dxi2,1);
220 const Array<OneD, const NekDouble>& inarray,
221 Array<OneD, NekDouble>& outarray)
245 ASSERTL1(
false,
"input dir is out of range");
252 const Array<OneD, const NekDouble>& inarray,
253 Array<OneD, NekDouble>& out_d0,
254 Array<OneD, NekDouble>& out_d1,
255 Array<OneD, NekDouble>& out_d2)
262 const Array<OneD, const NekDouble>& inarray,
263 Array<OneD, NekDouble>& outarray)
294 const Array<OneD, const NekDouble>& inarray,
295 Array<OneD, NekDouble>& outarray)
299 "Basis[1] is not a general tensor type");
303 "Basis[2] is not a general tensor type");
306 &&
m_base[2]->Collocation())
311 inarray, 1, outarray, 1);
324 const Array<OneD, const NekDouble>& inarray,
325 Array<OneD, NekDouble>& outarray)
327 int nquad1 =
m_base[1]->GetNumPoints();
328 int nquad2 =
m_base[2]->GetNumPoints();
329 int order0 =
m_base[0]->GetNumModes();
330 int order1 =
m_base[1]->GetNumModes();
332 Array<OneD, NekDouble> wsp(nquad2*order0*order1*(order1+1)/2+
333 nquad2*nquad1*order0);
338 inarray,outarray,wsp,
357 const Array<OneD, const NekDouble>& base0,
358 const Array<OneD, const NekDouble>& base1,
359 const Array<OneD, const NekDouble>& base2,
360 const Array<OneD, const NekDouble>& inarray,
361 Array<OneD, NekDouble>& outarray,
362 Array<OneD, NekDouble>& wsp,
363 bool doCheckCollDir0,
364 bool doCheckCollDir1,
365 bool doCheckCollDir2)
367 int nquad0 =
m_base[0]->GetNumPoints();
368 int nquad1 =
m_base[1]->GetNumPoints();
369 int nquad2 =
m_base[2]->GetNumPoints();
371 int order0 =
m_base[0]->GetNumModes();
372 int order1 =
m_base[1]->GetNumModes();
373 int order2 =
m_base[2]->GetNumModes();
375 Array<OneD, NekDouble > tmp = wsp;
376 Array<OneD, NekDouble > tmp1 = tmp + nquad2*order0*order1*(order1+1)/2;
381 int i, j, mode, mode1, cnt;
384 mode = mode1 = cnt = 0;
385 for(i = 0; i < order0; ++i)
387 for(j = 0; j < order1-i; ++j, ++cnt)
389 Blas::Dgemv(
'N', nquad2, order2-i-j,
390 1.0, base2.get()+mode*nquad2, nquad2,
391 inarray.get()+mode1, 1,
392 0.0, tmp.get()+cnt*nquad2, 1);
397 for(j = order1-i; j < order2-i; ++j)
409 Blas::Daxpy(nquad2,inarray[1],base2.get()+nquad2,1,
413 Blas::Daxpy(nquad2,inarray[1],base2.get()+nquad2,1,
414 &tmp[0]+order1*nquad2,1);
419 for(i = 0; i < order0; ++i)
421 Blas::Dgemm(
'N',
'T', nquad1, nquad2, order1-i,
422 1.0, base1.get()+mode*nquad1, nquad1,
423 tmp.get()+mode*nquad2, nquad2,
424 0.0, tmp1.get()+i*nquad1*nquad2, nquad1);
435 for(i = 0; i < nquad2; ++i)
437 Blas::Daxpy(nquad1,tmp[nquad2+i], base1.get()+nquad1,1,
438 &tmp1[nquad1*nquad2]+i*nquad1,1);
443 Blas::Dgemm(
'N',
'T', nquad0, nquad1*nquad2, order0,
444 1.0, base0.get(), nquad0,
445 tmp1.get(), nquad1*nquad2,
446 0.0, outarray.get(), nquad0);
456 Array<OneD, NekDouble> &outarray)
507 const Array<OneD, const NekDouble>& inarray,
508 Array<OneD, NekDouble> & outarray)
512 "Basis[1] is not a general tensor type");
516 "Basis[2] is not a general tensor type");
518 if(
m_base[0]->Collocation() &&
m_base[1]->Collocation())
530 const Array<OneD, const NekDouble>& inarray,
531 Array<OneD, NekDouble>& outarray)
537 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
538 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
549 const Array<OneD, const NekDouble>& inarray,
550 Array<OneD, NekDouble>& outarray)
552 int nquad0 =
m_base[0]->GetNumPoints();
553 int nquad1 =
m_base[1]->GetNumPoints();
554 int nquad2 =
m_base[2]->GetNumPoints();
555 int order0 =
m_base[0]->GetNumModes();
556 int order1 =
m_base[1]->GetNumModes();
558 Array<OneD, NekDouble> tmp (nquad0*nquad1*nquad2);
559 Array<OneD, NekDouble> wsp (nquad1*nquad2*order0 +
560 nquad2*order0*(order1+1)/2);
568 tmp, outarray, wsp,
true,
true,
true);
573 const Array<OneD, const NekDouble>& base0,
574 const Array<OneD, const NekDouble>& base1,
575 const Array<OneD, const NekDouble>& base2,
576 const Array<OneD, const NekDouble>& inarray,
577 Array<OneD, NekDouble> &outarray,
578 Array<OneD, NekDouble> &wsp,
579 bool doCheckCollDir0,
580 bool doCheckCollDir1,
581 bool doCheckCollDir2)
583 int nquad0 =
m_base[0]->GetNumPoints();
584 int nquad1 =
m_base[1]->GetNumPoints();
585 int nquad2 =
m_base[2]->GetNumPoints();
587 int order0 =
m_base[0]->GetNumModes();
588 int order1 =
m_base[1]->GetNumModes();
589 int order2 =
m_base[2]->GetNumModes();
591 Array<OneD, NekDouble > tmp1 = wsp;
592 Array<OneD, NekDouble > tmp2 = wsp + nquad1*nquad2*order0;
594 int i,j, mode,mode1, cnt;
597 Blas::Dgemm(
'T',
'N', nquad1*nquad2, order0, nquad0,
598 1.0, inarray.get(), nquad0,
600 0.0, tmp1.get(), nquad1*nquad2);
603 for(mode=i=0; i < order0; ++i)
605 Blas::Dgemm(
'T',
'N', nquad2, order1-i, nquad1,
606 1.0, tmp1.get()+i*nquad1*nquad2, nquad1,
607 base1.get()+mode*nquad1, nquad1,
608 0.0, tmp2.get()+mode*nquad2, nquad2);
617 Blas::Dgemv(
'T', nquad1, nquad2,
618 1.0, tmp1.get()+nquad1*nquad2, nquad1,
619 base1.get()+nquad1, 1,
620 1.0, tmp2.get()+nquad2, 1);
624 mode = mode1 = cnt = 0;
625 for(i = 0; i < order0; ++i)
627 for(j = 0; j < order1-i; ++j, ++cnt)
629 Blas::Dgemv(
'T', nquad2, order2-i-j,
630 1.0, base2.get()+mode*nquad2, nquad2,
631 tmp2.get()+cnt*nquad2, 1,
632 0.0, outarray.get()+mode1, 1);
637 for(j = order1-i; j < order2-i; ++j)
648 outarray[1] +=
Blas::Ddot(nquad2,base2.get()+nquad2,1,
652 outarray[1] +=
Blas::Ddot(nquad2,base2.get()+nquad2,1,
653 &tmp2[nquad2*order1],1);
660 const Array<OneD, const NekDouble>& inarray,
661 Array<OneD, NekDouble>& outarray)
669 const Array<OneD, const NekDouble>& inarray,
670 Array<OneD, NekDouble>& outarray)
672 ASSERTL0((dir==0)||(dir==1)||(dir==2),
"input dir is out of range");
693 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
694 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
706 const Array<OneD, const NekDouble>& inarray,
707 Array<OneD, NekDouble>& outarray)
710 int nquad0 =
m_base[0]->GetNumPoints();
711 int nquad1 =
m_base[1]->GetNumPoints();
712 int nquad2 =
m_base[2]->GetNumPoints();
713 int nqtot = nquad0*nquad1*nquad2;
714 int nmodes0 =
m_base[0]->GetNumModes();
715 int nmodes1 =
m_base[1]->GetNumModes();
716 int wspsize = nquad0 + nquad1 + nquad2 + max(nqtot,
m_ncoeffs)
717 + nquad1*nquad2*nmodes0 + nquad2*nmodes0*(nmodes1+1)/2;
719 Array<OneD, NekDouble> gfac0(wspsize);
720 Array<OneD, NekDouble> gfac1(gfac0 + nquad0);
721 Array<OneD, NekDouble> gfac2(gfac1 + nquad1);
722 Array<OneD, NekDouble> tmp0 (gfac2 + nquad2);
723 Array<OneD, NekDouble> wsp(tmp0 + max(nqtot,
m_ncoeffs));
725 const Array<OneD, const NekDouble>& z0 =
m_base[0]->GetZ();
726 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
727 const Array<OneD, const NekDouble>& z2 =
m_base[2]->GetZ();
730 for(i = 0; i < nquad0; ++i)
732 gfac0[i] = 0.5*(1+z0[i]);
736 for(i = 0; i < nquad1; ++i)
738 gfac1[i] = 2.0/(1-z1[i]);
742 for(i = 0; i < nquad2; ++i)
744 gfac2[i] = 2.0/(1-z2[i]);
748 for(i = 0; i < nquad1*nquad2; ++i)
750 Vmath::Smul(nquad0,gfac1[i%nquad1],&inarray[0]+i*nquad0,1,&tmp0[0]+i*nquad0,1);
752 for(i = 0; i < nquad2; ++i)
754 Vmath::Smul(nquad0*nquad1,gfac2[i],&tmp0[0]+i*nquad0*nquad1,1,&tmp0[0]+i*nquad0*nquad1,1);
774 for(i = 0; i < nquad1*nquad2; ++i)
776 Vmath::Vmul(nquad0,&gfac0[0],1,&tmp0[0]+i*nquad0,1,&tmp0[0]+i*nquad0,1);
785 for(i = 0; i < nquad2; ++i)
787 Vmath::Smul(nquad0*nquad1,gfac2[i],&inarray[0]+i*nquad0*nquad1,1,&tmp0[0]+i*nquad0*nquad1,1);
802 for(i = 0; i < nquad1; ++i)
804 gfac1[i] = (1+z1[i])/2;
807 for(i = 0; i < nquad1*nquad2; ++i)
809 Vmath::Vmul(nquad0,&gfac0[0],1,&tmp0[0]+i*nquad0,1,&tmp0[0]+i*nquad0,1);
817 for(i = 0; i < nquad2; ++i)
819 Vmath::Smul(nquad0*nquad1,gfac2[i],&inarray[0]+i*nquad0*nquad1,1,&tmp0[0]+i*nquad0*nquad1,1);
821 for(i = 0; i < nquad1*nquad2; ++i)
823 Vmath::Smul(nquad0,gfac1[i%nquad1],&tmp0[0]+i*nquad0,1,&tmp0[0]+i*nquad0,1);
845 ASSERTL1(
false,
"input dir is out of range");
858 const Array<OneD, const NekDouble>& xi,
859 Array<OneD, NekDouble>& eta)
882 eta[0] = 2.0*(1.0+xi[0])/(-xi[1]-xi[2]) - 1.0;
884 eta[1] = 2.0*(1.0+xi[1])/(1.0-xi[2]) - 1.0;
891 Array<OneD, NekDouble> &outarray)
893 Array<OneD, NekDouble> tmp(
m_ncoeffs,0.0);
927 "BasisType is not a boundary interior form");
930 "BasisType is not a boundary interior form");
933 "BasisType is not a boundary interior form");
935 int P =
m_base[0]->GetNumModes();
936 int Q =
m_base[1]->GetNumModes();
937 int R =
m_base[2]->GetNumModes();
947 "BasisType is not a boundary interior form");
950 "BasisType is not a boundary interior form");
953 "BasisType is not a boundary interior form");
955 int P =
m_base[0]->GetNumModes()-1;
956 int Q =
m_base[1]->GetNumModes()-1;
957 int R =
m_base[2]->GetNumModes()-1;
960 return (Q+1) + P*(1 + 2*Q - P)/2
961 + (R+1) + P*(1 + 2*R - P)/2
962 + 2*(R+1) + Q*(1 + 2*R - Q);
967 ASSERTL2((i >= 0) && (i <= 5),
"edge id is out of range");
968 int P =
m_base[0]->GetNumModes();
969 int Q =
m_base[1]->GetNumModes();
970 int R =
m_base[2]->GetNumModes();
976 else if (i == 1 || i == 2)
988 int P =
m_base[0]->GetNumModes()-2;
989 int Q =
m_base[1]->GetNumModes()-2;
990 int R =
m_base[2]->GetNumModes()-2;
997 ASSERTL2((i >= 0) && (i <= 3),
"face id is out of range");
999 int nummodesA, nummodesB, P, Q;
1005 else if ((i == 1) || (i == 2))
1017 nFaceCoeffs = Q+1 + (P*(1 + 2*Q - P))/2;
1023 ASSERTL2((i >= 0) && (i <= 3),
"face id is out of range");
1024 int Pi =
m_base[0]->GetNumModes() - 2;
1025 int Qi =
m_base[1]->GetNumModes() - 2;
1026 int Ri =
m_base[2]->GetNumModes() - 2;
1030 return Pi * (2*Qi - Pi - 1) / 2;
1034 return Pi * (2*Ri - Pi - 1) / 2;
1038 return Qi * (2*Ri - Qi - 1) / 2;
1044 int Pi =
m_base[0]->GetNumModes() - 2;
1045 int Qi =
m_base[1]->GetNumModes() - 2;
1046 int Ri =
m_base[2]->GetNumModes() - 2;
1048 return Pi * (2*Qi - Pi - 1) / 2 +
1049 Pi * (2*Ri - Pi - 1) / 2 +
1050 Qi * (2*Ri - Qi - 1);
1055 ASSERTL2(i >= 0 && i <= 3,
"face id is out of range");
1059 return m_base[0]->GetNumPoints()*
1060 m_base[1]->GetNumPoints();
1064 return m_base[0]->GetNumPoints()*
1065 m_base[2]->GetNumPoints();
1069 return m_base[1]->GetNumPoints()*
1070 m_base[2]->GetNumPoints();
1075 const int i,
const int j)
const
1077 ASSERTL2(i >= 0 && i <= 3,
"face id is out of range");
1078 ASSERTL2(j == 0 || j == 1,
"face direction is out of range");
1082 return m_base[j]->GetPointsKey();
1086 return m_base[2*j]->GetPointsKey();
1090 return m_base[j+1]->GetPointsKey();
1095 const std::vector<unsigned int>& nummodes,
1099 nummodes[modes_offset],
1100 nummodes[modes_offset+1],
1101 nummodes[modes_offset+2]);
1108 const int i,
const int k)
const
1110 ASSERTL2(i >= 0 && i <= 4,
"face id is out of range");
1111 ASSERTL2(k == 0 || k == 1,
"face direction out of range");
1131 m_base[dir]->GetNumModes());
1139 ASSERTL2(i >= 0 && i <= 5,
"edge id is out of range");
1145 else if (i == 1 || i == 2)
1156 Array<OneD, NekDouble> &xi_x,
1157 Array<OneD, NekDouble> &xi_y,
1158 Array<OneD, NekDouble> &xi_z)
1160 Array<OneD, const NekDouble> eta_x =
m_base[0]->GetZ();
1161 Array<OneD, const NekDouble> eta_y =
m_base[1]->GetZ();
1162 Array<OneD, const NekDouble> eta_z =
m_base[2]->GetZ();
1169 for(
int k = 0; k < Qz; ++k ) {
1170 for(
int j = 0; j < Qy; ++j ) {
1171 for(
int i = 0; i < Qx; ++i ) {
1172 int s = i + Qx*(j + Qy*k);
1173 xi_x[s] = (eta_x[i] + 1.0) * (1.0 - eta_y[j]) * (1.0 - eta_z[k]) / 4 - 1.0;
1174 xi_y[s] = (eta_y[j] + 1.0) * (1.0 - eta_z[k]) / 2 - 1.0;
1200 Array<OneD, unsigned int> &maparray,
1201 Array<OneD, int> &signarray,
1205 int P, Q, i, j, k, idx;
1208 "Method only implemented for Modified_A BasisType (x "
1209 "direction), Modified_B BasisType (y direction), and "
1210 "Modified_C BasisType(z direction)");
1212 int nFaceCoeffs = 0;
1214 if (nummodesA == -1)
1219 nummodesA =
m_base[0]->GetNumModes();
1220 nummodesB =
m_base[1]->GetNumModes();
1223 nummodesA =
m_base[0]->GetNumModes();
1224 nummodesB =
m_base[2]->GetNumModes();
1228 nummodesA =
m_base[1]->GetNumModes();
1229 nummodesB =
m_base[2]->GetNumModes();
1237 nFaceCoeffs = Q + ((P-1)*(1 + 2*(Q-1) - (P-1)))/2;
1240 if(maparray.num_elements() != nFaceCoeffs)
1242 maparray = Array<OneD, unsigned int>(nFaceCoeffs,1);
1245 if(signarray.num_elements() != nFaceCoeffs)
1247 signarray = Array<OneD, int>(nFaceCoeffs,1);
1251 fill( signarray.get() , signarray.get()+nFaceCoeffs, 1 );
1258 for (i = 0; i < P; ++i)
1260 for (j = 0; j < Q-i; ++j)
1262 if ((
int)faceOrient == 7 && i > 1)
1264 signarray[idx] = (i%2 ? -1 : 1);
1266 maparray[idx++] =
GetMode(i,j,0);
1272 for (i = 0; i < P; ++i)
1274 for (k = 0; k < Q-i; ++k)
1276 if ((
int)faceOrient == 7 && i > 1)
1278 signarray[idx] = (i%2 ? -1: 1);
1280 maparray[idx++] =
GetMode(i,0,k);
1286 for (j = 0; j < P-1; ++j)
1288 for (k = 0; k < Q-1-j; ++k)
1290 if ((
int)faceOrient == 7 && j > 1)
1292 signarray[idx] = ((j+1)%2 ? -1: 1);
1294 maparray[idx++] =
GetMode(1,j,k);
1296 if (j == 0 && k == 0) {
1297 maparray[idx++] =
GetMode(0,0,1);
1299 if (j == 0 && k == Q-2) {
1300 for (
int r = 0; r < Q-1; ++r) {
1301 maparray[idx++] =
GetMode(0,1,r);
1309 for (j = 0; j < P; ++j)
1311 for (k = 0; k < Q-j; ++k)
1313 if ((
int)faceOrient == 7 && j > 1)
1315 signarray[idx] = (j%2 ? -1: 1);
1317 maparray[idx++] =
GetMode(0,j,k);
1322 ASSERTL0(
false,
"Element map not available.");
1325 if ((
int)faceOrient == 7)
1327 swap(maparray[0], maparray[Q]);
1329 for (i = 1; i < Q-1; ++i)
1331 swap(maparray[i+1], maparray[Q+i]);
1341 "Mapping not defined for this type of basis");
1344 if(useCoeffPacking ==
true)
1346 switch(localVertexId)
1370 ASSERTL0(
false,
"Vertex ID must be between 0 and 3");
1377 switch(localVertexId)
1401 ASSERTL0(
false,
"Vertex ID must be between 0 and 3");
1417 Array<OneD, unsigned int> &maparray,
1418 Array<OneD, int> &signarray)
1421 const int P =
m_base[0]->GetNumModes();
1422 const int Q =
m_base[1]->GetNumModes();
1423 const int R =
m_base[2]->GetNumModes();
1427 if(maparray.num_elements() != nEdgeIntCoeffs)
1429 maparray = Array<OneD, unsigned int>(nEdgeIntCoeffs);
1433 fill( maparray.get(), maparray.get() + nEdgeIntCoeffs, 0);
1436 if(signarray.num_elements() != nEdgeIntCoeffs)
1438 signarray = Array<OneD, int>(nEdgeIntCoeffs,1);
1442 fill( signarray.get() , signarray.get()+nEdgeIntCoeffs, 1 );
1448 for (i = 0; i < P-2; ++i)
1450 maparray[i] =
GetMode(i+2, 0, 0);
1454 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1461 for (i = 0; i < Q-2; ++i)
1463 maparray[i] =
GetMode(1, i+1, 0);
1467 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1474 for (i = 0; i < Q-2; ++i)
1476 maparray[i] =
GetMode(0, i+2, 0);
1480 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1487 for (i = 0; i < R-2; ++i)
1489 maparray[i] =
GetMode(0, 0, i+2);
1493 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1500 for (i = 0; i < R - 2; ++i)
1502 maparray[i] =
GetMode(1, 0, i+1);
1506 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1513 for (i = 0; i < R-2; ++i)
1515 maparray[i] =
GetMode(0, 1, i+1);
1519 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1526 ASSERTL0(
false,
"Edge not defined.");
1534 Array<OneD, unsigned int> &maparray,
1535 Array<OneD, int> &signarray)
1538 const int P =
m_base[0]->GetNumModes();
1539 const int Q =
m_base[1]->GetNumModes();
1540 const int R =
m_base[2]->GetNumModes();
1544 if(maparray.num_elements() != nFaceIntCoeffs)
1546 maparray = Array<OneD, unsigned int>(nFaceIntCoeffs);
1549 if(signarray.num_elements() != nFaceIntCoeffs)
1551 signarray = Array<OneD, int>(nFaceIntCoeffs,1);
1555 fill( signarray.get() , signarray.get()+nFaceIntCoeffs, 1 );
1562 for (i = 2; i < P-1; ++i)
1564 for (j = 1; j < Q-i; ++j)
1566 if ((
int)faceOrient == 7)
1568 signarray[idx] = (i%2 ? -1 : 1);
1570 maparray[idx++] =
GetMode(i,j,0);
1576 for (i = 2; i < P; ++i)
1578 for (k = 1; k < R-i; ++k)
1580 if ((
int)faceOrient == 7)
1582 signarray[idx] = (i%2 ? -1: 1);
1584 maparray[idx++] =
GetMode(i,0,k);
1590 for (j = 1; j < Q-2; ++j)
1592 for (k = 1; k < R-1-j; ++k)
1594 if ((
int)faceOrient == 7)
1596 signarray[idx] = ((j+1)%2 ? -1: 1);
1598 maparray[idx++] =
GetMode(1,j,k);
1604 for (j = 2; j < Q-1; ++j)
1606 for (k = 1; k < R-j; ++k)
1608 if ((
int)faceOrient == 7)
1610 signarray[idx] = (j%2 ? -1: 1);
1612 maparray[idx++] =
GetMode(0,j,k);
1617 ASSERTL0(
false,
"Face interior map not available.");
1629 "BasisType is not a boundary interior form");
1632 "BasisType is not a boundary interior form");
1635 "BasisType is not a boundary interior form");
1637 int P =
m_base[0]->GetNumModes();
1638 int Q =
m_base[1]->GetNumModes();
1639 int R =
m_base[2]->GetNumModes();
1643 if(outarray.num_elements() != nIntCoeffs)
1645 outarray = Array<OneD, unsigned int>(nIntCoeffs);
1649 for (
int i = 2; i < P-2; ++i)
1651 for (
int j = 1; j < Q-i-1; ++j)
1653 for (
int k = 1; k < R-i-j; ++k)
1655 outarray[idx++] =
GetMode(i,j,k);
1668 "BasisType is not a boundary interior form");
1671 "BasisType is not a boundary interior form");
1674 "BasisType is not a boundary interior form");
1676 int P =
m_base[0]->GetNumModes();
1677 int Q =
m_base[1]->GetNumModes();
1678 int R =
m_base[2]->GetNumModes();
1683 for (i = 0; i < P; ++i)
1688 for (j = 0; j < Q-i; j++)
1690 for (k = 0; k < R-i-j; ++k)
1692 outarray[idx++] =
GetMode(i,j,k);
1700 for (k = 0; k < R-i; ++k)
1702 outarray[idx++] =
GetMode(i,0,k);
1704 for (j = 1; j < Q-i; ++j)
1706 outarray[idx++] =
GetMode(i,j,0);
1727 int nq0 =
m_base[0]->GetNumPoints();
1728 int nq1 =
m_base[1]->GetNumPoints();
1729 int nq2 =
m_base[2]->GetNumPoints();
1730 int nq = max(nq0,max(nq1,nq2));
1733 Array<OneD, Array<OneD, NekDouble> > coords(neq);
1734 Array<OneD, NekDouble> coll(3);
1735 Array<OneD, DNekMatSharedPtr> I(3);
1736 Array<OneD, NekDouble> tmp(nq0);
1742 for(
int i = 0; i < nq; ++i)
1744 for(
int j = 0; j < nq-i; ++j)
1746 for(
int k = 0; k < nq-i-j; ++k,++cnt)
1748 coords[cnt] = Array<OneD, NekDouble>(3);
1749 coords[cnt][0] = -1.0 + 2*k/(
NekDouble)(nq-1);
1750 coords[cnt][1] = -1.0 + 2*j/(
NekDouble)(nq-1);
1751 coords[cnt][2] = -1.0 + 2*i/(
NekDouble)(nq-1);
1756 for(
int i = 0; i < neq; ++i)
1760 I[0] =
m_base[0]->GetI(coll);
1761 I[1] =
m_base[1]->GetI(coll+1);
1762 I[2] =
m_base[2]->GetI(coll+2);
1766 for(
int k = 0; k < nq2; ++k)
1768 for (
int j = 0; j < nq1; ++j)
1771 fac = (I[1]->GetPtr())[j]*(I[2]->GetPtr())[k];
1826 const int Q =
m_base[1]->GetNumModes();
1827 const int R =
m_base[2]->GetNumModes();
1829 int i,j,q_hat,k_hat;
1833 for (i = 0; i < I; ++i)
1838 k_hat = max(R-Q-i,0);
1839 cnt += q_hat*(q_hat+1)/2 + k_hat*Q;
1844 for (j = 0; j < J; ++j)
1857 const Array<OneD, const NekDouble>& inarray,
1858 Array<OneD, NekDouble>& outarray)
1862 int nquad0 =
m_base[0]->GetNumPoints();
1863 int nquad1 =
m_base[1]->GetNumPoints();
1864 int nquad2 =
m_base[2]->GetNumPoints();
1866 const Array<OneD, const NekDouble>& w0 =
m_base[0]->GetW();
1867 const Array<OneD, const NekDouble>& w1 =
m_base[1]->GetW();
1868 const Array<OneD, const NekDouble>& w2 =
m_base[2]->GetW();
1870 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
1871 const Array<OneD, const NekDouble>& z2 =
m_base[2]->GetZ();
1874 for(i = 0; i < nquad1*nquad2; ++i)
1877 w0.get(),1, &outarray[0]+i*nquad0,1);
1884 for(j = 0; j < nquad2; ++j)
1886 for(i = 0; i < nquad1; ++i)
1888 Blas::Dscal(nquad0,0.5*w1[i], &outarray[0]+i*nquad0+
1895 for(j = 0; j < nquad2; ++j)
1897 for(i = 0; i < nquad1; ++i)
1900 0.5*(1-z1[i])*w1[i],
1901 &outarray[0]+i*nquad0 + j*nquad0*nquad1,
1912 for(i = 0; i < nquad2; ++i)
1914 Blas::Dscal(nquad0*nquad1, 0.25*w2[i],
1915 &outarray[0]+i*nquad0*nquad1, 1);
1920 for(i = 0; i < nquad2; ++i)
1922 Blas::Dscal(nquad0*nquad1,0.25*(1-z2[i])*(1-z2[i])*w2[i],
1923 &outarray[0]+i*nquad0*nquad1,1);
1940 int qa =
m_base[0]->GetNumPoints();
1941 int qb =
m_base[1]->GetNumPoints();
1942 int qc =
m_base[2]->GetNumPoints();
1943 int nmodes_a =
m_base[0]->GetNumModes();
1944 int nmodes_b =
m_base[1]->GetNumModes();
1945 int nmodes_c =
m_base[2]->GetNumModes();
1959 Array<OneD, NekDouble> orthocoeffs(OrthoExp.
GetNcoeffs());
1970 int cutoff_a = (int) (SVVCutOff*nmodes_a);
1971 int cutoff_b = (int) (SVVCutOff*nmodes_b);
1972 int cutoff_c = (int) (SVVCutOff*nmodes_c);
1973 int nmodes = min(min(nmodes_a,nmodes_b),nmodes_c);
1974 NekDouble cutoff = min(min(cutoff_a,cutoff_b),cutoff_c);
1978 OrthoExp.
FwdTrans(array,orthocoeffs);
1981 for(i = 0; i < nmodes_a; ++i)
1983 for(j = 0; j < nmodes_b-i; ++j)
1985 for(k = 0; k < nmodes_c-i-j; ++k)
1987 if(i + j + k >= cutoff)
1989 orthocoeffs[cnt] *= ((1.0+SvvDiffCoeff)*exp(-(i+j+k-nmodes)*(i+j+k-nmodes)/((
NekDouble)((i+j+k-cutoff+epsilon)*(i+j+k-cutoff+epsilon)))));
1996 OrthoExp.
BwdTrans(orthocoeffs,array);
2002 const Array<OneD, const NekDouble> &inarray,
2003 Array<OneD, NekDouble> &outarray)
2005 int nquad0 =
m_base[0]->GetNumPoints();
2006 int nquad1 =
m_base[1]->GetNumPoints();
2007 int nquad2 =
m_base[2]->GetNumPoints();
2008 int nqtot = nquad0 * nquad1 * nquad2;
2009 int nmodes0 =
m_base[0]->GetNumModes();
2010 int nmodes1 =
m_base[1]->GetNumModes();
2011 int nmodes2 =
m_base[2]->GetNumModes();
2012 int numMax = nmodes0;
2014 Array<OneD, NekDouble> coeff (
m_ncoeffs);
2015 Array<OneD, NekDouble> coeff_tmp1(
m_ncoeffs, 0.0);
2016 Array<OneD, NekDouble> coeff_tmp2(
m_ncoeffs, 0.0);
2017 Array<OneD, NekDouble> phys_tmp (nqtot, 0.0);
2018 Array<OneD, NekDouble> tmp, tmp2, tmp3, tmp4;
2040 OrthoTetExp->FwdTrans(phys_tmp, coeff);
2046 for (
int u = 0; u < numMin; ++u)
2048 for (
int i = 0; i < numMin-u; ++i)
2051 tmp2 = coeff_tmp1 + cnt, 1);
2052 cnt += numMax - u - i;
2054 for (
int i = numMin; i < numMax-u; ++i)
2056 cnt += numMax - u - i;
2060 OrthoTetExp->BwdTrans(coeff_tmp1,phys_tmp);
2066 Array<OneD, int> &conn,
2069 int np0 =
m_base[0]->GetNumPoints();
2070 int np1 =
m_base[1]->GetNumPoints();
2071 int np2 =
m_base[2]->GetNumPoints();
2072 int np = max(np0,max(np1,np2));
2075 conn = Array<OneD, int>(4*(np-1)*(np-1)*(np-1));
2084 for(
int i = 0; i < np-1; ++i)
2086 planep1 += (np-i)*(np-i+1)/2;
2091 for(
int j = 0; j < np-i-1; ++j)
2095 for(
int k = 0; k < np-i-j-2; ++k)
2097 conn[cnt++] = plane + row +k+1;
2098 conn[cnt++] = plane + row +k;
2099 conn[cnt++] = plane + rowp1 +k;
2100 conn[cnt++] = planep1 + row1 +k;
2102 conn[cnt++] = plane + row +k+1;
2103 conn[cnt++] = plane + rowp1 +k+1;
2104 conn[cnt++] = planep1 + row1 +k+1;
2105 conn[cnt++] = planep1 + row1 +k;
2107 conn[cnt++] = plane + rowp1 +k+1;
2108 conn[cnt++] = plane + row +k+1;
2109 conn[cnt++] = plane + rowp1 +k;
2110 conn[cnt++] = planep1 + row1 +k;
2112 conn[cnt++] = planep1 + row1 +k;
2113 conn[cnt++] = planep1 + row1p1+k;
2114 conn[cnt++] = plane + rowp1 +k;
2115 conn[cnt++] = plane + rowp1 +k+1;
2117 conn[cnt++] = planep1 + row1 +k;
2118 conn[cnt++] = planep1 + row1p1+k;
2119 conn[cnt++] = planep1 + row1 +k+1;
2120 conn[cnt++] = plane + rowp1 +k+1;
2124 conn[cnt++] = plane + rowp1 +k+1;
2125 conn[cnt++] = planep1 + row1p1 +k+1;
2126 conn[cnt++] = planep1 + row1 +k+1;
2127 conn[cnt++] = planep1 + row1p1 +k;
2131 conn[cnt++] = plane + row + np-i-j-1;
2132 conn[cnt++] = plane + row + np-i-j-2;
2133 conn[cnt++] = plane + rowp1 + np-i-j-2;
2134 conn[cnt++] = planep1 + row1 + np-i-j-2;
2139 plane += (np-i)*(np-i+1)/2;