[Yade-users] [Question #253249]: how to add Torque on a body

2014-08-18 Thread Carrie
New question #253249 on Yade:
https://answers.launchpad.net/yade/+question/253249

Hi,

I want to directly add force and torque to some bodies ( for example 10 spheres 
), and I find that there is a method  called "addForce" to deal with the force. 
But is there any good way to add the torque conveniently ?

Thanks for any of your suggestions!

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253059]: friction and shear stress

2014-08-18 Thread Jérôme Duriez
Question #253059 on Yade changed:
https://answers.launchpad.net/yade/+question/253059

Jérôme Duriez posted a new comment:
Hello,

As a first advice, do you understand what is this "shear stress" you are
speaking about ? (me not, but I think that would be the first step for
you to understand your results)

Jérôme

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253249]: how to add Torque on a body

2014-08-18 Thread Donia Marzougui
Question #253249 on Yade changed:
https://answers.launchpad.net/yade/+question/253249

Donia Marzougui proposed the following answer:
Hi,

It is the same for the force. you have just to write: forces.addTorque

Bests
Donia

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253249]: how to add Torque on a body

2014-08-18 Thread Jan Stránský
Question #253249 on Yade changed:
https://answers.launchpad.net/yade/+question/253249

Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Carrie
addT is what you are looking for [1]
cheers
Jan

[1]
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ForceContainer.addT



2014-08-18 10:42 GMT+02:00 Carrie :

> New question #253249 on Yade:
> https://answers.launchpad.net/yade/+question/253249
>
> Hi,
>
> I want to directly add force and torque to some bodies ( for example 10
> spheres ), and I find that there is a method  called "addForce" to deal
> with the force. But is there any good way to add the torque conveniently ?
>
> Thanks for any of your suggestions!
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> ___
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253105]: How to visualize bonds/cohesion using intr recorder and Paraview?

2014-08-18 Thread Jérôme Duriez
Question #253105 on Yade changed:
https://answers.launchpad.net/yade/+question/253105

Status: Open => Answered

Jérôme Duriez proposed the following answer:
Hello,

You're right that "intr" displays all interactions, so you probably need
a model-specific recorder. For example, for another contact law, the
"jcfpm" recorder (see [1]) allows to distinguish between cohesive-
frictionnal and purely frictionnal interactions, using a JCFpmPhys
variable [2].

You have to check if something similar exists in the "cpm" recorder, or
you will have to implement it yourself.

Jérôme

[1] 
https://www.yade-dem.org/doc/yade.wrapper.html#yade.wrapper.VTKRecorder.recorders
[2] 
https://www.yade-dem.org/doc/yade.wrapper.html#yade.wrapper.JCFpmPhys.isCohesive

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253249]: how to add Torque on a body

2014-08-18 Thread Carrie
Question #253249 on Yade changed:
https://answers.launchpad.net/yade/+question/253249

Carrie confirmed that the question is solved:
Thanks Jan Stránský, that solved my question.

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253249]: how to add Torque on a body

2014-08-18 Thread Carrie
Question #253249 on Yade changed:
https://answers.launchpad.net/yade/+question/253249

Status: Answered => Solved

Carrie confirmed that the question is solved:
oh, I find a addT function...

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


[Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Raphaël Maurin
New question #253257 on Yade:
https://answers.launchpad.net/yade/+question/253257

Hi all, 
I need to generate a random number from a gaussian distribution in the C++ code 
of Yade. 
For that, basing myself on 
http://www.cplusplus.com/reference/random/normal_distribution/
I wrote in the cpp file : 
#include
std::default_random_engine generator;
std::normal_distribution distribution(0.0,1.0);
double number = distribution(generator);

When compiling, I get an error which I do not understand :

In file included from /usr/include/c++/4.6/random:35:0,
 from 
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:13:
/usr/include/c++/4.6/bits/c++0x_warning.h:32:2: erreur: #error This file 
requires compiler and library support for the upcoming ISO C++ standard, C++0x. 
This support is currently experimental, and must be enabled with the -std=c++0x 
or -std=gnu++0x compiler options.
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp: In member 
function ‘virtual void HydroForceEngine::action()’:
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:3: erreur: 
‘default_random_engine’ is not a member of ‘std’
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:30: erreur: 
expected ‘;’ before ‘generator’
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:3: erreur: 
‘normal_distribution’ is not a member of ‘std’
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
expected primary-expression before ‘double’
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
expected ‘;’ before ‘double’
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:27: erreur: 
‘generator’ was not declared in this scope
/home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:36: erreur: 
‘distribution’ was not declared in this scope
make[2]: *** [CMakeFiles/yade.dir/pkg/common/ForceEngine.cpp.o] Erreur 1
make[2]: *** Attente des tâches non terminées
make[1]: *** [CMakeFiles/yade.dir/all] Erreur 2
make: *** [all] Erreur 2


Do you have an idea from where this error come from ? 
If necessary I can put the whole code but I don't think it will bring 
something. 

Raphaël

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Anton Gladky
Hi,

are you using the latest trunk version?
There we have already enabled C++11, which you seems need for
the compilation of this code.

Cheers,

Anton


2014-08-18 13:56 GMT+02:00 Raphaël Maurin
:
> New question #253257 on Yade:
> https://answers.launchpad.net/yade/+question/253257
>
> Hi all,
> I need to generate a random number from a gaussian distribution in the C++ 
> code of Yade.
> For that, basing myself on 
> http://www.cplusplus.com/reference/random/normal_distribution/
> I wrote in the cpp file :
> #include
> std::default_random_engine generator;
> std::normal_distribution distribution(0.0,1.0);
> double number = distribution(generator);
>
> When compiling, I get an error which I do not understand :
>
> In file included from /usr/include/c++/4.6/random:35:0,
>  from 
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:13:
> /usr/include/c++/4.6/bits/c++0x_warning.h:32:2: erreur: #error This file 
> requires compiler and library support for the upcoming ISO C++ standard, 
> C++0x. This support is currently experimental, and must be enabled with the 
> -std=c++0x or -std=gnu++0x compiler options.
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp: In member 
> function ‘virtual void HydroForceEngine::action()’:
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:3: erreur: 
> ‘default_random_engine’ is not a member of ‘std’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:30: erreur: 
> expected ‘;’ before ‘generator’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:3: erreur: 
> ‘normal_distribution’ is not a member of ‘std’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
> expected primary-expression before ‘double’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
> expected ‘;’ before ‘double’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:27: 
> erreur: ‘generator’ was not declared in this scope
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:36: 
> erreur: ‘distribution’ was not declared in this scope
> make[2]: *** [CMakeFiles/yade.dir/pkg/common/ForceEngine.cpp.o] Erreur 1
> make[2]: *** Attente des tâches non terminées
> make[1]: *** [CMakeFiles/yade.dir/all] Erreur 2
> make: *** [all] Erreur 2
>
>
> Do you have an idea from where this error come from ?
> If necessary I can put the whole code but I don't think it will bring 
> something.
>
> Raphaël
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> ___
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Anton Gladky
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Status: Open => Answered

Anton Gladky proposed the following answer:
Hi,

are you using the latest trunk version?
There we have already enabled C++11, which you seems need for
the compilation of this code.

Cheers,

Anton


2014-08-18 13:56 GMT+02:00 Raphaël Maurin
:
> New question #253257 on Yade:
> https://answers.launchpad.net/yade/+question/253257
>
> Hi all,
> I need to generate a random number from a gaussian distribution in the C++ 
> code of Yade.
> For that, basing myself on 
> http://www.cplusplus.com/reference/random/normal_distribution/
> I wrote in the cpp file :
> #include
> std::default_random_engine generator;
> std::normal_distribution distribution(0.0,1.0);
> double number = distribution(generator);
>
> When compiling, I get an error which I do not understand :
>
> In file included from /usr/include/c++/4.6/random:35:0,
>  from 
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:13:
> /usr/include/c++/4.6/bits/c++0x_warning.h:32:2: erreur: #error This file 
> requires compiler and library support for the upcoming ISO C++ standard, 
> C++0x. This support is currently experimental, and must be enabled with the 
> -std=c++0x or -std=gnu++0x compiler options.
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp: In member 
> function ‘virtual void HydroForceEngine::action()’:
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:3: erreur: 
> ‘default_random_engine’ is not a member of ‘std’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:94:30: erreur: 
> expected ‘;’ before ‘generator’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:3: erreur: 
> ‘normal_distribution’ is not a member of ‘std’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
> expected primary-expression before ‘double’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:95:28: erreur: 
> expected ‘;’ before ‘double’
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:27: 
> erreur: ‘generator’ was not declared in this scope
> /home/raphael/these/code/Yade/trunk/pkg/common/ForceEngine.cpp:109:36: 
> erreur: ‘distribution’ was not declared in this scope
> make[2]: *** [CMakeFiles/yade.dir/pkg/common/ForceEngine.cpp.o] Erreur 1
> make[2]: *** Attente des tâches non terminées
> make[1]: *** [CMakeFiles/yade.dir/all] Erreur 2
> make: *** [all] Erreur 2
>
>
> Do you have an idea from where this error come from ?
> If necessary I can put the whole code but I don't think it will bring 
> something.
>
> Raphaël
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> ___
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253097]: Imposing constant velocity on clumps on single axis

2014-08-18 Thread Colin Power
Question #253097 on Yade changed:
https://answers.launchpad.net/yade/+question/253097

Status: Answered => Solved

