summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlhan Özgen <ilhan.oezgen@wahyd.tu-berlin.de>2017-05-03 17:55:23 +0200
committerIlhan Özgen <ilhan.oezgen@wahyd.tu-berlin.de>2017-05-03 17:55:23 +0200
commitc0fec33997f40f9a987d953cd6d6004c8220ecf6 (patch)
tree7da2df1773a173a9ea5d6250a578e89b3ee62085
parentb730c00cc97f748e0fb60ff1c2708f6d1eec669f (diff)
change to struct in main
-rw-r--r--Makefile2
-rw-r--r--main.c5
-rw-r--r--sysmat.c2
-rw-r--r--sysmat.h2
4 files changed, 5 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 3fc7fd7..096bba7 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ PRG=main
CC=cc
CFLAGS=-Wall -Wextra -pedantic -g
LFLAGS=
-SRC=test_pcg.c linalg.c solver.c
+SRC=main.c linalg.c solver.c sysmat.c
INCLUDES=
LIB=-lm
diff --git a/main.c b/main.c
index 55fb5e2..fb9548a 100644
--- a/main.c
+++ b/main.c
@@ -66,13 +66,14 @@ int main (void)
m.ids = ids;
m.len_c = dim;
m.len_r = dim;
+ m.len_d = dim;
m.len_id = 5;
- m = system_matrix(m, nx, ny, kf);
+ system_matrix(&m, nx, ny, kf);
printf("... \n");
for (int i = 0; i < dim; i ++) {
for (int j = 0; j < dim; j ++) {
- printf(" %g ", get(m, i, j));
+ printf(" %g ", get(&m, i, j));
}
printf("\n");
}
diff --git a/sysmat.c b/sysmat.c
index 478113a..2c422f7 100644
--- a/sysmat.c
+++ b/sysmat.c
@@ -63,8 +63,6 @@ void system_matrix(struct diag* m, int nx, int ny, double* val)
printf("%g\n", get(m, 4, 1));
printf("%g\n", get(m, 4, 7));
- return m;
-
// // boundary cells with 2 neighbors
//
// // upper left corner : r = 0, c = 0;
diff --git a/sysmat.h b/sysmat.h
index ddfeac7..d19422d 100644
--- a/sysmat.h
+++ b/sysmat.h
@@ -14,7 +14,7 @@
#ifndef __SYSMAT_INCLUDED__
#define __SYSMAT_INCLUDED__
-struct diag system_matrix(struct diag, int, int, double*);
+void system_matrix(struct diag*, int, int, double*);
double harmonic(double, double);