The finite element method using deal.II - 2021/2022
|
|
#include <deal.II/base/point.h>
#include <deal.II/grid/tria.h>
#include <gtest/gtest.h>
#include <fstream>
Go to the source code of this file.
|
void | first_grid (Triangulation< 2 > &) |
| Generate a hypercube, and output it as an svg file. More...
|
|
void | second_grid (Triangulation< 2 > &) |
| Generate a locally refined hyper_shell, and output it as an svg file. More...
|
|
void | third_grid (Triangulation< 2 > &) |
| Create an L-shaped domain with one global refinement, and write it on. More...
|
|
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. More...
|
|
| TEST (Step1, Mark1) |
|
| TEST (Step1, DISABLED_Mark2) |
|
| TEST (Step1, DISABLED_Mark3) |
|
| TEST (Step1, DISABLED_Mark4) |
|
| TEST (Step1, DISABLED_Mark5) |
|
| TEST (Step1, DISABLED_Mark6) |
|
int | main (int argc, char *argv[]) |
|
◆ first_grid()
Generate a hypercube, and output it as an svg file.
Definition at line 35 of file step-1.cc.
39 std::cout <<
"Number of original vertices: " <<
triangulation.n_vertices()
44 std::cout <<
"Number of vertices after 4 refinements: "
47 std::ofstream out(
"grid-1.svg");
50 std::cout <<
"Grid written to grid-1.svg" << std::endl;
53 std::ofstream out(
"grid-1.vtk");
56 std::cout <<
"Grid written to grid-1.vtk" << std::endl;
◆ second_grid()
Generate a locally refined hyper_shell, and output it as an svg file.
Definition at line 63 of file step-1.cc.
66 const double inner_radius = 0.5, outer_radius = 1.0;
68 triangulation, center, inner_radius, outer_radius, 10);
80 for (
const auto v : cell->vertex_indices())
82 const double distance_from_center =
85 if (std::fabs(distance_from_center - inner_radius) <=
88 cell->set_refine_flag();
◆ third_grid()
Create an L-shaped domain with one global refinement, and write it on.
Definition at line 104 of file step-1.cc.
◆ 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 at line 112 of file step-1.cc.
115 return std::make_tuple(0, 0, 0);
◆ TEST() [1/6]
Definition at line 23 of file gtest.cc.
27 ASSERT_TRUE(std::ifstream(
"grid-1.svg"));
◆ TEST() [2/6]
TEST |
( |
Step1 |
, |
|
|
DISABLED_Mark2 |
|
|
) |
| |
Definition at line 33 of file gtest.cc.
37 ASSERT_TRUE(std::ifstream(
"grid-2.svg"));
◆ TEST() [3/6]
TEST |
( |
Step1 |
, |
|
|
DISABLED_Mark3 |
|
|
) |
| |
Definition at line 41 of file gtest.cc.
45 ASSERT_TRUE(std::ifstream(
"grid-3.vtk"));
◆ TEST() [4/6]
TEST |
( |
Step1 |
, |
|
|
DISABLED_Mark4 |
|
|
) |
| |
Definition at line 50 of file gtest.cc.
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);
◆ TEST() [5/6]
TEST |
( |
Step1 |
, |
|
|
DISABLED_Mark5 |
|
|
) |
| |
Definition at line 62 of file gtest.cc.
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);
◆ TEST() [6/6]
TEST |
( |
Step1 |
, |
|
|
DISABLED_Mark6 |
|
|
) |
| |
Definition at line 74 of file gtest.cc.
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);
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 87 of file gtest.cc.
89 testing::InitGoogleTest(&argc, argv);
90 return RUN_ALL_TESTS();
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
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.
void write_vtk(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
const ::Triangulation< dim, spacedim > & tria
void hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, bool colorize=false)
static std::string to_string(const T &s, const Patterns::PatternBase &p=*Convert< T >::to_pattern())=delete
void second_grid(Triangulation< 2 > &)
Generate a locally refined hyper_shell, and output it as an svg file.
numbers::NumberTraits< double >::real_type distance(const Point< dim, double > &p) const
void write_svg(const Triangulation< 2, 2 > &tria, std::ostream &out) const
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void step(Vector< number2 > &dst, const Vector< number2 > &rhs) const
void third_grid(Triangulation< 2 > &)
Create an L-shaped domain with one global refinement, and write it on.
void first_grid(Triangulation< 2 > &)
Generate a hypercube, and output it as an svg file.