Colin Power confirmed that the question is solved:
Thanks Anton Gladky, that solved my question.

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253097]: Imposing constant velocity on clumps on single axis

2014-08-18 Thread Colin Power
Question #253097 on Yade changed:
https://answers.launchpad.net/yade/+question/253097

Colin Power posted a new comment:
Just to add completeness to this question, this is what I changed in the
function to get the desired result:

def moreSpheres(i=1):   
y_shift = 0
for n in xrange(0,i):
geoFile = 'ice_blocks/ice_block_'+str(random.randint(1,1000))+'.geo'
y_shift+= random.uniform(10, 15)
x_shift = random.uniform(0, 20)
packing = yade.ymport.gengeoFile(fileName=geoFile, 
shift=Vector3(-99+x_shift, -99+y_shift, 2), scale=1.0, 
orientation=Quaternion((1, 0, 0), 0),color=sphereColor, material=ice, 
wire=False)
clump = O.bodies.appendClumped(packing)
clumpID = clump[0]
O.bodies[clumpID].state.vel= Vector3(50,0,0)

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253105]: How to visualize bonds/cohesion using intr recorder and Paraview?

2014-08-18 Thread Colin Power
Question #253105 on Yade changed:
https://answers.launchpad.net/yade/+question/253105

Status: Answered => Solved

Colin Power confirmed that the question is solved:
Thanks Jérôme Duriez, that solved my question.

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Raphaël Maurin
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Status: Answered => Solved

Raphaël Maurin confirmed that the question is solved:
Hi Anton, 
I was using the 29/06/2014 version, I updated and it solved the problem.  
Thank you !
Raphaël

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Raphaël Maurin
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Raphaël Maurin confirmed that the question is solved:
Thanks Anton Gladky, that solved my question.

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #251218]: Modifying the Cohesive Frictional Contact Law

2014-08-18 Thread Bruno Chareyre
Question #251218 on Yade changed:
https://answers.launchpad.net/yade/+question/251218

Bruno Chareyre proposed the following answer:
I was away from keyboard. Sorry for slow reply Behzad.
I think you can keep the 3 variables of CohFrictPhys even if you don't need 
them. It is harmless, and there is in fact a very good reason to keep them. If 
later you or somebody else wants to combine the Burger model with contact 
moments - and trust me it is likely to happen, it will be possible (for free! 
no need to write new code).
Jan's suggestion to introduce an intermediate class is also good, but it does 
not enable such combination of components.

I agree with Jan to delay the clean integration, just it is good to
anticipate it as it can guide the way you do the dirty tricks already.

As a simple example of how a good integration can look like,
Ip2_CohBurgersMat can inherit from Ip2_CohFrictMat so that:

void Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys::go(b1,b2,i)
{
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys::go(b1,b2,i); //here re-use
i->phys->kelvinViscosity = ... //here do the additional stuff
}

In this case you don't duplicate lines. If someone is fixing something
in Ip2_CohFrictMat_CohFrictMat_CohFrictPhys you will recieve the fix. If
you duplicate, the duplicated code will slowly diverge and bugs may
never be fixed.

Notes:
1/ This requires that you inherit from 
2/ I don't see any kelvin/maxwell viscosity and stiffness in CohBurgersPhys at 
the moment. I guess you will have to add something for some of them (not all, 
since they can be partly covered by the inherited stiffness and viscosity 
values).
3/ the example above can apply for Law2 functor as well (see [1]), but not 
always. If you find that the burger model needs to insert lines in the middle 
of the Law2::go() block of code (I mean if there is really no way to put all 
new lines before or after the inherited go()) then we will need to think a bit 
more. 

I hope it helps

[1]
https://github.com/yade/trunk/blob/master/pkg/dem/ElasticContactLaw.cpp#L102

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #252656]: Crash when using CPM model

2014-08-18 Thread Bruno Chareyre
Question #252656 on Yade changed:
https://answers.launchpad.net/yade/+question/252656

Bruno Chareyre proposed the following answer:
If some spheres have multiple contacts with facets, then maybe PWave timestep 
is irrelevant. Just an idea.
If you want to be sure it is not a timestep problem you can use automatic 
timestep with GlobalStiffnessTimeStepper.
Bruno

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253112]: memory leakage when passing a variable from python to C++

2014-08-18 Thread Bruno Chareyre
Question #253112 on Yade changed:
https://answers.launchpad.net/yade/+question/253112

Bruno Chareyre proposed the following answer:
Maybe python is just never erasing the vector that you pass from fortran to 
c++. I remember it can happen sometimes than python is not releasing memory as 
you expect.
If this is the problem it will not be visible in the c++ code, and it will not 
be related to the bug mentionned by Anton.
Can you show how you assign the values in the script?

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253112]: memory leakage when passing a variable from python to C++

2014-08-18 Thread Raphaël Maurin
Question #253112 on Yade changed:
https://answers.launchpad.net/yade/+question/253112

