The finite element method using deal.II - 2021/2022
gtest.cc
Go to the documentation of this file.
1 #include <deal.II/base/point.h>
2 
3 #include <deal.II/grid/tria.h>
4 
5 #include <gtest/gtest.h>
6 
7 #include <fstream>
8 
9 using namespace dealii;
10 
11 // Declare functions in step-1 and step-2
12 void
14 void
16 void
18 std::tuple<unsigned int, unsigned int, unsigned int>
19 get_info(const Triangulation<2> &);
20 
21 
22 
23 TEST(Step1, Mark1)
24 {
27  ASSERT_TRUE(std::ifstream("grid-1.svg"));
28 }
29 
30 
31 // Remove the DISABLED_ prefix from the following tests when you have done the
32 // corresponding exercise
33 TEST(Step1, DISABLED_Mark2)
34 {
37  ASSERT_TRUE(std::ifstream("grid-2.svg"));
38 }
39 
40 
41 TEST(Step1, DISABLED_Mark3)
42 {
45  ASSERT_TRUE(std::ifstream("grid-3.vtk"));
46 }
47 
48 
49 
50 TEST(Step1, DISABLED_Mark4)
51 {
54  auto [levels, cells, active_cells] = get_info(tria);
55  EXPECT_EQ(levels, 5u);
56  EXPECT_EQ(cells, 341u);
57  EXPECT_EQ(active_cells, 256u);
58 }
59 
60 
61 
62 TEST(Step1, DISABLED_Mark5)
63 {
66  const auto [levels, cells, active_cells] = get_info(tria);
67  EXPECT_EQ(levels, 6u);
68  EXPECT_EQ(cells, 1250u);
69  EXPECT_EQ(active_cells, 940u);
70 }
71 
72 
73 
74 TEST(Step1, DISABLED_Mark6)
75 {
78  auto [levels, cells, active_cells] = get_info(tria);
79  EXPECT_EQ(levels, 5u);
80  EXPECT_EQ(cells, 351u);
81  EXPECT_EQ(active_cells, 264u);
82 }
83 
84 
85 
86 int
87 main(int argc, char *argv[])
88 {
89  testing::InitGoogleTest(&argc, argv);
90  return RUN_ALL_TESTS();
91 }
get_info
std::tuple< unsigned int, unsigned int, unsigned int > get_info(const Triangulation< 2 > &)
Returns a tuple with number of levels, number of cells, number of active.
Definition: step-1.cc:112
dealii
point.h
Triangulation< 2 >
main
int main(int argc, char *argv[])
Definition: gtest.cc:87
tria
const ::Triangulation< dim, spacedim > & tria
tria.h
second_grid
void second_grid(Triangulation< 2 > &)
Generate a locally refined hyper_shell, and output it as an svg file.
Definition: step-1.cc:63
third_grid
void third_grid(Triangulation< 2 > &)
Create an L-shaped domain with one global refinement, and write it on.
Definition: step-1.cc:104
TEST
TEST(Step1, Mark1)
Definition: gtest.cc:23
first_grid
void first_grid(Triangulation< 2 > &)
Generate a hypercube, and output it as an svg file.
Definition: step-1.cc:35