KTH framework for Nek5000 toolboxes; testing version  0.0.1
crs_amg.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/stat.h>
#include <limits.h>
#include "gslib.h"
#include "crs_amg_io.h"
+ Include dependency graph for crs_amg.c:

Go to the source code of this file.

Data Structures

struct  csr_mat
 
struct  Q
 
struct  crs_data
 
struct  rid
 
struct  id_data
 
struct  gnz
 
struct  find_id_map
 
struct  find_id_data
 
struct  find_id_work
 
struct  rnz
 
struct  labelled_rid
 

Macros

#define crs_setup   PREFIXED_NAME(crs_amg_setup)
 
#define crs_solve   PREFIXED_NAME(crs_amg_solve)
 
#define crs_stats   PREFIXED_NAME(crs_amg_stats)
 
#define crs_free   PREFIXED_NAME(crs_amg_free )
 
#define AMG_BLOCK_ROWS   2400
 
#define AMG_MAX_ROWS   12000
 
#define rid_equal(a, b)   ((a).p==(b).p && (a).i==(b).i)
 
#define nz_pos_equal(a, b)    (rid_equal((a).i,(b).i) && rid_equal((a).j,(b).j))
 
#define BUILD_LIST(k)
 

Enumerations

enum  mat_order { row_major , col_major , row_major , col_major }
 
enum  distr { row_distr , col_distr , row_distr , col_distr }
 

Functions

void crs_solve (double *x, struct crs_data *data, double *b)
 
void crs_stats (const struct crs_data *const data)
 
struct crs_datacrs_setup (uint n, const ulong *id, uint nz, const uint *Ai, const uint *Aj, const double *A, uint null_space, const struct comm *comm, const char *datafname, uint *ierr)
 
void crs_free (struct crs_data *data)
 

Macro Definition Documentation

◆ AMG_BLOCK_ROWS

#define AMG_BLOCK_ROWS   2400

Definition at line 16 of file crs_amg.c.

◆ AMG_MAX_ROWS

#define AMG_MAX_ROWS   12000

Definition at line 20 of file crs_amg.c.

◆ BUILD_LIST

#define BUILD_LIST (   k)
Value:
do { \
last_rid.p=UINT_MAX,last_rid.i=UINT_MAX; \
for(count=0,p=mat->ptr;p!=e;++p) { \
if(p->k.p==pid || rid_equal(last_rid,p->k)) continue; \
last_rid=p->k; ++count; \
} \
array_init(struct labelled_rid, nonlocal_id, count); \
nonlocal_id->n=count; out=nonlocal_id->ptr; \
last_rid.p=UINT_MAX,last_rid.i=UINT_MAX; \
for(p=mat->ptr;p!=e;++p) { \
if(p->k.p==pid || rid_equal(last_rid,p->k)) continue; \
(out++)->rid=last_rid=p->k; \
} \
} while(0)
#define rid_equal(a, b)
Definition: crs_amg.c:1090
Definition: crs_amg.c:231

◆ crs_free

#define crs_free   PREFIXED_NAME(crs_amg_free )

Definition at line 13 of file crs_amg.c.

◆ crs_setup

#define crs_setup   PREFIXED_NAME(crs_amg_setup)

Definition at line 10 of file crs_amg.c.

◆ crs_solve

#define crs_solve   PREFIXED_NAME(crs_amg_solve)

Definition at line 11 of file crs_amg.c.

◆ crs_stats

#define crs_stats   PREFIXED_NAME(crs_amg_stats)

Definition at line 12 of file crs_amg.c.

◆ nz_pos_equal

#define nz_pos_equal (   a,
 
)     (rid_equal((a).i,(b).i) && rid_equal((a).j,(b).j))

Definition at line 1096 of file crs_amg.c.

◆ rid_equal

#define rid_equal (   a,
 
)    ((a).p==(b).p && (a).i==(b).i)

Definition at line 1090 of file crs_amg.c.

Enumeration Type Documentation

◆ distr

enum distr
Enumerator
row_distr 
col_distr 
row_distr 
col_distr 

Definition at line 1088 of file crs_amg.c.

◆ mat_order

enum mat_order
Enumerator
row_major 
col_major 
row_major 
col_major 

Definition at line 1087 of file crs_amg.c.

Function Documentation

◆ crs_free()

◆ crs_setup()

struct crs_data* crs_setup ( uint  n,
const ulong *  id,
uint  nz,
const uint *  Ai,
const uint *  Aj,
const double *  A,
uint  null_space,
const struct comm *  comm,
const char *  datafname,
uint *  ierr 
)

Definition at line 530 of file crs_amg.c.

References crs_data::comm, and crs_data::gs_top.

◆ crs_solve()

void crs_solve ( double *  x,
struct crs_data data,
double *  b 
)

Definition at line 185 of file crs_amg.c.

References crs_data::b, crs_data::gs_top, crs_data::umap, crs_data::un, and crs_data::x.

◆ crs_stats()

void crs_stats ( const struct crs_data *const  data)

Definition at line 204 of file crs_amg.c.

References crs_data::comm, crs_data::levels, crs_data::timing, and crs_data::timing_n.