Nektar++
Expansion.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Expansion.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: File for Expansion routines
32//
33///////////////////////////////////////////////////////////////////////////////
34
38
39using namespace std;
40
42{
44 : m_indexMapManager(
45 std::bind(&Expansion::CreateIndexMap, this, std::placeholders::_1),
46 std::string("ExpansionIndexMap")),
47 m_geom(pGeom), m_metricinfo(m_geom->GetGeomFactors()),
48 m_elementTraceLeft(-1), m_elementTraceRight(-1)
49{
50 if (!m_metricinfo)
51 {
52 return;
53 }
54
55 if (!m_metricinfo->IsValid())
56 {
57 int nDim = m_base.size();
58 string type = "regular";
59 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
60 {
61 type = "deformed";
62 }
63
64 stringstream err;
65 err << nDim << "D " << type << " Jacobian not positive "
66 << "(element ID = " << m_geom->GetGlobalID() << ") "
67 << "(first vertex ID = " << m_geom->GetVid(0) << ")";
68 NEKERROR(ErrorUtil::ewarning, err.str());
69 }
70
71 m_traceExp.clear();
72}
73
75 : StdExpansion(pSrc), m_indexMapManager(pSrc.m_indexMapManager),
76 m_geom(pSrc.m_geom), m_metricinfo(pSrc.m_metricinfo)
77{
78}
79
81{
82}
83
85 const LocalRegions::MatrixKey &mkey)
86{
87 return v_GetLocMatrix(mkey);
88}
89
91{
92 return v_DropLocMatrix(mkey);
93}
94
96 const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
97{
98 return v_BuildTransformationMatrix(r_bnd, matrixType);
99}
100
102{
103 return v_BuildVertexMatrix(r_bnd);
104}
105
107 const NekDouble *data, const std::vector<unsigned int> &nummodes,
108 const int nmodes_offset, NekDouble *coeffs,
109 std::vector<LibUtilities::BasisType> &fromType)
110{
111 v_ExtractDataToCoeffs(data, nummodes, nmodes_offset, coeffs, fromType);
112}
113
115 const int edge, const std::shared_ptr<Expansion> &EdgeExp,
118{
119 v_AddEdgeNormBoundaryInt(edge, EdgeExp, Fx, Fy, outarray);
120}
121
123 const int edge, const std::shared_ptr<Expansion> &EdgeExp,
125{
126 v_AddEdgeNormBoundaryInt(edge, EdgeExp, Fn, outarray);
127}
128
130 const int face, const std::shared_ptr<Expansion> &FaceExp,
132{
133 v_AddFaceNormBoundaryInt(face, FaceExp, Fn, outarray);
134}
135
136void Expansion::DGDeriv(const int dir,
137 const Array<OneD, const NekDouble> &inarray,
140 Array<OneD, NekDouble> &outarray)
141{
142 v_DGDeriv(dir, inarray, EdgeExp, coeffs, outarray);
143}
144
146{
147 return v_VectorFlux(vec);
148}
149
152 Array<OneD, Array<OneD, NekDouble>> &d0factors,
153 Array<OneD, Array<OneD, NekDouble>> &d1factors)
154{
155 return v_NormalTraceDerivFactors(factors, d0factors, d1factors);
156}
157
159 const StdRegions::MatrixType mtype,
161 const StdRegions::VarCoeffMap &varcoeffs)
162{
163 MatrixKey mkey(mtype, DetShapeType(), *this, factors, varcoeffs);
164 return GetLocMatrix(mkey);
165}
166
168{
169 return m_geom;
170}
171
173{
174 // Clear metrics
175 m_metrics.clear();
176
177 // Regenerate geometry factors
178 m_metricinfo = m_geom->GetGeomFactors();
179}
180
182{
183 IndexMapValuesSharedPtr returnval;
184
185 IndexMapType itype = ikey.GetIndexMapType();
186
187 int entity = ikey.GetIndexEntity();
188
190
193
194 switch (itype)
195 {
196 case eEdgeToElement:
197 {
198 GetTraceToElementMap(entity, map, sign, orient);
199 }
200 break;
201 case eFaceToElement:
202 {
203 GetTraceToElementMap(entity, map, sign, orient);
204 }
205 break;
206 case eEdgeInterior:
207 {
208 ASSERTL0(false, "Boundary Index Map not implemented yet.");
209 // v_GetEdgeInteriorMap(entity,orient,map,sign);
210 }
211 break;
212 case eFaceInterior:
213 {
214 ASSERTL0(false, "Boundary Index Map not implemented yet.");
215 // v_GetFaceInteriorMap(entity,orient,map,sign);
216 }
217 break;
218 case eBoundary:
219 {
220 ASSERTL0(false, "Boundary Index Map not implemented yet.");
221 }
222 break;
223 case eVertex:
224 {
225 ASSERTL0(false, "Vertex Index Map not implemented yet.");
226 }
227 break;
228 default:
229 {
230 ASSERTL0(false, "The Index Map you are requiring "
231 "is not between the possible options.");
232 }
233 }
234
236
237 for (int i = 0; i < map.size(); i++)
238 {
239 (*returnval)[i].index = map[i];
240 (*returnval)[i].sign = sign[i];
241 }
242
243 return returnval;
244}
245
247{
248 return m_metricinfo;
249}
250
252{
253 std::map<int, NormalVector>::const_iterator x;
254 x = m_traceNormals.find(id);
255
256 // if edge normal not defined compute it
257 if (x == m_traceNormals.end())
258 {
260 x = m_traceNormals.find(id);
261 }
262 return x->second;
263}
264
266 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
267{
268 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
270}
271
273{
274 DNekScalBlkMatSharedPtr returnval;
275
277 "Geometric information is not set up");
278
279 // set up block matrix system
280 unsigned int nbdry = NumBndryCoeffs();
281 unsigned int nint = (unsigned int)(m_ncoeffs - nbdry);
282 unsigned int exp_size[] = {nbdry, nint};
283 unsigned int nblks = 2;
285 nblks, nblks, exp_size, exp_size);
286 // Really need a constructor which takes Arrays
287 NekDouble factor = 1.0;
288
289 switch (mkey.GetMatrixType())
290 {
291 // this can only use stdregions statically condensed system
292 // for mass matrix
294 if ((m_metricinfo->GetGtype() == SpatialDomains::eDeformed) ||
295 (mkey.GetNVarCoeff()))
296 {
297 factor = 1.0;
298 goto UseLocRegionsMatrix;
299 }
300 else
301 {
302 factor = (m_metricinfo->GetJac(GetPointsKeys()))[0];
303 goto UseStdRegionsMatrix;
304 }
305 break;
306 default: // use Deformed case for both
307 // regular and deformed geometries
308 factor = 1.0;
309 goto UseLocRegionsMatrix;
310 break;
311 UseStdRegionsMatrix:
312 {
313 NekDouble invfactor = 1.0 / factor;
314 NekDouble one = 1.0;
317 DNekMatSharedPtr Asubmat;
318
319 returnval->SetBlock(
320 0, 0,
322 factor, Asubmat = mat->GetBlock(0, 0)));
323 returnval->SetBlock(
324 0, 1,
326 one, Asubmat = mat->GetBlock(0, 1)));
327 returnval->SetBlock(
328 1, 0,
330 factor, Asubmat = mat->GetBlock(1, 0)));
331 returnval->SetBlock(
332 1, 1,
334 invfactor, Asubmat = mat->GetBlock(1, 1)));
335 }
336 break;
337 UseLocRegionsMatrix:
338 {
339 int i, j;
340 NekDouble invfactor = 1.0 / factor;
341 NekDouble one = 1.0;
342 DNekScalMat &mat = *GetLocMatrix(mkey);
351
352 Array<OneD, unsigned int> bmap(nbdry);
353 Array<OneD, unsigned int> imap(nint);
354 GetBoundaryMap(bmap);
355 GetInteriorMap(imap);
356
357 for (i = 0; i < nbdry; ++i)
358 {
359 for (j = 0; j < nbdry; ++j)
360 {
361 (*A)(i, j) = mat(bmap[i], bmap[j]);
362 }
363
364 for (j = 0; j < nint; ++j)
365 {
366 (*B)(i, j) = mat(bmap[i], imap[j]);
367 }
368 }
369
370 for (i = 0; i < nint; ++i)
371 {
372 for (j = 0; j < nbdry; ++j)
373 {
374 (*C)(i, j) = mat(imap[i], bmap[j]);
375 }
376
377 for (j = 0; j < nint; ++j)
378 {
379 (*D)(i, j) = mat(imap[i], imap[j]);
380 }
381 }
382
383 // Calculate static condensed system
384 if (nint)
385 {
386 D->Invert();
387 (*B) = (*B) * (*D);
388 (*A) = (*A) - (*B) * (*C);
389 }
390
392
393 returnval->SetBlock(
394 0, 0,
395 Atmp =
397 returnval->SetBlock(
398 0, 1,
400 returnval->SetBlock(
401 1, 0,
402 Atmp =
404 returnval->SetBlock(
405 1, 1,
407 D));
408 }
409 }
410 return returnval;
411}
412
414 [[maybe_unused]] const LocalRegions::MatrixKey &mkey)
415{
416 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
417}
418
420 const Array<OneD, const NekDouble> &inarray,
421 Array<OneD, NekDouble> &outarray)
422{
423 const int nqtot = GetTotPoints();
424
425 if (m_metrics.count(eMetricQuadrature) == 0)
426 {
428 }
429
430 Vmath::Vmul(nqtot, m_metrics[eMetricQuadrature], 1, inarray, 1, outarray,
431 1);
432}
433
435 const Array<OneD, const NekDouble> &inarray,
436 Array<OneD, NekDouble> &outarray)
437{
438 const int nqtot = GetTotPoints();
439
440 if (m_metrics.count(eMetricQuadrature) == 0)
441 {
443 }
444
445 Vmath::Vdiv(nqtot, inarray, 1, m_metrics[eMetricQuadrature], 1, outarray,
446 1);
447}
448
450{
452}
453
455{
456 unsigned int nqtot = GetTotPoints();
457 SpatialDomains::GeomType type = m_metricinfo->GetGtype();
459 if (type == SpatialDomains::eRegular ||
461 {
463 Array<OneD, NekDouble>(nqtot, m_metricinfo->GetJac(p)[0]);
464 }
465 else
466 {
468 }
469
472}
473
475{
476 int nquad = GetTotPoints();
477 int ntraces = GetNtraces();
478 int ndir = m_base.size();
479
481 Array<OneD, NekDouble> phys(nquad);
482
483 Array<OneD, Array<OneD, int>> traceids(ntraces);
484
485 int tottracepts = 0;
486 for (int i = 0; i < ntraces; ++i)
487 {
488 GetTracePhysMap(i, traceids[i]);
489 tottracepts += GetTraceNumPoints(i);
490 }
491
492 // initialise array to null so can call for
493 // differnt dimensions
495
496 DerivMat = Array<OneD, DNekMatSharedPtr>(ndir);
497
498 for (int i = 0; i < ndir; ++i)
499 {
500 Deriv[i] = Array<OneD, NekDouble>(nquad);
501 DerivMat[i] =
503 }
504
505 for (int i = 0; i < m_ncoeffs; ++i)
506 {
507 Vmath::Zero(m_ncoeffs, coeffs, 1);
508 coeffs[i] = 1.0;
509 BwdTrans(coeffs, phys);
510
511 // dphi_i/d\xi_1, dphi_i/d\xi_2 dphi_i/d\xi_3
512 StdPhysDeriv(phys, Deriv[0], Deriv[1], Deriv[2]);
513
514 int cnt = 0;
515 for (int j = 0; j < ntraces; ++j)
516 {
517 int nTracePts = GetTraceNumPoints(j);
518 for (int k = 0; k < nTracePts; ++k)
519 {
520 for (int d = 0; d < ndir; ++d)
521 {
522 (*DerivMat[d])(i, cnt + k) = Deriv[d][traceids[j][k]];
523 }
524 }
525 cnt += nTracePts;
526 }
527 }
528}
529
531 Array<OneD, NekDouble> &coords_1,
532 Array<OneD, NekDouble> &coords_2)
533{
534 ASSERTL1(m_geom, "m_geom not defined");
535
536 // get physical points defined in Geom
537 m_geom->FillGeom();
538
539 const int expDim = m_base.size();
540 int nqGeom = 1;
541 bool doCopy = true;
542
545
546 for (int i = 0; i < expDim; ++i)
547 {
548 CBasis[i] = m_geom->GetXmap()->GetBasis(i);
549 nqGeom *= CBasis[i]->GetNumPoints();
550 doCopy = doCopy &&
551 m_base[i]->GetBasisKey().SamePoints(CBasis[i]->GetBasisKey());
552 }
553
554 tmp[0] = coords_0;
555 tmp[1] = coords_1;
556 tmp[2] = coords_2;
557
558 if (doCopy)
559 {
560 for (int i = 0; i < m_geom->GetCoordim(); ++i)
561 {
562 m_geom->GetXmap()->BwdTrans(m_geom->GetCoeffs(i), tmp[i]);
563 }
564 }
565 else
566 {
567 for (int i = 0; i < m_geom->GetCoordim(); ++i)
568 {
569 Array<OneD, NekDouble> tmpGeom(nqGeom);
570 m_geom->GetXmap()->BwdTrans(m_geom->GetCoeffs(i), tmpGeom);
571
572 switch (expDim)
573 {
574 case 1:
575 {
577 CBasis[0]->GetPointsKey(), &tmpGeom[0],
578 m_base[0]->GetPointsKey(), &tmp[i][0]);
579 break;
580 }
581 case 2:
582 {
584 CBasis[0]->GetPointsKey(), CBasis[1]->GetPointsKey(),
585 &tmpGeom[0], m_base[0]->GetPointsKey(),
586 m_base[1]->GetPointsKey(), &tmp[i][0]);
587 break;
588 }
589 case 3:
590 {
592 CBasis[0]->GetPointsKey(), CBasis[1]->GetPointsKey(),
593 CBasis[2]->GetPointsKey(), &tmpGeom[0],
594 m_base[0]->GetPointsKey(), m_base[1]->GetPointsKey(),
595 m_base[2]->GetPointsKey(), &tmp[i][0]);
596 break;
597 }
598 }
599 }
600 }
601}
602
604 const Array<OneD, const NekDouble> &direction,
606{
607 int shapedim = dfdir.size();
608 int coordim = GetCoordim();
609 int nqtot = direction.size() / coordim;
610
611 for (int j = 0; j < shapedim; j++)
612 {
613 dfdir[j] = Array<OneD, NekDouble>(nqtot, 0.0);
614 for (int k = 0; k < coordim; k++)
615 {
616 if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
617 {
618 Vmath::Vvtvp(nqtot, &df[shapedim * k + j][0], 1,
619 &direction[k * nqtot], 1, &dfdir[j][0], 1,
620 &dfdir[j][0], 1);
621 }
622 else
623 {
624 Vmath::Svtvp(nqtot, df[shapedim * k + j][0],
625 &direction[k * nqtot], 1, &dfdir[j][0], 1,
626 &dfdir[j][0], 1);
627 }
628 }
629 }
630}
631
632// Get Moving frames
634 const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
635{
636 int coordim = GetCoordim();
637
638 int nquad0, nquad1, nquad2;
639 int nqtot = 1;
640 switch (shapedim)
641 {
642 case 2:
643 {
644 nquad0 = m_base[0]->GetNumPoints();
645 nquad1 = m_base[1]->GetNumPoints();
646 nqtot = nquad0 * nquad1;
647 break;
648 }
649 case 3:
650 {
651 nquad0 = m_base[0]->GetNumPoints();
652 nquad1 = m_base[1]->GetNumPoints();
653 nquad2 = m_base[2]->GetNumPoints();
654 nqtot = nquad0 * nquad1 * nquad2;
655 break;
656 }
657 default:
658 break;
659 }
660
661 StdRegions::VarCoeffType MMFCoeffs[15] = {
670
671 Array<OneD, NekDouble> MF(coordim * nqtot);
672 Array<OneD, NekDouble> tmp(nqtot);
673 for (int k = 0; k < coordim; k++)
674 {
675 StdRegions::VarCoeffMap::const_iterator MFdir =
676 varcoeffs.find(MMFCoeffs[5 * dir + k]);
677 tmp = MFdir->second.GetValue();
678
679 Vmath::Vcopy(nqtot, &tmp[0], 1, &MF[k * nqtot], 1);
680 }
681
682 return MF;
683}
684
685// Get magnitude of MF
687 const int dir, const StdRegions::VarCoeffMap &varcoeffs)
688{
689 int indxDiv = 3;
690
691 StdRegions::VarCoeffType MMFCoeffs[15] = {
700
701 StdRegions::VarCoeffMap::const_iterator MFdir =
702 varcoeffs.find(MMFCoeffs[5 * dir + indxDiv]);
703 Array<OneD, NekDouble> MFDiv = MFdir->second.GetValue();
704
705 return MFDiv;
706}
707
708// Get magnitude of MF
710 const int dir, const StdRegions::VarCoeffMap &varcoeffs)
711{
712 int indxMag = 4;
713
714 StdRegions::VarCoeffType MMFCoeffs[15] = {
723
724 StdRegions::VarCoeffMap::const_iterator MFdir =
725 varcoeffs.find(MMFCoeffs[5 * dir + indxMag]);
726 Array<OneD, NekDouble> MFmag = MFdir->second.GetValue();
727
728 return MFmag;
729}
730
732 [[maybe_unused]] const DNekScalMatSharedPtr &r_bnd,
733 [[maybe_unused]] const StdRegions::MatrixType matrixType)
734{
735 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
737}
738
740 [[maybe_unused]] const DNekScalMatSharedPtr &r_bnd)
741{
742 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
744}
745
747 [[maybe_unused]] const NekDouble *data,
748 [[maybe_unused]] const std::vector<unsigned int> &nummodes,
749 [[maybe_unused]] const int nmodes_offset,
750 [[maybe_unused]] NekDouble *coeffs,
751 [[maybe_unused]] std::vector<LibUtilities::BasisType> &fromType)
752{
753 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
754}
755
757 [[maybe_unused]] const int edge,
758 [[maybe_unused]] const std::shared_ptr<Expansion> &EdgeExp,
759 [[maybe_unused]] const Array<OneD, const NekDouble> &Fx,
760 [[maybe_unused]] const Array<OneD, const NekDouble> &Fy,
761 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
762{
763 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
764}
765
767 [[maybe_unused]] const int edge,
768 [[maybe_unused]] const std::shared_ptr<Expansion> &EdgeExp,
769 [[maybe_unused]] const Array<OneD, const NekDouble> &Fn,
770 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
771{
772 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
773}
774
776 [[maybe_unused]] const int face,
777 [[maybe_unused]] const std::shared_ptr<Expansion> &FaceExp,
778 [[maybe_unused]] const Array<OneD, const NekDouble> &Fn,
779 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
780{
781 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
782}
783
785 [[maybe_unused]] const int dir,
786 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
787 [[maybe_unused]] Array<OneD, ExpansionSharedPtr> &EdgeExp,
788 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &coeffs,
789 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
790{
791 NEKERROR(ErrorUtil::efatal, "This function is only valid for LocalRegions");
792}
793
795 [[maybe_unused]] const Array<OneD, Array<OneD, NekDouble>> &vec)
796{
798 "This function is only valid for "
799 "shape expansion in LocalRegions, not parant class");
800 return 0.0;
801}
802
804 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &factors,
805 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &d0factors,
806 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &d1factors)
807{
809 "This function is only valid for "
810 "shape expansion in LocalRegions, not parant class");
811}
812
814{
816}
817
819 [[maybe_unused]] StdRegions::Orientation dir,
820 [[maybe_unused]] Array<OneD, const NekDouble> &inarray,
821 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
822{
823 NEKERROR(ErrorUtil::efatal, "This function is not defined for this shape");
824}
825
827 [[maybe_unused]] const int trace,
828 [[maybe_unused]] Array<OneD, NekDouble> &outarray)
829{
831 "Method does not exist for this shape or library");
832}
833
835 [[maybe_unused]] const int trace,
836 [[maybe_unused]] const StdRegions::StdExpansionSharedPtr &TraceExp,
837 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
838 [[maybe_unused]] Array<OneD, NekDouble> &outarray,
839 [[maybe_unused]] StdRegions::Orientation orient)
840{
842 "Method does not exist for this shape or library");
843}
844
845void Expansion::v_GetTracePhysMap([[maybe_unused]] const int edge,
846 [[maybe_unused]] Array<OneD, int> &outarray)
847{
849 "Method does not exist for this shape or library");
850}
851
853 [[maybe_unused]] const StdRegions::Orientation orient,
854 [[maybe_unused]] Array<OneD, int> &idmap, [[maybe_unused]] const int nq0,
855 [[maybe_unused]] const int nq1)
856{
858 "Method does not exist for this shape or library");
859}
860
861void Expansion::v_GenTraceExp([[maybe_unused]] const int traceid,
862 [[maybe_unused]] ExpansionSharedPtr &exp)
863{
865 "Method does not exist for this shape or library");
866}
867
868void Expansion::v_ComputeTraceNormal([[maybe_unused]] const int id)
869{
870 ASSERTL0(false, "Cannot compute trace normal for this expansion.");
871}
872
874{
875 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
877}
878
880 [[maybe_unused]] Array<OneD, const NekDouble> &normal)
881{
882 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
883}
884
885void Expansion::v_SetUpPhysNormals([[maybe_unused]] const int edge)
886{
887 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
888}
889
891 [[maybe_unused]] const int trace,
892 [[maybe_unused]] const Array<OneD, const NekDouble> &primCoeffs,
893 [[maybe_unused]] DNekMatSharedPtr &inoutmat)
894{
895 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
896}
897
899 [[maybe_unused]] const int traceid,
900 [[maybe_unused]] const Array<OneD, const NekDouble> &primCoeffs,
901 [[maybe_unused]] const Array<OneD, NekDouble> &incoeffs,
902 [[maybe_unused]] Array<OneD, NekDouble> &coeffs)
903{
904 NEKERROR(ErrorUtil::efatal, "This function is not valid for this class");
905}
906
907void Expansion::v_TraceNormLen([[maybe_unused]] const int traceid,
908 [[maybe_unused]] NekDouble &h,
909 [[maybe_unused]] NekDouble &p)
910{
911 NEKERROR(ErrorUtil::efatal, "This method has not been defined");
912}
913
915 const int nbnd) const
916{
917 auto x = m_elmtBndNormDirElmtLen.find(nbnd);
919 "m_elmtBndNormDirElmtLen normal not computed.");
920 return x->second;
921}
922
924 [[maybe_unused]] const int dir,
925 [[maybe_unused]] const Array<OneD, const NekDouble> &inarray,
926 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray)
927{
928 NEKERROR(ErrorUtil::efatal, "v_AlignVectorToCollapsedDir is not defined");
929}
930} // namespace Nektar::LocalRegions
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:265
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:47
std::map< int, NormalVector > m_traceNormals
Definition: Expansion.h:276
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:286
virtual void v_SetPhysNormals(Array< OneD, const NekDouble > &normal)
Definition: Expansion.cpp:879
SpatialDomains::GeometrySharedPtr GetGeom() const
Definition: Expansion.cpp:167
virtual void v_TraceNormLen(const int traceid, NekDouble &h, NekDouble &p)
Definition: Expansion.cpp:907
IndexMapValuesSharedPtr CreateIndexMap(const IndexMapKey &ikey)
Definition: Expansion.cpp:181
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:273
void GetTracePhysMap(const int edge, Array< OneD, int > &outarray)
Definition: Expansion.h:209
void DropLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:90
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
Definition: Expansion.cpp:246
DNekMatSharedPtr BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
Definition: Expansion.cpp:101
virtual void v_DivideByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:434
virtual void v_GenTraceExp(const int traceid, ExpansionSharedPtr &exp)
Definition: Expansion.cpp:861
void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: Expansion.cpp:818
virtual void v_AddRobinTraceContribution(const int traceid, const Array< OneD, const NekDouble > &primCoeffs, const Array< OneD, NekDouble > &incoeffs, Array< OneD, NekDouble > &coeffs)
Definition: Expansion.cpp:898
void ComputeGmatcdotMF(const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble > > &dfdir)
Definition: Expansion.cpp:603
virtual void v_GetTraceQFactors(const int trace, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:826
virtual void v_ComputeTraceNormal(const int id)
Definition: Expansion.cpp:868
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
Definition: Expansion.cpp:272
void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: Expansion.cpp:530
Array< OneD, NekDouble > GetMFMag(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:709
virtual DNekMatSharedPtr v_BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
Definition: Expansion.cpp:739
virtual DNekScalMatSharedPtr v_GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:265
virtual void v_AddFaceNormBoundaryInt(const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:775
virtual void v_DGDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &coeffs, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:784
virtual DNekMatSharedPtr v_BuildTransformationMatrix(const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
Definition: Expansion.cpp:731
const Array< OneD, const NekDouble > & GetElmtBndNormDirElmtLen(const int nbnd) const
Definition: Expansion.cpp:914
virtual void v_AddRobinMassMatrix(const int face, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
Definition: Expansion.cpp:890
std::map< int, ExpansionWeakPtr > m_traceExp
Definition: Expansion.h:272
virtual void v_NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble > > &factors, Array< OneD, Array< OneD, NekDouble > > &d0factors, Array< OneD, Array< OneD, NekDouble > > &d1factors)
Definition: Expansion.cpp:803
void AddEdgeNormBoundaryInt(const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:114
void AddFaceNormBoundaryInt(const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:129
virtual void v_DropLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:413
virtual NekDouble v_VectorFlux(const Array< OneD, Array< OneD, NekDouble > > &vec)
Definition: Expansion.cpp:794
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
Definition: Expansion.h:274
virtual StdRegions::Orientation v_GetTraceOrient(int trace)
Definition: Expansion.cpp:813
void DGDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &coeffs, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:136
void StdDerivBaseOnTraceMat(Array< OneD, DNekMatSharedPtr > &DerivMat)
Definition: Expansion.cpp:474
void ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
Definition: Expansion.cpp:106
void v_MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: Expansion.cpp:419
virtual void v_ReOrientTracePhysMap(const StdRegions::Orientation orient, Array< OneD, int > &idmap, const int nq0, const int nq1=-1)
Definition: Expansion.cpp:852
void NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble > > &factors, Array< OneD, Array< OneD, NekDouble > > &d0factors, Array< OneD, Array< OneD, NekDouble > > &d1factors)
Definition: Expansion.cpp:150
virtual void v_ComputeLaplacianMetric()
Definition: Expansion.h:311
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals()
Definition: Expansion.cpp:873
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
Definition: Expansion.cpp:746
virtual void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: Expansion.cpp:923
virtual void v_AddEdgeNormBoundaryInt(const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: Expansion.cpp:756
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:84
virtual void v_SetUpPhysNormals(const int id)
Definition: Expansion.cpp:885
virtual void v_GetTracePhysMap(const int edge, Array< OneD, int > &outarray)
Definition: Expansion.cpp:845
Array< OneD, NekDouble > GetMFDiv(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:686
const NormalVector & GetTraceNormal(const int id)
Definition: Expansion.cpp:251
Array< OneD, NekDouble > GetMF(const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:633
virtual void v_GetTracePhysVals(const int trace, const StdRegions::StdExpansionSharedPtr &TraceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
Definition: Expansion.cpp:834
Expansion(SpatialDomains::GeometrySharedPtr pGeom)
Definition: Expansion.cpp:43
DNekMatSharedPtr BuildTransformationMatrix(const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
Definition: Expansion.cpp:95
NekDouble VectorFlux(const Array< OneD, Array< OneD, NekDouble > > &vec)
Definition: Expansion.cpp:145
StdRegions::Orientation GetIndexOrientation() const
Definition: IndexMapKey.h:94
IndexMapType GetIndexMapType() const
Definition: IndexMapKey.h:89
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:669
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:134
int GetTraceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th trace.
Definition: StdExpansion.h:281
const LibUtilities::PointsKeyVector GetPointsKeys() const
DNekBlkMatSharedPtr GetStdStaticCondMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:608
int GetNtraces() const
Returns the number of trace elements connected to this element.
Definition: StdExpansion.h:351
virtual void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
Definition: StdExpansion.h:684
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:367
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:674
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:424
void StdPhysDeriv(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:882
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
Definition: StdMatrixKey.h:83
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:47
void Interp3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
this function interpolates a 3D function evaluated at the quadrature points of the 3D basis,...
Definition: Interp.cpp:162
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
Definition: Interp.cpp:101
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:231
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:66
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:60
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< Geometry > GeometrySharedPtr
Definition: Geometry.h:51
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:430
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:375
std::vector< double > d(NPUPPER *NPUPPER)
StdRegions::ConstFactorMap factors
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static DNekMatSharedPtr NullDNekMatSharedPtr
Definition: NekTypeDefs.hpp:83
static Array< OneD, NekDouble > NullNekDouble1DArray
static DNekScalMatSharedPtr NullDNekScalMatSharedPtr
Definition: NekTypeDefs.hpp:84
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.hpp:72
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
Definition: Vmath.hpp:396
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.hpp:366
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.hpp:126
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825
STL namespace.