#include "poisson_tester.h"
#include <gtest/gtest.h>
#include <fstream>
#include <sstream>
Go to the source code of this file.
◆ PoissonTestTypes
using PoissonTestTypes = ::testing::Types<std::integral_constant<int, 1>, std::integral_constant<int, 2>, std::integral_constant<int, 3> > |
◆ Poisson2DTester
◆ TYPED_TEST_CASE()
◆ TYPED_TEST()
◆ TEST_F() [1/4]
Definition at line 29 of file poisson_tester.cc.
31 std::stringstream str;
33 str <<
"subsection Poisson<2>" << std::endl
34 <<
" set Dirichlet boundary condition expression = x" << std::endl
35 <<
" set Dirichlet boundary ids = 0" << std::endl
36 <<
" set Finite element degree = 1" << std::endl
37 <<
" set Forcing term expression = 0" << std::endl
38 <<
" set Grid generator arguments = 0: 1: false"
40 <<
" set Grid generator function = hyper_cube"
42 <<
" set Neumann boundary condition expression = 0" << std::endl
43 <<
" set Neumann boundary ids = " << std::endl
44 <<
" set Number of global refinements = 4" << std::endl
45 <<
" set Number of refinement cycles = 1" << std::endl
46 <<
" set Output filename = poisson" << std::endl
47 <<
" set Problem constants = pi:3.14" << std::endl
48 <<
"end" << std::endl;
50 parse_string(str.str());
61 ASSERT_NEAR(tmp.l2_norm(), 0, 1e-10);
◆ TEST_F() [2/4]
Definition at line 65 of file poisson_tester.cc.
67 std::stringstream str;
69 str <<
"subsection Poisson<2>" << std::endl
70 <<
" set Dirichlet boundary condition expression = x^2" << std::endl
71 <<
" set Dirichlet boundary ids = 0" << std::endl
72 <<
" set Finite element degree = 2" << std::endl
73 <<
" set Forcing term expression = -2" << std::endl
74 <<
" set Grid generator arguments = 0: 1: false"
76 <<
" set Grid generator function = hyper_cube"
78 <<
" set Neumann boundary condition expression = 0" << std::endl
79 <<
" set Neumann boundary ids = " << std::endl
80 <<
" set Number of global refinements = 4" << std::endl
81 <<
" set Number of refinement cycles = 1" << std::endl
82 <<
" set Output filename = quadratic"
84 <<
" set Problem constants = pi:3.14" << std::endl
85 <<
"end" << std::endl;
87 parse_string(str.str());
98 ASSERT_NEAR(tmp.l2_norm(), 0, 1e-10);
◆ TEST_F() [3/4]
Definition at line 103 of file poisson_tester.cc.
105 std::stringstream str;
107 str <<
"subsection Poisson<2>" << std::endl
108 <<
" set Dirichlet boundary condition expression = x^2" << std::endl
109 <<
" set Dirichlet boundary ids = 1,2,3" << std::endl
110 <<
" set Finite element degree = 2" << std::endl
111 <<
" set Forcing term expression = -2" << std::endl
112 <<
" set Grid generator arguments = 0: 1: true"
114 <<
" set Grid generator function = hyper_cube"
116 <<
" set Neumann boundary condition expression = 0" << std::endl
117 <<
" set Neumann boundary ids = 0" << std::endl
118 <<
" set Number of global refinements = 4" << std::endl
119 <<
" set Number of refinement cycles = 1" << std::endl
120 <<
" set Output filename = quadratic"
122 <<
" set Problem constants = pi:3.14" << std::endl
123 <<
"end" << std::endl;
125 parse_string(str.str());
136 ASSERT_NEAR(tmp.l2_norm(), 0, 1e-10);
◆ TEST_F() [4/4]
Definition at line 142 of file poisson_tester.cc.
144 std::stringstream str;
146 str <<
"subsection Poisson<2>" << std::endl
147 <<
" set Dirichlet boundary condition expression = x" << std::endl
148 <<
" set Dirichlet boundary ids = 0" << std::endl
149 <<
" set Finite element degree = 1" << std::endl
150 <<
" set Forcing term expression = 0" << std::endl
151 <<
" set Grid generator arguments = 0: 1: false"
153 <<
" set Grid generator function = hyper_cube"
155 <<
" set Neumann boundary condition expression = 0" << std::endl
156 <<
" set Neumann boundary ids = " << std::endl
157 <<
" set Number of global refinements = 4" << std::endl
158 <<
" set Number of refinement cycles = 1" << std::endl
159 <<
" set Output filename = lin_with_handing"
161 <<
" set Problem constants = pi:3.14" << std::endl
162 <<
"end" << std::endl;
164 parse_string(str.str());
167 for (
unsigned int i = 0; i < 2; ++i)
169 for (
const auto &cell :
triangulation.active_cell_iterators())
170 if (cell->center().square() <= .25)
171 cell->set_refine_flag();
186 ASSERT_NEAR(tmp.l2_norm(), 0, 1e-10);