43 namespace LocalRegions
59 StdExpansion(Ba.GetNumModes(), 1, Ba),
60 StdExpansion1D(Ba.GetNumModes(), Ba),
61 StdRegions::StdSegExp(Ba),
65 boost::bind(&
SegExp::CreateMatrix, this, _1),
66 std::string(
"SegExpMatrix")),
67 m_staticCondMatrixManager(
68 boost::bind(&
SegExp::CreateStaticCondMatrix, this, _1),
69 std::string(
"SegExpStaticCondMatrix"))
81 StdRegions::StdSegExp(S),
84 m_matrixManager(S.m_matrixManager),
85 m_staticCondMatrixManager(S.m_staticCondMatrixManager)
117 const Array<OneD, const NekDouble>& inarray)
119 int nquad0 =
m_base[0]->GetNumPoints();
122 Array<OneD,NekDouble> tmp(nquad0);
165 const Array<OneD, const NekDouble>& inarray,
166 Array<OneD,NekDouble> &out_d0,
167 Array<OneD,NekDouble> &out_d1,
168 Array<OneD,NekDouble> &out_d2)
170 int nquad0 =
m_base[0]->GetNumPoints();
171 Array<TwoD, const NekDouble> gmat =
173 Array<OneD,NekDouble> diff(nquad0);
179 if(out_d0.num_elements())
185 if(out_d1.num_elements())
191 if(out_d2.num_elements())
199 if(out_d0.num_elements())
205 if(out_d1.num_elements())
211 if(out_d2.num_elements())
228 const Array<OneD, const NekDouble>& inarray,
229 Array<OneD,NekDouble> &out_ds)
231 int nquad0 =
m_base[0]->GetNumPoints();
232 int coordim =
m_geom->GetCoordim();
233 Array<OneD, NekDouble> diff (nquad0);
240 Array<OneD,NekDouble> diff(nquad0);
268 const Array<OneD, const NekDouble>& inarray,
269 Array<OneD, NekDouble>& out_dn)
271 int nquad0 =
m_base[0]->GetNumPoints();
272 Array<TwoD, const NekDouble> gmat =
274 int coordim =
m_geom->GetCoordim();
275 Array<OneD, NekDouble> out_dn_tmp(nquad0,0.0);
280 Array<OneD, NekDouble> inarray_d0(nquad0);
281 Array<OneD, NekDouble> inarray_d1(nquad0);
284 Array<OneD, Array<OneD, NekDouble> > normals;
285 normals = Array<OneD, Array<OneD, NekDouble> >(coordim);
287 for(
int k=0; k<coordim; ++k)
289 normals[k]= Array<OneD, NekDouble>(nquad0);
294 for(
int i=0; i<nquad0; i++)
296 cout<<
"nx= "<<normals[0][i]<<
" ny="<<normals[1][i]<<endl;
299 "normal vectors do not exist: check if a"
300 "boundary region is defined as I ");
302 Vmath::Vmul(nquad0,normals[0],1,inarray_d0,1,out_dn_tmp,1);
303 Vmath::Vadd(nquad0,out_dn_tmp,1,out_dn,1,out_dn,1);
305 Vmath::Vmul(nquad0,normals[1],1,inarray_d1,1,out_dn_tmp,1);
306 Vmath::Vadd(nquad0,out_dn_tmp,1,out_dn,1,out_dn,1);
308 for(
int i=0; i<nquad0; i++)
310 cout<<
"deps/dx ="<<inarray_d0[i]<<
" deps/dy="<<inarray_d1[i]<<endl;
318 const Array<OneD, const NekDouble>& inarray,
319 Array<OneD, NekDouble> &outarray)
343 ASSERTL1(
false,
"input dir is out of range");
376 const Array<OneD, const NekDouble>& inarray,
377 Array<OneD,NekDouble> &outarray)
379 if (
m_base[0]->Collocation())
400 const Array<OneD, const NekDouble>& inarray,
401 Array<OneD, NekDouble> &outarray)
403 if(
m_base[0]->Collocation())
432 ASSERTL0(
false,
"This type of FwdTrans is not defined"
433 "for this expansion type");
436 fill(outarray.get(), outarray.get()+
m_ncoeffs, 0.0 );
443 inarray[
m_base[0]->GetNumPoints()-1];
466 Blas::Dgemv(
'N',nInteriorDofs,nInteriorDofs,
468 &((matsys->GetOwnedMatrix())->GetPtr())[0],
469 nInteriorDofs,tmp1.get()+offset,1,0.0,
470 outarray.get()+offset,1);
502 const Array<OneD, const NekDouble>& inarray,
503 Array<OneD, NekDouble> &outarray)
537 const Array<OneD, const NekDouble>& base,
538 const Array<OneD, const NekDouble>& inarray,
539 Array<OneD, NekDouble> &outarray,
542 int nquad0 =
m_base[0]->GetNumPoints();
544 Array<OneD,NekDouble> tmp(nquad0);
562 const Array<OneD, const NekDouble>& inarray,
563 Array<OneD, NekDouble> & outarray)
565 int nquad =
m_base[0]->GetNumPoints();
566 const Array<TwoD, const NekDouble>& gmat =
569 Array<OneD, NekDouble> tmp1(nquad);
581 Vmath::Smul(nquad, gmat[0][0], inarray, 1, tmp1, 1);
593 Vmath::Smul(nquad, gmat[1][0], inarray, 1, tmp1, 1);
606 Vmath::Smul(nquad, gmat[2][0], inarray, 1, tmp1, 1);
612 ASSERTL1(
false,
"input dir is out of range");
620 const Array<OneD, const NekDouble> &Fx,
621 const Array<OneD, const NekDouble> &Fy,
622 Array<OneD, NekDouble> &outarray)
624 int nq =
m_base[0]->GetNumPoints();
625 Array<OneD, NekDouble > Fn(nq);
629 const Array<OneD, const Array<OneD, NekDouble> >
633 Vmath::Vmul (nq, &Fx[0], 1, &normals[0][0], 1, &Fn[0], 1);
634 Vmath::Vvtvp(nq, &Fy[0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
650 const Array<OneD, const NekDouble> &Lcoord,
651 const Array<OneD, const NekDouble> &physvals)
658 const Array<OneD, const NekDouble>& coord,
659 const Array<OneD, const NekDouble> &physvals)
661 Array<OneD,NekDouble> Lcoord = Array<OneD,NekDouble>(1);
664 m_geom->GetLocCoords(coord,Lcoord);
671 const Array<OneD, const NekDouble>& Lcoords,
672 Array<OneD,NekDouble> &coords)
676 ASSERTL1(Lcoords[0] >= -1.0&& Lcoords[0] <= 1.0,
677 "Local coordinates are not in region [-1,1]");
680 for(i = 0; i <
m_geom->GetCoordim(); ++i)
682 coords[i] =
m_geom->GetCoord(i,Lcoords);
687 Array<OneD, NekDouble> &coords_0,
688 Array<OneD, NekDouble> &coords_1,
689 Array<OneD, NekDouble> &coords_2)
697 const Array<OneD, const NekDouble> &inarray,
700 int nquad =
m_base[0]->GetNumPoints();
707 outarray = inarray[0];
710 outarray = inarray[nquad - 1];
725 outarray =
Blas::Ddot(nquad, mat_gauss->GetOwnedMatrix()
726 ->GetPtr().get(), 1, &inarray[0], 1);
736 Array<OneD, NekDouble> &coeffs,
744 Array<OneD, const NekDouble> &inarray,
745 Array<OneD, NekDouble> &outarray)
750 if (&inarray[0] != &outarray[0])
752 Array<OneD,NekDouble> intmp (inarray);
764 return m_geom->GetPorient(point);
770 return m_geom->GetCoordim();
816 const std::vector<unsigned int > &nummodes,
817 const int mode_offset,
824 int fillorder = min((
int) nummodes[mode_offset],
m_ncoeffs);
835 nummodes[mode_offset],
838 p0,data,
m_base[0]->GetPointsKey(), coeffs);
846 nummodes[mode_offset],
849 p0,data,
m_base[0]->GetPointsKey(), coeffs);
854 "basis is either not set up or not hierarchicial");
864 const Array<TwoD, const NekDouble> &gmat =
866 int nqe =
m_base[0]->GetNumPoints();
870 Array<OneD, Array<OneD, NekDouble> >(vCoordDim);
871 Array<OneD, Array<OneD, NekDouble> > &normal =
873 for (i = 0; i < vCoordDim; ++i)
875 normal[i] = Array<OneD, NekDouble>(nqe);
887 for(i = 0; i < vCoordDim; ++i)
893 for(i = 0; i < vCoordDim; ++i)
900 "point is out of range (point < 2)");
905 for (i =0 ; i < vCoordDim; ++i)
907 vert += normal[i][0]*normal[i][0];
909 vert = 1.0/sqrt(vert);
910 for (i = 0; i < vCoordDim; ++i)
912 Vmath::Smul(nqe, vert, normal[i], 1, normal[i], 1);
923 const Array<OneD, const NekDouble> &inarray,
924 Array<OneD, NekDouble> &outarray,
927 int nquad =
m_base[0]->GetNumPoints();
928 const Array<TwoD, const NekDouble>& gmat =
931 Array<OneD,NekDouble> physValues(nquad);
932 Array<OneD,NekDouble> dPhysValuesdx(nquad);
937 switch (
m_geom->GetCoordim())
947 &gmat[0][0],1,dPhysValuesdx.get(),1,
948 dPhysValuesdx.get(),1);
953 gmat[0][0], dPhysValuesdx.get(), 1);
959 Array<OneD,NekDouble> dPhysValuesdy(nquad);
961 PhysDeriv(physValues,dPhysValuesdx,dPhysValuesdy);
967 &gmat[0][0],1,dPhysValuesdx.get(),1,
968 dPhysValuesdx.get(),1);
970 &gmat[1][0],1,dPhysValuesdy.get(),1,
971 dPhysValuesdx.get(),1,
972 dPhysValuesdx.get(),1);
977 gmat[0][0], dPhysValuesdx.get(), 1);
979 gmat[1][0], dPhysValuesdy.get(), 1,
980 dPhysValuesdx.get(), 1);
986 Array<OneD,NekDouble> dPhysValuesdy(nquad);
987 Array<OneD,NekDouble> dPhysValuesdz(nquad);
990 dPhysValuesdy,dPhysValuesdz);
996 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
997 dPhysValuesdx.get(),1);
999 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1000 dPhysValuesdx.get(),1,
1001 dPhysValuesdx.get(),1);
1003 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1004 dPhysValuesdx.get(),1,
1005 dPhysValuesdx.get(),1);
1009 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1011 gmat[1][0], dPhysValuesdy.get(), 1,
1012 dPhysValuesdx.get(), 1);
1014 gmat[2][0], dPhysValuesdz.get(), 1,
1015 dPhysValuesdx.get(), 1);
1020 ASSERTL0(
false,
"Wrong number of dimensions");
1029 const Array<OneD, const NekDouble> &inarray,
1030 Array<OneD, NekDouble> &outarray,
1033 int nquad =
m_base[0]->GetNumPoints();
1034 const Array<TwoD, const NekDouble>& gmat =
1039 Array<OneD,NekDouble> physValues(nquad);
1040 Array<OneD,NekDouble> dPhysValuesdx(nquad);
1049 switch (
m_geom->GetCoordim())
1059 &gmat[0][0],1,dPhysValuesdx.get(),1,
1060 dPhysValuesdx.get(),1);
1064 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1070 Array<OneD,NekDouble> dPhysValuesdy(nquad);
1072 PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy);
1078 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1079 dPhysValuesdx.get(), 1);
1081 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1082 dPhysValuesdx.get(), 1,
1083 dPhysValuesdx.get(), 1);
1087 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1089 gmat[1][0], dPhysValuesdy.get(), 1,
1090 dPhysValuesdx.get(), 1);
1096 Array<OneD,NekDouble> dPhysValuesdy(nquad);
1097 Array<OneD,NekDouble> dPhysValuesdz(nquad);
1100 dPhysValuesdy, dPhysValuesdz);
1106 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1107 dPhysValuesdx.get(), 1);
1109 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1110 dPhysValuesdx.get(), 1,
1111 dPhysValuesdx.get(), 1);
1113 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1114 dPhysValuesdx.get(), 1,
1115 dPhysValuesdx.get(), 1);
1119 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1121 gmat[1][0], dPhysValuesdy.get(), 1,
1122 dPhysValuesdx.get(), 1);
1124 gmat[2][0], dPhysValuesdz.get(),
1125 1, dPhysValuesdx.get(), 1);
1130 ASSERTL0(
false,
"Wrong number of dimensions");
1135 Blas::Daxpy(
m_ncoeffs, lambda, wsp.get(), 1, outarray.get(), 1);
1167 return tmp->GetStdMatrix(mkey);
1179 "Geometric information is not set up");
1189 goto UseLocRegionsMatrix;
1194 goto UseStdRegionsMatrix;
1215 goto UseStdRegionsMatrix;
1227 goto UseLocRegionsMatrix;
1239 "Cannot call eWeakDeriv2 in a "
1240 "coordinate system which is not at "
1241 "least two-dimensional");
1246 "Cannot call eWeakDeriv2 in a "
1247 "coordinate system which is not "
1248 "three-dimensional");
1272 goto UseLocRegionsMatrix;
1276 int coordim =
m_geom->GetCoordim();
1278 for (
int i = 0; i < coordim; ++i)
1284 goto UseStdRegionsMatrix;
1300 int rows = LapMat.GetRows();
1301 int cols = LapMat.GetColumns();
1307 (*helm) = LapMat + factor*MassMat;
1347 Array<OneD, NekDouble> coords(1, 0.0);
1351 coords[0] = (vertex == 0) ? -1.0 : 1.0;
1353 m_Ix =
m_base[0]->GetI(coords);
1359 UseLocRegionsMatrix:
1366 UseStdRegionsMatrix:
1412 "Geometric information is not set up");
1417 Array<OneD, unsigned int> exp_size(2);
1418 exp_size[0] = nbdry;
1434 goto UseLocRegionsMatrix;
1440 goto UseLocRegionsMatrix;
1445 factor = mat->Scale();
1446 goto UseStdRegionsMatrix;
1449 UseStdRegionsMatrix:
1457 returnval->SetBlock(0,0,Atmp =
1459 factor,Asubmat = mat->GetBlock(0,0)));
1460 returnval->SetBlock(0,1,Atmp =
1462 one,Asubmat = mat->GetBlock(0,1)));
1463 returnval->SetBlock(1,0,Atmp =
1465 factor,Asubmat = mat->GetBlock(1,0)));
1466 returnval->SetBlock(1,1,Atmp =
1468 invfactor,Asubmat = mat->GetBlock(1,1)));
1471 UseLocRegionsMatrix:
1486 Array<OneD,unsigned int> bmap(nbdry);
1487 Array<OneD,unsigned int> imap(nint);
1491 for (i = 0; i < nbdry; ++i)
1493 for (j = 0; j < nbdry; ++j)
1495 (*A)(i,j) = mat(bmap[i],bmap[j]);
1498 for (j = 0; j < nint; ++j)
1500 (*B)(i,j) = mat(bmap[i],imap[j]);
1504 for (i = 0; i < nint; ++i)
1506 for (j = 0; j < nbdry; ++j)
1508 (*C)(i,j) = mat(imap[i],bmap[j]);
1511 for (j = 0; j < nint; ++j)
1513 (*D)(i,j) = mat(imap[i],imap[j]);
1522 (*A) = (*A) - (*B)*(*C);
1528 AllocateSharedPtr(factor,A));
1530 AllocateSharedPtr(one,B));
1532 AllocateSharedPtr(factor,C));
1534 AllocateSharedPtr(invfactor,D));
1553 const Array<OneD,NekDouble> &inarray,
1554 Array<OneD,NekDouble> &outarray)
1560 ASSERTL1(&inarray[0] != &outarray[0],
1561 "inarray and outarray can not be the same");
1566 outarray[0] = inarray[1];
1567 outarray[1] = inarray[0];
1571 outarray[m] = sgn*inarray[m];
1579 outarray[m_ncoeffs-1-m] = inarray[m];
1583 ASSERTL0(
false,
"This basis is not allowed in this method");
1595 const Array<OneD, const NekDouble>& inarray,
1596 Array<OneD,NekDouble> &outarray)