-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpartition.cpp
More file actions
33 lines (27 loc) · 738 Bytes
/
Copy pathpartition.cpp
File metadata and controls
33 lines (27 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include"partition.h"
using namespace std;
void Partition::set_size(int nodes_number, int partitions_number)
{
this->nodes_number = nodes_number;
this->partitions_number = partitions_number;
//-1 means not yet assigned
partitions.resize(nodes_number, -1);
partition_sizes.resize(partitions_number, 0);
}
void Partition::set_node_partition(int node_index, int partition)
{
partitions[node_index] = partition;
partition_sizes[partition]++;
}
int Partition::get_node_partition(int node_index) const
{
return partitions[node_index];
}
int Partition::get_partition_size(int partition_index) const
{
return partition_sizes[partition_index];
}
int Partition::get_partitions_number() const
{
return partitions_number;
}