Raphaël Maurin posted a new comment:
Hi Bruno,

To assign the value in the python script I write : 
HydroForceEngine.vxFluct = X

X being the vector containing all the values of fluctuations which is
the size of the number of bodies.

Raphaël

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253112]: memory leakage when passing a variable from python to C++

2014-08-18 Thread Bruno Chareyre
Question #253112 on Yade changed:
https://answers.launchpad.net/yade/+question/253112

Bruno Chareyre requested more information:
Now I see this (after [1]):
HydroForceEngine.vxFluct = X

Just a trivial thing: can you check len(HydroForceEngine.vxFluct) and len(X) 
just after this line? (to be sure)
If sizes are correct, I will need to see more lines to imagine other things.

[1] https://bugs.launchpad.net/yade/+bug/1041084

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253112]: memory leakage when passing a variable from python to C++

2014-08-18 Thread Raphaël Maurin
Question #253112 on Yade changed:
https://answers.launchpad.net/yade/+question/253112

Status: Answered => Open

Raphaël Maurin is still having a problem:
It gives always the same size which correspond to len(O.bodies)
What else do you need ? 
Because you have the C++ source code above (cpp and hpp, one after the other) 
and I tried a very simplified script only executing the command 
HydroForceEngine.vxFluct = np.zeros(len(O.bodies)
and I have the same problem. 

Raphael

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253112]: memory leakage when passing a variable from python to C++

2014-08-18 Thread Bruno Chareyre
Question #253112 on Yade changed:
https://answers.launchpad.net/yade/+question/253112

Bruno Chareyre posted a new comment:
This is how to reproduce your bug...

for k in range(1000):
   e.ids=range(0,100)

then watch yade eating the RAM...

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Raphaël Maurin
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Raphaël Maurin posted a new comment:
One last thing, the random number generator using 
#include
std::default_random_engine generator;
std::normal_distribution distribution(0.0,1.0);
double number = distribution(generator);

is pretty bad, I am able to see by eyes some number which are repeated
many times...I don't like it much. Does someone knows a better way to
generate random numbers in C++ ?

Thanks !

Raphaël

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Jan Stránský
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Jan Stránský posted a new comment:
Hi Raphael,

to generate random number in the interval 0 to 1, I use

double random() { return (double)rand()/(double)RAND_MAX; }

for normal distribution I use Box-Muller method (see also [1,2])

// function generating normally distributed random numbers using Box-Muller
method
double randNormal (double mean, double stddev, double min=-1e200, double
max=1e200) {
   double r, u, v, c, ret;
   do {
  do {
 u = 2*(double)rand() / (double)RAND_MAX-1;
 v = 2*(double)rand() / (double)RAND_MAX-1;
 r = u*u + v*v;
  } while (r==0. || r>1.);
  c = sqrt(-2*log(r)/r);
  ret = mean + u*c*stddev;
   } while (ret <= min || ret >= max);
   return ret;
}

cheers
Jan

[1] http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
[2]
http://math60082.blogspot.cz/2013/03/c-coding-random-numbers-and-monte-carlo.html



2014-08-18 19:36 GMT+02:00 Raphaël Maurin <
question253...@answers.launchpad.net>:

> Question #253257 on Yade changed:
> https://answers.launchpad.net/yade/+question/253257
>
> Raphaël Maurin posted a new comment:
> One last thing, the random number generator using
> #include
> std::default_random_engine generator;
> std::normal_distribution distribution(0.0,1.0);
> double number = distribution(generator);
>
> is pretty bad, I am able to see by eyes some number which are repeated
> many times...I don't like it much. Does someone knows a better way to
> generate random numbers in C++ ?
>
> Thanks !
>
> Raphaël
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> ___
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Bruno Chareyre
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Bruno Chareyre posted a new comment:
I suspect the problem is in the generator, not in the distribution.
In other words, Box-Muller based on std::default_random_engine would be bad as 
well.

I guess you have seen the list of available generators [1]. Not sure which one 
is best but, for the one you tried it says:
"provides at least acceptable engine behavior for relatively casual, inexpert, 
and/or lightweight use"...

I have no idea what is used for std::rand(). It seems it is
implementation dependent. It could be a wrapper of
std::default_random_engine...

[1] http://www.cplusplus.com/reference/random/

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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


Re: [Yade-users] [Question #253257]: generate a random number in the C++ code

2014-08-18 Thread Klaus Thoeni
Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Klaus Thoeni posted a new comment:
Hi,

 I am using boost's random number generators. I tested them and I am
very happy. Have a look in the code [1] and here [2].

Cheers,
Klaus

[1] https://github.com/yade/trunk/blob/master/pkg/dem/WirePM.cpp
[2] http://www.boost.org/doc/libs/1_55_0/doc/html/boost_random.html

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.

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