libMesh/libmesh: coverage diff

Base 036428 Head #4533 621b1e
Total Total +/- New
Rate 65.93% 65.93% +0.00% 100.00%
Hits 79374 79375 +1 35
Misses 41021 41018 -3 0
Filename Stmts Miss Cover
src/mesh/distributed_mesh.C -2 -2 +0.23%
src/mesh/mesh_triangle_holes.C 0 -1 +0.28%
TOTAL -2 -3 +0.00%
code
coverage unchanged
code
coverage increased
code
coverage decreased
+
line added or modified

src/mesh/distributed_mesh.C

162  
163  
164  
165 +
166  
167 +
168  
169  
170  

DistributedMesh::DistributedMesh (const MeshBase & other_mesh) :
  UnstructuredMesh (other_mesh), _is_serial(other_mesh.is_serial()),
  _is_serial_on_proc_0(other_mesh.is_serial_on_zero()),
  _deleted_coarse_elements(true), // better safe than sorry...
  _n_nodes(0), _n_elem(0), _max_node_id(0), _max_elem_id(0), // recomputed below
  _next_free_local_node_id(this->processor_id()),
  _next_free_local_elem_id(this->processor_id()),
  _next_free_unpartitioned_node_id(this->n_processors()),
193  
194  
195  
196 +
197 +
198 +
199 +
200  
201  
202  
203 +
204  
205 +
206 +
207 +
208 +
209  
210 +
211 +
212  
213  
214  
  // copying only the objects visible to this processor, those counts
  // reflect an incomplete local view rather than other_mesh's totals,
  // and need to be copied afresh.
  _n_nodes = other_mesh.n_nodes();
  _n_elem = other_mesh.n_elem();
  _max_node_id = other_mesh.max_node_id();
  _max_elem_id = other_mesh.max_elem_id();

  // If other_mesh is actually a DistributedMesh, we can just copy its raw
  // counters directly, mirroring other_mesh's own bookkeeping exactly
  if (const DistributedMesh * other_dist_mesh = dynamic_cast<const DistributedMesh *>(&other_mesh))
    {
      _next_free_local_node_id = other_dist_mesh->_next_free_local_node_id;
      _next_free_local_elem_id = other_dist_mesh->_next_free_local_elem_id;
      _next_free_unpartitioned_node_id = other_dist_mesh->_next_free_unpartitioned_node_id;
      _next_free_unpartitioned_elem_id = other_dist_mesh->_next_free_unpartitioned_elem_id;
#ifdef LIBMESH_ENABLE_UNIQUE_ID
      _next_unique_id = other_dist_mesh->_next_unique_id;
      _next_unpartitioned_unique_id = other_dist_mesh->_next_unpartitioned_unique_id;
#endif
    }
  else
220  
221  
222  
223 +
224  
225 +
226 +
227  
228  
229  
      // the unique id counters we copy other_mesh's own local next_unique_id()
      // and derive the next available unique ids
      // (partitioned and unpartitioned) via set_next_unique_ids().
      this->set_next_ids();
#ifdef LIBMESH_ENABLE_UNIQUE_ID
      libmesh_assert(other_mesh.comm().verify(other_mesh.next_unique_id()));
      this->set_next_unique_ids(other_mesh.next_unique_id());
#endif
    }

231  
232  
233  
234 +
235  
236  
237  
  // reports for has_synched_id_counts: the counts above are a faithful copy
  // of other_mesh's own (possibly not-yet-synced) counts, not a freshly
  // verified computation, so our synced-ness should match other_mesh's.
  this->_preparation = other_mesh.preparation();
}

void DistributedMesh::move_nodes_and_elements(MeshBase && other_meshbase)
261  
262  
263  
264 +
265  
266  
267  
  #endif
}

void DistributedMesh::set_next_ids()
{
  _next_free_unpartitioned_elem_id =
    ((_max_elem_id-1) / (this->n_processors() + 1) + 1) *
276  
277  
278  
279 +
280  
281  
282 +
283  
284  
285  
  _next_free_local_node_id =
    ((_max_node_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
    (this->n_processors() + 1) + this->processor_id();
}

#ifdef LIBMESH_ENABLE_UNIQUE_ID
void DistributedMesh::set_next_unique_ids(unique_id_type parallel_max_unique_id)
{
  // Unique ids are laid out in repeating groups of (n_processors()+1)
  // consecutive integers ("alignment" here means a value's position, i.e.
303  
304  
305  
306 +
307 +
308 +
309  
310  
311  
  // n_processors(), the unpartitioned pool's fixed offset within a group,
  // lands on that pool's reserved slot in that group.
  _next_unpartitioned_unique_id =
      ((parallel_max_unique_id - 1) / (this->n_processors() + 1) + 1) *
          (this->n_processors() + 1) +
      this->n_processors();

  // Same idiom, but shifted by (n_processors()-1) before dividing so that
  // the rounding accounts for processor_id() possibly being less than the
314  
315  
316  
317 +
318 +
319 +
320 +
321  
322  
323  
324  
325  
326  
327 +
328  
329  
330 +
331  
332 +
333 +
334 +
335 +
336  
337 +
338  
339  
340  
341  
342  
343  
344 +
345  
346  
347  
  // pool's above, or push it into the following group, depending on where
  // the max id and this processor's offset happen to fall.
  _next_unique_id =
      ((parallel_max_unique_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
          (this->n_processors() + 1) +
      this->processor_id();
}
#endif

// We use cached values for these so they can be called
// from one processor without bothering the rest, but
// we may need to update those caches before doing a full
// renumbering
void DistributedMesh::update_parallel_id_counts()
{
  // This function must be run on all processors at once
  parallel_object_only();

  _n_elem  = this->parallel_n_elem();
  _n_nodes = this->parallel_n_nodes();
  _max_node_id = this->parallel_max_node_id();
  _max_elem_id = this->parallel_max_elem_id();

  this->set_next_ids();

  // set_next_unique_ids() needs the true parallel max unique id (not just
  // this processor's possibly-stale cached _next_unique_id) since the whole
  // point of this function is to recompute counters that may have drifted
  // out of sync.
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  this->set_next_unique_ids(this->parallel_max_unique_id());
#endif

  this->_preparation.has_synched_id_counts = true;
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
                      sender_could_become_owner)
                    {
                      if (it != repartitioned_node_pids.end() &&
                          pid < it->second)
                        it->second = pid;
                      else
                        repartitioned_node_pids[n] = pid;
                    }
                  else
                    if (it == repartitioned_node_pids.end())
                      repartitioned_node_pids[n] =
                        DofObject::invalid_processor_id;

                  repartitioned_node_sets_to_push[pid].insert(n);

src/mesh/mesh_triangle_holes.C

276  
277  
278  
279  
280  
281  
282  
    {
      ray_target = inside - Point(1);
      intersection_distances =
        this->find_ray_intersections(inside, ray_target);
    }

  // I'd make this an assert, but I'm not 100% confident we can't