[Yade-dev] [Bug 795468] Re: plot.plot() causes crash

2011-10-17 Thread Anton Gladky
** Changed in: yade
   Status: New => Invalid

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/795468

Title:
  plot.plot() causes crash

Status in Yet Another Dynamic Engine:
  Invalid

Bug description:
  When trying to plot datas, the plot.plot() commande causes crash. 
  I run Debian (mixed) with Python 2.6.6, python-matplotlib 1.0.1-2.
  I can reproduce the crash with scripts/test/chained-cylinder-spring.py, 
giving me following backtrace :

  Yade [1]: plot.plot()
  Yade [2]: SIGSEGV/SIGABRT handler called; gdb batch file is 
`/tmp/yade-6e5SLo/tmp-0'
  GNU gdb (GDB) 7.2-debian
  Copyright (C) 2010 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later 
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "i486-linux-gnu".
  For bug reporting instructions, please see:
  .
  [Thread debugging using libthread_db enabled]
  [New Thread 0x9eb4bb70 (LWP 6850)]
  [New Thread 0xa2606b70 (LWP 6847)]
  [New Thread 0xa46ffb70 (LWP 6846)]
  [New Thread 0xa50f4b70 (LWP 6845)]
  0xb784e424 in __kernel_vsyscall ()
  No symbol "info" in current context.

  Thread 5 (Thread 0xa50f4b70 (LWP 6845)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x08132399 in ?? ()
  #3  0x080e09ef in PyEval_EvalFrameEx ()
  #4  0x080e2968 in PyEval_EvalCodeEx ()
  #5  0x080e0b5f in PyEval_EvalFrameEx ()
  #6  0x080e2968 in PyEval_EvalCodeEx ()
  #7  0x08174c9c in ?? ()
  #8  0x08066d7a in PyObject_Call ()
  #9  0x0806f931 in ?? ()
  #10 0x08066d7a in PyObject_Call ()
  #11 0x080dc2f2 in PyEval_CallObjectWithKeywords ()
  #12 0xa50fbfa3 in ?? () from /usr/lib/pymodules/python2.6/sip.so
  #13 0xa515830d in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #14 0xa518e066 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #15 0xb5d56d53 in ?? () from /usr/lib/libQtCore.so.4
  #16 0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #17 0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 4 (Thread 0xa46ffb70 (LWP 6846)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x08132399 in ?? ()
  #3  0x080e09ef in PyEval_EvalFrameEx ()
  #4  0x080e2968 in PyEval_EvalCodeEx ()
  #5  0x080e0b5f in PyEval_EvalFrameEx ()
  #6  0x080e2968 in PyEval_EvalCodeEx ()
  #7  0x08174c9c in ?? ()
  #8  0x08066d7a in PyObject_Call ()
  #9  0x0806f931 in ?? ()
  #10 0x08066d7a in PyObject_Call ()
  #11 0x080dc2f2 in PyEval_CallObjectWithKeywords ()
  #12 0xa50fbfa3 in ?? () from /usr/lib/pymodules/python2.6/sip.so
  #13 0xa515830d in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #14 0xa518e066 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #15 0xb5d56d53 in ?? () from /usr/lib/libQtCore.so.4
  #16 0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #17 0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 3 (Thread 0xa2606b70 (LWP 6847)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0xa26f97d2 in ?? () from /usr/lib/libtcl8.5.so.0
  #3  0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #4  0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 2 (Thread 0x9eb4bb70 (LWP 6850)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x0811f5f2 in ?? ()
  #3  0xa5e5ee90 in ?? ()

  Thread 1 (Thread 0xb74b36c0 (LWP 6842)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb754aefb in waitpid () from /lib/i686/cmov/libc.so.6
  #2  0xb74ed053 in ?? () from /lib/i686/cmov/libc.so.6
  #3  0xb74ed3e2 in system () from /lib/i686/cmov/libc.so.6
  #4  0xb782265d in system () from /lib/i686/cmov/libpthread.so.0
  #5  0xb709d914 in crashHandler (sig=11) at core/main/pyboot.cpp:45
  #6  
  #7  0xb60e4d6c in ?? () from /usr/lib/libQtGui.so.4
  #8  0xb6304c59 in ?? () from /usr/lib/libQtGui.so.4
  #9  0xb62fefdd in ?? () from /usr/lib/libQtGui.so.4
  #10 0xb62ff14a in ?? () from /usr/lib/libQtGui.so.4
  #11 0xb62cd0a9 in ?? () from /usr/lib/libQtGui.so.4
  #12 0xb629b403 in ?? () from /usr/lib/libQtGui.so.4
  #13 0xb62df3b3 in ?? () from /usr/lib/libQtGui.so.4
  #14 0xb62344f3 in ?? () from /usr/lib/libQtGui.so.4
  #15 0xb62448f3 in QPaintEngineEx::draw(QVectorPath const&) () from 
/usr/lib/libQtGui.so.4
  #16 0xb6245c69 in QPaintEngineEx::drawRects(QRectF const*, int) () from 
/usr/lib/libQtGui.so.4
  #17 0xb6257f15 in QPainter::drawRects(QRectF const*, int) () from 
/usr/lib/libQtGui.so.4
  #18 0xa3035751 in ?? () from /usr/lib/libQtSvg.so.4
  #19 0xa305ebeb in QSvgTinyDocument::dr

[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2938: 1. Remove "consider" parameter from textExp function

2011-10-17 Thread noreply

revno: 2938
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 16:48:16 +0200
message:
  1. Remove "consider" parameter from textExp function
  2. Add "mask" parameter into textExp function
  3. Add one more format for output.
modified:
  py/export.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/export.py'
--- py/export.py	2011-08-30 18:52:11 +
+++ py/export.py	2011-10-17 14:48:16 +
@@ -121,7 +121,7 @@
 		outFile.close()
 		self.snapCount+=1
 
-def textExt(filename, format='x_y_z_r',consider=lambda id: True, comment=''):
+def textExt(filename, format='x_y_z_r', comment='',mask=-1):
 	"""Save sphere coordinates and other parameters into a text file in specific format.
 	Non-spherical bodies are silently skipped.
 	Users can add here their own specific format, giving meaningful names.
@@ -136,8 +136,8 @@
 	`comment`:
 		the text, which will be added as a comment at the top of file. 
 		If you want to create several lines of text, please use `\n#` for next lines.
