| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <sparse/SparseMatrix.h> |
| 14 |
#include <stdbool.h> |
| 15 |
|
| 16 |
typedef struct Multilevel_struct *Multilevel; |
| 17 |
|
| 18 |
struct Multilevel_struct { |
| 19 |
int level; /* 0, 1, ... */ |
| 20 |
int n; |
| 21 |
SparseMatrix A; /* the weighting matrix */ |
| 22 |
SparseMatrix P; |
| 23 |
SparseMatrix R; |
| 24 |
Multilevel next; |
| 25 |
Multilevel prev; |
| 26 |
bool delete_top_level_A; |
| 27 |
}; |
| 28 |
|
| 29 |
enum { MAX_CLUSTER_SIZE = 4 }; |
| 30 |
|
| 31 |
typedef struct { |
| 32 |
int maxlevel; |
| 33 |
} Multilevel_control; |
| 34 |
|
| 35 |
void Multilevel_delete(Multilevel grid); |
| 36 |
|
| 37 |
Multilevel Multilevel_new(SparseMatrix A, const Multilevel_control ctrl); |
| 38 |
|
| 39 |
Multilevel Multilevel_get_coarsest(Multilevel grid); |
| 40 |
|
| 41 |
void print_padding(int n); |
| 42 |
|
| 43 |
#define Multilevel_is_finest(grid) (!((grid)->prev)) |
| 44 |
#define Multilevel_is_coarsest(grid) (!((grid)->next)) |