Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
81e30271
Commit
81e30271
authored
Aug 08, 2020
by
patrick.lambert
Browse files
many bugs fixed
parent
bcbaddf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/environment/RIOBasinNetworkWithContinent.java
View file @
81e30271
...
...
@@ -372,9 +372,11 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
OffshoreBasin
offshorebasin
=
new
OffshoreBasin
(
basin_id
,
name
,
OffshoreBasinFunction
.
valueOf
(
function
));
if
(
mapOffshoreBasin
!=
null
)
{
if
(
mapOffshoreBasin
.
containsKey
(
name
))
offshorebasin
.
getShape
().
append
(
mapInshoreBasin
.
get
(
name
),
true
);
else
{
if
(
mapOffshoreBasin
.
containsKey
(
name
))
{
System
.
out
.
println
(
name
);
// offshorebasin.getShape().append(mapInshoreBasin.get(name), true);
offshorebasin
.
setShape
(
mapInshoreBasin
.
get
(
name
));
}
else
{
System
.
out
.
println
(
name
+
"does not exist in "
+
offshoreBasinShpFile
);
System
.
exit
(
1
);
}
...
...
@@ -396,10 +398,6 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
try
{
// open the file
reader
=
new
FileReader
(
distanceGridFileName
);
/*
* // TODO fill the distance in each basin for (Basin basin : grid) {
* basin.setNeighboursDistances(getNeighboursWithDistance(basin)); }
*/
// Parsing the file
scanner
=
new
Scanner
(
reader
);
...
...
@@ -433,6 +431,46 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
e
.
printStackTrace
();
}
// ============================================ connection between basins
try
{
// open the file
reader
=
new
FileReader
(
distanceGridFileName
);
// Parsing the file
scanner
=
new
Scanner
(
reader
);
scanner
.
useLocale
(
Locale
.
ENGLISH
);
// to have a point as decimal separator !!!
scanner
.
useDelimiter
(
Pattern
.
compile
(
"[;,\r\n]"
));
// skip first line with headers
scanner
.
nextLine
();
String
[]
connections
;
RiverBasin
riverBasin
;
InshoreBasin
inshoreBasin
;
OffshoreBasin
winteringBasin
;
OffshoreBasin
summeringBasin
;
while
(
scanner
.
hasNextLine
())
{
connections
=
scanner
.
nextLine
().
replaceAll
(
"\""
,
""
).
split
(
","
);
riverBasin
=
getRiverBasin
(
connections
[
1
]);
inshoreBasin
=
getInshoreBasin
(
connections
[
1
]);
winteringBasin
=
getOffshoreBasin
(
connections
[
3
]);
summeringBasin
=
getOffshoreBasin
(
connections
[
5
]);
riverBasin
.
setConnectedInshoreBasin
(
inshoreBasin
);
riverBasin
.
setConnectedWinteringOffshoreBasin
(
winteringBasin
);
riverBasin
.
setConnectedSummeringOffshoreBasin
(
summeringBasin
);
inshoreBasin
.
setConnectedRiverBasin
(
riverBasin
);
}
scanner
.
close
();
reader
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// ======================== create a QueueMemoryMap to keep the spawnerOrigine in each basin
List
<
String
>
basinNames
=
new
ArrayList
<
String
>();
for
(
RiverBasin
basin
:
riverBasins
)
{
...
...
@@ -516,11 +554,11 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
/**
* @return the tempera
t
ure
CatchmentFile
* @return the
prefix of
temperaure
file (scenario,climatic model)
*/
@Override
public
String
getTemperatureCatchmentFile
()
{
return
null
;
return
(
temperatureRiverFile
.
split
(
"_"
)[
0
])
;
}
...
...
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