Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ahmad Reza Cheraghi
swarm-sim
Commits
06eea9e1
Commit
06eea9e1
authored
Jun 17, 2019
by
Ahmad Reza Cheraghi
Browse files
Update particle.py
parent
756e57b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/particle.py
View file @
06eea9e1
...
...
@@ -195,37 +195,7 @@ class Particle(matter.Matter):
else
:
return
None
def
write_to_with
(
self
,
matter
,
key
=
None
,
data
=
None
):
"""
Writes data with given a keyword directly on the matters (paricle, tile, or marker object) memory
:param matter: The matter can be either a particle, tile, or marker
:param key: A string keyword so to order the data that is written into the memory
:param data: The data that should be stored into the memory
:return: True: Successful written into the memory; False: Unsuccessful
"""
wrote
=
False
if
data
!=
None
:
wrote
=
False
if
key
==
None
:
wrote
=
matter
.
write_memory
(
data
)
else
:
wrote
=
matter
.
write_memory_with
(
key
,
data
)
if
wrote
==
True
:
if
matter
.
type
==
"particle"
:
self
.
sim
.
csv_round_writer
.
update_metrics
(
particle_write
=
1
)
self
.
csv_particle_writer
.
write_particle
(
particle_write
=
1
)
elif
matter
.
type
==
"tile"
:
self
.
sim
.
csv_round_writer
.
update_metrics
(
tile_write
=
1
)
self
.
csv_particle_writer
.
write_particle
(
tile_write
=
1
)
elif
matter
.
type
==
"marker"
:
self
.
sim
.
csv_round_writer
.
update_metrics
(
marker_write
=
1
)
self
.
csv_particle_writer
.
write_particle
(
marker_write
=
1
)
return
True
else
:
return
False
else
:
return
False
...
...
Write
Preview
Supports
Markdown
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