]> https://gitweb.dealii.org/ - dealii.git/commitdiff
reenter test for dof on THIS face
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 24 Oct 2007 19:35:25 +0000 (19:35 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 24 Oct 2007 19:35:25 +0000 (19:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@15375 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/matrices.cc

index 327b8717422cdfab34dc1593bf7a5301362fd4dc..02a144c014c1075fca5ddca56e5aea0123b1ea11 100644 (file)
@@ -1037,6 +1037,10 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
   std::vector<unsigned int> dofs (dofs_per_cell);
   std::vector<unsigned int> dofs_on_face_vector (dofs_per_face);
   
+                                  // for each dof on the cell, have a
+                                  // flag whether it is on the face
+  std::vector<bool>         dof_is_on_face(dofs_per_cell);
+  
   typename DoFHandler<dim>::active_cell_iterator cell = range.first;
   for (; cell!=range.second; ++cell)
     for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
@@ -1085,7 +1089,7 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
              for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
                {
                  const double weight = fe_values.JxW(point);
-                 for (unsigned int i=0; i<fe_values.dofs_per_cell; ++i) 
+                 for (unsigned int i=0; i<fe_values.dofs_per_cell; ++i)
                    if (fe_is_primitive)
                      {
                        for (unsigned int j=0; j<fe_values.dofs_per_cell; ++j)
@@ -1193,20 +1197,28 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
                                           // searches.
          cell->get_dof_indices (dofs);
          cell->face(face)->get_dof_indices (dofs_on_face_vector);
+         for (unsigned int i=0; i<dofs_per_cell; ++i)
+           dof_is_on_face[i] = (std::find(dofs_on_face_vector.begin(),
+                                          dofs_on_face_vector.end(),
+                                          dofs[i])
+                                !=
+                                dofs_on_face_vector.end());
          
                                            // lock the matrix
           Threads::ThreadMutex::ScopedLock lock (mutex);
          for (unsigned int i=0; i<dofs_per_cell; ++i)
-           for (unsigned int j=0; j<dofs_per_cell; ++j)
-             if (dof_to_boundary_mapping[dofs[i]] != deal_II_numbers::invalid_unsigned_int
-                 && dof_to_boundary_mapping[dofs[j]] != deal_II_numbers::invalid_unsigned_int)
-               matrix.add(dof_to_boundary_mapping[dofs[i]],
-                          dof_to_boundary_mapping[dofs[j]],
-                          cell_matrix(i,j));
-         
-         for (unsigned int j=0; j<dofs_per_cell; ++j)
-           if (dof_to_boundary_mapping[dofs[j]] != deal_II_numbers::invalid_unsigned_int)
-             rhs_vector(dof_to_boundary_mapping[dofs[j]]) += cell_vector(j);
+           {
+             if (dof_is_on_face[i] && dof_to_boundary_mapping[dofs[i]] != deal_II_numbers::invalid_unsigned_int)
+               {
+                 for (unsigned int j=0; j<dofs_per_cell; ++j)
+                   if (dof_is_on_face[j] && dof_to_boundary_mapping[dofs[j]] != deal_II_numbers::invalid_unsigned_int)
+                     matrix.add(dof_to_boundary_mapping[dofs[i]],
+                                dof_to_boundary_mapping[dofs[j]],
+                                cell_matrix(i,j));
+                 
+                 rhs_vector(dof_to_boundary_mapping[dofs[i]]) += cell_vector(i);
+               }
+           }
        }
 }
 

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.