← Back to team overview

yade-users team mailing list archive

Re: Gravity Triaxial

 

Hi Jerome,

I was declaring the pointer to the GravityEngine and setting the gravity in
the TCE but this does not work unless iterating through the list of engines.
Now it works!

Thank a lot ;)

Chiara



 I tried to modify the value of gravity accessing the engine in the
>> TriaxialCompressionEngine, but still it does nothing..
>>
> How did you try to do this ? Normally with following lines in TCEngine, I
> guess it should work. They allow you to pass through all the engines of the
> simulation, and to change the "gravity" attribute of the "GravityEngine",
> once you found it.
>
>
>           vector<shared_ptr<Engine> >::iterator itFirst =
> ncb->engines.begin(); // ncb is the Scene
>           vector<shared_ptr<Engine> >::iterator itLast =
> ncb->engines.end();
>           for ( ;itFirst!=itLast; ++itFirst )   // you check all the
> engines of the simulation
>           {
>               if ( ( *itFirst )->getClassName() == "GravityEngine" ) //
> that's the ClassName of this Engine, as it is defined in the first argument
> of YADE_CLASS_BASE_DOC_ATTRS of the .hpp (I guess ? I'm more used to other
> syntax, with REGISTER_CLASS_NAME(...))
>               {
>                   PtrGravityEngine =  YADE_PTR_CAST<GravityEngine> (
> *itFirst ); // PtrGravityEngine should before be declared as a
> shared_ptr<GravityEngine>....
>                   PtrGravityEngine ->gravity = "the value you want"
>               }
>           }
>
>
>
> Jerome
>
>
> _______________________________________________
> 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