-	`consider`:
-		anonymous function(optional)
+	`mask`:
+		export only spheres with the corresponding mask
 :return: number of spheres which were written.
 	"""
 	O=Omega()
@@ -154,11 +154,13 @@
 		out.write('# ' + comment + '\n')
 	for b in O.bodies:
 		try:
-			if (isinstance(b.shape,Sphere) and consider(b.id)):
+			if (isinstance(b.shape,Sphere) and ((mask<0) or ((mask&b.mask)>0))):
 if (format=='x_y_z_r'):
 	out.write('%g\t%g\t%g\t%g\n'%(b.state.pos[0],b.state.pos[1],b.state.pos[2],b.shape.radius))
 elif (format=='x_y_z_r_matId'):
 	out.write('%g\t%g\t%g\t%g\t%d\n'%(b.state.pos[0],b.state.pos[1],b.state.pos[2],b.shape.radius,b.material.id))
+elif (format=='id_x_y_z_r_matId'):
+	out.write('%d\t%g\t%g\t%g\t%g\t%d\n'%(b.id,b.state.pos[0],b.state.pos[1],b.state.pos[2],b.shape.radius,b.material.id))
 else:
 	raise RuntimeError("Please, specify a correct format output!");
 count+=1
@@ -167,18 +169,18 @@
 	out.close()
 	return count
 	
-def text(filename, consider=lambda id: True):
+def text(filename,mask=-1):
 	"""Save sphere coordinates into a text file; the format of the line is: x y z r.
 	Non-spherical bodies are silently skipped.
 	Example added to examples/regular-sphere-pack/regular-sphere-pack.py
 :parameters:
 	`filename`: string
 		the name of the file, where sphere coordinates will be exported.
