Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 4 Juillet 2022 entre 7h00 et 9h00
Open sidebar
Olivier Bonnefon
Aedes
Commits
618b5766
Commit
618b5766
authored
May 09, 2019
by
Olivier Bonnefon
Browse files
add adaptive ts simulator
parent
c86fb782
Changes
169
Hide whitespace changes
Inline
Side-by-side
AEDESINTER_AUTOROUTES_ADAPTIV/BinaryIO.cpp
0 → 100644
View file @
618b5766
#include <iostream>
#include <cfloat>
using
namespace
std
;
#include "error.hpp"
#include "AFunction.hpp"
#include "rgraph.hpp"
#include "RNM.hpp"
#include "fem.hpp"
#include "FESpace.hpp"
#include "MeshPoint.hpp"
#include "AFunction_ext.hpp" // Extension of "AFunction.hpp" to deal with more than 3 parameters function
using
namespace
Fem2D
;
double
SaveVecAppend
(
KN
<
double
>
*
const
&
f
,
string
*
const
&
nome
){
std
::
ofstream
outfile
(
nome
->
data
(),
ios_base
::
binary
|
std
::
ofstream
::
app
);
long
int
nn
=
f
->
N
();
// get number of nodes
long
int
dim
=
nn
;
long
pos
=
outfile
.
tellp
();
if
(
!
pos
)
outfile
.
write
((
char
*
)
&
dim
,
sizeof
(
long
int
));
//write the dimension of the vector
double
ftemp
;
for
(
long
int
i
=
0
;
i
<
nn
;
i
++
)
{
ftemp
=
*
(
f
[
0
]
+
i
)
;
outfile
.
write
((
char
*
)
&
ftemp
,
sizeof
(
double
));
}
outfile
.
close
();
return
0.0
;
// dummy return value.
}
double
SetSizeVec
(
long
int
*
const
&
size
,
string
*
const
&
nome
){
//std::ofstream outfile (nome->data(),ios_base::binary | std::ofstream::app);
std
::
fstream
outfile
(
nome
->
data
(),
ios_base
::
binary
|
std
::
fstream
::
out
|
std
::
fstream
::
in
);
long
int
N
=*
size
;
outfile
.
write
((
char
*
)
&
N
,
sizeof
(
long
int
));
//write the dimension of the vector
outfile
.
close
();
return
0.0
;
// dummy return value.
}
double
SaveVec
(
KN
<
double
>
*
const
&
f
,
string
*
const
&
nome
)
{
std
::
ofstream
outfile
(
nome
->
data
(),
ios_base
::
binary
);
// To access value at node i of vector N, do as follow: *(N[0]+i)
// Explanation (C++ for dummies as I am ;-):
// N is an alias to the KN object.
// N[0] is a pointer to the first element of the vector.
// N[0]+i is a pointer to the ith element of the vector.
// *(N[0]+i) is the value of the ith element of the vector.
long
int
nn
=
f
->
N
();
// get number of nodes
long
int
dim
=
nn
;
outfile
.
write
((
char
*
)
&
dim
,
sizeof
(
long
int
));
//write the dimension of the vector
double
ftemp
;
for
(
long
int
i
=
0
;
i
<
nn
;
i
++
)
{
ftemp
=
*
(
f
[
0
]
+
i
)
;
outfile
.
write
((
char
*
)
&
ftemp
,
sizeof
(
double
));
}
outfile
.
close
();
return
0.0
;
// dummy return value.
}
double
GetSizeVec
(
long
int
*
const
&
size
,
string
*
const
&
nome
){
std
::
ifstream
infile
(
nome
->
data
(),
ios_base
::
binary
);
long
int
dim
;
infile
.
read
((
char
*
)
&
dim
,
sizeof
(
long
int
));
*
size
=
dim
;
infile
.
close
();
return
0.0
;
}
double
LoadVec
(
KN
<
double
>
*
const
&
ww
,
string
*
const
&
nome
)
{
std
::
ifstream
infile
(
nome
->
data
(),
ios_base
::
binary
);
long
int
dim
;
infile
.
read
((
char
*
)
&
dim
,
sizeof
(
long
int
));
double
dtemp
;
for
(
long
int
i
=
0
;
i
<
dim
;
i
++
)
{
infile
.
read
((
char
*
)
&
dtemp
,
sizeof
(
double
));
*
(
ww
[
0
]
+
i
)
=
dtemp
;
}
return
0.0
;
// dummy return value.
}
double
LoadFlag
(
long
int
*
const
&
ww
,
string
*
const
&
nome
)
{
std
::
ifstream
infile
(
nome
->
data
(),
ios_base
::
binary
);
long
int
flag
;
infile
.
read
((
char
*
)
&
flag
,
sizeof
(
long
int
));
*
ww
=
flag
;
return
0.0
;
// dummy return value.
}
double
flag
(
long
int
*
const
&
FLAG
,
string
*
const
&
nome
)
{
std
::
ofstream
outfile
(
nome
->
data
(),
ios_base
::
binary
);
long
int
Flag
;
Flag
=
*
FLAG
;
outfile
.
write
((
char
*
)
&
Flag
,
sizeof
(
long
int
));
outfile
.
close
();
return
0.0
;
}
// add the function name to the freefem++ table
/* class Init { public:
Init();
};
$1 */
static
void
Load_Init
(){
Global
.
Add
(
"LoadVec"
,
"("
,
new
OneOperator2_
<
double
,
KN
<
double
>*
,
string
*
>
(
LoadVec
));
Global
.
Add
(
"LoadFlag"
,
"("
,
new
OneOperator2_
<
double
,
long
int
*
,
string
*
>
(
LoadFlag
));
Global
.
Add
(
"SaveVec"
,
"("
,
new
OneOperator2_
<
double
,
KN
<
double
>*
,
string
*
>
(
SaveVec
));
Global
.
Add
(
"flag"
,
"("
,
new
OneOperator2_
<
double
,
long
int
*
,
string
*
>
(
flag
));
Global
.
Add
(
"GetSizeVec"
,
"("
,
new
OneOperator2_
<
double
,
long
int
*
,
string
*
>
(
GetSizeVec
));
Global
.
Add
(
"SaveVecAppend"
,
"("
,
new
OneOperator2_
<
double
,
KN
<
double
>*
,
string
*
>
(
SaveVecAppend
));
Global
.
Add
(
"SetSizeVec"
,
"("
,
new
OneOperator2_
<
double
,
long
int
*
,
string
*
>
(
SetSizeVec
));
}
LOADFUNC
(
Load_Init
)
AEDESINTER_AUTOROUTES_ADAPTIV/BinaryIO.edp
0 → 100644
View file @
618b5766
load "BinaryIO"
// test of BinaryIO tools ...
real
[
int
]
buffer1
(
5
);
real
[
int
]
buffer2
(
5
);
for
(
int
ii
=
0
;
ii
<
5
;
ii
++
)
buffer1
[
ii
]
=
ii
;
SaveVec
(
buffer1
,
"saveBuff"
);
int
size
=
0
;
GetSizeVec
(
size
,
"saveBuff"
);
cout
<<
"size ="
<<
size
<<
endl
;
LoadVec
(
buffer2
,
"saveBuff"
);
for
(
int
ii
=
0
;
ii
<
size
;
ii
++
)
cout
<<
buffer2
[
ii
]
<<
" "
;
cout
<<
endl
;
for
(
int
jj
=
0
;
jj
<
4
;
jj
++
){
for
(
int
ii
=
0
;
ii
<
5
;
ii
++
)
buffer1
[
ii
]
=
buffer1
[
ii
]
+
5
;
SaveVecAppend
(
buffer1
,
"saveBuff"
);
}
int
newSize
=
25
;
SetSizeVec
(
newSize
,
"saveBuff"
);
GetSizeVec
(
size
,
"saveBuff"
);
real
[
int
]
buffer3
(
size
);
cout
<<
"now size ="
<<
size
<<
endl
;
LoadVec
(
buffer3
,
"saveBuff"
);
for
(
int
ii
=
0
;
ii
<
size
;
ii
++
)
cout
<<
buffer3
[
ii
]
<<
" "
;
cout
<<
endl
;
AEDESINTER_AUTOROUTES_ADAPTIV/BinaryIOb.edp
0 → 100644
View file @
618b5766
load "BinaryIO"
int
size
;
GetSizeVec
(
size
,
"SAVE/u2d0__rep_0"
);
cout
<<
"now size ="
<<
size
<<
endl
;
AEDESINTER_AUTOROUTES_ADAPTIV/Readme.txt
0 → 100755
View file @
618b5766
This file is copied during the execution of the C prog gen2speciesNL.c.
It contains the command that must be done to allow the simulation.
This commands are necessary to run the simulation:
1) more userFDef0.txt
Just to check the dynamic on each patch
2) chmod +x genSetFunc.sh
3) ./genSetFunc.sh
To generate the dynamic on each patch
The simuated must be ready to run:
FreeFem++ cas1.edp
Finaly, visualized with 'python vtktopng.py'
AEDESINTER_AUTOROUTES_ADAPTIV/Surfaces.txt
0 → 100755
View file @
618b5766
Surf0=1.36556e+11
Surf1=3.34226e+10
Surf2=5.28336e+10
Surf3=2.35296e+10
Surf4=4.77306e+10
Surf5=4.20849e+10
Surf6=3.22273e+10
Surf7=1.99198e+10
Surf8=4.59006e+10
Surf9=2.2696e+10
Surf10=2.2557e+10
Surf11=2.88487e+10
Surf12=5.73733e+09
Surf13=3.18954e+09
Surf14=2.29261e+10
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/README
0 → 100644
View file @
618b5766
ce repeertoire contient les scripts de post tratement de simulation.
1) checkSimu.edp : verifie que la presence et la taille des fichiers de sortie des 100 iterations du simulateur.
2) postT.cpp : calcul les trajectoire min et max
3) visuSimuMax.edp: creer les sorties VTK des trajectoires min max, doit etre lancer une fois avec "max" et une fois avec "min"
4)vtktopng.py et vtktopngGen.py: creer les images a partir des sorties vtk.
Attention, il convient de s'assurer que les scrits et programme pointe bien vers le repertoire de sorties que simulations visé.
\ No newline at end of file
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/checkSimu.edp
0 → 100755
View file @
618b5766
load "BinaryIO";
include "paramsTS.edp";
//string BASEREP="../SAVE/MEDIAN/";
string
BASEREP
=
"../SAVE/HIGHT/"
;
int
curStep
=
0
;
verbosity
=
0
;
int
[
int
]
sizeBinary
(
15
);
for
(
int
ii
=
0
;
ii
<
15
;
ii
++
)
sizeBinary
[
ii
]
=
0
;
int
sizeBinaryAux
=
0
;
macro
checkFile
(
XXINT
){
string
FILENAME
=
BASEREP
+
"u2d"
+
string
(
XXINT
)
+
"__rep_"
+
string
(
numRun
);
if
(
exec
(
"ls "
+
FILENAME
+
" 2>/dev/null >/dev/null"
)){
nofile
=
1
;
}
else
{
if
(
!
sizeBinary
[
XXINT
]){
GetSizeVec
(
sizeBinary
[
XXINT
],
FILENAME
);
}
else
{
GetSizeVec
(
sizeBinaryAux
,
FILENAME
);
if
(
sizeBinaryAux
!=
sizeBinary
[
XXINT
])
cout
<<
"ERROR "
+
FILENAME
+
" size is "
<<
sizeBinaryAux
<<
" and should be "
<<
sizeBinary
[
XXINT
]
<<
endl
;
}
}
}
//
for
(
int
numRun
=
0
;
numRun
<
100
;
numRun
++
){
int
nofile
=
0
;
//for (CURYEAR=FIRSTYEAR; CURYEAR<=LASTYEAR; CURYEAR++){
// for ( curStep=0;curStep<nbSteps;curStep++){
for
(
int
ii
=
0
;
ii
<
15
;
ii
++
)
checkFile
(
ii
);
if
(
!
nofile
){
cout
<<
"numRun="
<<
numRun
<<
" ok"
<<
endl
;
}
else
{
cout
<<
"numRun="
<<
numRun
<<
" missing"
<<
endl
;
}
}
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/freefem++.pref
0 → 100755
View file @
618b5766
includepath += ".."
includepath += "../../Tools1D/"
includepath += "../../Recorder/"
includepath += "../../examples1D/"
loadpath += "/opt/freefem++-3.58/examples++-load/"
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/postT.cpp
0 → 100644
View file @
618b5766
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using
namespace
std
;
#define BASEREP "../SAVE/HIGHT/"
long
int
GetSizeVec
(
char
*
name
){
std
::
ifstream
infile
(
name
,
ios_base
::
binary
);
long
int
dim
;
infile
.
read
((
char
*
)
&
dim
,
sizeof
(
long
int
));
infile
.
close
();
return
dim
;
}
void
LoadVec
(
char
*
name
,
double
*
pD
)
{
std
::
ifstream
infile
(
name
,
ios_base
::
binary
);
long
int
dim
;
infile
.
read
((
char
*
)
&
dim
,
sizeof
(
long
int
));
double
dtemp
;
for
(
long
int
i
=
0
;
i
<
dim
;
i
++
)
{
infile
.
read
((
char
*
)
&
dtemp
,
sizeof
(
double
));
*
(
pD
++
)
=
dtemp
;
}
infile
.
close
();
}
void
SaveVec
(
double
*
pD
,
long
int
N
,
char
*
name
)
{
std
::
ofstream
outfile
(
name
,
ios_base
::
binary
);
outfile
.
write
((
char
*
)
&
N
,
sizeof
(
long
int
));
//write the dimension of the vector
double
ftemp
;
for
(
long
int
i
=
0
;
i
<
N
;
i
++
)
{
ftemp
=
pD
[
i
]
;
outfile
.
write
((
char
*
)
&
ftemp
,
sizeof
(
double
));
}
outfile
.
close
();
}
int
main
(){
char
filename
[
256
];
int
N
=
4
;
double
*
pBufTraj
[
15
];
double
*
pMaxTraj
[
15
];
double
*
pMinTraj
[
15
];
long
int
size
[
15
];
for
(
int
j
=
0
;
j
<
15
;
j
++
){
sprintf
(
filename
,
"%su2d%i__rep_0"
,
BASEREP
,
j
);
size
[
j
]
=
GetSizeVec
(
filename
);
pBufTraj
[
j
]
=
(
double
*
)
malloc
(
size
[
j
]
*
sizeof
(
double
));
pMaxTraj
[
j
]
=
(
double
*
)
malloc
(
size
[
j
]
*
sizeof
(
double
));
pMinTraj
[
j
]
=
(
double
*
)
malloc
(
size
[
j
]
*
sizeof
(
double
));
LoadVec
(
filename
,
pMaxTraj
[
j
]);
memcpy
(
pMinTraj
[
j
],
pMaxTraj
[
j
],
size
[
j
]
*
sizeof
(
double
));
}
for
(
int
numRun
=
1
;
numRun
<
N
;
numRun
++
){
for
(
int
j
=
0
;
j
<
15
;
j
++
){
sprintf
(
filename
,
"%su2d%i__rep_%i"
,
BASEREP
,
j
,
numRun
);
LoadVec
(
filename
,
pBufTraj
[
j
]);
for
(
int
k
=
0
;
k
<
size
[
j
];
k
++
){
if
(
pBufTraj
[
j
][
k
]
>
pMaxTraj
[
j
][
k
])
pMaxTraj
[
j
][
k
]
=
pBufTraj
[
j
][
k
];
if
(
pBufTraj
[
j
][
k
]
<
pMinTraj
[
j
][
k
])
pMinTraj
[
j
][
k
]
=
pBufTraj
[
j
][
k
];
}
}
}
for
(
int
j
=
0
;
j
<
15
;
j
++
){
sprintf
(
filename
,
"%su2d%i__max"
,
BASEREP
,
j
);
SaveVec
(
pMaxTraj
[
j
],
size
[
j
],
filename
);
sprintf
(
filename
,
"%su2d%i__min"
,
BASEREP
,
j
);
SaveVec
(
pMinTraj
[
j
],
size
[
j
],
filename
);
}
for
(
int
j
=
0
;
j
<
15
;
j
++
){
free
(
pBufTraj
[
j
]);
free
(
pMaxTraj
[
j
]);
free
(
pMinTraj
[
j
]);
}
return
0
;
}
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/saveVtk.edp
0 → 100644
View file @
618b5766
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"0s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th0
,
utm12d0
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"1s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th1
,
utm12d1
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"2s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th2
,
utm12d2
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"3s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th3
,
utm12d3
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"4s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th4
,
utm12d4
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"5s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th5
,
utm12d5
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"6s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th6
,
utm12d6
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"7s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th7
,
utm12d7
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"8s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th8
,
utm12d8
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"9s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th9
,
utm12d9
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"10s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th10
,
utm12d10
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"11s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th11
,
utm12d11
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"12s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th12
,
utm12d12
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"13s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th13
,
utm12d13
,
dataname
=
"UU"
);
savevtk
(
OUTPUTDIR
+
"D2/u"
+
maxormin
+
"14s"
+
string
(
CURYEAR
)
+
"_"
+
string
(
curStep
)
+
".vtk"
,
Th14
,
utm12d14
,
dataname
=
"UU"
);
AEDESINTER_AUTOROUTES_ADAPTIV/VISU/traju0.txt
0 → 100644
View file @
618b5766
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
3.85613e-06 0
0.0284405 0
0.0778402 0
0.121077 0
0.161394 0
0.220532 0
0.280591 0
0.336086 0
0.385364 0
0.426625 0
0.46796 0
0.504761 0
0.538268 0
0.575018 0
0.609942 0
0.637195 0
0.647115 0.00321037
0.652092 0.0060321
0.660206 0.00898552
0.668265 0.0172032
0.68751 0.0313253
0.694344 0.0445632
0.695226 0.0559077
0.688502 0.0663872
0.685712 0.07607
0.672835 0.0843529
0.665876 0.0910832
0.664271 0.099907
0.665924 0.108778
0.668949 0.11572
0.674883 0.12336
0.679885 0.129018
0.68939 0.134352
0.69855 0.142519
0.711878 0.150751
0.722352 0.155866
0.729981 0.160653
0.738941 0.162009
0.753414 0.165344
0.76782 0.170793
0.780952 0.181198
0.78756 0.194104
0.792872 0.201162
0.79935 0.207955
0.780339 0.211145
0.759573 0.216576
0.757397 0.224282
0.759755 0.235011
0.758449 0.240344
0.755973 0.241761
0.757293 0.243881
0.763328 0.245506
0.769254 0.250253
0.775299 0.252357
0.782036 0.25112
0.781768 0.248496
0.781576 0.245946
0.785269 0.245291
0.778907 0.242842
0.774233 0.244789
0.779158 0.2529
0.786022 0.263392
0.788821 0.266067
0.793504 0.26692
0.790063 0.267135
0.786156 0.270026
0.783236 0.277656
0.779082 0.288072
0.778758 0.301145
0.780002 0.315479
0.781212 0.329376
0.786959 0.336215
0.794278 0.331837
0.796351 0.327586
0.796229 0.336386
0.799722 0.344163
0.808101 0.34855
0.814421 0.354543
0.818406 0.35432
0.813843 0.353539
0.809143 0.352181
0.807871 0.357717
0.812406 0.365039
0.819836 0.371318
0.823628 0.378043
0.82538 0.38553
0.82594 0.393583
0.824469 0.4015
0.823637 0.411359
0.823325 0.419303
0.820111 0.432713
0.815712 0.450149