Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
ecb86227
Verified
Commit
ecb86227
authored
Jun 09, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Fix warnings
parent
0d8ac8be
Changes
5
Hide whitespace changes
Inline
Side-by-side
includes/reseau_cellule_etats.h
View file @
ecb86227
...
...
@@ -75,4 +75,5 @@ public:
Reseau
(
const
unsigned
int
&
h
,
const
unsigned
int
&
l
);
Reseau
(
const
Reseau
&
);
~
Reseau
();
Reseau
&
operator
=
(
const
Reseau
&
r
);
};
includes/voisinage.h
View file @
ecb86227
...
...
@@ -78,7 +78,7 @@ class RegleVoisinageNeumann : public RegleVoisinage {
unsigned
int
rayon
;
public:
void
calculVoisinage
(
Voisinage
&
v
,
const
Reseau
&
r
)
const
override
;
void
setr
(
unsigned
int
r
)
;
void
setr
(
unsigned
int
r
)
{
rayon
=
r
;
}
unsigned
int
getr
()
const
{
return
rayon
;
}
int
getType
()
const
{
return
1
;
}
};
...
...
@@ -88,7 +88,7 @@ class RegleVoisinageMoore : public RegleVoisinage {
unsigned
int
rayon
;
public:
void
calculVoisinage
(
Voisinage
&
v
,
const
Reseau
&
r
)
const
override
;
void
setr
(
unsigned
int
r
)
;
void
setr
(
unsigned
int
r
)
{
rayon
=
r
;
}
unsigned
int
getr
()
const
{
return
rayon
;
}
int
getType
()
const
{
return
2
;
}
};
...
...
src/autosql.cpp
View file @
ecb86227
...
...
@@ -247,7 +247,7 @@ Reseau& Database::getReseau(int idReseau) const {
cellule
.
bindValue
(
":i"
,
static_cast
<
int
>
(
i
));
cellule
.
bindValue
(
":j"
,
static_cast
<
int
>
(
j
));
cellule
.
exec
();
while
(
r
->
getReseau
()[
i
][
j
].
getIndEtat
()
!=
cellule
.
value
(
"etat"
).
toInt
())
while
(
static_cast
<
int
>
(
r
->
getReseau
()[
i
][
j
].
getIndEtat
()
)
!=
cellule
.
value
(
"etat"
).
toInt
())
r
->
getReseau
()[
i
][
j
].
incrementerEtat
();
}
}
...
...
src/reseau_cellule_etats.cpp
View file @
ecb86227
...
...
@@ -111,4 +111,21 @@ Reseau::Reseau(const Reseau& init_grille){
reseau
[
i
][
j
].
initCellule
(
init_grille
.
reseau
[
i
][
j
].
getIndEtat
(),
i
,
j
);
}
};
}
Reseau
&
Reseau
::
operator
=
(
const
Reseau
&
init_grille
)
{
for
(
unsigned
int
i
=
0
;
i
<
hauteur
;
i
++
)
delete
[]
reseau
[
i
];
delete
[]
reseau
;
hauteur
=
init_grille
.
hauteur
;
largeur
=
init_grille
.
largeur
;
reseau
=
new
Cellule
*
[
hauteur
];
for
(
unsigned
int
i
=
0
;
i
<
hauteur
;
i
++
)
reseau
[
i
]
=
new
Cellule
[
largeur
];
for
(
unsigned
int
i
=
0
;
i
<
hauteur
;
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
largeur
;
j
++
)
reseau
[
i
][
j
].
initCellule
(
init_grille
.
reseau
[
i
][
j
].
getIndEtat
(),
i
,
j
);
return
*
this
;
}
src/voisinage.cpp
View file @
ecb86227
...
...
@@ -3,45 +3,29 @@
#include
<cmath>
#include
<iostream>
void
RegleVoisinageNeumann
::
setr
(
unsigned
int
r
){
if
(
r
>=
0
)
rayon
=
r
;
else
throw
(
"Rayon incorrect !
\n
"
);
}
void
RegleVoisinageMoore
::
setr
(
unsigned
int
r
){
if
(
r
>=
0
)
rayon
=
r
;
else
throw
(
"Rayon incorrect !
\n
"
);
}
void
RegleVoisinageNeumann
::
calculVoisinage
(
Voisinage
&
v
,
const
Reseau
&
r
)
const
{
v
.
voisinage
=
std
::
vector
<
Cellule
*>
();
int
nb
=
0
;
unsigned
int
cellX
=
v
.
celluleCentre
->
abs
;
unsigned
int
cellY
=
v
.
celluleCentre
->
ord
;
unsigned
int
hauteur
=
r
.
getHauteur
();
unsigned
int
largeur
=
r
.
getLargeur
();
for
(
int
i
=
-
rayon
;
i
<=
rayon
;
i
++
)
for
(
int
j
=
-
rayon
;
j
<=
rayon
;
j
++
)
if
(
abs
(
i
)
+
abs
(
j
)
<=
rayon
&&
i
!=
0
&&
j
!=
0
)
for
(
int
i
=
-
static_cast
<
int
>
(
rayon
)
;
i
<=
static_cast
<
int
>
(
rayon
)
;
i
++
)
for
(
int
j
=
-
static_cast
<
int
>
(
rayon
)
;
j
<=
static_cast
<
int
>
(
rayon
)
;
j
++
)
if
(
abs
(
i
)
+
abs
(
j
)
<=
static_cast
<
int
>
(
rayon
)
&&
i
!=
0
&&
j
!=
0
)
v
.
voisinage
.
push_back
(
&
r
.
getReseau
()[(
cellY
+
i
)
%
hauteur
][(
cellX
+
j
)
%
largeur
]);
}
void
RegleVoisinageMoore
::
calculVoisinage
(
Voisinage
&
v
,
const
Reseau
&
r
)
const
{
v
.
voisinage
=
std
::
vector
<
Cellule
*>
();
int
nb
=
0
;
unsigned
int
cellX
=
v
.
celluleCentre
->
abs
;
unsigned
int
cellY
=
v
.
celluleCentre
->
ord
;
unsigned
int
hauteur
=
r
.
getHauteur
();
unsigned
int
largeur
=
r
.
getLargeur
();
for
(
int
i
=
-
rayon
;
i
<=
rayon
;
i
++
)
for
(
int
j
=
-
rayon
;
j
<=
rayon
;
j
++
)
if
(
abs
(
i
)
<=
rayon
&&
abs
(
j
)
<=
rayon
&&
i
!=
0
&&
j
!=
0
)
for
(
int
i
=
-
static_cast
<
int
>
(
rayon
)
;
i
<=
static_cast
<
int
>
(
rayon
)
;
i
++
)
for
(
int
j
=
-
static_cast
<
int
>
(
rayon
)
;
j
<=
static_cast
<
int
>
(
rayon
)
;
j
++
)
if
(
abs
(
i
)
<=
static_cast
<
int
>
(
rayon
)
&&
abs
(
j
)
<=
static_cast
<
int
>
(
rayon
)
&&
i
!=
0
&&
j
!=
0
)
v
.
voisinage
.
push_back
(
&
r
.
getReseau
()[(
cellY
+
i
)
%
hauteur
][(
cellX
+
j
)
%
largeur
]);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment