10 #include "gtest/gtest.h"
16 TEST(FunctionalExpansionsTest, legendreConstructor)
18 const unsigned int order = 5;
24 EXPECT_EQ(legendre.getOrder(0), order);
27 TEST(FunctionalExpansionsTest, legendreSeriesOrthonormalEvaluation)
29 const unsigned int order = 15;
30 Real location = -0.90922108754014;
31 const std::array<Real, order> truth = {{0.50000000000000,
53 auto & answer = legendre.getAllGeneration();
54 for (std::size_t i = 0; i < order; ++i)
55 EXPECT_NEAR(answer[i], truth[i],
tol);
58 TEST(FunctionalExpansionsTest, legendreSeriesSqrtMuEvaluation)
60 const unsigned int order = 15;
61 Real location = -0.90922108754014;
62 const std::array<Real, order> truth = {{0.50000000000000,
84 auto & answer = legendre.getAllGeneration();
85 for (std::size_t i = 0; i < order; ++i)
86 EXPECT_NEAR(answer[i], truth[i] / std::sqrt(i + 0.5),
tol);
89 TEST(FunctionalExpansionsTest, legendreSeriesStandardEvaluation)
91 const unsigned int order = 15;
92 Real location = -0.90922108754014;
93 const std::array<Real, order> truth = {{0.50000000000000,
115 auto & answer = legendre.getAllGeneration();
116 for (std::size_t i = 0; i < order; ++i)
117 EXPECT_NEAR(answer[i], truth[i] / (i + 0.5),
tol);
120 TEST(FunctionalExpansionsTest, CartesianConstructor)
122 std::vector<MooseEnum> domains;
123 std::vector<std::size_t> orders;
124 std::vector<MooseEnum> series;
138 EXPECT_EQ(legendreTwo.
getNumberOfTerms(), (orders[0] + 1) * (orders[1] + 1));
141 orders = {{14, 21, 22}};
144 EXPECT_EQ(legendreThree.
getNumberOfTerms(), (orders[0] + 1) * (orders[1] + 1) * (orders[2] + 1));
147 TEST(FunctionalExpansionsTest, Cartesian3D)
152 const std::vector<std::size_t> orders = {14, 21, 22};
160 const std::vector<Point> locations = {
161 Point(-0.14854612627465, 0.60364074055275, 0.76978431165674),
162 Point(0.93801805187856, 0.74175118177279, 0.74211345600994),
163 Point(0.35423736896098, -0.83921049062126, -0.02231845586669)};
164 const std::vector<Real> standard_truth = {1.32257143058688, 3.68047786932034, 0.17515811557416};
165 const std::vector<Real> orthogonal_truth = {
166 -2.33043696271172, 74.48747654183713, -14.48091828923379};
168 for (std::size_t i = 0; i < locations.size(); ++i)
176 TEST(FunctionalExpansionsTest, functionalBasisInterfaceCartesian)
181 const std::vector<std::size_t> orders = {4, 5, 3};
189 const Point location(-0.38541903411291, 0.61369802505416, -0.04539307255549);
190 const Real truth = 0.26458908225718;
194 EXPECT_NEAR(interface.getExpansionSeriesSum(), truth,
tol);