Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90373457
algorithm_onethread.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 1, 01:47
Size
1 KB
Mime Type
text/x-c
Expires
Sun, Nov 3, 01:47 (2 d)
Engine
blob
Format
Raw Data
Handle
22064107
Attached To
R10834 Project_multiproc
algorithm_onethread.c
View Options
/*
============================================================================
Filename : algorithm.c
Author : Your names go here
SCIPER : Your SCIPER numbers
============================================================================
*/
#include <math.h>
#define INPUT(I,J) input[(I)*length+(J)]
#define OUTPUT(I,J) output[(I)*length+(J)]
void
simulate
(
double
*
input
,
double
*
output
,
int
threads
,
int
length
,
int
iterations
)
{
double
*
temp
;
for
(
int
n
=
0
;
n
<
iterations
;
n
++
)
{
for
(
int
i
=
1
;
i
<
length
-
1
;
i
++
)
{
for
(
int
j
=
1
;
j
<
length
-
1
;
j
++
)
{
if
(
((
i
==
length
/
2
-
1
)
||
(
i
==
length
/
2
))
&&
((
j
==
length
/
2
-
1
)
||
(
j
==
length
/
2
))
)
continue
;
OUTPUT
(
i
,
j
)
=
((
INPUT
(
i
-
1
,
j
-
1
)
+
INPUT
(
i
-
1
,
j
)
+
INPUT
(
i
-
1
,
j
+
1
))
+
(
INPUT
(
i
,
j
-
1
)
+
INPUT
(
i
,
j
)
+
INPUT
(
i
,
j
+
1
))
+
(
INPUT
(
i
+
1
,
j
-
1
)
+
INPUT
(
i
+
1
,
j
)
+
INPUT
(
i
+
1
,
j
+
1
)))
/
9.0
;
}
}
temp
=
input
;
input
=
output
;
output
=
temp
;
}
}
Event Timeline
Log In to Comment