KTH framework for Nek5000 toolboxes; testing version  0.0.1
crs_hypre.h
Go to the documentation of this file.
1 #ifndef CRS_HYPRE_H
2 #define CRS_HYPRE_H
3 
4 #ifdef HYPRE
5 
6 #include "_hypre_utilities.h"
7 #include "HYPRE_parcsr_ls.h"
8 #include "_hypre_parcsr_ls.h"
9 #include "HYPRE.h"
10 
11 struct hypre_crs_data {
12  HYPRE_Solver solver;
13  HYPRE_IJMatrix A;
14  HYPRE_IJVector b;
15  HYPRE_IJVector x;
16  HYPRE_Int ilower;
17  uint un;
18  struct comm comm;
19  struct gs_data *gs_top;
20  uint *umap;
21  uint nullspace;
22  double tni;
23 };
24 #else
25  struct hypre_crs_data;
26 #endif
27 
28 /* remote id - designates the i-th uknown owned by proc p */
29 struct rid { uint p,i; };
30 #define rid_equal(a,b) ((a).p==(b).p && (a).i==(b).i)
31 #define nz_pos_equal(a,b) \
32  (rid_equal((a).i,(b).i) && rid_equal((a).j,(b).j))
33 struct labelled_rid {
34  struct rid rid; ulong id;
35 };
36 
37 /* rnz is a mnemonic for remote non zero */
38 struct rnz {
39  double v; struct rid i,j;
40 };
41 
42 /* global non-zero (matrix entry) */
43 struct gnz { ulong i,j; double a; };
44 
47 
48 void build_hypre_matrix(struct hypre_crs_data *hypre_data, uint n,
49  const ulong *id, uint nz_unassembled, const uint *Ai, const uint *Aj, const double *Av);
50 
51 struct hypre_crs_data *ccrs_hypre_setup( uint n, const ulong *id,
52  uint nz, const uint *Ai, const uint *Aj, const double *Av,
53  const uint null_space, const struct comm *comm,
54  const double *param);
55 
56 void ccrs_hypre_solve(double *x, struct hypre_crs_data *data, double *b);
57 
58 void ccrs_hypre_free(struct hypre_crs_data *data);
59 
60 static uint *assign_dofs_hypre(struct array *const uid,
61  struct rid *const rid_map,
62  const ulong *const id, const uint n,
63  const uint p,
64  struct gs_data *gs_top, buffer *const buf,
65  struct comm *comm);
66 
67 static void mat_distribute(
68  struct array *const mat, const enum distr d, const enum mat_order o,
69  struct crystal *const cr);
70 
71 static void mat_list_nonlocal_sorted(
72  struct array *const nonlocal_id,
73  const struct array *const mat, const enum distr d,
74  const ulong *uid, struct crystal *const cr);
75 
76 #endif
mat_order
Definition: crs_amg.c:1087
distr
Definition: crs_amg.c:1088
void ccrs_hypre_free(struct hypre_crs_data *data)
Definition: crs_hypre.c:442
@ row_major
Definition: crs_hypre.h:45
@ col_major
Definition: crs_hypre.h:45
struct hypre_crs_data * ccrs_hypre_setup(uint n, const ulong *id, uint nz, const uint *Ai, const uint *Aj, const double *Av, const uint null_space, const struct comm *comm, const double *param)
Definition: crs_hypre.c:424
@ col_distr
Definition: crs_hypre.h:46
@ row_distr
Definition: crs_hypre.h:46
void ccrs_hypre_solve(double *x, struct hypre_crs_data *data, double *b)
Definition: crs_hypre.c:434
void build_hypre_matrix(struct hypre_crs_data *hypre_data, uint n, const ulong *id, uint nz_unassembled, const uint *Ai, const uint *Aj, const double *Av)
Definition: crs_amg.c:241
ulong i
Definition: crs_amg.c:241
ulong j
Definition: crs_amg.c:241
double a
Definition: crs_amg.c:241
ulong id
Definition: crs_amg.c:1148
Definition: crs_amg.c:231
uint i
Definition: crs_amg.c:231
uint p
Definition: crs_amg.c:231
Definition: crs_amg.c:1093
struct rid i j
Definition: crs_amg.c:1094
double v
Definition: crs_amg.c:1094