Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icc1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cristian Weiland
icc1
Commits
fe4df2c3
Commit
fe4df2c3
authored
Nov 11, 2015
by
Cristian Weiland
Browse files
Options
Downloads
Patches
Plain Diff
It works
Signed-off-by:
Cristian Weiland
<
cw14@inf.ufpr.br
>
parent
df3202ef
No related branches found
No related tags found
1 merge request
!1
Develop
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pdeSolver.c
+9
-51
9 additions, 51 deletions
pdeSolver.c
with
9 additions
and
51 deletions
pdeSolver.c
+
9
−
51
View file @
fe4df2c3
...
@@ -119,53 +119,6 @@ double residueNorm(double *r) {
...
@@ -119,53 +119,6 @@ double residueNorm(double *r) {
return
sqrt
(
res
);
return
sqrt
(
res
);
}
}
void
generate_matrix
(
double
*
A
,
double
*
b
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
N
*
N
;
++
i
)
{
A
[
i
]
=
0
;
}
for
(
i
=
0
;
i
<
N
;
++
i
)
{
for
(
j
=
0
;
j
<
N
;
++
j
)
{
if
(
i
==
j
)
A
[
in
(
i
,
j
)]
=
-
4
;
}
}
A
[
in
(
0
,
1
)]
=
1
;
A
[
in
(
0
,
3
)]
=
1
;
A
[
in
(
1
,
0
)]
=
1
;
A
[
in
(
1
,
2
)]
=
1
;
A
[
in
(
1
,
4
)]
=
1
;
A
[
in
(
2
,
1
)]
=
1
;
A
[
in
(
2
,
5
)]
=
1
;
A
[
in
(
3
,
0
)]
=
1
;
A
[
in
(
3
,
4
)]
=
1
;
A
[
in
(
3
,
6
)]
=
1
;
A
[
in
(
4
,
1
)]
=
1
;
A
[
in
(
4
,
3
)]
=
1
;
A
[
in
(
4
,
5
)]
=
1
;
A
[
in
(
4
,
7
)]
=
1
;
A
[
in
(
5
,
2
)]
=
1
;
A
[
in
(
5
,
4
)]
=
1
;
A
[
in
(
5
,
8
)]
=
1
;
A
[
in
(
6
,
3
)]
=
1
;
A
[
in
(
6
,
7
)]
=
1
;
A
[
in
(
7
,
4
)]
=
1
;
A
[
in
(
7
,
6
)]
=
1
;
A
[
in
(
7
,
8
)]
=
1
;
A
[
in
(
8
,
5
)]
=
1
;
A
[
in
(
8
,
7
)]
=
1
;
b
[
0
]
=
-
100
;
b
[
1
]
=
-
20
;
b
[
2
]
=
-
20
;
b
[
3
]
=
-
80
;
b
[
4
]
=
0
;
b
[
5
]
=
0
;
b
[
6
]
=
-
260
;
b
[
7
]
=
-
180
;
b
[
8
]
=
-
180
;
}
/*
/*
a11 * x1 + a12 * x2 + a13 * x3 = b1 -> x1 = (b1 - (a12 * x2 + a13 * x3)) / a11
a11 * x1 + a12 * x2 + a13 * x3 = b1 -> x1 = (b1 - (a12 * x2 + a13 * x3)) / a11
x1 = u11;
x1 = u11;
...
@@ -178,7 +131,6 @@ x6 = u23;
...
@@ -178,7 +131,6 @@ x6 = u23;
Res[1] = b1 - (a11 * x1 + a12 * x2 + a13 * x3)
Res[1] = b1 - (a11 * x1 + a12 * x2 + a13 * x3)
*/
*/
void
sor
(
double
*
b
,
double
*
x
,
double
*
r
,
double
*
timeSor
,
double
*
timeResNorm
)
{
void
sor
(
double
*
b
,
double
*
x
,
double
*
r
,
double
*
timeSor
,
double
*
timeResNorm
)
{
int
i
,
j
,
k
;
// Ax = b -> ?u = f
int
i
,
j
,
k
;
// Ax = b -> ?u = f
double
sigma
,
now
,
fxy
,
res
,
maxRes
=
0
,
tRes
=
0
;
// maxRes is the biggest residue, tRes is total residue in this iteration.
double
sigma
,
now
,
fxy
,
res
,
maxRes
=
0
,
tRes
=
0
;
// maxRes is the biggest residue, tRes is total residue in this iteration.
...
@@ -233,10 +185,8 @@ int main(int argc, char *argv[]) {
...
@@ -233,10 +185,8 @@ int main(int argc, char *argv[]) {
//double *A = calloc(sizeof(double), Nx * Ny * Nx * Ny);
//double *A = calloc(sizeof(double), Nx * Ny * Nx * Ny);
double
*
b
,
*
x
,
*
r
,
*
timeSor
,
*
timeResNorm
;
double
*
b
,
*
x
,
*
r
,
*
timeSor
,
*
timeResNorm
;
//generate_matrix(A,b);
b
=
malloc
(
Nx
*
Ny
*
sizeof
(
double
));
b
=
malloc
(
Nx
*
Ny
*
sizeof
(
double
));
x
=
malloc
(
Nx
*
Ny
*
sizeof
(
double
));
x
=
malloc
(
(
Nx
+
2
)
*
(
Ny
+
2
)
*
sizeof
(
double
));
r
=
malloc
(
MaxI
*
sizeof
(
double
));
r
=
malloc
(
MaxI
*
sizeof
(
double
));
timeSor
=
calloc
(
1
,
sizeof
(
double
));
timeSor
=
calloc
(
1
,
sizeof
(
double
));
timeResNorm
=
calloc
(
1
,
sizeof
(
double
));
timeResNorm
=
calloc
(
1
,
sizeof
(
double
));
...
@@ -247,6 +197,14 @@ int main(int argc, char *argv[]) {
...
@@ -247,6 +197,14 @@ int main(int argc, char *argv[]) {
A[ in(i,Nx) ] = sin(2 * M_PI * (i * Hx));
A[ in(i,Nx) ] = sin(2 * M_PI * (i * Hx));
}*/
}*/
// Creating borders
for
(
i
=
0
;
i
<
Nx
;
i
++
)
{
x
[
in
(
i
,
0
)
]
=
sin
(
2
*
M_PI
*
(
M_PI
-
(
i
*
Hx
)))
*
sigma
;
x
[
in
(
i
,
Nx
+
1
)
]
=
sin
(
2
*
M_PI
*
(
i
*
Hx
));
}
//for(i=0; i<Nx+2; i++)
//print_matrix(A);
//print_matrix(A);
sor
(
b
,
x
,
r
,
timeSor
,
timeResNorm
);
sor
(
b
,
x
,
r
,
timeSor
,
timeResNorm
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment