Commit b8e7569f authored by jonathan.froehlich's avatar jonathan.froehlich
Browse files

[429-extract-numerical-jacobi-from-newton] Added elliptic tests

parent 1964f0c8
......@@ -18,6 +18,8 @@ else ()
endif ()
# Test Executables
add_mpp_test(TestEllipticConsistency TUTORIAL)
add_mpi_test(TestEllipticMain TUTORIAL)
add_mpi_test(TestTransportMain TUTORIAL)
add_mpi_test(TestReactionMain TUTORIAL)
......
#include "TestEnvironment.hpp"
#include "IEllipticAssemble.hpp"
std::vector<std::string> ellipticProblems{"Kellogg", "Rock", "Laplace1D", "Laplace2D",
"Divergent", "Discontinuous1D", "Discontinuous2D"};
// Test Parameters are degree, level, problemName
class EllipticTest
: public TestWithParam<std::tuple<int, int, std::string>> {
protected:
std::unique_ptr<IEllipticProblem> problem;
std::unique_ptr<IEllipticAssemble> assemble;
std::unique_ptr<Vector> u;
EllipticTest(std::string model) :
problem(CreateEllipticProblemUnique(std::get<2>(GetParam()))),
assemble(
CreateEllipticAssembleUnique(*problem, model, std::get<0>(GetParam()),
std::get<1>(GetParam()), std::get<1>(GetParam()))),
u(std::make_unique<Vector>(0.0, assemble->GetDisc())) {
assemble->Initialize(*u);
}
};
/**************************************************
* Lagrange Consistency
**************************************************/
class LagrangeEllipticTest : public EllipticTest {
protected:
LagrangeEllipticTest() : EllipticTest("Lagrange") {}
};
TEST_P(LagrangeEllipticTest, AssembleConsistency) {
EXPECT_TRUE(isAssembleConsistent(*assemble, *u));
}
INSTANTIATE_TEST_CASE_P
(Degree_1_Consistency, LagrangeEllipticTest,
Combine(ValuesIn({1}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
INSTANTIATE_TEST_CASE_P
(Degree_2_Consistency, LagrangeEllipticTest,
Combine(ValuesIn({2}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
/**************************************************
* Mixed Consistency
**************************************************/
class MixedEllipticTest : public EllipticTest {
protected:
MixedEllipticTest() : EllipticTest("Mixed") {}
};
TEST_P(MixedEllipticTest, AssembleConsistency) {
EXPECT_TRUE(isAssembleConsistent(*assemble, *u));
}
INSTANTIATE_TEST_CASE_P
(Degree_1_Consistency, MixedEllipticTest,
Combine(ValuesIn({1}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
INSTANTIATE_TEST_CASE_P
(Degree_2_Consistency, MixedEllipticTest,
Combine(ValuesIn({2}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
/**************************************************
* Hybrid Consistency
**************************************************/
class HybridEllipticTest : public EllipticTest {
protected:
HybridEllipticTest() : EllipticTest("Hybrid") {}
};
TEST_P(HybridEllipticTest, AssembleConsistency) {
EXPECT_TRUE(isAssembleConsistent(*assemble, *u));
}
INSTANTIATE_TEST_CASE_P
(Degree_1_Consistency, HybridEllipticTest,
Combine(ValuesIn({1}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
INSTANTIATE_TEST_CASE_P
(Degree_2_Consistency, HybridEllipticTest,
Combine(ValuesIn({2}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
/**************************************************
* DG Consistency
**************************************************/
class DGEllipticTest : public EllipticTest {
protected:
DGEllipticTest() : EllipticTest("DG") {}
};
TEST_P(DGEllipticTest, AssembleConsistency) {
EXPECT_TRUE(isAssembleConsistent(*assemble, *u));
}
INSTANTIATE_TEST_CASE_P
(Degree_1_Consistency, DGEllipticTest,
Combine(ValuesIn({1}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
INSTANTIATE_TEST_CASE_P
(Degree_2_Consistency, DGEllipticTest,
Combine(ValuesIn({2}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
/**************************************************
* EG Consistency
**************************************************/
class EGEllipticTest : public EllipticTest {
protected:
EGEllipticTest() : EllipticTest("EG") {}
};
TEST_P(EGEllipticTest, AssembleConsistency) {
EXPECT_TRUE(isAssembleConsistent(*assemble, *u));
}
INSTANTIATE_TEST_CASE_P
(Degree_1_Consistency, EGEllipticTest,
Combine(ValuesIn({1}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
INSTANTIATE_TEST_CASE_P
(Degree_2_Consistency, EGEllipticTest,
Combine(ValuesIn({2}), ValuesIn({0, 2}), ValuesIn(ellipticProblems)));
int main(int argc, char **argv) {
return MppTest(
MppTestBuilder(argc, argv).
WithSearchPath(std::string(ProjectMppDir) + "/tutorial/").
WithScreenLogging().
WithPPM()
).RUN_ALL_MPP_TESTS();
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment