MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / reorder_gps

Method reorder_gps

cpp/dolfinx/graph/ordering.cpp:362–384  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

360
361//-----------------------------------------------------------------------------
362std::vector<std::int32_t>
363graph::reorder_gps(const graph::AdjacencyList<std::int32_t>& graph)
364{
365 const std::int32_t n = graph.num_nodes();
366 std::vector<std::int32_t> r(n, -1);
367 std::vector<std::int32_t> rv;
368
369 // Repeat for each disconnected part of the graph
370 int count = 0;
371 while (count < n)
372 {
373 rv = gps_reorder_unlabelled(graph, r);
374 assert(!rv.empty());
375
376 // Reverse permutation
377 for (std::int32_t q : rv)
378 r[q] = count++;
379 }
380
381 // Check all labelled
382 assert(std::find(r.begin(), r.end(), -1) == r.end());
383 return r;
384}
385//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

gps_reorder_unlabelledFunction · 0.85
num_nodesMethod · 0.45

Tested by

no test coverage detected