← Back to team overview

yade-dev team mailing list archive

Re: need help on ClumpTemplate

 

You have to make the class inherit from "Serializable" if you want to
handle it easily in python (using all the macros that yade defines). You
could use Body.hpp as an example.

As for the user's side, it make no difference if the function is
implemented in c++ or python (but the latest is sometimes more "light
weight" for the devs). See for instance, the source file
py/bodiesHandling.py.
Saving them with O.save sounds a little bit involved, since templates
are not bodies of the simulation and only them are saved currently.


> in hpp. How can I set the length of the vector, after construction of
the object in makeClumpTemplate() in yadeWrapper ?
> shared_ptr<ClumpTemplate> ct=shared_ptr<ClumpTemplate>(new
ClumpTemplate());
>ct->rad ???
>ct->pos ???

The vector will have null length by default, which should be ok.
If you register the vectors using python binding (like e.g. "ids" in
PartialEngine), you should be able to modify the list like this:
ct.rad.append(x) #or
ct.rad=[1,1,1]

Still, I don't see why there is a pointer to a template in the template.

Note also that the current interface uses something quite similar to a
template. In triax-tutorial/script1.py, you find this:

## define a unique clump type (we could have many, see clumpCloud
documentation)
 c1=pack.SpherePack([((-0.2*mean_rad,0,0),0.5*mean_rad),((0.2*mean_rad,0,0),0.5*mean_rad)])
 ## generate positions and input them in the simulation
 sp.makeClumpCloud(mn,mx,[c1],periodic=False)

c1 is a sort of template, isn't it? So if I understand correctly you
want something that would take c1 but would also be more flexible (i.e.
that would not require one to use ClumpCloud)?

Bruno



Follow ups

References