On Tue, 3 Mar 2009, Andrea Hawkins wrote:

> So, in using this fine feature I believe I have found a bug.

I think so too.  But before we get into the technical details, I think
it's a good idea to step back, look at the big picture, and focus on
what's important:

svn blame says Ben did it.

(yes, after I've had too many incidents of commiting insufficiently
tested code, my first reaction upon finding a bug is rushing to svn to
see whether or not it was one of mine...)

> When calling variable_first and variable_last they both return a value
> stored in a vector _var_first_local_df. In looking at these routines, it
> appears that _var_first_local_df should be a vector of length # of vars,
> containing only the first dof for each.

n_vars + 1 - we leave the total number of dofs in there too, to make
variable_last(n_vars) more straightforward.  That's probably what that
second push_back was trying to do; it just should have gone outside of
the loop.

> In looking where it gets defined in dof_map.C, in
> DofMap::distribute_local_dofs_var_major, there is a push back at the
> beginning of the loop and at the end, which appears to account for the extra
> values.

That would do it.  Thanks!

Double-check that the following patch fixes the problem?  If so I'll
commit it.
---
Roy


Index: src/base/dof_map.C
===================================================================
--- src/base/dof_map.C  (revision 3287)
+++ src/base/dof_map.C  (working copy)
@@ -900,9 +900,11 @@
                next_free_dof += elem->n_comp(sys_num,var);
              }
          } // end loop on elements
-      _var_first_local_df.push_back(next_free_dof);
      } // end loop on variables

+  // Cache the last local dof number too
+  _var_first_local_df.push_back(next_free_dof);
+
  #ifdef DEBUG
    // Make sure we didn't miss any nodes
    MeshTools::libmesh_assert_valid_node_procids(mesh);

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to