-	`consider`:
-		anonymous function(optional)
+	`mask`:
+		export only spheres with the corresponding mask
 :return: number of spheres which were written.
 	"""
-	return (textExt(filename=filename, format='x_y_z_r',consider=consider))
+	return (textExt(filename=filename, format='x_y_z_r',mask=mask))
 
 
 

___
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] [Bug 729079] Re: Performance optimization of InsertionSortCollider (Anton)

2011-10-17 Thread Bruno Chareyre
Hi Anton,

I commited fixes for the collider (branch collide2, r2925) and for cgal
feature. I don't find any problem when removing bodies now, but let you
try with your scripts.
Now, all interactions should be removed correctly after deleting bodies.

Bruno


On 14/10/11 07:55, Anton Gladky wrote:
> Hi Bruno,
>
> there is a comparison of new and old collider.
> A newer one is slower, but it can be because of
> tons of warnings like this:
>
> 931937 ERROR yade.InteractionContainer
> /home/gladk/dem/yade/cleanCompBruno/yade/core/InteractionContainer.cpp:55
> erase: InteractionContainer::erase: attempt to delete non-existent
> interaction ##14889+15066
>
> It can be related to the bug 813925 [1]
>
> The script, what I used, creates and removes bodies very actively.
>
> Speed, iter/sec
> -jOld colliderNew_Collider:
> 1  7.94 6.12
> 2  13.85   11.4
> 3  14.83   14.2
>
>
> [1] https://bugs.launchpad.net/yade/+bug/813925
>
> Anton
>


-- 
___
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
11, rue des Mathématiques
BP 46
38402 St Martin d'Hères, France
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43



___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2937: Add some more parameters to spheresPackDimensions

2011-10-17 Thread noreply

revno: 2937
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 14:43:05 +0200
message:
  Add some more parameters to spheresPackDimensions
modified:
  py/bodiesHandling.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/bodiesHandling.py'
--- py/bodiesHandling.py	2011-10-17 08:45:13 +
+++ py/bodiesHandling.py	2011-10-17 12:43:05 +
@@ -15,7 +15,7 @@
 	:param list idSpheres: list of spheres
 	:param int mask: :yref:`Body.mask` for the checked bodies
 	
-	:return: dictionary with keys ``min`` (minimal dimension, Vector3), ``max`` (maximal dimension, Vector3), ``minId`` (minimal dimension sphere Id, Vector3), ``maxId`` (maximal dimension sphere Id, Vector3), ``center`` (central point of bounding box, Vector3), ``extends`` (sizes of bounding box, Vector3)
+	:return: dictionary with keys ``min`` (minimal dimension, Vector3), ``max`` (maximal dimension, Vector3), ``minId`` (minimal dimension sphere Id, Vector3), ``maxId`` (maximal dimension sphere Id, Vector3), ``center`` (central point of bounding box, Vector3), ``extends`` (sizes of bounding box, Vector3), ``volume`` (volume of spheres, Real), ``mass`` (mass of spheres, Real), ``number`` (number of spheres, int), 
 	
 	"""
 	idSpheresIter=[]
@@ -44,6 +44,8 @@
 	maxId = Vector3.Zero
 	
 	counter = 0
+	volume = 0.0
+	mass = 0.0
 	
 		
 	for i in idSpheresIter:
