Nektar++
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::Collections::PhysInterp1DScaled_NoCollection Class Referencefinal

PhysInterp1DScaled operator using LocalRegions implementation. More...

Inheritance diagram for Nektar::Collections::PhysInterp1DScaled_NoCollection:
[legend]

Public Member Functions

 ~PhysInterp1DScaled_NoCollection () final
 
void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp) override
 Perform operation. More...
 
void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp) final
 
void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset) override
 Check the validity of the supplied factor map. More...
 
- Public Member Functions inherited from Nektar::Collections::Operator
 Operator (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
 Constructor. More...
 
virtual ~Operator ()=default
 
virtual COLLECTIONS_EXPORT void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 Perform operation. More...
 
virtual COLLECTIONS_EXPORT void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp=NullNekDouble1DArray)=0
 
virtual COLLECTIONS_EXPORT void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset)=0
 Check the validity of the supplied factor map. More...
 
unsigned int GetWspSize ()
 Get the size of the required workspace. More...
 
unsigned int GetNumElmt ()
 Get number of elements. More...
 
StdRegions::StdExpansionSharedPtr GetExpSharedPtr ()
 Get expansion pointer. More...
 
unsigned int GetInputSize ()
 
unsigned int GetOutputSize ()
 

Protected Attributes

vector< StdRegions::StdExpansionSharedPtrm_expList
 
StdRegions::FactorMap m_factors
 
- Protected Attributes inherited from Nektar::Collections::Operator
bool m_isDeformed
 
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 number of elements that the operator is applied on More...
 
unsigned int m_nqe
 
unsigned int m_wspSize
 
unsigned int m_inputSize
 number of modes or quadrature points that are passed as input to an operator More...
 
unsigned int m_outputSize
 number of modes or quadrature points that are taken as output from an operator More...
 

Private Member Functions

 PhysInterp1DScaled_NoCollection (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData, StdRegions::FactorMap factors)
 
void CheckFactors (StdRegions::FactorMap factors, int coll_phys_offset) override
 Check the validity of the supplied factor map. More...
 
 PhysInterp1DScaled_Helper ()
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Collections::Operator
virtual int v_GetInputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the size of input collection, that the operator is applied on either in physical or coefficient space. More...
 
virtual int v_GetOutputSize ()
 This purely virtual function needs to be set-up for every operator inside Collections. It is responsible for returning the output size either in physical or coefficient space of an operator inside Collections. More...
 
- Private Attributes inherited from Nektar::Collections::PhysInterp1DScaled_Helper
StdRegions::FactorMap m_factors
 

Detailed Description

PhysInterp1DScaled operator using LocalRegions implementation.

Definition at line 330 of file PhysInterp1DScaled.cpp.

Constructor & Destructor Documentation

◆ ~PhysInterp1DScaled_NoCollection()

Nektar::Collections::PhysInterp1DScaled_NoCollection::~PhysInterp1DScaled_NoCollection ( )
inlinefinal

Definition at line 336 of file PhysInterp1DScaled.cpp.

337 {
338 }

◆ PhysInterp1DScaled_NoCollection()

Nektar::Collections::PhysInterp1DScaled_NoCollection::PhysInterp1DScaled_NoCollection ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData,
StdRegions::FactorMap  factors 
)
inlineprivate

Definition at line 512 of file PhysInterp1DScaled.cpp.

515 : Operator(pCollExp, pGeomData, factors), PhysInterp1DScaled_Helper()
516 {
517 m_expList = pCollExp;
519 }
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, std::shared_ptr< CoalescedGeomData > GeomData, StdRegions::FactorMap factors)
Constructor.
Definition: Operator.cpp:66
vector< StdRegions::StdExpansionSharedPtr > m_expList
StdRegions::ConstFactorMap factors

References Nektar::VarcoeffHashingTest::factors, m_expList, and m_factors.

Member Function Documentation

◆ CheckFactors()

void Nektar::Collections::PhysInterp1DScaled_NoCollection::CheckFactors ( StdRegions::FactorMap  factors,
int  coll_phys_offset 
)
inlineoverridevirtual

Check the validity of the supplied factor map.

