There was not much reaction...

I added YADE_CLASS_BASE_DOC_ATTRS and
YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY macros in the last commit. When
Yade starts, it screams about classes that don't use those macros yet.

Please convert "your" classes to use those macros instead of
REGISTER_ATTRIBUTES, REGISTER_CLASS_AND_BASE, REGISTER_CLASS_NAME,
REGISTER_BASE_CLASS.

The advantages are the following:

1. All data members will be documented.
2. All classes will be properly exposed to python, along with their
attributes and interactive help.
3. Class methods can be (if you choose so) also exposed to python.

If you use YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY, then you additionally
get:

4. All attributes will be initialized, and the default values will
appear in the documentation as well. See e.g.
https://www.yade-dem.org/sphinx/yade.wrapper.html#yade.wrapper.CpmMat
which is generated from 

class CpmMat: public FrictMat {
        public:
                virtual shared_ptr<State> newAssocState() const { return 
shared_ptr<State>(new CpmState); }
                virtual bool stateTypeOk(State* s) const { return 
(bool)dynamic_cast<CpmState*>(s); }

        YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(CpmMat,FrictMat,"Concrete 
material, for use with other Cpm classes. (note: density is initialized to 4800 
automatically)",
                ((Real,G_over_E,NaN,"Ratio of normal/shear stiffness at 
interaction level [-]"))
                ((Real,sigmaT,NaN,"Initial cohesion [Pa]"))
                ((bool,neverDamage,false,"If true, no damage will occur (for 
testing only)."))
                ((Real,epsCrackOnset,NaN,"Limit elastic strain [-]"))
                ((Real,relDuctility,NaN,"Relative ductility, for damage 
evolution law peak right-tangent. [-]"))
                ((Real,dmgTau,((void)"deactivated if 
negative",-1),"Characteristic time for normal viscosity. [s]"))
                ((Real,dmgRateExp,0,"Exponent for normal viscosity function. 
[-]"))
                ((Real,plTau,((void)"deactivated if 
negative",-1),"Characteristic time for visco-plasticity. [s]"))
                ((Real,plRateExp,0,"Exponent for visco-plasticity function. 
[-]"))
                ((Real,isoPrestress,0,"Isotropic prestress of the whole 
specimen. [Pa]")),
                createIndex(); density=4800 /* goes inside the constructor */ ,
                /*py; nothing we need*/
        );
        REGISTER_CLASS_INDEX(CpmMat,FrictMat);
};
REGISTER_SERIALIZABLE(CpmMat);






_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to