Class GraphPartitioner

Inheritance Relationships

Derived Types

Class Documentation

class GraphPartitioner

Abstract base class for all partitioners.

Subclassed by opensn::KBAGraphPartitioner, opensn::LinearGraphPartitioner, opensn::PETScGraphPartitioner

Public Functions

virtual ~GraphPartitioner() = default
virtual std::vector<int> Partition(const std::vector<std::vector<uint64_t>> &graph, const std::vector<Vector3> &centroids, int number_of_parts) = 0

Given a graph. Returns the partition ids of each row in the graph.

Public Static Functions

static void FillEmptyPartitions(const std::vector<std::vector<uint64_t>> &graph, std::vector<int> &cell_pids, int num_partitions)

Gives every empty partition cells so that each partition has at least one.

When no partition is empty, nothing changes. Each empty partition takes about num_cells / num_partitions cells from the currently largest partition, which keeps at least one cell. The cells taken are connected. They are collected in breadth-first order within the donor partition, starting from the donor cell farthest from the donor’s lowest-index cell. Nothing changes when there are fewer cells than partitions.

Parameters:
  • graph – Cell adjacency, giving the neighbor indices of each cell.

  • cell_pids – Partition id of each cell, updated in place.

  • num_partitions – Number of partitions.

Protected Functions

explicit GraphPartitioner(const InputParameters &params)

Protected Static Functions

static InputParameters GetInputParameters()