@@ -76,12 +78,15 @@
 if ((sphereMin[dim]___
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] [Bug 795468] Re: plot.plot() causes crash

2011-10-17 Thread Rémi
I just tried again, the crash does not happen anymore. You can close the
bug report.

Cheers,
rémi


-- 
Rémi Cailletaud - IE CNRS
3S-R - Laboratoire Sols, Solides, Structures - Risques
BP53, 38041 Grenoble CEDEX 0
FRANCE
remi.caillet...@hmg.inpg.fr
Tél: +33 (0)4 76 82 52 78
Fax: +33 (0)4 76 82 70 43

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/795468

Title:
  plot.plot() causes crash

Status in Yet Another Dynamic Engine:
  New

Bug description:
  When trying to plot datas, the plot.plot() commande causes crash. 
  I run Debian (mixed) with Python 2.6.6, python-matplotlib 1.0.1-2.
  I can reproduce the crash with scripts/test/chained-cylinder-spring.py, 
giving me following backtrace :

  Yade [1]: plot.plot()
  Yade [2]: SIGSEGV/SIGABRT handler called; gdb batch file is 
`/tmp/yade-6e5SLo/tmp-0'
  GNU gdb (GDB) 7.2-debian
  Copyright (C) 2010 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later 
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "i486-linux-gnu".
  For bug reporting instructions, please see:
  .
  [Thread debugging using libthread_db enabled]
  [New Thread 0x9eb4bb70 (LWP 6850)]
  [New Thread 0xa2606b70 (LWP 6847)]
  [New Thread 0xa46ffb70 (LWP 6846)]
  [New Thread 0xa50f4b70 (LWP 6845)]
  0xb784e424 in __kernel_vsyscall ()
  No symbol "info" in current context.

  Thread 5 (Thread 0xa50f4b70 (LWP 6845)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x08132399 in ?? ()
  #3  0x080e09ef in PyEval_EvalFrameEx ()
  #4  0x080e2968 in PyEval_EvalCodeEx ()
  #5  0x080e0b5f in PyEval_EvalFrameEx ()
  #6  0x080e2968 in PyEval_EvalCodeEx ()
  #7  0x08174c9c in ?? ()
  #8  0x08066d7a in PyObject_Call ()
  #9  0x0806f931 in ?? ()
  #10 0x08066d7a in PyObject_Call ()
  #11 0x080dc2f2 in PyEval_CallObjectWithKeywords ()
  #12 0xa50fbfa3 in ?? () from /usr/lib/pymodules/python2.6/sip.so
  #13 0xa515830d in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #14 0xa518e066 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #15 0xb5d56d53 in ?? () from /usr/lib/libQtCore.so.4
  #16 0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #17 0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 4 (Thread 0xa46ffb70 (LWP 6846)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x08132399 in ?? ()
  #3  0x080e09ef in PyEval_EvalFrameEx ()
  #4  0x080e2968 in PyEval_EvalCodeEx ()
  #5  0x080e0b5f in PyEval_EvalFrameEx ()
  #6  0x080e2968 in PyEval_EvalCodeEx ()
  #7  0x08174c9c in ?? ()
  #8  0x08066d7a in PyObject_Call ()
  #9  0x0806f931 in ?? ()
  #10 0x08066d7a in PyObject_Call ()
  #11 0x080dc2f2 in PyEval_CallObjectWithKeywords ()
  #12 0xa50fbfa3 in ?? () from /usr/lib/pymodules/python2.6/sip.so
  #13 0xa515830d in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #14 0xa518e066 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
  #15 0xb5d56d53 in ?? () from /usr/lib/libQtCore.so.4
  #16 0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #17 0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 3 (Thread 0xa2606b70 (LWP 6847)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0xa26f97d2 in ?? () from /usr/lib/libtcl8.5.so.0
  #3  0xb7819c39 in start_thread () from /lib/i686/cmov/libpthread.so.0
  #4  0xb75808ee in clone () from /lib/i686/cmov/libc.so.6

  Thread 2 (Thread 0x9eb4bb70 (LWP 6850)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb7579bf1 in select () from /lib/i686/cmov/libc.so.6
  #2  0x0811f5f2 in ?? ()
  #3  0xa5e5ee90 in ?? ()

  Thread 1 (Thread 0xb74b36c0 (LWP 6842)):
  #0  0xb784e424 in __kernel_vsyscall ()
  #1  0xb754aefb in waitpid () from /lib/i686/cmov/libc.so.6
  #2  0xb74ed053 in ?? () from /lib/i686/cmov/libc.so.6
  #3  0xb74ed3e2 in system () from /lib/i686/cmov/libc.so.6
  #4  0xb782265d in system () from /lib/i686/cmov/libpthread.so.0
  #5  0xb709d914 in crashHandler (sig=11) at core/main/pyboot.cpp:45
  #6  
  #7  0xb60e4d6c in ?? () from /usr/lib/libQtGui.so.4
  #8  0xb6304c59 in ?? () from /usr/lib/libQtGui.so.4
  #9  0xb62fefdd in ?? () from /usr/lib/libQtGui.so.4
  #10 0xb62ff14a in ?? () from /usr/lib/libQtGui.so.4
  #11 0xb62cd0a9 in ?? () from /usr/lib/libQtGui.so.4
  #12 0xb629b403 in ?? () from /usr/lib/libQtGui.so.4
  #13 0xb62df3b3 in ?? () from /usr/lib/libQtGui.so.4
  #14 0xb62344f3 in ?? () from /usr/lib/libQtGui.so.4
  #15 0xb62448f3 in QPaintEngineEx::draw(QVectorPath const&) () from 
/usr/lib/libQtGui.so.4
  #16 0xb6245c69 in QPaintEngineEx::

Re: [Yade-dev] Strange behaviour of function unbalancedForce

2011-10-17 Thread Bruno Chareyre
Yes, I'm happy. ;)

B.

On 17/10/11 08:51, Klaus Thoeni wrote:
> Hi Bruno,
>
> I derived my WireMat from NormShearPhys and indeed it is working fine now. I 
> think for now it's the best solution. Let me know if you are happy with this 
> solution.
> If in the future we have more cases with normal forces only it might be 
> better 
> to introduce the boolean you mentioned. But we would have to check it in 
> several lines inthe code.
>
> Regarding the results I got previously. All results where wrong, although 
> they 
> where the same if I used one threat. Well, in debug mode the simulation was 
> not running because of the assert.
>
> Thanks,
> Klaus
>
> On Wed, 12 Oct 2011 12:06:39 AM Bruno Chareyre wrote:
>> Yes, deriving from NormShear would do the "trick". It is suboptimal in
>> terms of memory usage but the impact will be small.
>> There could be other ways, like passing an optional bool "hasShear" to
>> the unbalancedForce function, but it would solve only one specific
>> problem and if normShearPhys is used everywhere you will indeed hit the
>> same problem again with other functions.
>>
>> Something I still don't get is why it works _sometimes_, and why your
>> interactions don't simply give a crash on the typecasting:
>> shared_ptr nsi=YADE_PTR_CAST(I->phys);
>>
>> Any idea?
>>
>> Bruno
>>
>> p.s. Please, don't send mails to me+yade-dev (it makes duplicates in my
>> mbox and it disables the reply-to-list feature of thunderbird), yade-dev
>> alone will be enough.
>>
>> On 11/10/11 09:50, Klaus Thoeni wrote:
>>> Hi Bruno,
>>>
>>> I just had a look at the code and NormShearPhys is used in many other
>>> places as well. This means that it is always assumend that there is a
>>> normal and a shear force. So probably I should derive WirePhys from
>>> NormSherPhys and set ks and Fs equal to zero.
>>>
>>> What do you think?
>>>
>>> Klaus
>>>
>>> On Mon, 10 Oct 2011 11:51:40 PM Bruno Chareyre wrote:
 Hi,

 If you can get 0 after pausing, then it's a good starting point for
 debugging. In release build, you may try and check if there are forces
 on the bodies.
 In debug build (does it give 0 too?) you could set a breakpoint at
 Shop.cpp:162 and see what happens line by line, surely the best way.

 Bruno

 On 10/10/11 14:16, Klaus Thoeni wrote:
> Hi,
>
> yes, if you pause the simulation unbalancedForce() is still exactly 0.
>
> Regarding the results for displacements:
> - if I run the same file with -j1 I will get exactly the same
> deformation, however the the unbalancedForce is not exactly the same
> - if I compare the displacements of a case where I used
> multi-threading the displacements are exactly the same for a certain
> amount of iterations then the slightly differ (even if unbalancedForce
> is 0 from beginning)
>
> I am still trying to find out what's going on. Any hints are welcome!
>
> Thanks,
> Klaus
>
>
>
> On Fri, Oct 7, 2011 at 9:35 PM, Bruno Chareyre
>
> mailto:bruno.chare...@hmg.inpg.fr>> wrote:
> I can't imagine any explanation yet. It is strange.
> I wonder if the unbalanced force will also be exactly 0 if you
> pause the
> simulation and type unbalancedForce() in the terminal.
> Are you sure that the results in terms of positions and deformation
> of the net are always the same? else it could mean that there is
> another problem that the unbalanced force is only reflecting.
> 
> Bruno
> 
> On 07/10/11 07:08, Klaus Thoeni wrote:
> > Hi guys,
> > 
> > yes, you have to try it several times in order to reproduce the
> 
> strange
> 
> > behaviour.
> > 
> > However, I found out a bit more. Actually it might be a problem
> 
> with multi-
> 
> > threading. Maybe someone can try to reproduce the behaviour. The
> 
> following
> 
> > link provides a slightly modified version my script and a bash
> 
> script which
> 
> > allows for several executions for -j1 and -j2 (before running the
> 
> script make
> 
> > sure it is executable 'chmod +x runscript'). In addition I
> 
> included as well my
> 
> > results.
> > 
> > http://bit.ly/rtN0w3
> > 
> > Something very strange is that my desktop has the same problem
> 
> even with -j1
> 
> > (eaven cpu usage is more than 100% and I have no idea why)
> 
> whereas my notebook
> 
> > gives the right results in that case (cpu usage is max 100%) just
> 
> have a look
> 
> > at the graphs. It would be good to find out if this problem
> 
> effects just me or
> 
> 

[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2936: Fix a default parameter for ids in spheresPackDimensions

2011-10-17 Thread noreply

revno: 2936
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 10:45:13 +0200
message:
  Fix a default parameter for ids in spheresPackDimensions
modified:
  py/bodiesHandling.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/bodiesHandling.py'
--- py/bodiesHandling.py	2011-10-17 08:18:44 +
+++ py/bodiesHandling.py	2011-10-17 08:45:13 +
@@ -9,7 +9,7 @@
 import utils,math,numpy
 
 #spheresPackDimensions==
-def spheresPackDimensions(idSpheres=[0],mask=-1):
+def spheresPackDimensions(idSpheres=[],mask=-1):
 	"""The function accepts the list of spheres id's or list of bodies and calculates max and min dimensions, geometrical center.
 
 	:param list idSpheres: list of spheres
@@ -36,6 +36,7 @@
 	else:
 		idSpheresIter=idSpheres
 	
+	
 	min = Vector3.Zero
 	max = Vector3.Zero
 	

___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2935: Add mask-parameter to spheresModify.

2011-10-17 Thread noreply

revno: 2935
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 10:18:44 +0200
message:
  Add mask-parameter to spheresModify.
modified:
  py/bodiesHandling.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/bodiesHandling.py'
--- py/bodiesHandling.py	2011-10-17 07:42:58 +
+++ py/bodiesHandling.py	2011-10-17 08:18:44 +
@@ -20,10 +20,10 @@
 	"""
 	idSpheresIter=[]
 	
-	if (len(idSpheres)<2):
+	if (len(idSpheres)<1):
 		#check mask
 		ifSpherMask=[]
-		if (mask>-1):
+		if (mask>-1):   #The case, when only the mask was given, without list of ids
 			for i in O.bodies:
 if ((i.mask&mask)<>0):
 	ifSpherMask.append(i.id)
@@ -84,9 +84,11 @@
 	return dimensions
 
 #spheresPackDimensions==
-def spheresModify(idSpheres,shift=Vector3.Zero,scale=1.0,orientation=Quaternion.Identity,copy=False):
+def spheresModify(idSpheres=[],mask=-1,shift=Vector3.Zero,scale=1.0,orientation=Quaternion.Identity,copy=False):
 	"""The function accepts the list of spheres id's or list of bodies and modifies them: rotating, scaling, shifting.
 	if copy=True copies bodies and modifies them.
+	Also the mask can be given. If idSpheres not empty, the function affects only bodies, where the mask passes.
+	If idSpheres is empty, the function search for bodies, where the mask passes.
 	
 	:Parameters:
 	`shift`: Vector3
@@ -95,12 +97,33 @@
 		factor scales given spheres.
 	`orientation`: quaternion
 		orientation of spheres
+	`mask`: int
+		:yref:`Body.mask` for the checked bodies
 	:Returns: list of bodies if copy=True, and Boolean value if copy=False
 	"""
-	dims = spheresPackDimensions(idSpheres)
+	
+	idSpheresIter=[]
+	
+	if (len(idSpheres)==0):
+		#check mask
+		ifSpherMask=[]
+		if (mask>-1):   #The case, when only the mask was given, without list of ids
+			for i in O.bodies:
+if ((i.mask&mask)<>0):
+	ifSpherMask.append(i.id)
+			if (len(ifSpherMask)==0):
+raise RuntimeWarning("No bodies to modify with given mask")
+			else:
+idSpheresIter=ifSpherMask
+		else:
+			raise RuntimeWarning("No bodies to modify")
+	else:
+		idSpheresIter=idSpheres
+	
+	dims = spheresPackDimensions(idSpheresIter)
 	
 	ret=[]
-	for i in idSpheres:
+	for i in idSpheresIter:
 		if (type(i).__name__=='int'):
 			b = O.bodies[i]			#We have received a list of ID's
 		elif (type(i).__name__=='Body'):
@@ -112,6 +135,8 @@
 			sphereRadius=b.shape.radius	#skip non-spheres
 		except AttributeError: continue
 		
+		if (mask>-1) and ((mask&b.mask)==0): continue			#skip bodies with wrong mask
+		
 		if (copy): b=sphereDuplicate(b)
 		
 		b.state.pos=orientation*(b.state.pos-dims['center'])+dims['center']

___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2934: Fix in spheresPackDimensions. The bug appeared, when only mask was inputted

2011-10-17 Thread noreply

revno: 2934
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 09:42:58 +0200
message:
  Fix in spheresPackDimensions. The bug appeared, when only mask was inputted
modified:
  py/bodiesHandling.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/bodiesHandling.py'
--- py/bodiesHandling.py	2011-10-17 07:02:48 +
+++ py/bodiesHandling.py	2011-10-17 07:42:58 +
@@ -26,7 +26,7 @@
 		if (mask>-1):
 			for i in O.bodies:
 if ((i.mask&mask)<>0):
-	ifSpherMask+=i.id
+	ifSpherMask.append(i.id)
 			if (len(ifSpherMask)<2):
 raise RuntimeWarning("Not enough bodies to analyze with given mask")
 			else:
@@ -36,7 +36,6 @@
 	else:
 		idSpheresIter=idSpheres
 	
-	
 	min = Vector3.Zero
 	max = Vector3.Zero
 	
@@ -46,7 +45,7 @@
 	counter = 0
 	
 		
-	for i in idSpheres:
+	for i in idSpheresIter:
 		if (type(i).__name__=='int'):
 			b = O.bodies[i]			#We have received a list of ID's
 		elif (type(i).__name__=='Body'):

___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2933: Fix mask-check in several places

2011-10-17 Thread noreply

revno: 2933
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 09:33:59 +0200
message:
  Fix mask-check in several places
modified:
  pkg/dem/Shop.cpp
  py/utils.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Shop.cpp'
--- pkg/dem/Shop.cpp	2011-09-02 19:23:13 +
+++ pkg/dem/Shop.cpp	2011-10-17 07:33:59 +
@@ -283,7 +283,7 @@
 	FOREACH(shared_ptr b, *scene->bodies){
 		if (!b || !b->isDynamic()) continue;
 		Sphere* s=dynamic_cast(b->shape.get());
-		if((!s) or ((mask>0) and (mask!=b->groupMask))) continue;
+		if((!s) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
 		vol += (4/3.)*Mathr::PI*pow(s->radius,3);
 	}
 	return vol;
@@ -295,7 +295,7 @@
 	FOREACH(shared_ptr b, *scene->bodies){
 		if (!b || !b->isDynamic()) continue;
 		Sphere* s=dynamic_cast(b->shape.get());
-		if((!s) or ((mask>0) and (mask!=b->groupMask))) continue;
+		if((!s) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
 		mass += b->state->mass;
 	}
 	return mass;

=== modified file 'py/utils.py'
--- py/utils.py	2011-07-21 09:10:30 +
+++ py/utils.py	2011-10-17 07:33:59 +
@@ -780,8 +780,9 @@
 	"""
 	maxD = 0.0
 	minD = 0.0
+	
 	for b in O.bodies:
-		if (isinstance(b.shape,Sphere) and ((mask<0) or (b.mask==mask))):
+		if (isinstance(b.shape,Sphere) and ((mask<0) or ((b.mask&mask)<>0))):
 			if ((2*b.shape.radius)	> maxD) : maxD = 2*b.shape.radius
 			if (((2*b.shape.radius)	< minD) or (minD==0.0)): minD = 2*b.shape.radius
 
@@ -795,7 +796,7 @@
 	
 		
 	for b in O.bodies:
-		if (isinstance(b.shape,Sphere) and ((mask<0) or (b.mask==mask))):
+		if (isinstance(b.shape,Sphere) and ((mask<0) or ((b.mask&mask)<>0))):
 			d=2*b.shape.radius
 			
 			basketId = int(math.floor( (d-minD) / deltaBinD ) )

___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2932: Add mask-parameter for spheresPackDimensions

2011-10-17 Thread noreply

revno: 2932
committer: Anton Gladky 
branch nick: yade
timestamp: Mon 2011-10-17 09:02:48 +0200
message:
  Add mask-parameter for spheresPackDimensions
modified:
  py/bodiesHandling.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to 
https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/bodiesHandling.py'
--- py/bodiesHandling.py	2011-06-16 07:11:37 +
+++ py/bodiesHandling.py	2011-10-17 07:02:48 +
@@ -9,17 +9,33 @@
 import utils,math,numpy
 
 #spheresPackDimensions==
-def spheresPackDimensions(idSpheres):
+def spheresPackDimensions(idSpheres=[0],mask=-1):
 	"""The function accepts the list of spheres id's or list of bodies and calculates max and min dimensions, geometrical center.
 
 	:param list idSpheres: list of spheres
+	:param int mask: :yref:`Body.mask` for the checked bodies
 	
 	:return: dictionary with keys ``min`` (minimal dimension, Vector3), ``max`` (maximal dimension, Vector3), ``minId`` (minimal dimension sphere Id, Vector3), ``maxId`` (maximal dimension sphere Id, Vector3), ``center`` (central point of bounding box, Vector3), ``extends`` (sizes of bounding box, Vector3)
 	
 	"""
+	idSpheresIter=[]
 	
 	if (len(idSpheres)<2):
-		raise RuntimeError("Only a list of particles with length > 1 can be analyzed")
+		#check mask
+		ifSpherMask=[]
+		if (mask>-1):
+			for i in O.bodies:
+if ((i.mask&mask)<>0):
+	ifSpherMask+=i.id
+			if (len(ifSpherMask)<2):
+raise RuntimeWarning("Not enough bodies to analyze with given mask")
+			else:
+idSpheresIter=ifSpherMask
+		else:
+			raise RuntimeWarning("Only a list of particles with length > 1 can be analyzed")
+	else:
+		idSpheresIter=idSpheres
+	
 	
 	min = Vector3.Zero
 	max = Vector3.Zero
@@ -45,6 +61,9 @@
 sphereRadius=b.shape.radius	#skip non-spheres
 			except AttributeError: continue
 			
+			if (mask>-1) and ((mask&b.mask)==0): continue			#skip bodies with wrong mask
+			
+			
 			sphereRadiusVec3 = Vector3(sphereRadius,sphereRadius,sphereRadius)
 			
 			sphereMax = spherePosition + sphereRadiusVec3

___
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