Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixPerformance
Commits
7901258d
Commit
7901258d
authored
Jan 16, 2021
by
Pierre Aubert
Browse files
Get some nice simulation results, Ok for benchmarking
parent
d6a7205f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
src/cpp20/Sequential/GrayScott/GrayScott2Pic/main.cpp
src/cpp20/Sequential/GrayScott/GrayScott2Pic/main.cpp
+4
-0
src/cpp20/Sequential/GrayScott/Naive/naive_propagation.cpp
src/cpp20/Sequential/GrayScott/Naive/naive_propagation.cpp
+0
-1
src/cpp20/Sequential/GrayScott/Program/main.cpp
src/cpp20/Sequential/GrayScott/Program/main.cpp
+16
-10
No files found.
src/cpp20/Sequential/GrayScott/GrayScott2Pic/main.cpp
View file @
7901258d
...
...
@@ -6,6 +6,7 @@
#include <sstream>
#include "ProgressBarr.h"
#include "OptionParser.h"
#include "PImagePng.h"
...
...
@@ -54,7 +55,9 @@ bool simulateImage(const std::string & inputFile, const std::string & outputDir)
colorMap
.
addColor
(
0.4
,
"FF0000"
);
colorMap
.
addColor
(
0.6
,
"FFFFFF"
);
ProgressBarr
progress
(
nbImage
);
for
(
size_t
i
(
0lu
);
i
<
nbImage
;
++
i
){
progress
.
progress
(
i
);
float
*
matValue
=
fullMat
.
getTabMat
(
i
);
image
.
setColor
(
matValue
,
nbRow
,
nbCol
,
colorMap
);
...
...
@@ -66,6 +69,7 @@ bool simulateImage(const std::string & inputFile, const std::string & outputDir)
return
false
;
}
}
progress
.
finish
();
std
::
cerr
<<
"Done"
<<
std
::
endl
;
return
true
;
}
...
...
src/cpp20/Sequential/GrayScott/Naive/naive_propagation.cpp
View file @
7901258d
...
...
@@ -45,7 +45,6 @@ void naive_propagation(float * outMatU, float * outMatV, const float * matU, con
for
(
long
k
(
firstRowStencil
);
k
<
lastRowStencil
;
++
k
){
long
stencilIndexCol
(
0l
);
for
(
long
l
(
firstColStencil
);
l
<
lastColStencil
;
++
l
){
if
(
k
==
1l
&&
l
==
1l
){
continue
;}
float
deltaSquare
(
matDeltaSquare
[
stencilIndexRow
*
nbStencilCol
+
stencilIndexCol
]);
// float deltaSquare(1.0f);
fullU
+=
(
matU
[
k
*
nbCol
+
l
]
-
u
)
*
deltaSquare
;
...
...
src/cpp20/Sequential/GrayScott/Program/main.cpp
View file @
7901258d
...
...
@@ -7,6 +7,7 @@
#include "OptionParser.h"
#include "PTensor.h"
#include "ProgressTime.h"
#include "naive_propagation.h"
#include "MatrixHdf5.h"
...
...
@@ -78,8 +79,9 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
tmpInV
.
fill
(
0.0
f
);
tmpOutV
.
fill
(
0.0
f
);
for
(
size_t
i
((
2lu
*
nbRow
)
/
5lu
);
i
<
(
3lu
*
nbRow
)
/
5lu
;
++
i
){
for
(
size_t
j
((
2lu
*
nbCol
)
/
5lu
);
j
<
(
3lu
*
nbCol
)
/
5lu
;
++
j
){
size_t
frac
(
9lu
),
numBegin
(
4lu
),
numEnd
(
5lu
),
rowShift
(
-
25lu
);
for
(
size_t
i
(
rowShift
+
(
numBegin
*
nbRow
)
/
frac
);
i
<
rowShift
+
(
numEnd
*
nbRow
)
/
frac
;
++
i
){
for
(
size_t
j
((
numBegin
*
nbCol
)
/
frac
);
j
<
(
numEnd
*
nbCol
)
/
frac
;
++
j
){
tmpInU
.
setValue
(
i
,
j
,
0.0
f
);
tmpInV
.
setValue
(
i
,
j
,
1.0
f
);
}
...
...
@@ -91,15 +93,18 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
long
nbStencilRow
(
3l
),
nbStencilCol
(
3l
);
float
diffudionRateU
(
0.1
f
),
diffusionRateV
(
0.05
f
);
float
matDeltaSquare
[]
=
{
0.05
f
,
0.2
f
,
0.05
f
,
0.2
f
,
-
1.0
f
,
0.2
f
,
0.05
f
,
0.2
f
,
0.05
f
};
// float matDeltaSquare[] = {1.0f, 1.0f, 1.0f,
// 1.0f, 1.0f, 1.0f,
// 1.0f, 1.0f, 1.0f};
//This matrix of neigbour exchange is quite accurate but gives not so fun results
// float matDeltaSquare[] = {0.05f, 0.2f, 0.05f,
// 0.2f, 0.0f, 0.2f,
// 0.05f, 0.2f, 0.05f};
float
matDeltaSquare
[]
=
{
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
};
ProgressTime
progress
(
nbImage
);
progress
.
start
();
for
(
size_t
i
(
0lu
);
i
<
nbImage
;
++
i
){
std
::
cout
<<
"simulateImage n°"
<<
i
<<
"..."
<<
std
::
endl
;
progress
.
print
()
;
for
(
size_t
j
(
0lu
);
j
<
nbExtraStep
;
++
j
){
float
*
matInputU
=
tmpU2
;
float
*
matInputV
=
tmpV2
;
...
...
@@ -125,6 +130,7 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
tmpInV
=
tmpOutV
;
}
}
progress
.
finish
();
std
::
cerr
<<
"Done"
<<
std
::
endl
;
//Let's save the output file
fullMat
.
write
(
outputFile
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment