← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2314: making TriaxialStressController more python friendly.

 

Bruno Chareyre said:     (by the date of Mon, 05 Jul 2010 10:53:28 +0200)

> Try r2318. :)

Thanks, but how can I read strain? Python gives following error:

    return triaxialStressController.strain[1]
TypeError: No to_python (by-value) converter found for C++ type:
double [3]


Did I miss something?

Currently to get this to work I must 

change line 38 in TriaxialStressController.hpp from his:

		Real 		strain [3];
into this:

		Vector3r	strain;

And then the attached script works very good.

-- 
Janek Kozicki                               http://janek.kozicki.pl/  |
#!/usr/local/bin/yade-trunk -j3
# -*- coding: utf-8 -*-
# -*- encoding=utf-8 -*-

TriaxialTest(numberOfGrains=200).load()
O.engines += [PeriodicPythonRunner(iterPeriod=10,command='plot1()')]


triaxialStressController=O.engines[5]

def sigma_1():
	return triaxialStressController.stress(triaxialStressController.wall_top_id)

def epsilon_1():
	return triaxialStressController.strain[1]


from yade import qt
qt.View()
qt.Controller()


# plot some results
from math import *
from yade import plot
plot.plots={'epsilon_1':'sigma_1'}
def plot1():
	plot.addData(sigma_1=sigma_1(),
		     epsilon_1=epsilon_1())
O.run(10000,True)
plot.plot()


Follow ups

References