Skip to content

Commit

Permalink
Update n_elem/n_nodes caches more frequently
Browse files Browse the repository at this point in the history
This seems to fix the regression with Gmsh->ParallelMesh reads
  • Loading branch information
roystgnr committed Feb 19, 2015
1 parent d70a1bb commit 2706688
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/mesh/parallel_mesh.C
Expand Up @@ -450,6 +450,12 @@ Elem* ParallelMesh::insert_elem (Elem* e)
if (_elements[e->id()])
this->delete_elem(_elements[e->id()]);

// Try to make the cached elem data more accurate
processor_id_type elem_procid = e->processor_id();
if (elem_procid == this->processor_id() ||
elem_procid == DofObject::invalid_processor_id)
_n_elem++;

_elements[e->id()] = e;

return e;
Expand All @@ -461,6 +467,12 @@ void ParallelMesh::delete_elem(Elem* e)
{
libmesh_assert (e);

// Try to make the cached elem data more accurate
processor_id_type elem_procid = e->processor_id();
if (elem_procid == this->processor_id() ||
elem_procid == DofObject::invalid_processor_id)
_n_elem--;

// Delete the element from the BoundaryInfo object
this->get_boundary_info().remove(e);

Expand Down Expand Up @@ -620,6 +632,12 @@ void ParallelMesh::delete_node(Node* n)
libmesh_assert(n);
libmesh_assert(_nodes[n->id()]);

// Try to make the cached elem data more accurate
processor_id_type node_procid = n->processor_id();
if (node_procid == this->processor_id() ||
node_procid == DofObject::invalid_processor_id)
_n_nodes--;

// Delete the node from the BoundaryInfo object
this->get_boundary_info().remove(n);

Expand Down

0 comments on commit 2706688

Please sign in to comment.