Implements Nektar::Collections::Operator.

Definition at line 496 of file PhysInterp1DScaled.cpp.

498 {
501 }
void CheckFactors(StdRegions::FactorMap factors, int coll_phys_offset) override
Check the validity of the supplied factor map.

References Nektar::Collections::PhysInterp1DScaled_Helper::CheckFactors(), Nektar::VarcoeffHashingTest::factors, and m_factors.

◆ operator()() [1/2]

void Nektar::Collections::PhysInterp1DScaled_NoCollection::operator() ( const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output0,
Array< OneD, NekDouble > &  output1,
Array< OneD, NekDouble > &  output2,
Array< OneD, NekDouble > &  wsp 
)
inlineoverridevirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 340 of file PhysInterp1DScaled.cpp.

345 {
346 int cnt{0};
347 int cnt1{0};
349 int dim{m_expList[0]->GetShapeDimension()}; // same as m_expType
350 switch (dim)
351 {
352 case 1:
353 {
355 // the number of points before and after interpolation are the
356 // same for each element inside a single collection
357 int pt0 = m_expList[0]->GetNumPoints(0);
358 int npt0 = (int)pt0 * scale;
359 for (int i = 0; i < m_numElmt; ++i)
360 {
361 // current points key
362 LibUtilities::PointsKey PointsKey0(
363 pt0, m_expList[i]->GetPointsType(0));
364 // get new points key
365 LibUtilities::PointsKey newPointsKey0(
366 npt0, m_expList[i]->GetPointsType(0));
367 // Interpolate points;
368 I0 = LibUtilities::PointsManager()[PointsKey0]->GetI(
369 newPointsKey0);
370
371 Blas::Dgemv('N', npt0, pt0, 1.0, I0->GetPtr().get(), npt0,
372 &input[cnt], 1, 0.0, &output[cnt1], 1);
373 cnt += pt0;
374 cnt1 += npt0;
375 }
376 }
377 break;
378 case 2:
379 {
380 DNekMatSharedPtr I0, I1;
381 // the number of points before and after interpolation are
382 // the same for each element inside a single collection
383 int pt0 = m_expList[0]->GetNumPoints(0);
384 int pt1 = m_expList[0]->GetNumPoints(1);
385 int npt0 = (int)pt0 * scale;
386 int npt1 = (int)pt1 * scale;
387 // workspace declaration
388 Array<OneD, NekDouble> wsp(npt1 * pt0); // fnp0*tnp1
389
390 for (int i = 0; i < m_numElmt; ++i)
391 {
392 // current points key
393 LibUtilities::PointsKey PointsKey0(
394 pt0, m_expList[i]->GetPointsType(0));
395 LibUtilities::PointsKey PointsKey1(
396 pt1, m_expList[i]->GetPointsType(1));
397 // get new points key
398 LibUtilities::PointsKey newPointsKey0(
399 npt0, m_expList[i]->GetPointsType(0));
400 LibUtilities::PointsKey newPointsKey1(
401 npt1, m_expList[i]->GetPointsType(1));
402
403 // Interpolate points;
404 I0 = LibUtilities::PointsManager()[PointsKey0]->GetI(
405 newPointsKey0);
406 I1 = LibUtilities::PointsManager()[PointsKey1]->GetI(
407 newPointsKey1);
408
409 Blas::Dgemm('N', 'T', pt0, npt1, pt1, 1.0, &input[cnt], pt0,
410 I1->GetPtr().get(), npt1, 0.0, wsp.get(), pt0);
411
412 Blas::Dgemm('N', 'N', npt0, npt1, pt0, 1.0,
413 I0->GetPtr().get(), npt0, wsp.get(), pt0, 0.0,
414 &output[cnt1], npt0);
415
416 cnt += pt0 * pt1;
417 cnt1 += npt0 * npt1;
418 }
419 }
420 break;
421 case 3:
422 {
423 DNekMatSharedPtr I0, I1, I2;
424
425 int pt0 = m_expList[0]->GetNumPoints(0);
426 int pt1 = m_expList[0]->GetNumPoints(1);
427 int pt2 = m_expList[0]->GetNumPoints(2);
428 int npt0 = (int)pt0 * scale;
429 int npt1 = (int)pt1 * scale;
430 int npt2 = (int)pt2 * scale;
431 Array<OneD, NekDouble> wsp1(npt0 * npt1 * pt2);
432 Array<OneD, NekDouble> wsp2(npt0 * pt1 * pt2);
433
434 for (int i = 0; i < m_numElmt; ++i)
435 {
436 // current points key
437 LibUtilities::PointsKey PointsKey0(
438 pt0, m_expList[i]->GetPointsType(0));
439 LibUtilities::PointsKey PointsKey1(
440 pt1, m_expList[i]->GetPointsType(1));
441 LibUtilities::PointsKey PointsKey2(
442 pt2, m_expList[i]->GetPointsType(2));
443 // get new points key
444 LibUtilities::PointsKey newPointsKey0(
445 npt0, m_expList[i]->GetPointsType(0));
446 LibUtilities::PointsKey newPointsKey1(
447 npt1, m_expList[i]->GetPointsType(1));
448 LibUtilities::PointsKey newPointsKey2(
449 npt2, m_expList[i]->GetPointsType(2));
450
451 I0 = LibUtilities::PointsManager()[PointsKey0]->GetI(
452 newPointsKey0);
453 I1 = LibUtilities::PointsManager()[PointsKey1]->GetI(
454 newPointsKey1);
455 I2 = LibUtilities::PointsManager()[PointsKey2]->GetI(
456 newPointsKey2);
457
458 // Interpolate points
459 Blas::Dgemm('N', 'N', npt0, pt1 * pt2, pt0, 1.0,
460 I0->GetPtr().get(), npt0, &input[cnt], pt0, 0.0,
461 wsp2.get(), npt0);
462
463 for (int j = 0; j < pt2; j++)
464 {
465 Blas::Dgemm('N', 'T', npt0, npt1, pt1, 1.0,
466 wsp2.get() + j * npt0 * pt1, npt0,
467 I1->GetPtr().get(), npt1, 0.0,
468 wsp1.get() + j * npt0 * npt1, npt0);
469 }
470
471 Blas::Dgemm('N', 'T', npt0 * npt1, npt2, pt2, 1.0,
472 wsp1.get(), npt0 * npt1, I2->GetPtr().get(),
473 npt2, 0.0, &output[cnt1], npt0 * npt1);
474
475 cnt += pt0 * pt1 * pt2;
476 cnt1 += npt0 * npt1 * npt2;
477 }
478 }
479 break;
480 default:
481 {
482 NEKERROR(ErrorUtil::efatal, "This expansion is not set for the "
483 "PhysInterp1DScaled operator.");
484 }
485 break;
486 }
487 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
unsigned int m_numElmt
number of elements that the operator is applied on
Definition: Operator.h:190
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 = alpha A x plus beta y where A[m x n].
Definition: Blas.hpp:211
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
Definition: Blas.hpp:383
PointsManagerT & PointsManager(void)
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble

References Blas::Dgemm(), Blas::Dgemv(), Nektar::StdRegions::eFactorConst, Nektar::ErrorUtil::efatal, m_expList, m_factors, Nektar::Collections::Operator::m_numElmt, NEKERROR, and Nektar::LibUtilities::PointsManager().

◆ operator()() [2/2]

void Nektar::Collections::PhysInterp1DScaled_NoCollection::operator() ( int  dir,
const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output,
Array< OneD, NekDouble > &  wsp 
)
inlinefinalvirtual

Implements Nektar::Collections::Operator.

Definition at line 488 of file PhysInterp1DScaled.cpp.

492 {
493 ASSERTL0(false, "Not valid for this operator.");
494 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208

References ASSERTL0.

Member Data Documentation

◆ m_expList

vector<StdRegions::StdExpansionSharedPtr> Nektar::Collections::PhysInterp1DScaled_NoCollection::m_expList
protected

Definition at line 504 of file PhysInterp1DScaled.cpp.

Referenced by operator()(), and PhysInterp1DScaled_NoCollection().

◆ m_factors

StdRegions::FactorMap Nektar::Collections::PhysInterp1DScaled_NoCollection::m_factors
protected