Skip to content

Commit

Permalink
Make the reinitNodes() function a bit safer when run with ParallelMes…
Browse files Browse the repository at this point in the history
…h by using the MeshBase::query_node_ptr() functionality.

Refs #2105.

r20855
  • Loading branch information
John Peterson authored and permcody committed Feb 14, 2014
1 parent 7db6e8a commit cbdb375
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions framework/src/base/MooseVariable.C
Expand Up @@ -243,12 +243,15 @@ MooseVariable::reinitNodes(const std::vector<unsigned int> & nodes)
_dof_indices.clear();
for (unsigned int i = 0; i < nodes.size(); i++)
{
Node & nd = _subproblem.mesh().node(nodes[i]);
if (nd.processor_id() == libMesh::processor_id())
// The MeshBase::query_node_ptr() routine will return NULL if the requested
// node is non-local.
Node * nd = _subproblem.mesh().getMesh().query_node_ptr(nodes[i]);

if (nd && (nd->processor_id() == libMesh::processor_id()))
{
if (nd.n_dofs(_sys.number(), _var_num) > 0)
if (nd->n_dofs(_sys.number(), _var_num) > 0)
{
unsigned int dof = nd.dof_number(_sys.number(), _var_num, 0);
unsigned int dof = nd->dof_number(_sys.number(), _var_num, 0);
_dof_indices.push_back(dof);
}
}
Expand Down

0 comments on commit cbdb375

Please sign in to comment.