Multilevel.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #pragma once
  11. #include <sparse/SparseMatrix.h>
  12. #include <stdbool.h>
  13. typedef struct Multilevel_struct *Multilevel;
  14. struct Multilevel_struct {
  15. int level; /* 0, 1, ... */
  16. int n;
  17. SparseMatrix A; /* the weighting matrix */
  18. SparseMatrix P;
  19. SparseMatrix R;
  20. Multilevel next;
  21. Multilevel prev;
  22. bool delete_top_level_A;
  23. };
  24. enum { MAX_CLUSTER_SIZE = 4 };
  25. typedef struct {
  26. int maxlevel;
  27. } Multilevel_control;
  28. void Multilevel_delete(Multilevel grid);
  29. Multilevel Multilevel_new(SparseMatrix A, const Multilevel_control ctrl);
  30. Multilevel Multilevel_get_coarsest(Multilevel grid);
  31. void print_padding(int n);
  32. #define Multilevel_is_finest(grid) (!((grid)->prev))
  33. #define Multilevel_is_coarsest(grid) (!((grid)->next))