42 namespace LocalRegions
50 StdNodalTriExp(Ba,Bb,Ntype),
55 std::string(
"NodalTriExpMatrix")),
56 m_staticCondMatrixManager(
57 boost::bind(&
NodalTriExp::CreateStaticCondMatrix, this, _1),
58 std::string(
"NodalTriExpStaticCondMatrix"))
65 StdRegions::StdNodalTriExp(T),
68 m_matrixManager(T.m_matrixManager),
69 m_staticCondMatrixManager(T.m_staticCondMatrixManager)
100 int nquad0 =
m_base[0]->GetNumPoints();
101 int nquad1 =
m_base[1]->GetNumPoints();
104 Array<OneD,NekDouble> tmp(nquad0*nquad1);
109 Vmath::Vmul(nquad0*nquad1, jac, 1, inarray, 1,tmp, 1);
113 Vmath::Smul(nquad0*nquad1, jac[0], inarray, 1, tmp, 1);
123 Array<OneD, NekDouble> &outarray)
125 int nquad0 =
m_base[0]->GetNumPoints();
126 int nquad1 =
m_base[1]->GetNumPoints();
127 int order1 =
m_base[1]->GetNumModes();
129 Array<OneD,NekDouble> tmp(nquad0*nquad1+nquad0*order1);
130 Array<OneD,NekDouble> wsp(tmp+nquad0*nquad1);
138 Array<OneD, NekDouble> &outarray)
144 Blas::Dgemv(
'N',
m_ncoeffs,nq,iprodmat->Scale(),(iprodmat->GetOwnedMatrix())->GetPtr().get(),
145 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
149 const Array<OneD, const NekDouble>& inarray,
150 Array<OneD, NekDouble> & outarray)
152 ASSERTL1((dir==0)||(dir==1)||(dir==2),
"Invalid direction.");
153 ASSERTL1((dir==2)?(
m_geom->GetCoordim()==3):
true,
"Invalid direction.");
156 int nquad0 =
m_base[0]->GetNumPoints();
157 int nquad1 =
m_base[1]->GetNumPoints();
158 int nqtot = nquad0*nquad1;
161 const Array<TwoD, const NekDouble>& df =
164 Array<OneD, NekDouble> tmp0 (6*wspsize);
165 Array<OneD, NekDouble> tmp1 (tmp0 + wspsize);
166 Array<OneD, NekDouble> tmp2 (tmp0 + 2*wspsize);
167 Array<OneD, NekDouble> tmp3 (tmp0 + 3*wspsize);
168 Array<OneD, NekDouble> gfac0(tmp0 + 4*wspsize);
169 Array<OneD, NekDouble> gfac1(tmp0 + 5*wspsize);
171 const Array<OneD, const NekDouble>& z0 =
m_base[0]->GetZ();
172 const Array<OneD, const NekDouble>& z1 =
m_base[1]->GetZ();
175 for(i = 0; i < nquad1; ++i)
177 gfac0[i] = 2.0/(1-z1[i]);
179 for(i = 0; i < nquad0; ++i)
181 gfac1[i] = 0.5*(1+z0[i]);
184 for(i = 0; i < nquad1; ++i)
186 Vmath::Smul(nquad0,gfac0[i],&inarray[0]+i*nquad0,1,&tmp0[0]+i*nquad0,1);
189 for(i = 0; i < nquad1; ++i)
191 Vmath::Vmul(nquad0,&gfac1[0],1,&tmp0[0]+i*nquad0,1,&tmp1[0]+i*nquad0,1);
196 Vmath::Vmul(nqtot,&df[2*dir][0], 1,&tmp0[0], 1,&tmp0[0],1);
197 Vmath::Vmul(nqtot,&df[2*dir+1][0],1,&tmp1[0], 1,&tmp1[0],1);
198 Vmath::Vmul(nqtot,&df[2*dir+1][0],1,&inarray[0],1,&tmp2[0],1);
202 Vmath::Smul(nqtot, df[2*dir][0], tmp0, 1, tmp0, 1);
203 Vmath::Smul(nqtot, df[2*dir+1][0], tmp1, 1, tmp1, 1);
204 Vmath::Smul(nqtot, df[2*dir+1][0], inarray, 1, tmp2, 1);
219 const Array<OneD, const NekDouble>& inarray,
220 Array<OneD, NekDouble> &outarray)
244 ASSERTL1(
false,
"input dir is out of range");
252 Blas::Dgemv(
'N',
m_ncoeffs,nq,iprodmat->Scale(),(iprodmat->GetOwnedMatrix())->GetPtr().get(),
253 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
265 Array<OneD,NekDouble> &out_d0,
266 Array<OneD,NekDouble> &out_d1,
267 Array<OneD,NekDouble> &out_d2)
269 int nquad0 =
m_base[0]->GetNumPoints();
270 int nquad1 =
m_base[1]->GetNumPoints();
271 int nqtot = nquad0*nquad1;
272 const Array<TwoD, const NekDouble>& df
275 Array<OneD,NekDouble> diff0(2*nqtot);
276 Array<OneD,NekDouble> diff1(diff0+nqtot);
282 if(out_d0.num_elements())
285 Vmath::Vvtvp (nqtot,df[1],1,diff1,1, out_d0, 1, out_d0,1);
288 if(out_d1.num_elements())
291 Vmath::Vvtvp (nqtot,df[3],1,diff1,1, out_d1, 1, out_d1,1);
294 if(out_d2.num_elements())
297 Vmath::Vvtvp (nqtot,df[5],1,diff1,1, out_d2, 1, out_d2,1);
302 if(out_d0.num_elements())
304 Vmath::Smul (nqtot, df[0][0], diff0, 1, out_d0, 1);
305 Blas::Daxpy (nqtot, df[1][0], diff1, 1, out_d0, 1);
308 if(out_d1.num_elements())
310 Vmath::Smul (nqtot, df[2][0], diff0, 1, out_d1, 1);
311 Blas::Daxpy (nqtot, df[3][0], diff1, 1, out_d1, 1);
314 if(out_d2.num_elements())
316 Vmath::Smul (nqtot, df[4][0], diff0, 1, out_d2, 1);
317 Blas::Daxpy (nqtot, df[5][0], diff1, 1, out_d2, 1);
336 Array<OneD,NekDouble> &outarray)
353 Array<OneD,NekDouble> &outarray,
358 if(inarray.get() == outarray.get())
363 Blas::Dgemv(
'N',
m_ncoeffs,
m_ncoeffs,mat->Scale(),(mat->GetOwnedMatrix())->GetPtr().get(),
364 m_ncoeffs, tmp.get(), 1, 0.0, outarray.get(), 1);
368 Blas::Dgemv(
'N',
m_ncoeffs,
m_ncoeffs,mat->Scale(),(mat->GetOwnedMatrix())->GetPtr().get(),
369 m_ncoeffs, inarray.get(), 1, 0.0, outarray.get(), 1);
374 Array<OneD,NekDouble> &coords_1,
375 Array<OneD,NekDouble> &coords_2)
382 Array<OneD,NekDouble> &coords)
386 ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[1] <= 1.0 &&
387 Lcoords[1] >= -1.0 && Lcoords[1] <=1.0,
388 "Local coordinates are not in region [-1,1]");
392 for(i = 0; i <
m_geom->GetCoordim(); ++i)
394 coords[i] =
m_geom->GetCoord(i,Lcoords);
406 return tmp->GetStdMatrix(mkey);
410 const Array<OneD, const NekDouble> &coord,
411 const Array<OneD, const NekDouble> &physvals)
414 Array<OneD,NekDouble> Lcoord = Array<OneD,NekDouble>(2);
417 m_geom->GetLocCoords(coord,Lcoord);
480 ASSERTL1(
m_geom->GetCoordim() == 2,
"Standard Region Laplacian is only set up for Quads in two-dimensional");
493 Array<TwoD, const NekDouble> gmat =
496 int rows = lap00.GetRows();
497 int cols = lap00.GetColumns();
501 (*lap) = gmat[0][0] * lap00 +
502 gmat[1][0] * (lap01 +
Transpose(lap01)) +
519 int rows = LapMat.GetRows();
520 int cols = LapMat.GetColumns();
525 (*helm) = LapMat + factor*MassMat;
546 unsigned int nint = (
unsigned int)(
m_ncoeffs - nbdry);
547 unsigned int exp_size[] = {nbdry,nint};
548 unsigned int nblks = 2;
559 goto UseLocRegionsMatrix;
565 goto UseLocRegionsMatrix;
570 factor = mat->Scale();
571 goto UseStdRegionsMatrix;
599 Array<OneD,unsigned int> bmap(nbdry);
600 Array<OneD,unsigned int> imap(nint);
604 for(i = 0; i < nbdry; ++i)
606 for(j = 0; j < nbdry; ++j)
608 (*A)(i,j) = mat(bmap[i],bmap[j]);
611 for(j = 0; j < nint; ++j)
613 (*B)(i,j) = mat(bmap[i],imap[j]);
617 for(i = 0; i < nint; ++i)
619 for(j = 0; j < nbdry; ++j)
621 (*C)(i,j) = mat(imap[i],bmap[j]);
624 for(j = 0; j < nint; ++j)
626 (*D)(i,j) = mat(imap[i],imap[j]);
635 (*A) = (*A) - (*B)*(*C);
679 const Array<TwoD, const NekDouble> & df = geomFactors->GetDerivFactors(ptsKeys);
680 const Array<OneD, const NekDouble> & jac = geomFactors->GetJac(ptsKeys);
681 int nqe =
m_base[0]->GetNumPoints();
684 m_edgeNormals[edge] = Array<OneD, Array<OneD, NekDouble> >(dim);
685 Array<OneD, Array<OneD, NekDouble> > &normal =
m_edgeNormals[edge];
686 for (i = 0; i < dim; ++i)
688 normal[i] = Array<OneD, NekDouble>(nqe);
707 Vmath::Fill(nqe,df[2*i+1][0] + df[2*i][0],normal[i],1);
717 ASSERTL0(
false,
"Edge is out of range (edge < 3)");
724 fac += normal[i][0]*normal[i][0];
736 int nquad0 = ptsKeys[0].GetNumPoints();
737 int nquad1 = ptsKeys[1].GetNumPoints();
741 Array<OneD,NekDouble> normals(
GetCoordim()*max(nquad0,nquad1),0.0);
742 Array<OneD,NekDouble> edgejac(
GetCoordim()*max(nquad0,nquad1),0.0);
750 for(j = 0; j < nquad0; ++j)
755 normals[i*nquad0+j] = -df[2*i+1][j]*edgejac[j];
758 from_key = ptsKeys[0];
761 for(j = 0; j < nquad1; ++j)
763 edgejac[j] = jac[nquad0*j+nquad0-1];
766 normals[i*nquad1+j] = (df[2*i][nquad0*j + nquad0-1] + df[2*i+1][nquad0*j + nquad0-1])*edgejac[j];
769 from_key = ptsKeys[1];
772 for(j = 0; j < nquad1; ++j)
774 edgejac[j] = jac[nquad0*j];
777 normals[i*nquad1+j] = -df[2*i][nquad0*j]*edgejac[j];
780 from_key = ptsKeys[1];
783 ASSERTL0(
false,
"edge is out of range (edge < 3)");
788 Array<OneD,NekDouble> work(nqe,0.0);
805 Vmath::Vvtvp(nqe,normal[i],1, normal[i],1,work,1,work,1);