Nektar++
Loading...
Searching...
No Matches
Functions
Nektar::StdRegionsUnitTests Namespace Reference

Functions

void CheckInvBwdTrans (const StdRegions::StdExpansionSharedPtr &exp)
 
 BOOST_AUTO_TEST_CASE (TestQuadInvBwdTransPseudoInverse)
 
 BOOST_AUTO_TEST_CASE (TestHexInvBwdTransPseudoInverse)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

Nektar::StdRegionsUnitTests::BOOST_AUTO_TEST_CASE ( TestHexInvBwdTransPseudoInverse  )

Definition at line 99 of file TestInvBwdTrans.cpp.

100{
101 using namespace LibUtilities;
102
103 const PointsKey pointsKey(5, eGaussLobattoLegendre);
104 const BasisKey basisKey(eModified_A, 3, pointsKey);
105
108 basisKey, basisKey, basisKey);
109 CheckInvBwdTrans(exp);
110}
Describes the specification for a Basis.
Definition Basis.h:45
Defines a specification for a set of points.
Definition Points.h:50
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
void CheckInvBwdTrans(const StdRegions::StdExpansionSharedPtr &exp)

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CheckInvBwdTrans(), Nektar::LibUtilities::eGaussLobattoLegendre, and Nektar::LibUtilities::eModified_A.

◆ BOOST_AUTO_TEST_CASE() [2/2]

Nektar::StdRegionsUnitTests::BOOST_AUTO_TEST_CASE ( TestQuadInvBwdTransPseudoInverse  )

Definition at line 86 of file TestInvBwdTrans.cpp.

87{
88 using namespace LibUtilities;
89
90 const PointsKey pointsKey(6, eGaussLobattoLegendre);
91 const BasisKey basisKey(eModified_A, 4, pointsKey);
92
95 basisKey);
97}

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CheckInvBwdTrans(), Nektar::LibUtilities::eGaussLobattoLegendre, and Nektar::LibUtilities::eModified_A.

◆ CheckInvBwdTrans()

void Nektar::StdRegionsUnitTests::CheckInvBwdTrans ( const StdRegions::StdExpansionSharedPtr exp)

Definition at line 44 of file TestInvBwdTrans.cpp.

45{
46 const StdRegions::StdMatrixKey bwdKey(StdRegions::eBwdTrans,
47 exp->DetShapeType(), *exp);
48 const StdRegions::StdMatrixKey invKey(StdRegions::eInvBwdTrans,
49 exp->DetShapeType(), *exp);
50 const StdRegions::StdMatrixKey invIProdKey(StdRegions::eInvIProductWRTBase,
51 exp->DetShapeType(), *exp);
52
53 DNekMatSharedPtr bwd = exp->GetStdMatrix(bwdKey);
54 DNekMatSharedPtr invBwd = exp->GetStdMatrix(invKey);
55 DNekMatSharedPtr invIProd = exp->GetStdMatrix(invIProdKey);
56
57 BOOST_REQUIRE_EQUAL(bwd->GetRows(), exp->GetTotPoints());
58 BOOST_REQUIRE_EQUAL(bwd->GetColumns(), exp->GetNcoeffs());
59 BOOST_REQUIRE_EQUAL(invBwd->GetRows(), exp->GetNcoeffs());
60 BOOST_REQUIRE_EQUAL(invBwd->GetColumns(), exp->GetTotPoints());
61 BOOST_REQUIRE_EQUAL(invIProd->GetRows(), exp->GetTotPoints());
62 BOOST_REQUIRE_EQUAL(invIProd->GetColumns(), exp->GetNcoeffs());
63
64 const NekDouble epsilon = 1.0e-8;
65 DNekMat identity = (*invBwd) * (*bwd);
66
67 for (unsigned int i = 0; i < identity.GetRows(); ++i)
68 {
69 for (unsigned int j = 0; j < identity.GetColumns(); ++j)
70 {
71 const NekDouble expected = i == j ? 1.0 : 0.0;
72 BOOST_CHECK_SMALL(std::abs(*identity(i, j) - expected), epsilon);
73 }
74 }
75
76 for (unsigned int i = 0; i < invBwd->GetRows(); ++i)
77 {
78 for (unsigned int j = 0; j < invBwd->GetColumns(); ++j)
79 {
80 BOOST_CHECK_SMALL(std::abs(*(*invIProd)(j, i) - *(*invBwd)(i, j)),
81 epsilon);
82 }
83 }
84}
std::shared_ptr< DNekMat > DNekMatSharedPtr

References Nektar::StdRegions::eBwdTrans, Nektar::StdRegions::eInvBwdTrans, and Nektar::StdRegions::eInvIProductWRTBase.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().