]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Abstract the question of whether a cell is fluid or solid.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 Apr 2011 03:23:14 +0000 (03:23 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 Apr 2011 03:23:14 +0000 (03:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@23605 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-46/step-46.cc

index 425b689dbd1218e78465b9cde2ae51f6afff1e2e..12194154a234364321b4149e837e4acfb2b75077 100644 (file)
@@ -64,6 +64,13 @@ class FluidStructureProblem
     void run ();
 
   private:
+    static bool
+    cell_is_in_fluid_domain (const typename hp::DoFHandler<dim>::cell_iterator &cell);
+
+    static bool
+    cell_is_in_solid_domain (const typename hp::DoFHandler<dim>::cell_iterator &cell);
+
+
     void setup_dofs ();
     void assemble_system ();
     void solve ();
@@ -196,6 +203,25 @@ FluidStructureProblem<dim>::FluidStructureProblem (const unsigned int stokes_deg
 
 
 
+template <int dim>
+bool
+FluidStructureProblem<dim>::
+cell_is_in_fluid_domain (const typename hp::DoFHandler<dim>::cell_iterator &cell)
+{
+  return (cell->active_fe_index() == 0);
+}
+
+
+template <int dim>
+bool
+FluidStructureProblem<dim>::
+cell_is_in_solid_domain (const typename hp::DoFHandler<dim>::cell_iterator &cell)
+{
+  return (cell->active_fe_index() == 1);
+}
+
+
+
 template <int dim>
 void FluidStructureProblem<dim>::setup_dofs ()
 {
@@ -248,15 +274,15 @@ void FluidStructureProblem<dim>::setup_dofs ()
     for (typename hp::DoFHandler<dim>::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<GeometryInfo<dim>::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<dim>::setup_dofs ()
                                                   // on the other
                                                   // side are elastic
                  for (unsigned int sf=0; sf<cell->face(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<dim>::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<dim>::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<GeometryInfo<dim>::faces_per_cell; ++f)
          if (cell->at_boundary(f) == false)
@@ -446,7 +472,7 @@ void FluidStructureProblem<dim>::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;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.