]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rewrite a few algorithms to only use get_fe() on cells, not faces, where it
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Apr 2006 02:01:34 +0000 (02:01 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Apr 2006 02:01:34 +0000 (02:01 +0000)
doesn't make much sense.

git-svn-id: https://svn.dealii.org/trunk@12916 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_tools.cc

index 994da67285ab707622ee8dc4e826bea4584894b0..8130067b0a6ea6c7d55addd965c8ac3031359064 100644 (file)
@@ -1137,21 +1137,22 @@ DoFTools::make_boundary_sparsity_pattern (
                                   // boundaries of dimension dim-2,
                                   // and so every boundary line is
                                   // also part of a boundary face.
-  typename DH::active_face_iterator face = dof.begin_active_face(),
-                                   endf = dof.end_face();
-  for (; face!=endf; ++face)
-    if (face->at_boundary())
-      {
-        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
-        dofs_on_this_face.resize (dofs_per_face);
-       face->get_dof_indices (dofs_on_this_face);
-
-                                        // make sparsity pattern for this cell
-       for (unsigned int i=0; i<dofs_per_face; ++i)
-         for (unsigned int j=0; j<dofs_per_face; ++j) 
-           sparsity.add (dof_to_boundary_mapping[dofs_on_this_face[i]],
-                         dof_to_boundary_mapping[dofs_on_this_face[j]]);
-      };
+  typename DH::active_cell_iterator cell = dof.begin_active(),
+                                   endc = dof.end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<DH::dimension>::faces_per_cell; ++f)
+      if (cell->at_boundary(f))
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_this_face.resize (dofs_per_face);
+          cell->face(f)->get_dof_indices (dofs_on_this_face);
+          
+                                           // make sparsity pattern for this cell
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            for (unsigned int j=0; j<dofs_per_face; ++j) 
+              sparsity.add (dof_to_boundary_mapping[dofs_on_this_face[i]],
+                            dof_to_boundary_mapping[dofs_on_this_face[j]]);
+      }
 }
 
 
@@ -1188,22 +1189,23 @@ void DoFTools::make_boundary_sparsity_pattern (
 
   std::vector<unsigned int> dofs_on_this_face;
   dofs_on_this_face.reserve (max_dofs_per_face(dof));
-  typename DH::active_face_iterator face = dof.begin_active_face(),
-                                   endf = dof.end_face();
-  for (; face!=endf; ++face)
-    if (boundary_indicators.find(face->boundary_indicator()) !=
-       boundary_indicators.end())
-      {
-        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
-        dofs_on_this_face.resize (dofs_per_face);
-       face->get_dof_indices (dofs_on_this_face);
-
-                                        // make sparsity pattern for this cell
-       for (unsigned int i=0; i<dofs_per_face; ++i)
-         for (unsigned int j=0; j<dofs_per_face; ++j)
-           sparsity.add (dof_to_boundary_mapping[dofs_on_this_face[i]],
-                         dof_to_boundary_mapping[dofs_on_this_face[j]]);
-      };
+  typename DH::active_cell_iterator cell = dof.begin_active(),
+                                   endc = dof.end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<DH::dimension>::faces_per_cell; ++f)
+      if (boundary_indicators.find(cell->face(f)->boundary_indicator()) !=
+          boundary_indicators.end())
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_this_face.resize (dofs_per_face);
+          cell->face(f)->get_dof_indices (dofs_on_this_face);
+
+                                           // make sparsity pattern for this cell
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            for (unsigned int j=0; j<dofs_per_face; ++j)
+              sparsity.add (dof_to_boundary_mapping[dofs_on_this_face[i]],
+                            dof_to_boundary_mapping[dofs_on_this_face[j]]);
+        }
 }
 
 #endif
@@ -3769,18 +3771,19 @@ DoFTools::map_dof_to_boundary_indices (const DH                  &dof_handler,
                                   // line is also part of a boundary
                                   // face which we will be visiting
                                   // sooner or later
-  typename DH::active_face_iterator face = dof_handler.begin_active_face(),
-                                   endf = dof_handler.end_face();
-  for (; face!=endf; ++face)
-    if (face->at_boundary()) 
-      {
-        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
-        dofs_on_face.resize (dofs_per_face);
-       face->get_dof_indices (dofs_on_face);
-       for (unsigned int i=0; i<dofs_per_face; ++i)
-         if (mapping[dofs_on_face[i]] == DH::invalid_dof_index)
-           mapping[dofs_on_face[i]] = next_boundary_index++;
-      };
+  typename DH::active_cell_iterator cell = dof_handler.begin_active(),
+                                   endc = dof_handler.end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<DH::dimension>::faces_per_cell; ++f)
+      if (cell->at_boundary(f)) 
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_face.resize (dofs_per_face);
+          cell->face(f)->get_dof_indices (dofs_on_face);
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            if (mapping[dofs_on_face[i]] == DH::invalid_dof_index)
+              mapping[dofs_on_face[i]] = next_boundary_index++;
+        }
 
   Assert (next_boundary_index == dof_handler.n_boundary_dofs(),
          ExcInternalError());
@@ -3810,19 +3813,20 @@ void DoFTools::map_dof_to_boundary_indices (
   dofs_on_face.reserve (max_dofs_per_face(dof_handler));
   unsigned int next_boundary_index = 0;
   
-  typename DH::active_face_iterator face = dof_handler.begin_active_face(),
-                                   endf = dof_handler.end_face();
-  for (; face!=endf; ++face)
-    if (boundary_indicators.find (face->boundary_indicator()) !=
-       boundary_indicators.end())
+  typename DH::active_cell_iterator cell = dof_handler.begin_active(),
+                                   endc = dof_handler.end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<DH::dimension>::faces_per_cell; ++f)
+      if (boundary_indicators.find (cell->face(f)->boundary_indicator()) !=
+          boundary_indicators.end())
       {
-        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
+        const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
         dofs_on_face.resize (dofs_per_face);
-       face->get_dof_indices (dofs_on_face);
+       cell->face(f)->get_dof_indices (dofs_on_face);
        for (unsigned int i=0; i<dofs_per_face; ++i)
          if (mapping[dofs_on_face[i]] == DH::invalid_dof_index)
            mapping[dofs_on_face[i]] = next_boundary_index++;
-      };
+      }
 
   Assert (next_boundary_index == dof_handler.n_boundary_dofs (boundary_indicators),
          ExcInternalError());

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.