73struct DistributedCoarseningRuntime
78 eDistributedCoarseningType c;
79 void* handle =
nullptr;
81 explicit DistributedCoarseningRuntime(params prm = params())
82 : c(prm.get(
"type", eDistributedCoarseningType::smoothed_aggregation))
84 if (!prm.erase(
"type"))
85 ARCCORE_ALINA_PARAM_MISSING(
"type");
88 case eDistributedCoarseningType::aggregation: {
90 handle =
static_cast<void*
>(
new C(prm));
92 case eDistributedCoarseningType::smoothed_aggregation: {
94 handle =
static_cast<void*
>(
new C(prm));
97 throw std::invalid_argument(
"Unsupported coarsening type");
101 ~DistributedCoarseningRuntime()
104 case eDistributedCoarseningType::aggregation: {
106 delete static_cast<C*
>(handle);
108 case eDistributedCoarseningType::smoothed_aggregation: {
110 delete static_cast<C*
>(handle);
117 std::tuple<std::shared_ptr<matrix>, std::shared_ptr<matrix>>
118 transfer_operators(
const matrix& A)
121 case eDistributedCoarseningType::aggregation: {
123 return static_cast<C*
>(handle)->transfer_operators(A);
125 case eDistributedCoarseningType::smoothed_aggregation: {
127 return static_cast<C*
>(handle)->transfer_operators(A);
130 throw std::invalid_argument(
"Unsupported partition type");
134 std::shared_ptr<matrix>
135 coarse_operator(
const matrix& A,
const matrix& P,
const matrix& R)
const
138 case eDistributedCoarseningType::aggregation: {
140 return static_cast<C*
>(handle)->coarse_operator(A, P, R);
142 case eDistributedCoarseningType::smoothed_aggregation: {
144 return static_cast<C*
>(handle)->coarse_operator(A, P, R);
147 throw std::invalid_argument(
"Unsupported partition type");
150 friend std::ostream& operator<<(std::ostream& os,
const DistributedCoarseningRuntime& w)
152 os <<
"Coarsening: " << w.c <<
"\n";