yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #09112
Re: [Question #244984]: Clumps,sphere and walls IDs
Question #244984 on Yade changed:
https://answers.launchpad.net/yade/+question/244984
Jan Stránský proposed the following answer:
Hi Behzad,
the IDs of bodies are assigned as you use O.bodies.append(...). I don't
know the implementation of replaceByClumps, but appearently firstly the
spheres of a clump are created and added to O.bodies and after that the
clump is created and added to O.bodies, repeating sequentially for all
templates, so you get this numbering.
Does the ids matters so much? To create a list of clumps, you can use
something like
clumps = []
for b in O.bodies:
if b.isClump:
clump.append(b)
# or more pythonic
clumps = [b for b in O.bodies if b.isClump]
and then call clumps[localClumpIDs] numbers as they would be ascending form
0..
cheers
Jan
2014-03-04 20:11 GMT+01:00 behzad majidi <
question244984@xxxxxxxxxxxxxxxxxxxxx>:
> Question #244984 on Yade changed:
> https://answers.launchpad.net/yade/+question/244984
>
> behzad majidi posted a new comment:
> Hi Jan,
>
> Thanks for the answer. I tried it and it works.
>
> But, still the IDs of clumps are kind of strange for me.
> I tried the following commands in the above mentioned script;
> for t in O.bodies:
> if t.isClump:
> print 'Clump ',t.id,' has following members: '
> keys=t.shape.members.keys()
> for ii in range(0,len(keys)):
> print '- Body',keys[ii]
>
> and what I get is :
>
>
> Clump 33 has following members:
> - Body 3
> - Body 4
> - Body 5
> - Body 6
> - Body 7
> - Body 8
> - Body 9
> - Body 10
> - Body 11
> - Body 12
> - Body 13
> - Body 14
> - Body 15
> - Body 16
> - Body 17
> - Body 18
> - Body 19
> - Body 20
> - Body 21
> - Body 22
> - Body 23
> - Body 24
> - Body 25
> - Body 26
> - Body 27
> - Body 28
> - Body 29
> - Body 30
> - Body 31
> - Body 32
> Clump 53 has following members:
> - Body 1
> - Body 34
> - Body 35
> - Body 36
> - Body 37
> - Body 38
> - Body 39
> - Body 40
> - Body 41
> - Body 42
> - Body 43
> - Body 44
> - Body 45
> - Body 46
> - Body 47
> - Body 48
> - Body 49
> - Body 50
> - Body 51
> - Body 52
>
>
> As you see the IDs of clumps are polluted with the spheres IDs. Imagine a
> model with thousands of clumps and stand-alone spheres. This makes it very
> difficult to assign properties to certain clumps. Like here, we hav only
> two clumps but the IDs are 33 and 53.
> For me it's pretty normal to have Clump id 1 and 2 in this case.
>
> thank you!
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.