← Back to team overview

yade-users team mailing list archive

Re: How to declare the global variable?

 

Ok, thank you.

I think it should work for me.
______________________________
[ENG] Best Regards
[GER] Mit freundlichen Grüßen
[RUS] С наилучшими пожеланиями
[UKR] З найкращими побажаннями

Anton Gladkyy


2009/8/10 Václav Šmilauer <eudoxos@xxxxxxxx>

>
> > I want to calculate the total number of cohesive contacts in my
> > model.
> > How can I declare the global variable for that?
>
> No globals, sorry. You can make a variable static in some of your
> classes, but it is discouraged in general (e.g. you would not be able to
> use O.switchWorld() consistently). You have to update that number
> somehow, anyways.
>
> If you need that number just once in a while, count the interactions
> like this:
>
> long n=0;
> FOREACH(const shared_ptr<Interaction>& I, *rootBody->interaction){
> if(I->isReal()) n++; }
>
> In python, you can use O.interactions.countReal().
>
> HTH, Vaclav
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> More help   : https://help.launchpad.net/ListHelp
>

References