]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a bug that I introduced yesterday.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Apr 2009 08:44:40 +0000 (08:44 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Apr 2009 08:44:40 +0000 (08:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@18561 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/constraint_matrix.templates.h

index fbc2fd957975384b74ac2aa04631eca46a83afb3..5699e87841da89e7d04b79f73ff9a26245aab9d0 100644 (file)
@@ -1591,9 +1591,8 @@ distribute_local_to_global (const FullMatrix<double>        &local_matrix,
     {
       for (unsigned int i=block_start; i<block_ends[block]; ++i)
        {
-         const unsigned int row = my_indices[i].global_row;
+         const unsigned int row = localized_indices[i];
          const unsigned int loc_row = my_indices[i].local_row;
-         double val = 0;
 
          unsigned int block_col_start = 0;
          for (unsigned int block_col=0; block_col<num_blocks; ++block_col)
@@ -1617,15 +1616,6 @@ distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                          col_counter++;
                        }
                    }
-
-                 if (use_vectors == true)
-                   {
-                     val = local_vector(loc_row);
-
-                     for (unsigned int i=0; i<constraint_lines.size(); ++i)
-                       val -= constraint_lines[i].second->inhomogeneity *
-                         local_matrix(loc_row,constraint_lines[i].first);
-                   }
                }
 
              else
@@ -1687,29 +1677,6 @@ distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                          col_counter++;
                        }
                    }
-
-                 if (use_vectors == true)
-                   {
-                     if (loc_row != deal_II_numbers::invalid_unsigned_int)
-                       {
-                         Assert (loc_row >= 0 && loc_row < n_local_dofs,
-                                 ExcInternalError());
-                         val = local_vector(loc_row);
-                         for (unsigned int i=0; i<constraint_lines.size(); ++i)
-                           val -= constraint_lines[i].second->inhomogeneity *
-                             local_matrix(loc_row,constraint_lines[i].first);
-                       }
-
-                     for (unsigned int q=0; q < my_indices[i].constraints.size(); ++q)
-                       {
-                         const unsigned int loc_row_q = my_indices[i].constraints[q].first;
-                         double add_this = local_vector (loc_row_q);
-                         for (unsigned int k=0; k<constraint_lines.size(); ++k)
-                           add_this -= constraint_lines[k].second->inhomogeneity *
-                                       local_matrix(loc_row_q,constraint_lines[k].first);
-                         val += add_this * my_indices[i].constraints[q].second;
-                       }
-                   }
                }
 
              block_col_start = block_ends[block_col];
@@ -1721,14 +1688,39 @@ distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                                   // go trough the individual blocks and
                                   // look which entries we need to set.
              Threads::ThreadMutex::ScopedLock lock(mutex);
-             global_matrix.block(block, block_col).add(localized_indices[i], col_counter,
+             global_matrix.block(block, block_col).add(row, col_counter,
                                                        &cols[0], &vals[0],
                                                        false, true);
            }
-         if (val != 0)
+
+
+         if (use_vectors == true)
            {
-             Threads::ThreadMutex::ScopedLock lock(mutex);
-             global_vector(row) += val;
+             double val = 0;
+             if (loc_row != deal_II_numbers::invalid_unsigned_int)
+               {
+                 Assert (loc_row >= 0 && loc_row < n_local_dofs,
+                         ExcInternalError());
+                 val = local_vector(loc_row);
+                 for (unsigned int i=0; i<constraint_lines.size(); ++i)
+                   val -= constraint_lines[i].second->inhomogeneity *
+                     local_matrix(loc_row,constraint_lines[i].first);
+               }
+
+             for (unsigned int q=0; q < my_indices[i].constraints.size(); ++q)
+               {
+                 const unsigned int loc_row_q = my_indices[i].constraints[q].first;
+                 double add_this = local_vector (loc_row_q);
+                 for (unsigned int k=0; k<constraint_lines.size(); ++k)
+                   add_this -= constraint_lines[k].second->inhomogeneity *
+                               local_matrix(loc_row_q,constraint_lines[k].first);
+                 val += add_this * my_indices[i].constraints[q].second;
+               }
+             if (val != 0)
+               {
+                 Threads::ThreadMutex::ScopedLock lock(mutex);
+                 global_vector(my_indices[i].global_row) += val;
+               }
            }
        }
       block_start = block_ends[block];

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.