--- /dev/null
+Fixed: DoFTools::make_periodicity_constraints() was not instantiated for condition 'dim < spacedim'. The instantiation was corrected and a test was added to verify that the function works for such condition.
+<br>
+(Malhar Tidke, 2020/12/23)
-template <int dim>
+template <int dim, int spacedim = dim>
void
-check_this(const DoFHandler<dim> &dof_handler)
+check_this(const DoFHandler<dim, spacedim> &dof_handler)
{
Functions::CosineFunction<dim> test_func(dof_handler.get_fe().n_components());
triangulation.refine_global(0);
}
+/* The 2D in 3D case */
+void generate_grid(Triangulation<2, 3> &triangulation, int orientation)
+{
+ Point<3> vertices_1[] = {
+ Point<3>(-1., -3., 0.),
+ Point<3>(+1., -3., 0.),
+ Point<3>(-1., -1., 0.),
+ Point<3>(+1., -1., 0.),
+ Point<3>(-1., +1., 0.),
+ Point<3>(+1., +1., 0.),
+ Point<3>(-1., +3., 0.),
+ Point<3>(+1., +3., 0.),
+ };
+ std::vector<Point<3>> vertices(&vertices_1[0], &vertices_1[8]);
+
+ std::vector<CellData<2>> cells(2, CellData<2>());
+
+ /* cell 0 */
+ int cell_vertices_0[GeometryInfo<2>::vertices_per_cell] = {0, 1, 2, 3};
+
+ /* cell 1 */
+ int cell_vertices_1[2][GeometryInfo<2>::vertices_per_cell] = {
+ {4, 5, 6, 7},
+ {7, 6, 5, 4},
+ };
+
+ for (const unsigned int j : GeometryInfo<2>::vertex_indices())
+ {
+ cells[0].vertices[j] = cell_vertices_0[j];
+ cells[1].vertices[j] = cell_vertices_1[orientation][j];
+ }
+ cells[0].material_id = 0;
+ cells[1].material_id = 0;
+
+ triangulation.create_triangulation(vertices, cells, SubCellData());
+
+ Triangulation<2, 3>::cell_iterator cell_1 = triangulation.begin();
+ Triangulation<2, 3>::cell_iterator cell_2 = cell_1++;
+ Triangulation<2, 3>::face_iterator face_1;
+ Triangulation<2, 3>::face_iterator face_2;
+
+ // Look for the two outermost faces:
+ for (const unsigned int j : GeometryInfo<2>::face_indices())
+ {
+ if (cell_1->face(j)->center()(1) > 2.9)
+ face_1 = cell_1->face(j);
+ if (cell_2->face(j)->center()(1) < -2.9)
+ face_2 = cell_2->face(j);
+ }
+ face_1->set_boundary_id(42);
+ face_2->set_boundary_id(43);
+
+ triangulation.refine_global(0);
+}
/* The 3D case */
void generate_grid(Triangulation<3> &triangulation, int orientation)
* Print out all face DoFs and support points as well as the actual
* matching via make_periodicity_constraints
*/
-template <int dim>
+template <int dim, int spacedim = dim>
void
-print_matching(DoFHandler<dim> &dof_handler,
- bool constrain_only_velocity = false)
+print_matching(DoFHandler<dim, spacedim> &dof_handler,
+ bool constrain_only_velocity = false)
{
- const FiniteElement<dim> &fe = dof_handler.get_fe();
- MappingQ<dim> mapping(1);
+ const FiniteElement<dim, spacedim> &fe = dof_handler.get_fe();
+ MappingQ<dim, spacedim> mapping(1);
- AffineConstraints<double> constraint_matrix;
- AffineConstraints<double> constraint_matrix_reverse;
- std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(mapping,
- dof_handler,
- support_points);
+ AffineConstraints<double> constraint_matrix;
+ AffineConstraints<double> constraint_matrix_reverse;
+ std::vector<Point<spacedim>> support_points(dof_handler.n_dofs());
+ DoFTools::map_dofs_to_support_points<dim, spacedim>(mapping,
+ dof_handler,
+ support_points);
FEValuesExtractors::Vector v(0);
FEValuesExtractors::Scalar v_1(0);
velocity_mask = fe.component_mask(v);
// Look for the two outermost faces:
- typename DoFHandler<dim>::face_iterator face_1;
- typename DoFHandler<dim>::face_iterator face_2;
- for (typename DoFHandler<dim>::cell_iterator cell = dof_handler.begin(0);
+ typename DoFHandler<dim, spacedim>::face_iterator face_1;
+ typename DoFHandler<dim, spacedim>::face_iterator face_2;
+ for (typename DoFHandler<dim, spacedim>::cell_iterator cell =
+ dof_handler.begin(0);
cell != dof_handler.end(0);
++cell)
{
face_1,
face_2,
dim == 2 ? 1 : 2,
- dealii::Tensor<1, dim>()))
+ dealii::Tensor<1, spacedim>()))
std::cerr << " not match! oh noze!! " << std::endl;
deallog << "Orientation: " << orientation[0] << orientation[1]
<< orientation[2] << std::endl;
print_matching(dof_handler);
}
+ deallog << "Test for 2D in 3D, Q1:" << std::endl << std::endl;
+
+ for (int i = 0; i < 2; ++i)
+ {
+ // Generate a triangulation and match:
+ Triangulation<2, 3> triangulation;
+ FE_Q<2, 3> fe(1);
+ DoFHandler<2, 3> dof_handler(triangulation);
+
+ deallog << "Triangulation:" << i << std::endl;
+
+ generate_grid(triangulation, i);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
+
deallog << "Test for 3D, Q1:" << std::endl << std::endl;
for (int i = 0; i < 8; ++i)
DEAL::DoFs of face_2:
DEAL:: component 0: (0 - -1.000 -3.000) (1 - 1.000 -3.000)
DEAL::Orientation: 110
+DEAL::Matching:
+ 4 1: 1.000
+ 5 0: 1.000
+DEAL::Reverse Matching:
+ 5 0: 1.000
+ 4 1: 1.000
+DEAL::Test for 2D in 3D, Q1:
+DEAL::
+DEAL::Triangulation:0
+DEAL::DoFs of face_1:
+DEAL:: component 0: (6 - -1.000 3.000 0.000) (7 - 1.000 3.000 0.000)
+DEAL::DoFs of face_2:
+DEAL:: component 0: (0 - -1.000 -3.000 0.000) (1 - 1.000 -3.000 0.000)
+DEAL::Orientation: 100
+DEAL::Matching:
+ 6 0: 1.000
+ 7 1: 1.000
+DEAL::Reverse Matching:
+ 6 0: 1.000
+ 7 1: 1.000
+DEAL::Triangulation:1
+DEAL::DoFs of face_1:
+DEAL:: component 0: (4 - 1.000 3.000 0.000) (5 - -1.000 3.000 0.000)
+DEAL::DoFs of face_2:
+DEAL:: component 0: (0 - -1.000 -3.000 0.000) (1 - 1.000 -3.000 0.000)
+DEAL::Orientation: 110
DEAL::Matching:
4 1: 1.000
5 0: 1.000
face_2->set_boundary_id(43);
}
+/* The 2D in 3D case */
+void generate_grid(Triangulation<2, 3> &triangulation)
+{
+ Point<3> vertices_1[] = {
+ Point<3>(-1., -3., 0.),
+ Point<3>(+1., -3., 0.),
+ Point<3>(-1., -1., 0.),
+ Point<3>(+1., -1., 0.),
+ Point<3>(-1., +1., 0.),
+ Point<3>(+1., +1., 0.),
+ Point<3>(-1., +3., 0.),
+ Point<3>(+1., +3., 0.),
+ };
+ std::vector<Point<3>> vertices(&vertices_1[0], &vertices_1[8]);
+
+ std::vector<CellData<2>> cells(2, CellData<2>());
+
+ /* cell 0 */
+ int cell_vertices_0[GeometryInfo<2>::vertices_per_cell] = {0, 1, 2, 3};
+
+ /* cell 1 */
+ int cell_vertices_1[GeometryInfo<2>::vertices_per_cell] = {7, 6, 5, 4};
+
+ for (const unsigned int j : GeometryInfo<2>::vertex_indices())
+ {
+ cells[0].vertices[j] = cell_vertices_0[j];
+ cells[1].vertices[j] = cell_vertices_1[j];
+ }
+ cells[0].material_id = 0;
+ cells[1].material_id = 0;
+
+ triangulation.create_triangulation(vertices, cells, SubCellData());
+
+ Triangulation<2, 3>::cell_iterator cell_1 = triangulation.begin();
+ Triangulation<2, 3>::cell_iterator cell_2 = cell_1++;
+ Triangulation<2, 3>::face_iterator face_1;
+ Triangulation<2, 3>::face_iterator face_2;
+
+ // Look for the two outermost faces:
+ for (const unsigned int j : GeometryInfo<2>::face_indices())
+ {
+ if (cell_1->face(j)->center()(1) > 2.9)
+ face_1 = cell_1->face(j);
+ if (cell_2->face(j)->center()(1) < -2.9)
+ face_2 = cell_2->face(j);
+ }
+ face_1->set_boundary_id(42);
+ face_2->set_boundary_id(43);
+}
+
/*
* Print out all face DoFs and support points as well as the actual
* matching via make_periodicity_constraints
*/
-template <int dim>
+template <int dim, int spacedim = dim>
void
-print_matching(DoFHandler<dim> &dof_handler)
+print_matching(DoFHandler<dim, spacedim> &dof_handler)
{
- const FiniteElement<dim> &fe = dof_handler.get_fe();
- MappingQ<dim> mapping(1);
+ const FiniteElement<dim, spacedim> &fe = dof_handler.get_fe();
+ MappingQ<dim, spacedim> mapping(1);
- AffineConstraints<double> constraint_matrix;
- std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(mapping,
- dof_handler,
- support_points);
+ AffineConstraints<double> constraint_matrix;
+ std::vector<Point<spacedim>> support_points(dof_handler.n_dofs());
+ DoFTools::map_dofs_to_support_points<dim, spacedim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
- typename DoFHandler<dim>::face_iterator face_1 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_1 =
(++dof_handler.begin(0))->face(2);
- typename DoFHandler<dim>::face_iterator face_2 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_2 =
dof_handler.begin(0)->face(2);
// Determine the orientation of the two faces:
logfile << std::setprecision(4);
deallog.attach(logfile);
- // Generate a triangulation and match:
- Triangulation<2> triangulation;
- FE_Q<2> fe(1);
- DoFHandler<2> dof_handler(triangulation);
-
- generate_grid(triangulation);
- dof_handler.distribute_dofs(fe);
- print_matching(dof_handler);
+ {
+ // Generate a triangulation and match:
+ Triangulation<2> triangulation;
+ FE_Q<2> fe(1);
+ DoFHandler<2> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
+
+ {
+ // Generate a triangulation and match:
+ Triangulation<2, 3> triangulation;
+ FE_Q<2, 3> fe(1);
+ DoFHandler<2, 3> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
return 0;
}
4 1: 1.000
5 0: 1.000
DEAL::Matching:
+DEAL::DoFs of face_1:
+DEAL::4 is located at 1.000 3.000 0.000
+DEAL::5 is located at -1.000 3.000 0.000
+DEAL::DoFs of face_2:
+DEAL::0 is located at -1.000 -3.000 0.000
+DEAL::1 is located at 1.000 -3.000 0.000
+ 4 1: 1.000
+ 5 0: 1.000
+DEAL::Matching:
face_2->set_boundary_id(43);
}
+/* The 2D in 3D case */
+void generate_grid(Triangulation<2, 3> &triangulation)
+{
+ Point<3> vertices_1[] = {
+ Point<3>(-1., -3., 0.),
+ Point<3>(+1., -3., 0.),
+ Point<3>(-1., -1., 0.),
+ Point<3>(+1., -1., 0.),
+ Point<3>(-1., +1., 0.),
+ Point<3>(+1., +1., 0.),
+ Point<3>(-1., +3., 0.),
+ Point<3>(+1., +3., 0.),
+ };
+ std::vector<Point<3>> vertices(&vertices_1[0], &vertices_1[8]);
+
+ std::vector<CellData<2>> cells(2, CellData<2>());
+
+ /* cell 0 */
+ int cell_vertices_0[GeometryInfo<2>::vertices_per_cell] = {0, 1, 2, 3};
+
+ /* cell 1 */
+ int cell_vertices_1[GeometryInfo<2>::vertices_per_cell] = {7, 6, 5, 4};
+
+ for (const unsigned int j : GeometryInfo<2>::vertex_indices())
+ {
+ cells[0].vertices[j] = cell_vertices_0[j];
+ cells[1].vertices[j] = cell_vertices_1[j];
+ }
+ cells[0].material_id = 0;
+ cells[1].material_id = 0;
+
+ triangulation.create_triangulation(vertices, cells, SubCellData());
+
+ Triangulation<2, 3>::cell_iterator cell_1 = triangulation.begin();
+ Triangulation<2, 3>::cell_iterator cell_2 = cell_1++;
+ Triangulation<2, 3>::face_iterator face_1;
+ Triangulation<2, 3>::face_iterator face_2;
+
+ // Look for the two outermost faces:
+ for (const unsigned int j : GeometryInfo<2>::face_indices())
+ {
+ if (cell_1->face(j)->center()(1) > 2.9)
+ face_1 = cell_1->face(j);
+ if (cell_2->face(j)->center()(1) < -2.9)
+ face_2 = cell_2->face(j);
+ }
+ face_1->set_boundary_id(42);
+ face_2->set_boundary_id(43);
+}
+
/*
* Print out all face DoFs and support points as well as the actual
* matching via make_periodicity_constraints
*/
-template <int dim>
+template <int dim, int spacedim = dim>
void
-print_matching(DoFHandler<dim> &dof_handler)
+print_matching(DoFHandler<dim, spacedim> &dof_handler)
{
- const FiniteElement<dim> &fe = dof_handler.get_fe();
- MappingQ<dim> mapping(1);
+ const FiniteElement<dim, spacedim> &fe = dof_handler.get_fe();
+ MappingQ<dim, spacedim> mapping(1);
- AffineConstraints<double> constraint_matrix;
- std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(mapping,
- dof_handler,
- support_points);
+ AffineConstraints<double> constraint_matrix;
+ std::vector<Point<spacedim>> support_points(dof_handler.n_dofs());
+ DoFTools::map_dofs_to_support_points<dim, spacedim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
- typename DoFHandler<dim>::face_iterator face_1 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_1 =
(++dof_handler.begin(0))->face(2);
- typename DoFHandler<dim>::face_iterator face_2 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_2 =
dof_handler.begin(0)->face(2);
// Determine the orientation of the two faces:
logfile << std::setprecision(4);
deallog.attach(logfile);
- // Generate a triangulation and match:
- Triangulation<2> triangulation;
- FE_Q<2> fe(3);
- DoFHandler<2> dof_handler(triangulation);
+ {
+ // Generate a triangulation and match:
+ Triangulation<2> triangulation;
+ FE_Q<2> fe(3);
+ DoFHandler<2> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
+
+ {
+ // Generate a triangulation and match:
+ Triangulation<2, 3> triangulation;
+ FE_Q<2, 3> fe(3);
+ DoFHandler<2, 3> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
- generate_grid(triangulation);
- dof_handler.distribute_dofs(fe);
- print_matching(dof_handler);
return 0;
}
24 9: 1.000
25 8: 1.000
DEAL::Matching:
+DEAL::DoFs of face_1:
+DEAL::16 is located at 1.000 3.000 0.000
+DEAL::17 is located at -1.000 3.000 0.000
+DEAL::24 is located at 0.4472 3.000 0.000
+DEAL::25 is located at -0.4472 3.000 0.000
+DEAL::DoFs of face_2:
+DEAL::0 is located at -1.000 -3.000 0.000
+DEAL::1 is located at 1.000 -3.000 0.000
+DEAL::8 is located at -0.4472 -3.000 0.000
+DEAL::9 is located at 0.4472 -3.000 0.000
+ 16 1: 1.000
+ 17 0: 1.000
+ 24 9: 1.000
+ 25 8: 1.000
+DEAL::Matching:
face_2->set_boundary_id(43);
}
+/* The 2D in 3D case */
+void generate_grid(Triangulation<2, 3> &triangulation)
+{
+ Point<3> vertices_1[] = {
+ Point<3>(-1., -3., 0.),
+ Point<3>(+1., -3., 0.),
+ Point<3>(-1., -1., 0.),
+ Point<3>(+1., -1., 0.),
+ Point<3>(-1., +1., 0.),
+ Point<3>(+1., +1., 0.),
+ Point<3>(-1., +3., 0.),
+ Point<3>(+1., +3., 0.),
+ };
+ std::vector<Point<3>> vertices(&vertices_1[0], &vertices_1[8]);
+
+ std::vector<CellData<2>> cells(2, CellData<2>());
+
+ /* cell 0 */
+ int cell_vertices_0[GeometryInfo<2>::vertices_per_cell] = {0, 1, 2, 3};
+
+ /* cell 1 */
+ int cell_vertices_1[GeometryInfo<2>::vertices_per_cell] = {7, 6, 5, 4};
+
+ for (const unsigned int j : GeometryInfo<2>::vertex_indices())
+ {
+ cells[0].vertices[j] = cell_vertices_0[j];
+ cells[1].vertices[j] = cell_vertices_1[j];
+ }
+ cells[0].material_id = 0;
+ cells[1].material_id = 0;
+
+ triangulation.create_triangulation(vertices, cells, SubCellData());
+ triangulation.refine_global(1);
+
+ Triangulation<2, 3>::cell_iterator cell_1 = triangulation.begin();
+ Triangulation<2, 3>::cell_iterator cell_2 = cell_1++;
+ Triangulation<2, 3>::face_iterator face_1;
+ Triangulation<2, 3>::face_iterator face_2;
+
+ // Look for the two outermost faces:
+ for (const unsigned int j : GeometryInfo<2>::face_indices())
+ {
+ if (cell_1->face(j)->center()(1) > 2.9)
+ face_1 = cell_1->face(j);
+ if (cell_2->face(j)->center()(1) < -2.9)
+ face_2 = cell_2->face(j);
+ }
+ face_1->set_boundary_id(42);
+ face_2->set_boundary_id(43);
+}
+
/*
* Print out all face DoFs and support points as well as the actual
* matching via make_periodicity_constraints
*/
-template <int dim>
+template <int dim, int spacedim = dim>
void
-print_matching(DoFHandler<dim> &dof_handler)
+print_matching(DoFHandler<dim, spacedim> &dof_handler)
{
- const FiniteElement<dim> &fe = dof_handler.get_fe();
- MappingQ<dim> mapping(1);
+ const FiniteElement<dim, spacedim> &fe = dof_handler.get_fe();
+ MappingQ<dim, spacedim> mapping(1);
- AffineConstraints<double> constraint_matrix;
- std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(mapping,
- dof_handler,
- support_points);
+ AffineConstraints<double> constraint_matrix;
+ std::vector<Point<spacedim>> support_points(dof_handler.n_dofs());
+ DoFTools::map_dofs_to_support_points<dim, spacedim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
- typename DoFHandler<dim>::face_iterator face_1 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_1 =
(++dof_handler.begin(0))->face(2);
- typename DoFHandler<dim>::face_iterator face_2 =
+ typename DoFHandler<dim, spacedim>::face_iterator face_2 =
dof_handler.begin(0)->face(2);
// Determine the orientation of the two faces:
logfile << std::setprecision(4);
deallog.attach(logfile);
- // Generate a triangulation and match:
- Triangulation<2> triangulation;
- FE_Q<2> fe(1);
- DoFHandler<2> dof_handler(triangulation);
+ {
+ // Generate a triangulation and match:
+ Triangulation<2> triangulation;
+ FE_Q<2> fe(1);
+ DoFHandler<2> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
+
+ {
+ Triangulation<2, 3> triangulation;
+ FE_Q<2, 3> fe(1);
+ DoFHandler<2, 3> dof_handler(triangulation);
+
+ generate_grid(triangulation);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
- generate_grid(triangulation);
- dof_handler.distribute_dofs(fe);
- print_matching(dof_handler);
return 0;
}
10 1: 1.000
13 0: 1.000
DEAL::Matching:
+DEAL::DoFs of face_1:
+DEAL::9 is located at 1.000 3.000 0.000
+DEAL::13 is located at -1.000 3.000 0.000
+DEAL::DoFs of face_2:
+DEAL::0 is located at -1.000 -3.000 0.000
+DEAL::4 is located at 1.000 -3.000 0.000
+ 9 4: 1.000
+ 10 1: 1.000
+ 13 0: 1.000
+DEAL::Matching:
triangulation.execute_coarsening_and_refinement();
}
+/* The 2D in 3D case */
+void generate_grid(Triangulation<2, 3> &triangulation, int orientation)
+{
+ Point<3> vertices_1[] = {
+ Point<3>(-1., -3., 0.),
+ Point<3>(+1., -3., 0.),
+ Point<3>(-1., -1., 0.),
+ Point<3>(+1., -1., 0.),
+ Point<3>(-1., +1., 0.),
+ Point<3>(+1., +1., 0.),
+ Point<3>(-1., +3., 0.),
+ Point<3>(+1., +3., 0.),
+ };
+ std::vector<Point<3>> vertices(&vertices_1[0], &vertices_1[8]);
+
+ std::vector<CellData<2>> cells(2, CellData<2>());
+
+ /* cell 0 */
+ int cell_vertices_0[GeometryInfo<2>::vertices_per_cell] = {0, 1, 2, 3};
+
+ /* cell 1 */
+ int cell_vertices_1[2][GeometryInfo<2>::vertices_per_cell] = {
+ {4, 5, 6, 7},
+ {7, 6, 5, 4},
+ };
+
+ for (const unsigned int j : GeometryInfo<2>::vertex_indices())
+ {
+ cells[0].vertices[j] = cell_vertices_0[j];
+ cells[1].vertices[j] = cell_vertices_1[orientation][j];
+ }
+ cells[0].material_id = 0;
+ cells[1].material_id = 0;
+
+ triangulation.create_triangulation(vertices, cells, SubCellData());
+
+ Triangulation<2, 3>::cell_iterator cell_1 = triangulation.begin();
+ Triangulation<2, 3>::cell_iterator cell_2 = cell_1++;
+ Triangulation<2, 3>::face_iterator face_1;
+ Triangulation<2, 3>::face_iterator face_2;
+
+ // Look for the two outermost faces:
+ for (const unsigned int j : GeometryInfo<2>::face_indices())
+ {
+ if (cell_1->face(j)->center()(1) > 2.9)
+ face_1 = cell_1->face(j);
+ if (cell_2->face(j)->center()(1) < -2.9)
+ face_2 = cell_2->face(j);
+ }
+ face_1->set_boundary_id(42);
+ face_2->set_boundary_id(43);
+
+ cell_2->set_refine_flag();
+ triangulation.execute_coarsening_and_refinement();
+}
/* The 3D case */
void generate_grid(Triangulation<3> &triangulation, int orientation)
* Print out all face DoFs and support points as well as the actual
* matching via make_periodicity_constraints
*/
-template <int dim>
+template <int dim, int spacedim = dim>
void
-print_matching(DoFHandler<dim> &dof_handler,
- bool constrain_only_velocity = false)
+print_matching(DoFHandler<dim, spacedim> &dof_handler,
+ bool constrain_only_velocity = false)
{
- const FiniteElement<dim> &fe = dof_handler.get_fe();
- MappingQ<dim> mapping(1);
+ const FiniteElement<dim, spacedim> &fe = dof_handler.get_fe();
+ MappingQ<dim, spacedim> mapping(1);
- AffineConstraints<double> constraint_matrix;
- AffineConstraints<double> constraint_matrix_reverse;
- std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(mapping,
- dof_handler,
- support_points);
+ AffineConstraints<double> constraint_matrix;
+ AffineConstraints<double> constraint_matrix_reverse;
+ std::vector<Point<spacedim>> support_points(dof_handler.n_dofs());
+ DoFTools::map_dofs_to_support_points<dim, spacedim>(mapping,
+ dof_handler,
+ support_points);
FEValuesExtractors::Vector v(0);
FEValuesExtractors::Scalar v_1(0);
velocity_mask = fe.component_mask(v);
// Look for the two outermost faces:
- typename DoFHandler<dim>::face_iterator face_1;
- typename DoFHandler<dim>::face_iterator face_2;
- for (typename DoFHandler<dim>::cell_iterator cell = dof_handler.begin(0);
+ typename DoFHandler<dim, spacedim>::face_iterator face_1;
+ typename DoFHandler<dim, spacedim>::face_iterator face_2;
+ for (typename DoFHandler<dim, spacedim>::cell_iterator cell =
+ dof_handler.begin(0);
cell != dof_handler.end(0);
++cell)
{
face_1,
face_2,
dim == 2 ? 1 : 2,
- dealii::Tensor<1, dim>()))
+ dealii::Tensor<1, spacedim>()))
std::cerr << " not match! oh noze!! " << std::endl;
deallog << "Orientation: " << orientation[0] << orientation[1]
<< orientation[2] << std::endl;
print_matching(dof_handler);
}
+ deallog << "Test for 2D in 3D, Q1:" << std::endl << std::endl;
+
+ for (int i = 0; i < 2; ++i)
+ {
+ // Generate a triangulation and match:
+ Triangulation<2, 3> triangulation;
+ FE_Q<2, 3> fe(1);
+ DoFHandler<2, 3> dof_handler(triangulation);
+
+ deallog << "Triangulation:" << i << std::endl;
+
+ generate_grid(triangulation, i);
+ dof_handler.distribute_dofs(fe);
+ print_matching(dof_handler);
+ }
+
deallog << "Test for 3D, Q1:" << std::endl << std::endl;
for (int i = 0; i < 8; ++i)
DEAL::DoFs of face_2:
DEAL:: component 0: (4 - -1.000 -3.000) (8 - 1.000 -3.000)
DEAL::Orientation: 110
+DEAL::Matching:
+ 4 1: 1.000
+ 5 1: 0.5000
+ 5 0: 0.5000
+ 8 0: 1.000
+DEAL::Reverse Matching:
+ 4 1: 1.000
+ 5 1: 0.5000
+ 5 0: 0.5000
+ 8 0: 1.000
+DEAL::Test for 2D in 3D, Q1:
+DEAL::
+DEAL::Triangulation:0
+DEAL::DoFs of face_1:
+DEAL:: component 0: (2 - -1.000 3.000 0.000) (3 - 1.000 3.000 0.000)
+DEAL::DoFs of face_2:
+DEAL:: component 0: (4 - -1.000 -3.000 0.000) (8 - 1.000 -3.000 0.000)
+DEAL::Orientation: 100
+DEAL::Matching:
+ 4 2: 1.000
+ 5 2: 0.5000
+ 5 3: 0.5000
+ 8 3: 1.000
+DEAL::Reverse Matching:
+ 4 2: 1.000
+ 5 2: 0.5000
+ 5 3: 0.5000
+ 8 3: 1.000
+DEAL::Triangulation:1
+DEAL::DoFs of face_1:
+DEAL:: component 0: (0 - 1.000 3.000 0.000) (1 - -1.000 3.000 0.000)
+DEAL::DoFs of face_2:
+DEAL:: component 0: (4 - -1.000 -3.000 0.000) (8 - 1.000 -3.000 0.000)
+DEAL::Orientation: 110
DEAL::Matching:
4 1: 1.000
5 1: 0.5000
-template <int dim>
+template <int dim, int spacedim = dim>
void
-check_this(const DoFHandler<dim> &dof_handler)
+check_this(const DoFHandler<dim, spacedim> &dof_handler)
{
Functions::CosineFunction<dim> test_func(dof_handler.get_fe().n_components());
// forward declaration of the function that must be provided in the
// .cc files
-template <int dim>
+template <int dim, int spacedim = dim>
void
-check_this(const DoFHandler<dim> &dof_handler);
+check_this(const DoFHandler<dim, spacedim> &dof_handler);