]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Do not access the element-past-the-end of a vector.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2011 00:03:09 +0000 (00:03 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2011 00:03:09 +0000 (00:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@23895 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/dofs/dof_handler_policy.cc

index 922ee7e53962129beb3b892b950286cdcf078673..8fafef684623750da4cb80ebd9aada6335a09a5b 100644 (file)
@@ -1133,12 +1133,12 @@ namespace internal
                        tr->get_communicator());
 
        const unsigned int
-         shift = std::accumulate( &number_cache
-                                  .n_locally_owned_dofs_per_processor[0],
-                                  &number_cache
-                                  .n_locally_owned_dofs_per_processor
-                                  [tr->locally_owned_subdomain()],
-                                  0 );
+         shift = std::accumulate (number_cache
+                                  .n_locally_owned_dofs_per_processor.begin(),
+                                  number_cache
+                                  .n_locally_owned_dofs_per_processor.begin()
+                                  + tr->locally_owned_subdomain(),
+                                  0);
        for (std::vector<unsigned int>::iterator it=renumbering.begin();
             it!=renumbering.end(); ++it)
          if (*it != DoFHandler<dim,spacedim>::invalid_dof_index)
@@ -1155,11 +1155,11 @@ namespace internal
                                         // now a little bit of
                                         // housekeeping
        number_cache.n_global_dofs
-         = std::accumulate( &number_cache
-                            .n_locally_owned_dofs_per_processor[0],
-                            &number_cache
-                            .n_locally_owned_dofs_per_processor[n_cpus],
-                            0 );
+         = std::accumulate (number_cache
+                            .n_locally_owned_dofs_per_processor.begin(),
+                            number_cache
+                            .n_locally_owned_dofs_per_processor.end(),
+                            0);
 
        number_cache.locally_owned_dofs = IndexSet(number_cache.n_global_dofs);
        number_cache.locally_owned_dofs
@@ -1539,11 +1539,11 @@ namespace internal
            }
 
          number_cache.n_global_dofs
-           = std::accumulate( &number_cache
-                              .n_locally_owned_dofs_per_processor[0],
-                              &number_cache
-                              .n_locally_owned_dofs_per_processor[n_cpus],
-                              0 );
+           = std::accumulate (number_cache
+                              .n_locally_owned_dofs_per_processor.begin(),
+                              number_cache
+                              .n_locally_owned_dofs_per_processor.end(),
+                              0);
 
          tr->load_user_flags(user_flags);
        }

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.