Nektar++
Functions
Nektar::VariableSizedNekVectorUnitTests Namespace Reference

Functions

 BOOST_AUTO_TEST_CASE (TestConstructorWithArrayAndUserSpecifiedSize)
 
 BOOST_AUTO_TEST_CASE (ItemsThatShouldNotCompile)
 
 BOOST_AUTO_TEST_CASE (TestVectorSubtraction)
 
 BOOST_AUTO_TEST_CASE (TestVectorAddition)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

Nektar::VariableSizedNekVectorUnitTests::BOOST_AUTO_TEST_CASE ( ItemsThatShouldNotCompile  )

Definition at line 72 of file LibUtilities/LinearAlgebra/testNekVector.cpp.

73{
75 // NekVector<NekDouble> wrapper(test, eWrapper);
76}

References Nektar::UnitTests::test().

◆ BOOST_AUTO_TEST_CASE() [2/4]

Nektar::VariableSizedNekVectorUnitTests::BOOST_AUTO_TEST_CASE ( TestConstructorWithArrayAndUserSpecifiedSize  )

Definition at line 43 of file LibUtilities/LinearAlgebra/testNekVector.cpp.

44{
45 int nint = 1, nbndry = 1;
47
48 NekDouble buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
49 Array<OneD, NekDouble> out(10, buf);
50
51 NekVector<NekDouble> Fint(nint, offset = out + nbndry);
52 BOOST_CHECK_EQUAL(1u, Fint.GetDimension());
53 BOOST_CHECK_EQUAL(2u, Fint[0]);
54
55 NekVector<NekDouble> Vint(nint, offset = out + nbndry, eWrapper);
56 BOOST_CHECK_EQUAL(1u, Vint.GetDimension());
57 BOOST_CHECK_EQUAL(2, Vint[0]);
58
59 NekVector<NekDouble> testVector(4, offset = out + 3, eWrapper);
60 BOOST_CHECK_EQUAL(4u, testVector.GetDimension());
61 BOOST_CHECK_EQUAL(4, testVector[0]);
62 BOOST_CHECK_EQUAL(5, testVector[1]);
63 BOOST_CHECK_EQUAL(6, testVector[2]);
64 BOOST_CHECK_EQUAL(7, testVector[3]);
65
66 testVector[0] = 9.9;
67 BOOST_CHECK_EQUAL(9.9, testVector[0]);
68 BOOST_CHECK_EQUAL(9.9, offset[0]);
69 BOOST_CHECK_EQUAL(9.9, out[3]);
70}
double NekDouble

References Nektar::eWrapper, and Nektar::NekVector< DataType >::GetDimension().

◆ BOOST_AUTO_TEST_CASE() [3/4]

Nektar::VariableSizedNekVectorUnitTests::BOOST_AUTO_TEST_CASE ( TestVectorAddition  )

Definition at line 95 of file LibUtilities/LinearAlgebra/testNekVector.cpp.

96{
97 double lhs_buf[] = {1.0, 2.0, 3.0, 4.0};
98 double rhs_buf[] = {10.0, 11.0, 12.0, 13.0};
99
100 NekVector<double> lhs(4, lhs_buf);
101 NekVector<double> rhs(4, rhs_buf);
102
103 NekVector<double> result = lhs + rhs;
104
105 double expected_result_buf[] = {1.0 + 10.0, 2.0 + 11.0, 3.0 + 12.0,
106 4.0 + 13.0};
107 NekVector<double> expected_result(4, expected_result_buf);
108
109 BOOST_CHECK_EQUAL(expected_result, result);
110}

◆ BOOST_AUTO_TEST_CASE() [4/4]

Nektar::VariableSizedNekVectorUnitTests::BOOST_AUTO_TEST_CASE ( TestVectorSubtraction  )

Definition at line 78 of file LibUtilities/LinearAlgebra/testNekVector.cpp.

79{
80 double lhs_buf[] = {1.0, 2.0, 3.0, 4.0};
81 double rhs_buf[] = {10.0, 11.0, 12.0, 13.0};
82
83 NekVector<double> lhs(4, lhs_buf);
84 NekVector<double> rhs(4, rhs_buf);
85
86 NekVector<double> result = lhs - rhs;
87
88 double expected_result_buf[] = {1.0 - 10.0, 2.0 - 11.0, 3.0 - 12.0,
89 4.0 - 13.0};
90 NekVector<double> expected_result(4, expected_result_buf);
91
92 BOOST_CHECK_EQUAL(expected_result, result);
93}