Nektar++
SegExp.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: SegExp.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: SegExp routines
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <boost/core/ignore_unused.hpp>
36 
39 #include <LocalRegions/SegExp.h>
40 
41 using namespace std;
42 
43 namespace Nektar
44 {
45 namespace LocalRegions
46 {
47 
48 /**
49  * @class SegExp
50  * Defines a Segment local expansion.
51  */
52 
53 /// Constructor using BasisKey class for quadrature points and
54 /// order definition.
55 /**
56  * @param Ba Basis key of segment expansion.
57  * @param geom Description of geometry.
58  */
59 SegExp::SegExp(const LibUtilities::BasisKey &Ba,
61  : StdExpansion(Ba.GetNumModes(), 1, Ba),
62  StdExpansion1D(Ba.GetNumModes(), Ba), StdRegions::StdSegExp(Ba),
63  Expansion(geom), Expansion1D(geom),
64  m_matrixManager(
65  std::bind(&SegExp::CreateMatrix, this, std::placeholders::_1),
66  std::string("SegExpMatrix")),
67  m_staticCondMatrixManager(std::bind(&Expansion::CreateStaticCondMatrix,
68  this, std::placeholders::_1),
69  std::string("SegExpStaticCondMatrix"))
70 {
71 }
72 
73 /// Copy Constructor
74 /**
75  * @param S Existing segment to duplicate.
76  */
78  : StdExpansion(S), StdExpansion1D(S), StdRegions::StdSegExp(S),
79  Expansion(S), Expansion1D(S), m_matrixManager(S.m_matrixManager),
80  m_staticCondMatrixManager(S.m_staticCondMatrixManager)
81 {
82 }
83 
84 //----------------------------
85 // Integration Methods
86 //----------------------------
87 
88 /** \brief Integrate the physical point list \a inarray over region
89  and return the value
90 
91  Inputs:\n
92 
93  - \a inarray: definition of function to be returned at
94  quadrature point of expansion.
95 
96  Outputs:\n
97 
98  - returns \f$\int^1_{-1} u(\xi_1)d \xi_1 \f$ where \f$inarray[i]
99  = u(\xi_{1i}) \f$
100 */
101 
103 {
104  int nquad0 = m_base[0]->GetNumPoints();
106  NekDouble ival;
107  Array<OneD, NekDouble> tmp(nquad0);
108 
109  // multiply inarray with Jacobian
110  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
111  {
112  Vmath::Vmul(nquad0, jac, 1, inarray, 1, tmp, 1);
113  }
114  else
115  {
116  Vmath::Smul(nquad0, jac[0], inarray, 1, tmp, 1);
117  }
118 
119  // call StdSegExp version;
120  ival = StdSegExp::v_Integral(tmp);
121  // ival = StdSegExp::Integral(tmp);
122  return ival;
123 }
124 
125 //-----------------------------
126 // Differentiation Methods
127 //-----------------------------
128 
129 /** \brief Evaluate the derivative \f$ d/d{\xi_1} \f$ at the
130  physical quadrature points given by \a inarray and return in \a
131  outarray.
132 
133  This is a wrapper around StdExpansion1D::Tensor_Deriv
134 
135  Input:\n
136 
137  - \a n: number of derivatives to be evaluated where \f$ n \leq dim\f$
138 
139  - \a inarray: array of function evaluated at the quadrature points
140 
141  Output: \n
142 
143  - \a outarray: array of the derivatives \f$
144  du/d_{\xi_1}|_{\xi_{1i}} d\xi_1/dx,
145  du/d_{\xi_1}|_{\xi_{1i}} d\xi_1/dy,
146  du/d_{\xi_1}|_{\xi_{1i}} d\xi_1/dz,
147  \f$ depending on value of \a dim
148 */
150  Array<OneD, NekDouble> &out_d0,
151  Array<OneD, NekDouble> &out_d1,
152  Array<OneD, NekDouble> &out_d2)
153 {
154  int nquad0 = m_base[0]->GetNumPoints();
156  m_metricinfo->GetDerivFactors(GetPointsKeys());
157  Array<OneD, NekDouble> diff(nquad0);
158 
159  // StdExpansion1D::PhysTensorDeriv(inarray,diff);
160  PhysTensorDeriv(inarray, diff);
161  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
162  {
163  if (out_d0.size())
164  {
165  Vmath::Vmul(nquad0, &gmat[0][0], 1, &diff[0], 1, &out_d0[0], 1);
166  }
167 
168  if (out_d1.size())
169  {
170  Vmath::Vmul(nquad0, &gmat[1][0], 1, &diff[0], 1, &out_d1[0], 1);
171  }
172 
173  if (out_d2.size())
174  {
175  Vmath::Vmul(nquad0, &gmat[2][0], 1, &diff[0], 1, &out_d2[0], 1);
176  }
177  }
178  else
179  {
180  if (out_d0.size())
181  {
182  Vmath::Smul(nquad0, gmat[0][0], diff, 1, out_d0, 1);
183  }
184 
185  if (out_d1.size())
186  {
187  Vmath::Smul(nquad0, gmat[1][0], diff, 1, out_d1, 1);
188  }
189 
190  if (out_d2.size())
191  {
192  Vmath::Smul(nquad0, gmat[2][0], diff, 1, out_d2, 1);
193  }
194  }
195 }
196 
197 /**
198  *\brief Evaluate the derivative along a line:
199  * \f$ d/ds=\frac{spacedim}{||tangent||}d/d{\xi} \f$.
200  * The derivative is calculated performing
201  *the product \f$ du/d{s}=\nabla u \cdot tangent \f$.
202  *\param inarray function to derive
203  *\param out_ds result of the derivative operation
204  **/
206  Array<OneD, NekDouble> &out_ds)
207 {
208  int nquad0 = m_base[0]->GetNumPoints();
209  int coordim = m_geom->GetCoordim();
210  Array<OneD, NekDouble> diff(nquad0);
211  // this operation is needed if you put out_ds==inarray
212  Vmath::Zero(nquad0, out_ds, 1);
213  switch (coordim)
214  {
215  case 2:
216  // diff= dU/de
217  Array<OneD, NekDouble> diff(nquad0);
218 
219  PhysTensorDeriv(inarray, diff);
220 
221  // get dS/de= (Jac)^-1
223  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
224  {
225  // calculate the derivative as (dU/de)*(Jac)^-1
226  Vmath::Vdiv(nquad0, diff, 1, Jac, 1, out_ds, 1);
227  }
228  else
229  {
230  NekDouble invJac = 1 / Jac[0];
231  Vmath::Smul(nquad0, invJac, diff, 1, out_ds, 1);
232  }
233  }
234 }
235 
236 /**
237  *\brief Evaluate the derivative normal to a line:
238  * \f$ d/dn=\frac{spacedim}{||normal||}d/d{\xi} \f$.
239  * The derivative is calculated performing
240  *the product \f$ du/d{s}=\nabla u \cdot normal \f$.
241  *\param inarray function to derive
242  *\param out_dn result of the derivative operation
243  **/
245  Array<OneD, NekDouble> &out_dn)
246 {
247  int nquad0 = m_base[0]->GetNumPoints();
249  m_metricinfo->GetDerivFactors(GetPointsKeys());
250  int coordim = m_geom->GetCoordim();
251  Array<OneD, NekDouble> out_dn_tmp(nquad0, 0.0);
252  switch (coordim)
253  {
254  case 2:
255 
256  Array<OneD, NekDouble> inarray_d0(nquad0);
257  Array<OneD, NekDouble> inarray_d1(nquad0);
258 
259  v_PhysDeriv(inarray, inarray_d0, inarray_d1);
261  normals = Array<OneD, Array<OneD, NekDouble>>(coordim);
262  cout << "der_n" << endl;
263  for (int k = 0; k < coordim; ++k)
264  {
265  normals[k] = Array<OneD, NekDouble>(nquad0);
266  }
267  // @TODO: this routine no longer makes sense, since normals are not
268  // unique on
269  // an edge
270  // normals = GetMetricInfo()->GetNormal();
271  for (int i = 0; i < nquad0; i++)
272  {
273  cout << "nx= " << normals[0][i] << " ny=" << normals[1][i]
274  << endl;
275  }
277  "normal vectors do not exist: check if a"
278  "boundary region is defined as I ");
279  // \nabla u \cdot normal
280  Vmath::Vmul(nquad0, normals[0], 1, inarray_d0, 1, out_dn_tmp, 1);
281  Vmath::Vadd(nquad0, out_dn_tmp, 1, out_dn, 1, out_dn, 1);
282  Vmath::Zero(nquad0, out_dn_tmp, 1);
283  Vmath::Vmul(nquad0, normals[1], 1, inarray_d1, 1, out_dn_tmp, 1);
284  Vmath::Vadd(nquad0, out_dn_tmp, 1, out_dn, 1, out_dn, 1);
285 
286  for (int i = 0; i < nquad0; i++)
287  {
288  cout << "deps/dx =" << inarray_d0[i]
289  << " deps/dy=" << inarray_d1[i] << endl;
290  }
291  }
292 }
293 void SegExp::v_PhysDeriv(const int dir,
294  const Array<OneD, const NekDouble> &inarray,
295  Array<OneD, NekDouble> &outarray)
296 {
297  switch (dir)
298  {
299  case 0:
300  {
301  PhysDeriv(inarray, outarray, NullNekDouble1DArray,
303  }
304  break;
305  case 1:
306  {
307  PhysDeriv(inarray, NullNekDouble1DArray, outarray,
309  }
310  break;
311  case 2:
312  {
314  outarray);
315  }
316  break;
317  default:
318  {
319  ASSERTL1(false, "input dir is out of range");
320  }
321  break;
322  }
323 }
324 
325 //-----------------------------
326 // Transforms
327 //-----------------------------
328 
329 /** \brief Forward transform from physical quadrature space
330  stored in \a inarray and evaluate the expansion coefficients and
331  store in \a outarray
332 
333  Perform a forward transform using a Galerkin projection by
334  taking the inner product of the physical points and multiplying
335  by the inverse of the mass matrix using the Solve method of the
336  standard matrix container holding the local mass matrix, i.e.
337  \f$ {\bf \hat{u}} = {\bf M}^{-1} {\bf I} \f$ where \f$ {\bf I}[p] =
338  \int^1_{-1} \phi_p(\xi_1) u(\xi_1) d\xi_1 \f$
339 
340  Inputs:\n
341 
342  - \a inarray: array of physical quadrature points to be transformed
343 
344  Outputs:\n
345 
346  - \a outarray: updated array of expansion coefficients.
347 
348 */
349 // need to sort out family of matrices
351  Array<OneD, NekDouble> &outarray)
352 {
353  if (m_base[0]->Collocation())
354  {
355  Vmath::Vcopy(m_ncoeffs, inarray, 1, outarray, 1);
356  }
357  else
358  {
359  v_IProductWRTBase(inarray, outarray);
360 
361  // get Mass matrix inverse
362  MatrixKey masskey(StdRegions::eInvMass, DetShapeType(), *this);
363  DNekScalMatSharedPtr matsys = m_matrixManager[masskey];
364 
365  // copy inarray in case inarray == outarray
366  NekVector<NekDouble> in(m_ncoeffs, outarray, eCopy);
367  NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
368 
369  out = (*matsys) * in;
370  }
371 }
372 
374  const Array<OneD, const NekDouble> &inarray,
375  Array<OneD, NekDouble> &outarray)
376 {
377  if (m_base[0]->Collocation())
378  {
379  Vmath::Vcopy(m_ncoeffs, inarray, 1, outarray, 1);
380  }
381  else
382  {
383  int nInteriorDofs = m_ncoeffs - 2;
384  int offset = 0;
385 
386  switch (m_base[0]->GetBasisType())
387  {
389  {
390  offset = 1;
391  }
392  break;
394  {
395  nInteriorDofs = m_ncoeffs;
396  offset = 0;
397  }
398  break;
401  {
402  ASSERTL1(
403  m_base[0]->GetPointsType() ==
405  m_base[0]->GetPointsType() ==
407  "Cannot use FwdTrans_BndConstrained with these points.");
408  offset = 2;
409  }
410  break;
411  default:
412  ASSERTL0(false, "This type of FwdTrans is not defined"
413  "for this expansion type");
414  }
415 
416  fill(outarray.get(), outarray.get() + m_ncoeffs, 0.0);
417 
419  {
420 
421  outarray[GetVertexMap(0)] = inarray[0];
422  outarray[GetVertexMap(1)] = inarray[m_base[0]->GetNumPoints() - 1];
423 
424  if (m_ncoeffs > 2)
425  {
426  // ideally, we would like to have tmp0 to be replaced
427  // by outarray (currently MassMatrixOp does not allow
428  // aliasing)
431 
433  DetShapeType(), *this);
434  MassMatrixOp(outarray, tmp0, stdmasskey);
435  v_IProductWRTBase(inarray, tmp1);
436 
437  Vmath::Vsub(m_ncoeffs, tmp1, 1, tmp0, 1, tmp1, 1);
438 
439  // get Mass matrix inverse (only of interior DOF)
440  MatrixKey masskey(StdRegions::eMass, DetShapeType(), *this);
441  DNekScalMatSharedPtr matsys =
442  (m_staticCondMatrixManager[masskey])->GetBlock(1, 1);
443 
444  Blas::Dgemv('N', nInteriorDofs, nInteriorDofs, matsys->Scale(),
445  &((matsys->GetOwnedMatrix())->GetPtr())[0],
446  nInteriorDofs, tmp1.get() + offset, 1, 0.0,
447  outarray.get() + offset, 1);
448  }
449  }
450  else
451  {
452  SegExp::v_FwdTrans(inarray, outarray);
453  }
454  }
455 }
456 
457 //-----------------------------
458 // Inner product functions
459 //-----------------------------
460 
461 /** \brief Inner product of \a inarray over region with respect to
462  the expansion basis (this)->_Base[0] and return in \a outarray
463 
464  Wrapper call to SegExp::IProduct_WRT_B
465 
466  Input:\n
467 
468  - \a inarray: array of function evaluated at the physical
469  collocation points
470 
471  Output:\n
472 
473  - \a outarray: array of inner product with respect to each
474  basis over region
475 */
477  Array<OneD, NekDouble> &outarray)
478 {
479  v_IProductWRTBase(m_base[0]->GetBdata(), inarray, outarray, 1);
480 }
481 
482 /**
483  \brief Inner product of \a inarray over region with respect to
484  expansion basis \a base and return in \a outarray
485 
486  Calculate \f$ I[p] = \int^{1}_{-1} \phi_p(\xi_1) u(\xi_1) d\xi_1
487  = \sum_{i=0}^{nq-1} \phi_p(\xi_{1i}) u(\xi_{1i}) w_i \f$ where
488  \f$ outarray[p] = I[p], inarray[i] = u(\xi_{1i}), base[p*nq+i] =
489  \phi_p(\xi_{1i}) \f$.
490 
491  Inputs: \n
492 
493  - \a base: an array definiing the local basis for the inner
494  product usually passed from Basis->get_bdata() or
495  Basis->get_Dbdata()
496  - \a inarray: physical point array of function to be integrated
497  \f$ u(\xi_1) \f$
498  - \a coll_check: Flag to identify when a Basis->collocation()
499  call should be performed to see if this is a GLL_Lagrange basis
500  with a collocation property. (should be set to 0 if taking the
501  inner product with respect to the derivative of basis)
502 
503  Output: \n
504 
505  - \a outarray: array of coefficients representing the inner
506  product of function with ever mode in the exapnsion
507 
508 **/
510  const Array<OneD, const NekDouble> &inarray,
511  Array<OneD, NekDouble> &outarray, int coll_check)
512 {
513  int nquad0 = m_base[0]->GetNumPoints();
515  Array<OneD, NekDouble> tmp(nquad0);
516 
517  // multiply inarray with Jacobian
518  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
519  {
520  Vmath::Vmul(nquad0, jac, 1, inarray, 1, tmp, 1);
521  }
522  else
523  {
524  Vmath::Smul(nquad0, jac[0], inarray, 1, tmp, 1);
525  }
526  StdSegExp::v_IProductWRTBase(base, tmp, outarray, coll_check);
527 }
528 
530  const Array<OneD, const NekDouble> &inarray,
531  Array<OneD, NekDouble> &outarray)
532 {
533  ASSERTL1(dir < 3, "input dir is out of range");
534  ASSERTL1((dir == 2) ? m_geom->GetCoordim() == 3 : true,
535  "input dir is out of range");
536 
537  int nquad = m_base[0]->GetNumPoints();
538  const Array<TwoD, const NekDouble> &gmat =
539  m_metricinfo->GetDerivFactors(GetPointsKeys());
540 
541  Array<OneD, NekDouble> tmp1(nquad);
542 
543  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
544  {
545  Vmath::Vmul(nquad, gmat[dir], 1, inarray, 1, tmp1, 1);
546  }
547  else
548  {
549  Vmath::Smul(nquad, gmat[dir][0], inarray, 1, tmp1, 1);
550  }
551 
552  v_IProductWRTBase(m_base[0]->GetDbdata(), tmp1, outarray, 1);
553 }
554 
557  Array<OneD, NekDouble> &outarray)
558 {
559  int nq = m_base[0]->GetNumPoints();
560  Array<OneD, NekDouble> Fn(nq);
561 
562  // @TODO: This routine no longer makes sense as a normal is not unique to an
563  // edge
565  GetLeftAdjacentElementExp()->GetTraceNormal(
567  Vmath::Vmul(nq, &Fx[0], 1, &normals[0][0], 1, &Fn[0], 1);
568  Vmath::Vvtvp(nq, &Fy[0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
569 
570  v_IProductWRTBase(Fn, outarray);
571 }
572 
574  const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
575  Array<OneD, NekDouble> &outarray)
576 {
577  NormVectorIProductWRTBase(Fvec[0], Fvec[1], outarray);
578 }
579 
580 //-----------------------------
581 // Evaluation functions
582 //-----------------------------
583 
584 /**
585  * Given the local cartesian coordinate \a Lcoord evaluate the
586  * value of physvals at this point by calling through to the
587  * StdExpansion method
588  */
590  const Array<OneD, const NekDouble> &Lcoord,
591  const Array<OneD, const NekDouble> &physvals)
592 {
593  // Evaluate point in local (eta) coordinates.
594  return StdExpansion1D::v_PhysEvaluate(Lcoord, physvals);
595 }
596 
598  const Array<OneD, const NekDouble> &physvals)
599 {
601 
602  ASSERTL0(m_geom, "m_geom not defined");
603  m_geom->GetLocCoords(coord, Lcoord);
604 
605  return StdExpansion1D::v_PhysEvaluate(Lcoord, physvals);
606 }
607 
609  const Array<OneD, const NekDouble> &inarray,
610  std::array<NekDouble, 3> &firstOrderDerivs)
611 {
612  Array<OneD, NekDouble> Lcoord(1);
613  ASSERTL0(m_geom, "m_geom not defined");
614  m_geom->GetLocCoords(coord, Lcoord);
615  return StdSegExp::v_PhysEvaluate(Lcoord, inarray, firstOrderDerivs);
616 }
617 
619  const Array<OneD, const NekDouble> &inarray,
620  std::array<NekDouble, 3> &firstOrderDerivs,
621  std::array<NekDouble, 6> &secondOrderDerivs)
622 {
623  Array<OneD, NekDouble> Lcoord(1);
624  ASSERTL0(m_geom, "m_geom not defined");
625  m_geom->GetLocCoords(coord, Lcoord);
626  return StdSegExp::v_PhysEvaluate(Lcoord, inarray, firstOrderDerivs,
627  secondOrderDerivs);
628 }
629 
631  Array<OneD, NekDouble> &coords)
632 {
633  int i;
634 
635  ASSERTL1(Lcoords[0] >= -1.0 && Lcoords[0] <= 1.0,
636  "Local coordinates are not in region [-1,1]");
637 
638  m_geom->FillGeom();
639  for (i = 0; i < m_geom->GetCoordim(); ++i)
640  {
641  coords[i] = m_geom->GetCoord(i, Lcoords);
642  }
643 }
644 
646  Array<OneD, NekDouble> &coords_1,
647  Array<OneD, NekDouble> &coords_2)
648 {
649  Expansion::v_GetCoords(coords_0, coords_1, coords_2);
650 }
651 
652 // Get vertex value from the 1D Phys space.
653 void SegExp::v_GetVertexPhysVals(const int vertex,
654  const Array<OneD, const NekDouble> &inarray,
655  NekDouble &outarray)
656 {
657  int nquad = m_base[0]->GetNumPoints();
658 
660  {
661  switch (vertex)
662  {
663  case 0:
664  outarray = inarray[0];
665  break;
666  case 1:
667  outarray = inarray[nquad - 1];
668  break;
669  }
670  }
671  else
672  {
674  factors[StdRegions::eFactorGaussVertex] = vertex;
675 
677  *this, factors);
678 
679  DNekScalMatSharedPtr mat_gauss = m_matrixManager[key];
680 
681  outarray =
682  Blas::Ddot(nquad, mat_gauss->GetOwnedMatrix()->GetPtr().get(), 1,
683  &inarray[0], 1);
684  }
685 }
686 
687 // Get vertex value from the 1D Phys space.
689  const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
690  const Array<OneD, const NekDouble> &inarray,
692 {
693  boost::ignore_unused(EdgeExp, orient);
694 
695  NekDouble result;
696  v_GetVertexPhysVals(edge, inarray, result);
697  outarray[0] = result;
698 }
699 
700 // Get vertex map from the 1D Phys space.
701 void SegExp::v_GetTracePhysMap(const int vertex, Array<OneD, int> &map)
702 {
703  int nquad = m_base[0]->GetNumPoints();
704 
705  ASSERTL1(vertex == 0 || vertex == 1, "Vertex value should be 0 or 1");
706 
707  map = Array<OneD, int>(1);
708 
709  map[0] = vertex == 0 ? 0 : nquad - 1;
710 }
711 
712 //-----------------------------
713 // Helper functions
714 //-----------------------------
715 
718  Array<OneD, NekDouble> &outarray)
719 {
720 
721  if (dir == StdRegions::eBackwards)
722  {
723  if (&inarray[0] != &outarray[0])
724  {
725  Array<OneD, NekDouble> intmp(inarray);
726  ReverseCoeffsAndSign(intmp, outarray);
727  }
728  else
729  {
730  ReverseCoeffsAndSign(inarray, outarray);
731  }
732  }
733 }
734 
736 {
738  m_base[0]->GetBasisKey());
739 }
740 
742 {
744  m_base[0]->GetPointsKey());
745 
747 }
748 
750 {
751  NEKERROR(ErrorUtil::efatal, "Got to SegExp");
752  return NullNekDouble1DArray;
753 }
754 
756 {
757  return 2;
758 }
759 
761 {
762  return 2;
763 }
764 
765 /// Unpack data from input file assuming it comes from
766 // the same expansion type
768  const NekDouble *data, const std::vector<unsigned int> &nummodes,
769  const int mode_offset, NekDouble *coeffs,
770  std::vector<LibUtilities::BasisType> &fromType)
771 {
772  boost::ignore_unused(fromType);
773 
774  switch (m_base[0]->GetBasisType())
775  {
777  {
778  int fillorder = min((int)nummodes[mode_offset], m_ncoeffs);
779 
780  Vmath::Zero(m_ncoeffs, coeffs, 1);
781  Vmath::Vcopy(fillorder, &data[0], 1, &coeffs[0], 1);
782  }
783  break;
785  {
786  // Assume that input is also Gll_Lagrange
787  // but no way to check;
788  LibUtilities::PointsKey f0(nummodes[mode_offset],
790  LibUtilities::PointsKey t0(m_base[0]->GetNumModes(),
792  LibUtilities::Interp1D(f0, data, t0, coeffs);
793  }
794  break;
796  {
797  // Assume that input is also Gauss_Lagrange
798  // but no way to check;
799  LibUtilities::PointsKey f0(nummodes[mode_offset],
801  LibUtilities::PointsKey t0(m_base[0]->GetNumModes(),
803  LibUtilities::Interp1D(f0, data, t0, coeffs);
804  }
805  break;
806  default:
807  ASSERTL0(false, "basis is either not set up or not hierarchicial");
808  }
809 }
810 
811 void SegExp::v_ComputeTraceNormal(const int vertex)
812 {
813  int i;
814  const SpatialDomains::GeomFactorsSharedPtr &geomFactors =
815  GetGeom()->GetMetricInfo();
816  SpatialDomains::GeomType type = geomFactors->GetGtype();
817  const Array<TwoD, const NekDouble> &gmat =
818  geomFactors->GetDerivFactors(GetPointsKeys());
819  int nqe = 1;
820  int vCoordDim = GetCoordim();
821 
824  for (i = 0; i < vCoordDim; ++i)
825  {
826  normal[i] = Array<OneD, NekDouble>(nqe);
827  }
828 
829  size_t nqb = nqe;
830  size_t nbnd = vertex;
833 
834  // Regular geometry case
835  if ((type == SpatialDomains::eRegular) ||
837  {
838  NekDouble vert;
839  // Set up normals
840  switch (vertex)
841  {
842  case 0:
843  for (i = 0; i < vCoordDim; ++i)
844  {
845  Vmath::Fill(nqe, -gmat[i][0], normal[i], 1);
846  }
847  break;
848  case 1:
849  for (i = 0; i < vCoordDim; ++i)
850  {
851  Vmath::Fill(nqe, gmat[i][0], normal[i], 1);
852  }
853  break;
854  default:
855  ASSERTL0(false, "point is out of range (point < 2)");
856  }
857 
858  // normalise
859  vert = 0.0;
860  for (i = 0; i < vCoordDim; ++i)
861  {
862  vert += normal[i][0] * normal[i][0];
863  }
864  vert = 1.0 / sqrt(vert);
865 
866  Vmath::Fill(nqb, vert, length, 1);
867 
868  for (i = 0; i < vCoordDim; ++i)
869  {
870  Vmath::Smul(nqe, vert, normal[i], 1, normal[i], 1);
871  }
872  }
873 }
874 
875 //-----------------------------
876 // Operator creation functions
877 //-----------------------------
878 
880  Array<OneD, NekDouble> &outarray,
881  const StdRegions::StdMatrixKey &mkey)
882 {
883  boost::ignore_unused(mkey);
884 
885  int nquad = m_base[0]->GetNumPoints();
886  const Array<TwoD, const NekDouble> &gmat =
887  m_metricinfo->GetDerivFactors(GetPointsKeys());
888 
889  Array<OneD, NekDouble> physValues(nquad);
890  Array<OneD, NekDouble> dPhysValuesdx(nquad);
891 
892  BwdTrans(inarray, physValues);
893 
894  // Laplacian matrix operation
895  switch (m_geom->GetCoordim())
896  {
897  case 1:
898  {
899  PhysDeriv(physValues, dPhysValuesdx);
900 
901  // multiply with the proper geometric factors
902  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
903  {
904  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
905  dPhysValuesdx.get(), 1);
906  }
907  else
908  {
909  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
910  }
911  }
912  break;
913  case 2:
914  {
915  Array<OneD, NekDouble> dPhysValuesdy(nquad);
916 
917  PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy);
918 
919  // multiply with the proper geometric factors
920  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
921  {
922  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
923  dPhysValuesdx.get(), 1);
924  Vmath::Vvtvp(nquad, &gmat[1][0], 1, dPhysValuesdy.get(), 1,
925  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
926  }
927  else
928  {
929  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
930  Blas::Daxpy(nquad, gmat[1][0], dPhysValuesdy.get(), 1,
931  dPhysValuesdx.get(), 1);
932  }
933  }
934  break;
935  case 3:
936  {
937  Array<OneD, NekDouble> dPhysValuesdy(nquad);
938  Array<OneD, NekDouble> dPhysValuesdz(nquad);
939 
940  PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy, dPhysValuesdz);
941 
942  // multiply with the proper geometric factors
943  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
944  {
945  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
946  dPhysValuesdx.get(), 1);
947  Vmath::Vvtvp(nquad, &gmat[1][0], 1, dPhysValuesdy.get(), 1,
948  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
949  Vmath::Vvtvp(nquad, &gmat[2][0], 1, dPhysValuesdz.get(), 1,
950  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
951  }
952  else
953  {
954  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
955  Blas::Daxpy(nquad, gmat[1][0], dPhysValuesdy.get(), 1,
956  dPhysValuesdx.get(), 1);
957  Blas::Daxpy(nquad, gmat[2][0], dPhysValuesdz.get(), 1,
958  dPhysValuesdx.get(), 1);
959  }
960  }
961  break;
962  default:
963  ASSERTL0(false, "Wrong number of dimensions");
964  break;
965  }
966 
967  v_IProductWRTBase(m_base[0]->GetDbdata(), dPhysValuesdx, outarray, 1);
968 }
969 
971  Array<OneD, NekDouble> &outarray,
972  const StdRegions::StdMatrixKey &mkey)
973 {
974  int nquad = m_base[0]->GetNumPoints();
975  const Array<TwoD, const NekDouble> &gmat =
976  m_metricinfo->GetDerivFactors(GetPointsKeys());
978 
979  Array<OneD, NekDouble> physValues(nquad);
980  Array<OneD, NekDouble> dPhysValuesdx(nquad);
982 
983  BwdTrans(inarray, physValues);
984 
985  // mass matrix operation
986  v_IProductWRTBase((m_base[0]->GetBdata()), physValues, wsp, 1);
987 
988  // Laplacian matrix operation
989  switch (m_geom->GetCoordim())
990  {
991  case 1:
992  {
993  PhysDeriv(physValues, dPhysValuesdx);
994 
995  // multiply with the proper geometric factors
996  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
997  {
998  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
999  dPhysValuesdx.get(), 1);
1000  }
1001  else
1002  {
1003  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1004  }
1005  }
1006  break;
1007  case 2:
1008  {
1009  Array<OneD, NekDouble> dPhysValuesdy(nquad);
1010 
1011  PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy);
1012 
1013  // multiply with the proper geometric factors
1014  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1015  {
1016  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1017  dPhysValuesdx.get(), 1);
1018  Vmath::Vvtvp(nquad, &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1019  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
1020  }
1021  else
1022  {
1023  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1024  Blas::Daxpy(nquad, gmat[1][0], dPhysValuesdy.get(), 1,
1025  dPhysValuesdx.get(), 1);
1026  }
1027  }
1028  break;
1029  case 3:
1030  {
1031  Array<OneD, NekDouble> dPhysValuesdy(nquad);
1032  Array<OneD, NekDouble> dPhysValuesdz(nquad);
1033 
1034  PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy, dPhysValuesdz);
1035 
1036  // multiply with the proper geometric factors
1037  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1038  {
1039  Vmath::Vmul(nquad, &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1040  dPhysValuesdx.get(), 1);
1041  Vmath::Vvtvp(nquad, &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1042  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
1043  Vmath::Vvtvp(nquad, &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1044  dPhysValuesdx.get(), 1, dPhysValuesdx.get(), 1);
1045  }
1046  else
1047  {
1048  Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1049  Blas::Daxpy(nquad, gmat[1][0], dPhysValuesdy.get(), 1,
1050  dPhysValuesdx.get(), 1);
1051  Blas::Daxpy(nquad, gmat[2][0], dPhysValuesdz.get(), 1,
1052  dPhysValuesdx.get(), 1);
1053  }
1054  }
1055  break;
1056  default:
1057  ASSERTL0(false, "Wrong number of dimensions");
1058  break;
1059  }
1060 
1061  v_IProductWRTBase(m_base[0]->GetDbdata(), dPhysValuesdx, outarray, 1);
1062  Blas::Daxpy(m_ncoeffs, lambda, wsp.get(), 1, outarray.get(), 1);
1063 }
1064 
1065 //-----------------------------
1066 // Matrix creation functions
1067 //-----------------------------
1068 
1070 {
1071  return m_staticCondMatrixManager[mkey];
1072 }
1073 
1075 {
1076  m_staticCondMatrixManager.DeleteObject(mkey);
1077 }
1078 
1080 {
1081  return m_matrixManager[mkey];
1082 }
1083 
1085 {
1086  m_matrixManager.DeleteObject(mkey);
1087 }
1088 
1090 {
1091  LibUtilities::BasisKey bkey = m_base[0]->GetBasisKey();
1094 
1095  return tmp->GetStdMatrix(mkey);
1096 }
1097 
1099 {
1100  DNekScalMatSharedPtr returnval;
1101  NekDouble fac;
1103 
1105  "Geometric information is not set up");
1106 
1107  switch (mkey.GetMatrixType())
1108  {
1109  case StdRegions::eMass:
1110  {
1111  if ((m_metricinfo->GetGtype() == SpatialDomains::eDeformed) ||
1112  (mkey.GetNVarCoeff()))
1113  {
1114  fac = 1.0;
1115  goto UseLocRegionsMatrix;
1116  }
1117  else
1118  {
1119  fac = (m_metricinfo->GetJac(ptsKeys))[0];
1120  goto UseStdRegionsMatrix;
1121  }
1122  }
1123  break;
1124  case StdRegions::eInvMass:
1125  {
1126  if ((m_metricinfo->GetGtype() == SpatialDomains::eDeformed) ||
1127  (mkey.GetNVarCoeff()))
1128  {
1129  NekDouble one = 1.0;
1131  DetShapeType(), *this);
1132  DNekMatSharedPtr mat = GenMatrix(masskey);
1133  mat->Invert();
1134 
1135  returnval =
1137  }
1138  else
1139  {
1140  fac = 1.0 / (m_metricinfo->GetJac(ptsKeys))[0];
1141  goto UseStdRegionsMatrix;
1142  }
1143  }
1144  break;
1148  {
1149  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed ||
1150  mkey.GetNVarCoeff())
1151  {
1152  fac = 1.0;
1153  goto UseLocRegionsMatrix;
1154  }
1155  else
1156  {
1157  int dir = 0;
1158  switch (mkey.GetMatrixType())
1159  {
1161  dir = 0;
1162  break;
1164  ASSERTL1(m_geom->GetCoordim() >= 2,
1165  "Cannot call eWeakDeriv2 in a "
1166  "coordinate system which is not at "
1167  "least two-dimensional");
1168  dir = 1;
1169  break;
1171  ASSERTL1(m_geom->GetCoordim() == 3,
1172  "Cannot call eWeakDeriv2 in a "
1173  "coordinate system which is not "
1174  "three-dimensional");
1175  dir = 2;
1176  break;
1177  default:
1178  break;
1179  }
1180 
1182  mkey.GetShapeType(), *this);
1183 
1184  DNekMatSharedPtr WeakDerivStd = GetStdMatrix(deriv0key);
1185  fac = m_metricinfo->GetDerivFactors(ptsKeys)[dir][0] *
1186  m_metricinfo->GetJac(ptsKeys)[0];
1187 
1189  fac, WeakDerivStd);
1190  }
1191  }
1192  break;
1194  {
1195  if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
1196  {
1197  fac = 1.0;
1198  goto UseLocRegionsMatrix;
1199  }
1200  else
1201  {
1202  int coordim = m_geom->GetCoordim();
1203  fac = 0.0;
1204  for (int i = 0; i < coordim; ++i)
1205  {
1206  fac += m_metricinfo->GetDerivFactors(ptsKeys)[i][0] *
1207  m_metricinfo->GetDerivFactors(ptsKeys)[i][0];
1208  }
1209  fac *= m_metricinfo->GetJac(ptsKeys)[0];
1210  goto UseStdRegionsMatrix;
1211  }
1212  }
1213  break;
1215  {
1217  MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
1218  DNekScalMat &MassMat = *(this->m_matrixManager[masskey]);
1219  MatrixKey lapkey(StdRegions::eLaplacian, mkey.GetShapeType(), *this,
1220  mkey.GetConstFactors(), mkey.GetVarCoeffs());
1221  DNekScalMat &LapMat = *(this->m_matrixManager[lapkey]);
1222 
1223  int rows = LapMat.GetRows();
1224  int cols = LapMat.GetColumns();
1225 
1226  DNekMatSharedPtr helm =
1228 
1229  NekDouble one = 1.0;
1230  (*helm) = LapMat + factor * MassMat;
1231 
1232  returnval =
1234  }
1235  break;
1240  {
1241  NekDouble one = 1.0;
1242 
1243  DNekMatSharedPtr mat = GenMatrix(mkey);
1244  returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one, mat);
1245  }
1246  break;
1248  {
1249  NekDouble one = 1.0;
1250 
1251  // StdRegions::StdMatrixKey
1252  // hkey(StdRegions::eHybridDGHelmholtz,
1253  // DetShapeType(),*this,
1254  // mkey.GetConstant(0),
1255  // mkey.GetConstant(1));
1257  *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
1258  DNekMatSharedPtr mat = GenMatrix(hkey);
1259 
1260  mat->Invert();
1261  returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one, mat);
1262  }
1263  break;
1265  {
1266  DNekMatSharedPtr m_Ix;
1267  Array<OneD, NekDouble> coords(1, 0.0);
1269  int vertex = (int)factors[StdRegions::eFactorGaussVertex];
1270 
1271  coords[0] = (vertex == 0) ? -1.0 : 1.0;
1272 
1273  m_Ix = m_base[0]->GetI(coords);
1274  returnval =
1276  }
1277  break;
1278 
1279  UseLocRegionsMatrix:
1280  {
1281  DNekMatSharedPtr mat = GenMatrix(mkey);
1282  returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(fac, mat);
1283  }
1284  break;
1285  UseStdRegionsMatrix:
1286  {
1287  DNekMatSharedPtr mat = GetStdMatrix(mkey);
1288  returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(fac, mat);
1289  }
1290  break;
1291  default:
1292  NEKERROR(ErrorUtil::efatal, "Matrix creation not defined");
1293  break;
1294  }
1295 
1296  return returnval;
1297 }
1298 
1300 {
1301  DNekMatSharedPtr returnval;
1302 
1303  switch (mkey.GetMatrixType())
1304  {
1311  returnval = Expansion1D::v_GenMatrix(mkey);
1312  break;
1313  default:
1314  returnval = StdSegExp::v_GenMatrix(mkey);
1315  break;
1316  }
1317 
1318  return returnval;
1319 }
1320 
1321 //-----------------------------
1322 // Private methods
1323 //-----------------------------
1324 
1325 /// Reverse the coefficients in a boundary interior expansion
1326 /// this routine is of use when we need the segment
1327 /// coefficients corresponding to a expansion in the reverse
1328 /// coordinate direction
1330  Array<OneD, NekDouble> &outarray)
1331 {
1332 
1333  int m;
1334  NekDouble sgn = 1;
1335 
1336  ASSERTL1(&inarray[0] != &outarray[0],
1337  "inarray and outarray can not be the same");
1338  switch (GetBasisType(0))
1339  {
1341  // Swap vertices
1342  outarray[0] = inarray[1];
1343  outarray[1] = inarray[0];
1344  // negate odd modes
1345  for (m = 2; m < m_ncoeffs; ++m)
1346  {
1347  outarray[m] = sgn * inarray[m];
1348  sgn = -sgn;
1349  }
1350  break;
1353  for (m = 0; m < m_ncoeffs; ++m)
1354  {
1355  outarray[m_ncoeffs - 1 - m] = inarray[m];
1356  }
1357  break;
1358  default:
1359  ASSERTL0(false, "This basis is not allowed in this method");
1360  break;
1361  }
1362 }
1363 
1364 /* \brief Mass inversion product from \a inarray to \a outarray
1365  *
1366  * Multiply by the inverse of the mass matrix
1367  * \f$ {\bf \hat{u}} = {\bf M}^{-1} {\bf I} \f$
1368  *
1369  **/
1371  Array<OneD, NekDouble> &outarray)
1372 {
1373  // get Mass matrix inverse
1374  MatrixKey masskey(StdRegions::eInvMass, DetShapeType(), *this);
1375  DNekScalMatSharedPtr matsys = m_matrixManager[masskey];
1376 
1377  NekVector<NekDouble> in(m_ncoeffs, inarray, eCopy);
1378  NekVector<NekDouble> out(m_ncoeffs, outarray, eWrapper);
1379 
1380  out = (*matsys) * in;
1381 }
1382 
1383 } // namespace LocalRegions
1384 } // namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:272
Describes the specification for a Basis.
Definition: Basis.h:50
Defines a specification for a set of points.
Definition: Points.h:59
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: Expansion1D.cpp:47
std::map< int, NormalVector > m_traceNormals
Definition: Expansion.h:278
std::map< int, Array< OneD, NekDouble > > m_elmtBndNormDirElmtLen
the element length in each element boundary(Vertex, edge or face) normal direction calculated based o...
Definition: Expansion.h:288
SpatialDomains::GeometrySharedPtr GetGeom() const
Definition: Expansion.cpp:171
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:275
ExpansionSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion.h:443
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: Expansion.cpp:535
int GetLeftAdjacentElementTrace() const
Definition: Expansion.h:456
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
Definition: Expansion.h:276
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:879
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
Definition: SegExp.cpp:350
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1084
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: SegExp.cpp:741
virtual void v_GetTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient) override
Definition: SegExp.cpp:688
virtual void v_PhysDeriv_s(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds) override
Evaluate the derivative along a line: . The derivative is calculated performing the product .
Definition: SegExp.cpp:205
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray) override
Definition: SegExp.cpp:653
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:589
void ReverseCoeffsAndSign(const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Reverse the coefficients in a boundary interior expansion this routine is of use when we need the seg...
Definition: SegExp.cpp:1329
SegExp(const LibUtilities::BasisKey &Ba, const SpatialDomains::Geometry1DSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: SegExp.cpp:59
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:555
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
Definition: SegExp.cpp:1098
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: SegExp.cpp:735
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:373
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Inner product of inarray over region with respect to the expansion basis (this)->_Base[0] and return ...
Definition: SegExp.cpp:476
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1299
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: SegExp.h:238
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
Integrate the physical point list inarray over region and return the value.
Definition: SegExp.cpp:102
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:970
virtual void v_PhysDeriv_n(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn) override
Evaluate the derivative normal to a line: . The derivative is calculated performing the product .
Definition: SegExp.cpp:244
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int mode_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType) override
Unpack data from input file assuming it comes from.
Definition: SegExp.cpp:767
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray) override
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray.
Definition: SegExp.cpp:149
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: SegExp.cpp:645
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1069
void MultiplyByElmtInvMass(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:1370
virtual int v_NumBndryCoeffs() const override
Definition: SegExp.cpp:755
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: SegExp.h:236
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:597
virtual void v_GetTracePhysMap(const int vertex, Array< OneD, int > &map) override
Definition: SegExp.cpp:701
virtual int v_NumDGBndryCoeffs() const override
Definition: SegExp.cpp:760
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1089
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:716
virtual void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1074
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals() override
Definition: SegExp.cpp:749
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1079
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition: SegExp.cpp:630
virtual void v_ComputeTraceNormal(const int vertex) override
Definition: SegExp.cpp:811
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:529
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray.
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
Definition: StdExpansion.h:162
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:609
const LibUtilities::PointsKeyVector GetPointsKeys() const
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Definition: StdExpansion.h:758
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:685
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:619
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:373
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
Definition: StdExpansion.h:430
DNekMatSharedPtr GenMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:843
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
Definition: StdExpansion.h:211
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Definition: StdExpansion.h:848
Array< OneD, LibUtilities::BasisSharedPtr > m_base
const ConstFactorMap & GetConstFactors() const
Definition: StdMatrixKey.h:140
LibUtilities::ShapeType GetShapeType() const
Definition: StdMatrixKey.h:90
const VarCoeffMap & GetVarCoeffs() const
Definition: StdMatrixKey.h:171
MatrixType GetMatrixType() const
Definition: StdMatrixKey.h:85
NekDouble GetConstFactor(const ConstFactorType &factor) const
Definition: StdMatrixKey.h:126
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = A x where A[m x n].
Definition: Blas.hpp:246
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition: Blas.hpp:168
static double Ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: output = .
Definition: Blas.hpp:182
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:154
void Interp1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
this function interpolates a 1D function evaluated at the quadrature points of the basis fbasis0 to ...
Definition: Interp.cpp:52
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:250
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
@ ePolyEvenlySpaced
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:75
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:51
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
Definition: BasisType.h:59
@ eGLL_Lagrange
Lagrange for SEM basis .
Definition: BasisType.h:58
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:50
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eNoGeomType
No type defined.
@ eMovingRegular
Currently unused.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry.h:63
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:399
std::shared_ptr< StdSegExp > StdSegExpSharedPtr
Definition: StdSegExp.h:267
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:209
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:574
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:359
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:248
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:284
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:492
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:419
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294