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
H
hierarchical-homogenization
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
37
Issues
37
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jeremy BLEYER
hierarchical-homogenization
Commits
a007729c
Commit
a007729c
authored
May 19, 2020
by
Antoine MARTIN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout inclusions_elliptiques.py
parent
25047a44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
inclusions_elliptiques.py
inclusions_elliptiques.py
+93
-0
No files found.
inclusions_elliptiques.py
0 → 100644
View file @
a007729c
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
random
import
uniform
def
compteur
(
im
):
nn
,
mm
=
im
.
shape
cpt
=
0
for
i
in
range
(
nn
):
for
j
in
range
(
mm
):
if
im
[
i
,
j
]
==
1
:
cpt
=
cpt
+
1
return
cpt
/
nn
/
mm
def
ajoute
(
im
,
a
,
b
,
th
,
iso
,
nb
):
nn
,
mm
=
im
.
shape
centers
=
[[
0.
,
0.
]
for
i
in
range
(
nb
)]
theta
=
[
0.
for
i
in
range
(
nb
)]
if
iso
==
True
:
for
i
in
range
(
nb
):
theta
[
i
]
=
uniform
(
0
,
np
.
pi
)
else
:
for
i
in
range
(
nb
):
theta
[
i
]
=
th
for
i
in
range
(
nb
):
centers
[
i
]
=
[
uniform
(
0
,
1
),
uniform
(
0
,
1
)]
for
i
in
range
(
nb
):
c
=
max
(
a
,
b
)
x
=
centers
[
i
][
0
]
y
=
centers
[
i
][
1
]
the
=
theta
[
i
]
for
j
in
range
(
int
((
x
-
c
)
*
nn
)
-
1
,
int
((
x
+
c
)
*
nn
)
+
1
):
for
k
in
range
(
int
((
y
-
c
)
*
mm
)
-
1
,
int
((
y
+
c
)
*
mm
)
+
1
):
x1
=
(
j
+
0.5
)
/
nn
y1
=
(
k
+
0.5
)
/
mm
x2
=
x1
*
np
.
cos
(
the
)
+
y1
*
np
.
sin
(
the
)
y2
=
y1
*
np
.
cos
(
the
)
-
x1
*
np
.
sin
(
the
)
if
(
x2
-
x
)
**
2
/
a
**
2
+
(
y2
-
y
)
**
2
/
b
**
2
<=
1
:
if
j
>=
nn
:
l
=
nn
else
:
l
=
0
if
k
>=
mm
:
m
=
mm
else
:
m
=
0
im
[
j
-
l
,
k
-
m
]
=
1
def
image_init
(
N
,
a
,
b
,
th
,
iso
,
f
):
im
=
np
.
zeros
((
N
,
N
))
n
=
int
(
f
/
np
.
pi
/
a
/
b
)
c
=
0
while
c
<
f
:
ajoute
(
im
,
a
,
b
,
th
,
iso
,
n
)
c
=
compteur
(
im
)
n
=
int
((
f
-
c
)
/
np
.
pi
/
a
/
b
)
+
1
return
im
,
c
def
image_augmente
(
im
,
a
,
b
,
th
,
iso
,
f
):
f0
=
compteur
(
im
)
if
f
<=
f0
:
print
(
'fraction volumique actuelle :'
+
str
(
f0
))
else
:
c
=
f0
n
=
int
((
f
-
c
)
/
np
.
pi
/
a
/
b
)
+
1
while
c
<
f
:
ajoute
(
im
,
a
,
b
,
th
,
iso
,
n
)
c
=
compteur
(
im
)
n
=
int
((
f
-
c
)
/
np
.
pi
/
a
/
b
)
+
1
return
c
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