Re: [Yade-dev] How to change the macros

2011-04-27 Thread Anna Effeindzourou
ok ok thank you guys
___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Anton Gladky
Hi, Anna,

Is it not easier to add one more parameter to Wiremat?
But you should first contact to original author of this file.

Please, send diffs of files, not the whole ones. Because it is a
little difficult to find, what you have changed.

Thanks.
Anton

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Anna Effeindzourou
 Hi, Anton,
 I have to change the body of the class:

 class WireMat: public FrictMat {
public:
virtual shared_ptrState newAssocState() const { return
shared_ptrState(new WireState); }
virtual bool stateTypeOk(State* s) const { return
(bool)dynamic_castWireState*(s); }
void postLoad(WireMat);
DECLARE_LOGGER;
YADE_CLASS_BASE_DOC_ATTRS_CTOR(WireMat,FrictMat,Material for use with
the Wire classes,
((Real,diameter,0.0027,, (Diameter of the single wire in [m] (the
diameter is used to compute the cross-section area of the wire).))

 ((vectorVector2r,strainStressValues1,,Attr::triggerPostLoad,Piecewise
linear definition of the stress-strain curve by set of points
(strain[-]0,stress[Pa]0) for one single wire. Tension only is considered
and the point (0,0) is not needed!))

/I've add a other vector in order to take
account of my two curves*/


 ((vectorVector2r,strainStressValues2,,Attr::triggerPostLoad,Piecewise
linear definition of the stress-strain curve by set of points
(strain[-]0,stress[Pa]0) for one double wire. Tension only is considered
and the point (0,0) is not needed!))
((bool,isDoubleTwist,false,,Type of the mesh. If true two particles
of the same material which body ids differ by one will be considered as
double-twisted interaction.))
/*((Real,lambdaEps,0.4,,Parameter between 0 and 1 to reduce the
failure strain of the double-twisted wire (as used by [Bertrand2008]_).
[-]))
((Real,lambdak,0.21,,Parameter between 0 and 1 to compute the
elastic stiffness of the double-twisted wire (as used by [Bertrand2008]_):
$k^D=2(\\lambda_k k_h + (1-\\lambda_k)k^S)$. [-]))*/
((vector,lambda,,Attr::triggerPostLoad,/*it contain the two lamdaEps
and lambdak in order to not have to modify the form of the fonction(don't
want to change the number of
parameters*/,lambda[0]=lambdaEps,lambda[1]=lambdak))
((Real,as,0,Attr::readonly,Cross-section area of a single wire used
for the computation of the limit normal contact forces. [m²]))
,
createIndex();
);
REGISTER_CLASS_INDEX(WireMat,FrictMat);


But it can't work with YADE_CLASS_BASE_DOC_ATTRS_CTOR() because of the
number of parameters so I've try to modify serialiazable.hpp in order to
have a new fuction with the number of parameters I need:


/** USER MACROS START HERE /

// attrs is (type,name,init-value,docstring)
#define YADE_CLASS_BASE_DOC(klass,base,doc)
YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(klass,base,doc)
#define YADE_CLASS_BASE_DOC_ATTRS(klass,base,doc,attrs)
YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(klass,base,doc,attrs,,,)
#define YADE_CLASS_BASE_DOC_ATTRS_CTOR(klass,base,doc,attrs,ctor)
YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(klass,base,doc,attrs,,ctor,)

/*Adding a macro to have additional
attributes/
#define
YADE_CLASS_BASE_DOC_ATTRS_attrs_CTOR(klass,base,doc,attrs,attrs,ctor)
YADE_CLASS_BASE_DOC_ATTRS_attrs_INIT_CTOR_PY(klass,base,doc,attrs,attrs,,ctor,)
#define YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(klass,base,doc,attrs,ctor,py)
YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(klass,base,doc,attrs,,ctor,py)
#define
YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(klass,base,doc,attrs,inits,ctor,py)
YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(klass,base,doc,attrs,,inits,ctor,py)

Thanks.
 Anna


___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Anton Gladky
Sorry, I still do not understand, why do you need to change Serializable.hpp
If you need to add some more parameters to WireMat, you simply add it.

Please, see attached diff. strainStressValues1 and strainStressValues2
are added and the code compiles just fine.

But if you want to add it to the main trunk, please, contact Klaus
Thoeni for those changes.

Anton
=== modified file 'pkg/dem/WirePM.hpp'
--- pkg/dem/WirePM.hpp	2011-04-18 08:00:23 +
+++ pkg/dem/WirePM.hpp	2011-04-26 14:15:22 +
@@ -45,6 +45,8 @@
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(WireMat,FrictMat,Material for use with the Wire classes,
 		((Real,diameter,0.0027,, (Diameter of the single wire in [m] (the diameter is used to compute the cross-section area of the wire).))
 		((vectorVector2r,strainStressValues,,Attr::triggerPostLoad,Piecewise linear definition of the stress-strain curve by set of points (strain[-]0,stress[Pa]0) for one single wire. Tension only is considered and the point (0,0) is not needed!))
+		((vectorVector2r,strainStressValues1,,Attr::triggerPostLoad,Piecewise linear definition of the stress-strain curve by set of points (strain[-]0,stress[Pa]0) for one single wire. Tension only is considered and the point (0,0) is not needed!))
+		((vectorVector2r,strainStressValues2,,Attr::triggerPostLoad,Piecewise linear definition of the stress-strain curve by set of points (strain[-]0,stress[Pa]0) for one double wire. Tension only is considered and the point (0,0) is not needed!))
 		((bool,isDoubleTwist,false,,Type of the mesh. If true two particles of the same material which body ids differ by one will be considered as double-twisted interaction.))
 		((Real,lambdaEps,0.4,,Parameter between 0 and 1 to reduce the failure strain of the double-twisted wire (as used by [Bertrand2008]_). [-]))
 		((Real,lambdak,0.21,,Parameter between 0 and 1 to compute the elastic stiffness of the double-twisted wire (as used by [Bertrand2008]_): $k^D=2(\\lambda_k k_h + (1-\\lambda_k)k^S)$. [-]))

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Bruno Chareyre
This alone should be enough:


 /I've add a other vector in order to
 take account of my two curves*/
  
   
  ((vectorVector2r,strainStressValues2,,Attr::triggerPostLoad,Piecewise
 linear definition of the stress-strain curve by set of points
 (strain[-]0,stress[Pa]0) for one double wire. Tension only is
 considered and the point (0,0) is not needed!))

You surely don't need (and should not) modify the Serializable.hpp file.
Your compilation problem is probably due to something else (and
actually, there is no compile error shown in the log you sent).

For showing diffs, type (for instance) bzr diff
path/to/your/modified/file.cpp  nameOfOutputFile.

Also, for questions, please use launchpad questions:
https://answers.launchpad.net/yade/+addquestion

Bruno

p.s. I added a note on launchpad questions here
https://yade-dem.org/wiki/Contact#yade-users.40lists.launchpad.net

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Janek Kozicki
Anna Effeindzourou said: (by the date of Tue, 26 Apr 2011 15:55:45 +0200)


 YADE_CLASS_BASE_DOC_ATTRS_attrs_CTOR(klass,base,doc,attrs,attrs,ctor)

attrs,attrs makes no sense.

All brackets that are not separated by commas are attrs, no matter
how many attributes there are, for example, three attributes: (a)(b)(c)
this is handled by preprocessor. no need to change macros.

-- 
Janek Kozicki   http://janek.kozicki.pl/  |

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] How to change the macros

2011-04-26 Thread Klaus Thoeni
Hoi Anna,

as already pointed out by Bruno and Anton it makes no sense to change 
Serializable.hpp. If you want to add more parameters to to WireMat you have to 
define it in WirePM.hpp. However, in order to use this new parameters you would 
have to change the code in WirePM.cpp as well.

Anyway, the actual code uses two different stress-strain-curves where the one 
for the double-twist is computed from the single wire curve by using the 
parameters lambda_eps and lambda_k (see Bertrand, some assumptions are made 
and the single wire curve is somehow scaled to get the one for the double 
twist). So if you know your stress-strain-curve for the double twist you just 
have to find out which parameters give you the expected behaviour.

HTH

Klaus

On Tue, 26 Apr 2011 11:20:14 pm Anna Effeindzourou wrote:
 Hi,
 
 I try to change the macros in Serializable.hpp in order to have more
 parameters when I define the wireMat (I have join the code) I want to have
 possibility to enter two curves but it doesn't work.
 I have this error with the code join with this mail:
 
 home/anna/yade/lib/serialization/Serializable.hpp: In member function
 'PyObject*
 boost::python::objects::caller_py_function_implCaller::operator()(PyObjec
 t*, PyObject*) [with Caller = boost::python::detail::callerPyObject*
 (*)(Serializable, const Serializable),
 boost::python::default_call_policies, boost::mpl::vector3PyObject*,
 Serializable, const Serializable ]':
 /home/anna/yade/lib/serialization/Serializable.hpp:264: warning:
 dereferencing pointer 'p.2661' does break strict-aliasing rules
 /usr/include/boost/python/detail/destroy.hpp:90: note: initialized from
 here /home/anna/build-trunk/include/yade/lib/factory/Factorable.hpp:63:
 warning: dereferencing pointer 'this.685' does break strict-aliasing rules
 /home/anna/yade/lib/serialization/Serializable.hpp:264: note: initialized
 from here
 /home/anna/yade/lib/serialization/Serializable.hpp:264: warning:
 dereferencing pointer 'p.2661' does break strict-aliasing rules
 /usr/include/boost/python/detail/destroy.hpp:90: note: initialized from
 here /home/anna/build-trunk/include/yade/lib/factory/Factorable.hpp:63:
 warning: dereferencing pointer 'this.685' does break strict-aliasing rules
 /home/anna/yade/lib/serialization/Serializable.hpp:264: note: initialized
 from here
 scons: *** [/home/anna/build-trunk/lib/yade-support.os] Error 1
 scons: *** [/home/anna/build-trunk/core/core.os] Error 1
 scons: building terminated because of errors.
 
 What can I do to make it work?
 
 Thanks in advance,
 Anna

-- 
Dr. Klaus Thoeni - Centre for Geotechnical and Materials Modelling
Civil, Surveying and Environmental Engineering - Engineering Building EA
The University of Newcastle, Callaghan, NSW 2308, Australia
web: http://www.newcastle.edu.au/research-centre/cgmm
phone: +61 (0)2 4921 5118

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp