From: Wolfgang Bangerth Date: Mon, 18 Apr 2011 03:23:14 +0000 (+0000) Subject: Abstract the question of whether a cell is fluid or solid. X-Git-Tag: v8.0.0~4152 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=793c849037a3abb6f7d0b6e10d3fdd79306499b9;p=dealii.git Abstract the question of whether a cell is fluid or solid. git-svn-id: https://svn.dealii.org/trunk@23605 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index 425b689dbd..12194154a2 100644 --- a/deal.II/examples/step-46/step-46.cc +++ b/deal.II/examples/step-46/step-46.cc @@ -64,6 +64,13 @@ class FluidStructureProblem void run (); private: + static bool + cell_is_in_fluid_domain (const typename hp::DoFHandler::cell_iterator &cell); + + static bool + cell_is_in_solid_domain (const typename hp::DoFHandler::cell_iterator &cell); + + void setup_dofs (); void assemble_system (); void solve (); @@ -196,6 +203,25 @@ FluidStructureProblem::FluidStructureProblem (const unsigned int stokes_deg +template +bool +FluidStructureProblem:: +cell_is_in_fluid_domain (const typename hp::DoFHandler::cell_iterator &cell) +{ + return (cell->active_fe_index() == 0); +} + + +template +bool +FluidStructureProblem:: +cell_is_in_solid_domain (const typename hp::DoFHandler::cell_iterator &cell) +{ + return (cell->active_fe_index() == 1); +} + + + template void FluidStructureProblem::setup_dofs () { @@ -248,15 +274,15 @@ void FluidStructureProblem::setup_dofs () for (typename hp::DoFHandler::active_cell_iterator cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell) - if (cell->active_fe_index() == 0) + if (cell_is_in_fluid_domain (cell)) for (unsigned int f=0; f::faces_per_cell; ++f) - if (not cell->at_boundary(f)) + if (!cell->at_boundary(f)) { bool face_is_on_interface = false; if ((cell->neighbor(f)->has_children() == false) && - (cell->neighbor(f)->active_fe_index() == 1)) + (cell_is_in_solid_domain (cell->neighbor(f)))) face_is_on_interface = true; else if (cell->neighbor(f)->has_children() == true) { @@ -267,7 +293,7 @@ void FluidStructureProblem::setup_dofs () // on the other // side are elastic for (unsigned int sf=0; sfface(f)->n_children(); ++sf) - if (cell->neighbor_child_on_subface(f, sf)->active_fe_index() == 1) + if (cell_is_in_solid_domain (cell->neighbor_child_on_subface(f, sf))) { face_is_on_interface = true; break; @@ -375,7 +401,7 @@ void FluidStructureProblem::assemble_system () cell->get_fe().dofs_per_cell); local_rhs.reinit (cell->get_fe().dofs_per_cell); - if (cell->active_fe_index() == 0) + if (cell_is_in_fluid_domain (cell)) { const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; Assert (dofs_per_cell == stokes_dofs_per_cell, @@ -436,7 +462,7 @@ void FluidStructureProblem::assemble_system () cell->get_dof_indices (local_dof_indices); // see about face terms - if (cell->active_fe_index() == 0) + if (cell_is_in_fluid_domain (cell)) // we are on a fluid cell for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->at_boundary(f) == false) @@ -446,7 +472,7 @@ void FluidStructureProblem::assemble_system () (cell->neighbor(f)->has_children() == false)) { // cells are on same level - if (cell->neighbor(f)->active_fe_index() == 0) + if (cell_is_in_fluid_domain (cell->neighbor(f))) // neighbor is also a fluid cell continue;