63 "order in 'a' direction is higher than order "
81 const Array<OneD, const NekDouble>& inarray)
84 int nquad1 =
m_base[1]->GetNumPoints();
85 Array<OneD, NekDouble> w1_tmp(nquad1);
87 Array<OneD, const NekDouble> w0 =
m_base[0]->GetW();
88 Array<OneD, const NekDouble> w1 =
m_base[1]->GetW();
89 Array<OneD, const NekDouble> z1 =
m_base[1]->GetZ();
101 for(i = 0; i < nquad1; ++i)
103 w1_tmp[i] = 0.5*(1-z1[i])*w1[i];
129 const Array<OneD, const NekDouble>& inarray,
130 Array<OneD, NekDouble>& out_d0,
131 Array<OneD, NekDouble>& out_d1,
132 Array<OneD, NekDouble>& out_d2)
135 int nquad0 =
m_base[0]->GetNumPoints();
136 int nquad1 =
m_base[1]->GetNumPoints();
137 Array<OneD, NekDouble> wsp(nquad0*nquad1);
139 const Array<OneD, const NekDouble>& z0 =
m_base[0]->GetZ();
140 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
143 for (i = 0; i < nquad1; ++i)
145 wsp[i] = 2.0/(1-z1[i]);
148 if (out_d0.num_elements() > 0)
152 for (i = 0; i < nquad1; ++i)
154 Blas::Dscal(nquad0,wsp[i],&out_d0[0]+i*nquad0,1);
158 if (out_d1.num_elements() > 0)
161 for (i = 0; i < nquad0; ++i)
163 wsp[i] = 0.5*(1+z0[i]);
166 for (i = 0; i < nquad1; ++i)
169 1,&out_d1[0]+i*nquad0,
170 1,&out_d1[0]+i*nquad0,1);
174 else if (out_d1.num_elements() > 0)
176 Array<OneD, NekDouble> diff0(nquad0*nquad1);
179 for (i = 0; i < nquad1; ++i)
181 Blas::Dscal(nquad0,wsp[i],&diff0[0]+i*nquad0,1);
184 for (i = 0; i < nquad0; ++i)
186 wsp[i] = 0.5*(1+z0[i]);
189 for (i = 0; i < nquad1; ++i)
192 1,&out_d1[0]+i*nquad0,
193 1,&out_d1[0]+i*nquad0,1);
200 const Array<OneD, const NekDouble>& inarray,
201 Array<OneD, NekDouble>& outarray)
217 ASSERTL1(
false,
"input dir is out of range");
224 const Array<OneD, const NekDouble>& inarray,
225 Array<OneD, NekDouble>& out_d0,
226 Array<OneD, NekDouble>& out_d1,
227 Array<OneD, NekDouble>& out_d2)
234 const Array<OneD, const NekDouble>& inarray,
235 Array<OneD, NekDouble>& outarray)
251 const Array<OneD, const NekDouble>& inarray,
252 Array<OneD, NekDouble>& outarray)
259 const Array<OneD, const NekDouble>& inarray,
260 Array<OneD, NekDouble>& outarray)
263 m_base[1]->GetNumModes());
267 inarray,outarray,wsp);
271 const Array<OneD, const NekDouble>& base0,
272 const Array<OneD, const NekDouble>& base1,
273 const Array<OneD, const NekDouble>& inarray,
274 Array<OneD, NekDouble>& outarray,
275 Array<OneD, NekDouble>& wsp,
276 bool doCheckCollDir0,
277 bool doCheckCollDir1)
281 int nquad0 =
m_base[0]->GetNumPoints();
282 int nquad1 =
m_base[1]->GetNumPoints();
283 int nmodes0 =
m_base[0]->GetNumModes();
284 int nmodes1 =
m_base[1]->GetNumModes();
286 ASSERTL1(wsp.num_elements() >= nquad0*nmodes1,
287 "Workspace size is not sufficient");
290 "Basis[1] is not of general tensor type");
292 for (i = mode = 0; i < nmodes0; ++i)
294 Blas::Dgemv(
'N', nquad1,nmodes1-i,1.0,base1.get()+mode*nquad1,
295 nquad1,&inarray[0]+mode,1,0.0,&wsp[0]+i*nquad1,1);
302 Blas::Daxpy(nquad1,inarray[1],base1.get()+nquad1,1,
306 Blas::Dgemm(
'N',
'T', nquad0,nquad1,nmodes0,1.0, base0.get(),nquad0,
307 &wsp[0], nquad1,0.0, &outarray[0], nquad0);
311 const Array<OneD, const NekDouble>& inarray,
312 Array<OneD, NekDouble>& outarray)
329 const Array<OneD, const NekDouble>& inarray,
330 Array<OneD, NekDouble>& outarray)
333 int npoints[2] = {
m_base[0]->GetNumPoints(),
334 m_base[1]->GetNumPoints()};
335 int nmodes[2] = {
m_base[0]->GetNumModes(),
336 m_base[1]->GetNumModes()};
338 fill(outarray.get(), outarray.get()+
m_ncoeffs, 0.0 );
340 Array<OneD, NekDouble> physEdge[3];
341 Array<OneD, NekDouble> coeffEdge[3];
342 for(i = 0; i < 3; i++)
344 physEdge[i] = Array<OneD, NekDouble>(npoints[i!=0]);
345 coeffEdge[i] = Array<OneD, NekDouble>(nmodes[i!=0]);
348 for(i = 0; i < npoints[0]; i++)
350 physEdge[0][i] = inarray[i];
353 for(i = 0; i < npoints[1]; i++)
355 physEdge[1][i] = inarray[npoints[0]-1+i*npoints[0]];
356 physEdge[2][i] = inarray[(npoints[1]-1)*npoints[0]-i*npoints[0]];
361 m_base[0]->GetBasisKey()),
366 Array<OneD, unsigned int> mapArray;
367 Array<OneD, int> signArray;
370 for (i = 0; i < 3; i++)
373 segexp[i!=0]->FwdTrans_BndConstrained(physEdge[i],coeffEdge[i]);
376 for (j = 0; j < nmodes[i != 0]; j++)
379 outarray[ mapArray[j] ] = sign * coeffEdge[i][j];
399 int nInteriorDofs =
m_ncoeffs - nBoundaryDofs;
401 Array<OneD, NekDouble> rhs (nInteriorDofs);
402 Array<OneD, NekDouble> result(nInteriorDofs);
406 for (i = 0; i < nInteriorDofs; i++)
408 rhs[i] = tmp1[ mapArray[i] ];
411 Blas::Dgemv(
'N',nInteriorDofs,nInteriorDofs,
412 1.0,&(matsys->GetPtr())[0],nInteriorDofs,
416 for (i = 0; i < nInteriorDofs; i++)
418 outarray[ mapArray[i] ] = result[i];
465 const Array<OneD, const NekDouble>& inarray,
466 Array<OneD, NekDouble>& outarray)
472 const Array<OneD, const NekDouble>& inarray,
473 Array<OneD, NekDouble>& outarray)
479 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
480 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
484 const Array<OneD, const NekDouble>& inarray,
485 Array<OneD, NekDouble>& outarray)
487 int nquad0 =
m_base[0]->GetNumPoints();
488 int nquad1 =
m_base[1]->GetNumPoints();
489 int order0 =
m_base[0]->GetNumModes();
491 Array<OneD,NekDouble> tmp(nquad0*nquad1+nquad1*order0);
492 Array<OneD,NekDouble> wsp(tmp+nquad0*nquad1);
504 const Array<OneD, const NekDouble>& base0,
505 const Array<OneD, const NekDouble>& base1,
506 const Array<OneD, const NekDouble>& inarray,
507 Array<OneD, NekDouble>& outarray,
508 Array<OneD, NekDouble>& wsp,
509 bool doCheckCollDir0,
510 bool doCheckCollDir1)
514 int nquad0 =
m_base[0]->GetNumPoints();
515 int nquad1 =
m_base[1]->GetNumPoints();
516 int nmodes0 =
m_base[0]->GetNumModes();
517 int nmodes1 =
m_base[1]->GetNumModes();
519 ASSERTL1(wsp.num_elements() >= nquad1*nmodes0,
520 "Workspace size is not sufficient");
522 Blas::Dgemm(
'T',
'N',nquad1,nmodes0,nquad0,1.0,inarray.get(),nquad0,
523 base0.get(),nquad0,0.0,wsp.get(),nquad1);
526 for (mode=i=0; i < nmodes0; ++i)
528 Blas::Dgemv(
'T',nquad1,nmodes1-i,1.0, base1.get()+mode*nquad1,
529 nquad1,wsp.get()+i*nquad1,1, 0.0,
530 outarray.get() + mode,1);
537 outarray[1] +=
Blas::Ddot(nquad1,base1.get()+nquad1,1,
544 const Array<OneD, const NekDouble>& inarray,
545 Array<OneD, NekDouble>& outarray)
552 const Array<OneD, const NekDouble>& inarray,
553 Array<OneD, NekDouble>& outarray)
572 ASSERTL1(
false,
"input dir is out of range");
580 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
581 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
586 const Array<OneD, const NekDouble>& inarray,
587 Array<OneD, NekDouble>& outarray)
590 int nquad0 =
m_base[0]->GetNumPoints();
591 int nquad1 =
m_base[1]->GetNumPoints();
592 int nqtot = nquad0*nquad1;
593 int nmodes0 =
m_base[0]->GetNumModes();
594 int wspsize = max(max(nqtot,
m_ncoeffs),nquad1*nmodes0);
596 Array<OneD, NekDouble> gfac0(2*wspsize);
597 Array<OneD, NekDouble> tmp0 (gfac0+wspsize);
599 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
602 for(i = 0; i < nquad1; ++i)
604 gfac0[i] = 2.0/(1-z1[i]);
607 for(i = 0; i < nquad1; ++i)
609 Vmath::Smul(nquad0,gfac0[i],&inarray[0]+i*nquad0,1,
610 &tmp0[0]+i*nquad0,1);
621 tmp0,outarray,gfac0);
627 const Array<OneD, const NekDouble>& z0 =
m_base[0]->GetZ();
629 for (i = 0; i < nquad0; ++i)
631 gfac0[i] = 0.5*(1+z0[i]);
634 for (i = 0; i < nquad1; ++i)
636 Vmath::Vmul(nquad0,&gfac0[0],1,&tmp0[0]+i*nquad0,1,
637 &tmp0[0]+i*nquad0,1);
647 tmp0,outarray,gfac0);
654 ASSERTL1(
false,
"input dir is out of range");
665 Array<OneD, NekDouble>& eta)
676 eta[0] = 2*(1+xi[0])/(1-xi[1])-1.0;
682 const int mode, Array<OneD, NekDouble> &outarray)
685 int nquad0 =
m_base[0]->GetNumPoints();
686 int nquad1 =
m_base[1]->GetNumPoints();
687 int order0 =
m_base[0]->GetNumModes();
688 int order1 =
m_base[1]->GetNumModes();
690 Array<OneD, const NekDouble> base0 =
m_base[0]->GetBdata();
691 Array<OneD, const NekDouble> base1 =
m_base[1]->GetBdata();
694 "calling argument mode is larger than "
695 "total expansion order");
698 for (i = 0; i < order0; ++i, m+=order1-i)
715 for (i = 0; i < nquad1; ++i)
718 1,&outarray[0]+i*nquad0,1);
722 for(i = 0; i < nquad0; ++i)
725 1,&outarray[0]+i,nquad0,&outarray[0]+i,nquad0);
748 "BasisType is not a boundary interior form");
750 "BasisType is not a boundary interior form");
758 "BasisType is not a boundary interior form");
760 "BasisType is not a boundary interior form");
767 ASSERTL2(i >= 0 && i <= 2,
"edge id is out of range");
781 ASSERTL2((i >= 0)&&(i <= 2),
"edge id is out of range");
794 const std::vector<unsigned int> &nummodes,
798 nummodes[modes_offset],
799 nummodes[modes_offset+1]);
807 ASSERTL2(i >= 0 && i <= 2,
"edge id is out of range");
821 Array<OneD, NekDouble> &coords_1,
822 Array<OneD, NekDouble> &coords_2)
824 Array<OneD, const NekDouble> z0 =
m_base[0]->GetZ();
825 Array<OneD, const NekDouble> z1 =
m_base[1]->GetZ();
830 for(i = 0; i < nq1; ++i)
832 for(j = 0; j < nq0; ++j)
834 coords_0[i*nq0+j] = (1+z0[j])*(1-z1[i])/2.0 - 1.0;
848 ASSERTL2(edge >= 0 && edge <= 2,
"edge id is out of range");
850 return edge == 0 ? 0 : 1;
856 ASSERTL2(i >= 0 && i <= 2,
"edge id is out of range");
873 m_base[1]->GetBasisKey().GetPointsKey().
878 m_base[1]->GetNumModes(),pkey);
883 ASSERTL0(
false,
"unexpected points distribution");
888 ASSERTL0(
false,
"Information not available to set edge key");
904 Array<OneD, unsigned int>& maparray,
905 Array<OneD, int>& signarray)
909 "Mapping not defined for this type of basis");
912 const int nummodes1 =
m_base[1]->GetNumModes();
915 if(maparray.num_elements() != nEdgeCoeffs)
917 maparray = Array<OneD, unsigned int>(nEdgeCoeffs);
920 if(signarray.num_elements() != nEdgeCoeffs)
922 signarray = Array<OneD, int>(nEdgeCoeffs,1);
926 fill(signarray.get() , signarray.get()+nEdgeCoeffs, 1);
934 for(i = 0; i < nEdgeCoeffs; cnt+=nummodes1-i, ++i)
941 swap( maparray[0] , maparray[1] );
943 for(i = 3; i < nEdgeCoeffs; i+=2)
952 maparray[0] = nummodes1;
954 for(i = 2; i < nEdgeCoeffs; i++)
956 maparray[i] = nummodes1-1+i;
961 swap( maparray[0] , maparray[1] );
963 for(i = 3; i < nEdgeCoeffs; i+=2)
972 for(i = 0; i < nEdgeCoeffs; i++)
979 swap( maparray[0] , maparray[1] );
981 for(i = 3; i < nEdgeCoeffs; i+=2)
989 ASSERTL0(
false,
"eid must be between 0 and 2");
999 "Mapping not defined for this type of basis");
1002 if(useCoeffPacking ==
true)
1004 switch(localVertexId)
1018 localDOF =
m_base[1]->GetNumModes();
1023 ASSERTL0(
false,
"eid must be between 0 and 2");
1030 switch(localVertexId)
1039 localDOF =
m_base[1]->GetNumModes();
1049 ASSERTL0(
false,
"eid must be between 0 and 2");
1061 Array<OneD, unsigned int>& maparray,
1062 Array<OneD, int>& signarray)
1066 "Mapping not defined for this type of basis");
1068 const int nummodes1 =
m_base[1]->GetNumModes();
1071 if(maparray.num_elements() != nEdgeIntCoeffs)
1073 maparray = Array<OneD, unsigned int>(nEdgeIntCoeffs);
1076 if(signarray.num_elements() != nEdgeIntCoeffs)
1078 signarray = Array<OneD, int>(nEdgeIntCoeffs,1);
1082 fill( signarray.get() , signarray.get()+nEdgeIntCoeffs, 1 );
1089 int cnt = 2*nummodes1 - 1;
1090 for(i = 0; i < nEdgeIntCoeffs; cnt+=nummodes1-2-i, ++i)
1097 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1106 for(i = 0; i < nEdgeIntCoeffs; i++)
1108 maparray[i] = nummodes1+1+i;
1113 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1122 for(i = 0; i < nEdgeIntCoeffs; i++)
1129 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1138 ASSERTL0(
false,
"eid must be between 0 and 2");
1148 "Expansion not of a proper type");
1152 int nummodes0, nummodes1;
1159 nummodes0 =
m_base[0]->GetNumModes();
1160 nummodes1 =
m_base[1]->GetNumModes();
1162 startvalue = 2*nummodes1;
1164 for(i = 0; i < nummodes0-2; i++)
1166 for(j = 0; j < nummodes1-3-i; j++)
1168 outarray[cnt++]=startvalue+j;
1170 startvalue+=nummodes1-2-i;
1178 "Expansion not of expected type");
1181 int nummodes0, nummodes1;
1189 nummodes0 =
m_base[0]->GetNumModes();
1190 nummodes1 =
m_base[1]->GetNumModes();
1192 value = 2*nummodes1-1;
1193 for(i = 0; i < value; i++)
1199 for(i = 0; i < nummodes0-2; i++)
1201 outarray[cnt++]=value;
1202 value += nummodes1-2-i;
1241 const Array<OneD, const NekDouble> &inarray,
1242 Array<OneD, NekDouble> &outarray,
1249 const Array<OneD, const NekDouble> &inarray,
1250 Array<OneD, NekDouble> &outarray,
1259 const Array<OneD, const NekDouble> &inarray,
1260 Array<OneD, NekDouble> &outarray,
1264 k1,k2,inarray,outarray,mkey);
1269 const Array<OneD, const NekDouble> &inarray,
1270 Array<OneD, NekDouble> &outarray,
1277 const Array<OneD, const NekDouble> &inarray,
1278 Array<OneD, NekDouble> &outarray,
1288 int qa =
m_base[0]->GetNumPoints();
1289 int qb =
m_base[1]->GetNumPoints();
1290 int nmodes_a =
m_base[0]->GetNumModes();
1291 int nmodes_b =
m_base[1]->GetNumModes();
1301 Array<OneD, NekDouble> orthocoeffs(OrthoExp.
GetNcoeffs());
1308 int nmodes = min(nmodes_a,nmodes_b);
1314 OrthoExp.
FwdTrans(array,orthocoeffs);
1318 for(j = 0; j < nmodes_a; ++j)
1320 for(k = 0; k < nmodes_b-j; ++k)
1324 orthocoeffs[cnt] *= (1.0+SvvDiffCoeff*exp(-(j+k-nmodes)*(j+k-nmodes)/((
NekDouble)((j+k-cutoff+epsilon)*(j+k-cutoff+epsilon)))));
1331 OrthoExp.
BwdTrans(orthocoeffs,array);
1336 const Array<OneD, const NekDouble> &inarray,
1337 Array<OneD, NekDouble> &outarray)
1339 int n_coeffs = inarray.num_elements();
1340 int nquad0 =
m_base[0]->GetNumPoints();
1341 int nquad1 =
m_base[1]->GetNumPoints();
1342 Array<OneD, NekDouble> coeff(n_coeffs);
1343 Array<OneD, NekDouble> coeff_tmp(n_coeffs,0.0);
1344 Array<OneD, NekDouble> tmp;
1345 Array<OneD, NekDouble> tmp2;
1346 int nqtot = nquad0*nquad1;
1347 Array<OneD, NekDouble> phys_tmp(nqtot,0.0);
1349 int nmodes0 =
m_base[0]->GetNumModes();
1350 int nmodes1 =
m_base[1]->GetNumModes();
1351 int numMax = nmodes0;
1352 int numMin2 = nmodes0;
1374 m_TriExp ->BwdTrans(inarray,phys_tmp);
1375 m_OrthoTriExp->FwdTrans(phys_tmp, coeff);
1377 for (i = 0; i < n_coeffs; i++)
1382 numMin += numMin2 - 1;
1387 m_OrthoTriExp->BwdTrans(coeff,phys_tmp);
1388 m_TriExp ->FwdTrans(phys_tmp, outarray);
1393 const Array<OneD, const NekDouble> &inarray,
1394 Array<OneD, NekDouble> &outarray,
1399 if(inarray.get() == outarray.get())
1405 m_ncoeffs, tmp.get(), 1, 0.0, outarray.get(), 1);
1410 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
1419 const Array<OneD, const NekDouble>& inarray,
1420 Array<OneD, NekDouble> &outarray)
1423 int nquad0 =
m_base[0]->GetNumPoints();
1424 int nquad1 =
m_base[1]->GetNumPoints();
1426 const Array<OneD, const NekDouble>& w0 =
m_base[0]->GetW();
1427 const Array<OneD, const NekDouble>& w1 =
m_base[1]->GetW();
1428 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
1431 for(i = 0; i < nquad1; ++i)
1434 w0.get(),1, outarray.get()+i*nquad0,1);
1442 for(i = 0; i < nquad1; ++i)
1444 Blas::Dscal(nquad0,0.5*(1-z1[i])*w1[i],
1445 outarray.get()+i*nquad0,1);
1451 for(i = 0; i < nquad1; ++i)
1453 Blas::Dscal(nquad0,0.5*w1[i],outarray.get()+i*nquad0,1);
1458 ASSERTL0(
false,
"Unsupported quadrature points type.");