55 StdExpansion (Ba.GetNumModes()*Bb.GetNumModes(),2,Ba,Bb),
77 const Array<OneD, const NekDouble>& inarray)
79 Array<OneD, const NekDouble> w0 =
m_base[0]->GetW();
80 Array<OneD, const NekDouble> w1 =
m_base[1]->GetW();
96 Array<OneD, NekDouble> &out_d0,
97 Array<OneD, NekDouble> &out_d1,
98 Array<OneD, NekDouble> &out_d2)
104 const Array<OneD, const NekDouble>& inarray,
105 Array<OneD, NekDouble> &outarray)
121 ASSERTL1(
false,
"input dir is out of range");
128 Array<OneD, NekDouble> &out_d0,
129 Array<OneD, NekDouble> &out_d1,
130 Array<OneD, NekDouble> &out_d2)
137 const Array<OneD, const NekDouble>& inarray,
138 Array<OneD, NekDouble> &outarray)
151 Array<OneD, NekDouble> &outarray)
153 if(
m_base[0]->Collocation() &&
m_base[1]->Collocation())
156 inarray, 1, outarray, 1);
165 const Array<OneD, const NekDouble>& inarray,
166 Array<OneD, NekDouble> &outarray)
169 m_base[1]->GetNumModes());
173 inarray,outarray,wsp,
true,
true);
187 const Array<OneD, const NekDouble>& base0,
188 const Array<OneD, const NekDouble>& base1,
189 const Array<OneD, const NekDouble>& inarray,
190 Array<OneD, NekDouble> &outarray,
191 Array<OneD, NekDouble> &wsp,
192 bool doCheckCollDir0,
193 bool doCheckCollDir1)
195 int nquad0 =
m_base[0]->GetNumPoints();
196 int nquad1 =
m_base[1]->GetNumPoints();
197 int nmodes0 =
m_base[0]->GetNumModes();
198 int nmodes1 =
m_base[1]->GetNumModes();
200 bool colldir0 = doCheckCollDir0?(
m_base[0]->Collocation()):
false;
201 bool colldir1 = doCheckCollDir1?(
m_base[1]->Collocation()):
false;
203 if(colldir0 && colldir1)
209 Blas::Dgemm(
'N',
'T', nquad0, nquad1,nmodes1, 1.0, &inarray[0], nquad0,
210 base1.get(), nquad1, 0.0, &outarray[0], nquad0);
214 Blas::Dgemm(
'N',
'N', nquad0,nmodes1,nmodes0,1.0, base0.get(),
215 nquad0, &inarray[0], nmodes0,0.0,&outarray[0], nquad0);
219 ASSERTL1(wsp.num_elements()>=nquad0*nmodes1,
"Workspace size is not sufficient");
223 Blas::Dgemm(
'N',
'N', nquad0,nmodes1,nmodes0,1.0, base0.get(),
224 nquad0, &inarray[0], nmodes0,0.0,&wsp[0], nquad0);
225 Blas::Dgemm(
'N',
'T', nquad0, nquad1,nmodes1, 1.0, &wsp[0], nquad0,
226 base1.get(), nquad1, 0.0, &outarray[0], nquad0);
232 Array<OneD, NekDouble> &outarray)
234 if((
m_base[0]->Collocation())&&(
m_base[1]->Collocation()))
255 const Array<OneD, const NekDouble>& inarray,
256 Array<OneD, NekDouble> &outarray)
258 if((
m_base[0]->Collocation())&&(
m_base[1]->Collocation()))
265 int npoints[2] = {
m_base[0]->GetNumPoints(),
266 m_base[1]->GetNumPoints()};
267 int nmodes[2] = {
m_base[0]->GetNumModes(),
268 m_base[1]->GetNumModes()};
270 fill(outarray.get(), outarray.get()+
m_ncoeffs, 0.0 );
272 Array<OneD, NekDouble> physEdge[4];
273 Array<OneD, NekDouble> coeffEdge[4];
274 for(i = 0; i < 4; i++)
276 physEdge[i] = Array<OneD, NekDouble>(npoints[i%2]);
277 coeffEdge[i] = Array<OneD, NekDouble>(nmodes[i%2]);
280 for(i = 0; i < npoints[0]; i++)
282 physEdge[0][i] = inarray[i];
283 physEdge[2][i] = inarray[npoints[0]*npoints[1]-1-i];
286 for(i = 0; i < npoints[1]; i++)
288 physEdge[1][i] = inarray[npoints[0]-1+i*npoints[0]];
289 physEdge[3][i] = inarray[(npoints[1]-1)*npoints[0]-i*npoints[0]];
295 Array<OneD, unsigned int> mapArray;
296 Array<OneD, int> signArray;
299 for(i = 0; i < 4; i++)
301 segexp[i%2]->FwdTrans_BndConstrained(physEdge[i],coeffEdge[i]);
304 for(j=0; j < nmodes[i%2]; j++)
307 outarray[ mapArray[j] ] = sign * coeffEdge[i][j];
326 int nInteriorDofs =
m_ncoeffs - nBoundaryDofs;
329 Array<OneD, NekDouble> rhs(nInteriorDofs);
330 Array<OneD, NekDouble> result(nInteriorDofs);
334 for(i = 0; i < nInteriorDofs; i++)
336 rhs[i] = tmp1[ mapArray[i] ];
339 Blas::Dgemv(
'N',nInteriorDofs,nInteriorDofs,1.0, &(matsys->GetPtr())[0],
340 nInteriorDofs,rhs.get(),1,0.0,result.get(),1);
342 for(i = 0; i < nInteriorDofs; i++)
344 outarray[ mapArray[i] ] = result[i];
380 const Array<OneD, const NekDouble>& inarray,
381 Array<OneD, NekDouble> &outarray)
383 if(
m_base[0]->Collocation() &&
m_base[1]->Collocation())
395 const Array<OneD, const NekDouble>& inarray,
396 Array<OneD, NekDouble> &outarray)
398 int nquad0 =
m_base[0]->GetNumPoints();
399 int nquad1 =
m_base[1]->GetNumPoints();
400 int order0 =
m_base[0]->GetNumModes();
402 Array<OneD,NekDouble> tmp(nquad0*nquad1+nquad1*order0);
403 Array<OneD,NekDouble> wsp(tmp+nquad0*nquad1);
410 tmp,outarray,wsp,
true,
true);
414 const Array<OneD, const NekDouble>& inarray,
415 Array<OneD, NekDouble> &outarray)
421 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
422 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
426 const Array<OneD, const NekDouble>& inarray,
427 Array<OneD, NekDouble> & outarray)
433 const Array<OneD, const NekDouble>& inarray,
434 Array<OneD, NekDouble> &outarray)
436 ASSERTL0((dir==0)||(dir==1),
"input dir is out of range");
438 int nquad0 =
m_base[0]->GetNumPoints();
439 int nquad1 =
m_base[1]->GetNumPoints();
440 int nqtot = nquad0*nquad1;
441 int order0 =
m_base[0]->GetNumModes();
443 Array<OneD,NekDouble> tmp(nqtot+nquad1*order0);
444 Array<OneD,NekDouble> wsp(tmp+nqtot);
453 tmp,outarray,wsp,
true,
false);
459 tmp,outarray,wsp,
false,
true);
464 const Array<OneD, const NekDouble>& inarray,
465 Array<OneD, NekDouble> &outarray)
467 ASSERTL0((dir==0)||(dir==1),
"input dir is out of range");
484 Blas::Dgemv(
'N',
m_ncoeffs,nq,1.0,iprodmat->GetPtr().get(),
485 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
499 const Array<OneD, const NekDouble>& base0,
500 const Array<OneD, const NekDouble>& base1,
501 const Array<OneD, const NekDouble>& inarray,
502 Array<OneD, NekDouble> &outarray,
503 Array<OneD, NekDouble> &wsp,
504 bool doCheckCollDir0,
505 bool doCheckCollDir1)
507 int nquad0 =
m_base[0]->GetNumPoints();
508 int nquad1 =
m_base[1]->GetNumPoints();
509 int nmodes0 =
m_base[0]->GetNumModes();
510 int nmodes1 =
m_base[1]->GetNumModes();
512 bool colldir0 = doCheckCollDir0?(
m_base[0]->Collocation()):
false;
513 bool colldir1 = doCheckCollDir1?(
m_base[1]->Collocation()):
false;
515 if(colldir0 && colldir1)
521 Blas::Dgemm(
'N',
'N',nmodes0,nmodes1, nquad1,1.0, inarray.get(),
522 nmodes0, base1.get(), nquad1, 0.0,outarray.get(),nmodes0);
526 Blas::Dgemm(
'T',
'N',nmodes0,nquad1,nquad0,1.0,base0.get(),
527 nquad0,inarray.get(),nquad0,0.0,outarray.get(),nmodes0);
531 ASSERTL1(wsp.num_elements()>=nquad1*nmodes0,
"Workspace size is not sufficient");
534 Blas::Dgemm(
'T',
'N',nmodes0,nquad1,nquad0,1.0,base0.get(),
535 nquad0,inarray.get(),nquad0,0.0,wsp.get(),nmodes0);
538 for(
int i = 0; i < nmodes0; ++i)
540 for(
int j = 0; j < nquad1; ++j)
543 base0.get()+i*nquad0,1,
544 inarray.get()+j*nquad0,1);
548 Blas::Dgemm(
'N',
'N',nmodes0,nmodes1, nquad1,1.0, wsp.get(),
549 nmodes0, base1.get(), nquad1, 0.0,outarray.get(),nmodes0);
559 Array<OneD, NekDouble>& eta)
572 Array<OneD, NekDouble> &outarray)
575 int nquad0 =
m_base[0]->GetNumPoints();
576 int nquad1 =
m_base[1]->GetNumPoints();
577 Array<OneD, const NekDouble> base0 =
m_base[0]->GetBdata();
578 Array<OneD, const NekDouble> base1 =
m_base[1]->GetBdata();
579 int btmp0 =
m_base[0]->GetNumModes();
580 int mode0 = mode%btmp0;
581 int mode1 = mode/btmp0;
584 ASSERTL2(mode1 == (
int)floor((1.0*mode)/btmp0),
585 "Integer Truncation not Equiv to Floor");
588 "calling argument mode is larger than total expansion order");
590 for(i = 0; i < nquad1; ++i)
593 1, &outarray[0]+i*nquad0,1);
596 for(i = 0; i < nquad0; ++i)
599 &outarray[0]+i,nquad0,&outarray[0]+i,nquad0);
619 ASSERTL2((i >= 0)&&(i <= 3),
"edge id is out of range");
621 if((i == 0)||(i == 2))
633 ASSERTL2((i >= 0)&&(i <= 3),
"edge id is out of range");
635 if((i == 0)||(i == 2))
647 ASSERTL2((i >= 0)&&(i <= 3),
"edge id is out of range");
649 if((i == 0)||(i == 2))
661 ASSERTL2((edge >= 0)&&(edge <= 3),
"edge id is out of range");
663 if((edge == 0)||(edge == 2))
675 ASSERTL2((i >= 0)&&(i <= 3),
"edge id is out of range");
677 if((i == 0)||(i == 2))
699 "BasisType is not a boundary interior form");
703 "BasisType is not a boundary interior form");
713 "BasisType is not a boundary interior form");
717 "BasisType is not a boundary interior form");
723 const std::vector<unsigned int> &nummodes,
726 int nmodes = nummodes[modes_offset]*nummodes[modes_offset+1];
734 bool returnval =
false;
750 Array<OneD, NekDouble> &coords_1,
751 Array<OneD, NekDouble> &coords_2)
753 Array<OneD, const NekDouble> z0 =
m_base[0]->GetZ();
754 Array<OneD, const NekDouble> z1 =
m_base[1]->GetZ();
759 for(i = 0; i < nq1; ++i)
761 Blas::Dcopy(nq0,z0.get(), 1,&coords_0[0] + i*nq0,1);
774 int nummodes0, nummodes1;
775 int value1 = 0, value2 = 0;
781 nummodes0 =
m_base[0]->GetNumModes();
782 nummodes1 =
m_base[1]->GetNumModes();
794 value1 = 2*nummodes0;
797 ASSERTL0(0,
"Mapping array is not defined for this expansion");
801 for(i = 0; i < value1; i++)
811 value2 = value1+nummodes0-1;
817 ASSERTL0(0,
"Mapping array is not defined for this expansion");
821 for(i = 0; i < nummodes1-2; i++)
823 outarray[cnt++]=value1+i*nummodes0;
824 outarray[cnt++]=value2+i*nummodes0;
830 for(i = nummodes0*(nummodes1-1);i <
GetNcoeffs(); i++)
841 int nummodes0, nummodes1;
848 nummodes0 =
m_base[0]->GetNumModes();
849 nummodes1 =
m_base[1]->GetNumModes();
857 startvalue = nummodes0;
860 startvalue = 2*nummodes0;
863 ASSERTL0(0,
"Mapping array is not defined for this expansion");
876 ASSERTL0(0,
"Mapping array is not defined for this expansion");
880 for(i = 0; i < nummodes1-2; i++)
882 for(j = 0; j < nummodes0-2; j++)
884 outarray[cnt++]=startvalue+j;
886 startvalue+=nummodes0;
894 if(useCoeffPacking ==
true)
896 switch(localVertexId)
907 localDOF =
m_base[0]->GetNumModes()-1;
919 localDOF =
m_base[0]->GetNumModes() * (
m_base[1]->GetNumModes()-1);
923 localDOF =
m_base[0]->GetNumModes();
931 localDOF =
m_base[0]->GetNumModes()*
m_base[1]->GetNumModes()-1;
935 localDOF =
m_base[0]->GetNumModes()+1;
940 ASSERTL0(
false,
"eid must be between 0 and 3");
947 switch(localVertexId)
958 localDOF =
m_base[0]->GetNumModes()-1;
970 localDOF =
m_base[0]->GetNumModes()*
m_base[1]->GetNumModes()-1;
974 localDOF =
m_base[0]->GetNumModes()+1;
982 localDOF =
m_base[0]->GetNumModes() * (
m_base[1]->GetNumModes()-1);
986 localDOF =
m_base[0]->GetNumModes();
991 ASSERTL0(
false,
"eid must be between 0 and 3");
1000 Array<OneD, unsigned int> &maparray,
1001 Array<OneD, int> &signarray)
1004 const int nummodes0 =
m_base[0]->GetNumModes();
1005 const int nummodes1 =
m_base[1]->GetNumModes();
1009 if(maparray.num_elements() != nEdgeIntCoeffs)
1011 maparray = Array<OneD, unsigned int>(nEdgeIntCoeffs);
1014 if(signarray.num_elements() != nEdgeIntCoeffs)
1016 signarray = Array<OneD, int>(nEdgeIntCoeffs,1);
1020 fill( signarray.get() , signarray.get()+nEdgeIntCoeffs, 1 );
1029 for(i = 0; i < nEdgeIntCoeffs; i++)
1036 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1045 for(i = 0; i < nEdgeIntCoeffs; i++)
1047 maparray[i] = (i+2)*nummodes0 + 1;
1052 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1061 for(i = 0; i < nEdgeIntCoeffs; i++)
1063 maparray[i] = nummodes0+i+2;
1068 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1077 for(i = 0; i < nEdgeIntCoeffs; i++)
1079 maparray[i] = (i+2)*nummodes0;
1084 for(i = 1; i < nEdgeIntCoeffs; i+=2)
1092 ASSERTL0(
false,
"eid must be between 0 and 3");
1102 for(i = 0; i < nEdgeIntCoeffs; i++)
1110 for(i = 0; i < nEdgeIntCoeffs; i++)
1112 maparray[i] = (i+2)*nummodes0 - 1;
1118 for(i = 0; i < nEdgeIntCoeffs; i++)
1120 maparray[i] = nummodes0*nummodes1 - 2 - i;
1126 for(i = 0; i < nEdgeIntCoeffs; i++)
1128 maparray[i] = nummodes0*(nummodes1-2-i);
1133 ASSERTL0(
false,
"eid must be between 0 and 3");
1138 reverse( maparray.get() , maparray.get()+nEdgeIntCoeffs );
1143 ASSERTL0(
false,
"Mapping not defined for this type of basis");
1150 Array<OneD, unsigned int> &maparray,
1151 Array<OneD, int> &signarray)
1154 const int nummodes0 =
m_base[0]->GetNumModes();
1155 const int nummodes1 =
m_base[1]->GetNumModes();
1159 if(maparray.num_elements() != nEdgeCoeffs)
1161 maparray = Array<OneD, unsigned int>(nEdgeCoeffs);
1164 if(signarray.num_elements() != nEdgeCoeffs)
1166 signarray = Array<OneD, int>(nEdgeCoeffs,1);
1170 fill( signarray.get() , signarray.get()+nEdgeCoeffs, 1 );
1179 for(i = 0; i < nEdgeCoeffs; i++)
1186 swap( maparray[0] , maparray[1] );
1188 for(i = 3; i < nEdgeCoeffs; i+=2)
1197 for(i = 0; i < nEdgeCoeffs; i++)
1199 maparray[i] = i*nummodes0 + 1;
1204 swap( maparray[0] , maparray[1] );
1206 for(i = 3; i < nEdgeCoeffs; i+=2)
1215 for(i = 0; i < nEdgeCoeffs; i++)
1217 maparray[i] = nummodes0+i;
1222 swap( maparray[0] , maparray[1] );
1224 for(i = 3; i < nEdgeCoeffs; i+=2)
1233 for(i = 0; i < nEdgeCoeffs; i++)
1235 maparray[i] = i*nummodes0;
1240 swap( maparray[0] , maparray[1] );
1242 for(i = 3; i < nEdgeCoeffs; i+=2)
1250 ASSERTL0(
false,
"eid must be between 0 and 3");
1261 for(i = 0; i < nEdgeCoeffs; i++)
1269 for(i = 0; i < nEdgeCoeffs; i++)
1271 maparray[i] = (i+1)*nummodes0 - 1;
1277 for(i = 0; i < nEdgeCoeffs; i++)
1279 maparray[i] = nummodes0*nummodes1 - 1 - i;
1285 for(i = 0; i < nEdgeCoeffs; i++)
1287 maparray[i] = nummodes0*(nummodes1-1-i);
1292 ASSERTL0(
false,
"eid must be between 0 and 3");
1297 reverse( maparray.get() , maparray.get()+nEdgeCoeffs );
1302 ASSERTL0(
false,
"Mapping not defined for this type of basis");
1323 int nq0 =
m_base[0]->GetNumPoints();
1324 int nq1 =
m_base[1]->GetNumPoints();
1325 int nq = max(nq0,nq1);
1328 Array<OneD, Array<OneD, NekDouble> > coords(neq);
1329 Array<OneD, NekDouble> coll (2);
1330 Array<OneD, DNekMatSharedPtr> I (2);
1331 Array<OneD, NekDouble> tmp (nq0);
1337 for(
int i = 0; i < nq; ++i)
1339 for(
int j = 0; j < nq; ++j,++cnt)
1341 coords[cnt] = Array<OneD, NekDouble>(2);
1342 coords[cnt][0] = -1.0 + 2*j/(
NekDouble)(nq-1);
1343 coords[cnt][1] = -1.0 + 2*i/(
NekDouble)(nq-1);
1347 for(
int i = 0; i < neq; ++i)
1351 I[0] =
m_base[0]->GetI(coll);
1352 I[1] =
m_base[1]->GetI(coll+1);
1355 for (
int j = 0; j < nq1; ++j)
1361 Mat->GetRawPtr()+j*nq0*neq+i,neq);
1374 for(i = 0; i < order1; ++i)
1376 (*Mat)(order0*i+1,i*order0+1) = 1.0;
1382 for(i = 0; i < order0; ++i)
1384 (*Mat)(order0+i ,order0+i) = 1.0;
1397 (*Mat) = Imass*Iprod;
1405 int dir = (edge + 1) % 2;
1406 int nCoeffs =
m_base[dir]->GetNumModes();
1413 Array<OneD, NekDouble> coords(1, 0.0);
1414 coords[0] = (edge == 0 || edge == 3) ? -1.0 : 1.0;
1422 Vmath::Vcopy(nCoeffs, m_Ix->GetPtr(), 1, Mat->GetPtr(), 1);
1445 const Array<OneD, const NekDouble> &inarray,
1446 Array<OneD,NekDouble> &outarray,
1452 if(inarray.get() == outarray.get())
1458 m_ncoeffs, tmp.get(), 1, 0.0, outarray.get(), 1);
1463 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
1472 int qa =
m_base[0]->GetNumPoints();
1473 int qb =
m_base[1]->GetNumPoints();
1474 int nmodes_a =
m_base[0]->GetNumModes();
1475 int nmodes_b =
m_base[1]->GetNumModes();
1484 Array<OneD, NekDouble> orthocoeffs(OrthoExp.
GetNcoeffs());
1493 OrthoExp.
FwdTrans(array,orthocoeffs);
1497 int nmodes = min(nmodes_a,nmodes_b);
1500 for(j = 0; j < nmodes_a; ++j)
1502 for(k = 0; k < nmodes_b; ++k)
1506 orthocoeffs[j*nmodes_b+k] *=
1507 (1.0+SvvDiffCoeff*exp(-(j+k-nmodes)*(j+k-nmodes)/
1516 OrthoExp.
BwdTrans(orthocoeffs,array);
1521 const Array<OneD, const NekDouble> &inarray,
1522 Array<OneD, NekDouble> &outarray)
1524 int n_coeffs = inarray.num_elements();
1527 Array<OneD, NekDouble> coeff(n_coeffs);
1528 Array<OneD, NekDouble> coeff_tmp(n_coeffs,0.0);
1529 Array<OneD, NekDouble> tmp;
1530 Array<OneD, NekDouble> tmp2;
1532 int nmodes0 =
m_base[0]->GetNumModes();
1533 int nmodes1 =
m_base[1]->GetNumModes();
1534 int numMax = nmodes0;
1550 b0, b1, coeff_tmp, bortho0, bortho1, coeff);
1555 for (
int i = 0; i < numMin+1; ++i)
1559 tmp2 = coeff_tmp+cnt,1);
1565 bortho0, bortho1, coeff_tmp, b0, b1, outarray);
1570 const Array<OneD, const NekDouble> &inarray,
1571 Array<OneD,NekDouble> &outarray,
1578 const Array<OneD, const NekDouble> &inarray,
1579 Array<OneD,NekDouble> &outarray,
1586 const Array<OneD, const NekDouble> &inarray,
1587 Array<OneD,NekDouble> &outarray,
1594 const Array<OneD, const NekDouble> &inarray,
1595 Array<OneD,NekDouble> &outarray,
1602 Array<OneD,NekDouble> &outarray,
1610 const Array<OneD, const NekDouble> &inarray,
1611 Array<OneD, NekDouble> &outarray)
1614 int nquad0 =
m_base[0]->GetNumPoints();
1615 int nquad1 =
m_base[1]->GetNumPoints();
1617 const Array<OneD, const NekDouble>& w0 =
m_base[0]->GetW();
1618 const Array<OneD, const NekDouble>& w1 =
m_base[1]->GetW();
1621 for(i = 0; i < nquad1; ++i)
1624 w0.get(),1,outarray.get()+i*nquad0,1);
1627 for(i = 0; i < nquad0; ++i)
1629 Vmath::Vmul(nquad1,outarray.get()+i,nquad0,w1.get(),1,
1630 outarray.get()+i,nquad0);
1635 Array<OneD, int> &conn,
1638 int np1 =
m_base[0]->GetNumPoints();
1639 int np2 =
m_base[1]->GetNumPoints();
1640 int np = max(np1,np2);
1642 conn = Array<OneD, int>(6*(np-1)*(np-1));
1647 for(
int i = 0; i < np-1; ++i)
1650 for(
int j = 0; j < np-1; ++j)
1652 conn[cnt++] = row +j;
1653 conn[cnt++] = row +j+1;
1654 conn[cnt++] = rowp1 +j;
1656 conn[cnt++] = rowp1 +j+1;
1657 conn[cnt++] = rowp1 +j;
1658 conn[cnt++] = row +j+1;