-
Notifications
You must be signed in to change notification settings - Fork 3
/
stencil_assembly.h
55 lines (40 loc) · 1.72 KB
/
stencil_assembly.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "definitions.h"
// #include "/zhome/c3/7/127558/SuiteSparse/SuiteSparse-5.10.1/include/cholmod.h"
#include "cholmod.h"
struct CSRMatrix {
uint64_t nnz;
int32_t nrows;
int *rowOffsets;
int *colIndex;
MTYPE *vals;
};
struct CoarseSolverData {
cholmod_common *cholmodCommon;
cholmod_sparse *sparseMatrix;
cholmod_factor *factoredMatrix;
cholmod_dense *rhs;
cholmod_dense *solution;
cholmod_dense *Y_workspace;
cholmod_dense *E_workspace;
};
void allocateSubspaceMatrix(const struct gridContext gc, const int l,
struct CSRMatrix *M);
void freeSubspaceMatrix(struct CSRMatrix *M);
void assembleSubspaceMatrix(const struct gridContext gc, const int l,
const DTYPE *x, struct CSRMatrix M, MTYPE *tmp);
void applyStateOperatorSubspaceMatrix(const struct gridContext gc, const int l,
const struct CSRMatrix M, const CTYPE *in,
CTYPE *out);
void initializeCholmod(const struct gridContext gc, const int l,
struct CoarseSolverData *ssolverData,
const struct CSRMatrix M);
void finishCholmod(const struct gridContext gc, const int l,
struct CoarseSolverData *solverData,
const struct CSRMatrix M, const int verbose);
void factorizeSubspaceMatrix(const struct gridContext gc, const int l,
struct CoarseSolverData solverData,
const struct CSRMatrix M);
void solveSubspaceMatrix(const struct gridContext gc, const int l,
struct CoarseSolverData solverData, const CTYPE *in,
CTYPE *out);