yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05098
[Branch ~yade-dev/yade/trunk] Rev 2324: fix two small typos in docs, add spheresVolume python wrapper for TriaxialStressController. (I ne...
------------------------------------------------------------
revno: 2324
committer: Janek Kozicki <cosurgi@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-07-06 10:14:52 +0200
message:
fix two small typos in docs, add spheresVolume python wrapper for TriaxialStressController. (I need it to calculate void_ratio=voids/sphresVolume)
modified:
doc/sphinx/prog.rst
doc/sphinx/user.rst
pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp
--
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 'doc/sphinx/prog.rst'
--- doc/sphinx/prog.rst 2010-05-17 08:51:45 +0000
+++ doc/sphinx/prog.rst 2010-07-06 08:14:52 +0000
@@ -1764,7 +1764,7 @@
------------------
Python internally uses `reference counting <http://en.wikipedia.org/wiki/Reference_counting>`_ on all its objects, which is not visible to casual user. It has to be handled explicitly if using pure `Python/C API <http://docs.python.org/c-api/index.html>`_ with ``Py_INCREF`` and similar functions.
-``boost::python`` used in Yade fortunately handles reference counting internally. Additionally, it `automatically integrates <http://wiki.python.org/moin/boost.python/PointersAndSmartPointers>`_ reference counting for ``shared_ptr`` and python objects, if class ``A`` is wrapped as ``boost::python::class_<A,shared_ptr<A>>``. Since *all* Yade classes wrapped using :ref:`YADE_CLASS_BASE_DOC` are wrapped in this way, returning ``shared_ptr<â¦>`` objects from is the preffered way of passing objects from c++ to python.
+``boost::python`` used in Yade fortunately handles reference counting internally. Additionally, it `automatically integrates <http://wiki.python.org/moin/boost.python/PointersAndSmartPointers>`_ reference counting for ``shared_ptr`` and python objects, if class ``A`` is wrapped as ``boost::python::class_<A,shared_ptr<A>>``. Since *all* Yade classes wrapped using :ref:`YADE_CLASS_BASE_DOC` are wrapped in this way, returning ``shared_ptr<â¦>`` objects from is the preferred way of passing objects from c++ to python.
Returning ``shared_ptr`` is much more efficient, since only one pointer is returned and reference count internally incremented. Modifying the object from python will modify the (same) object in c++ and vice versa. It also makes sure that the c++ object will not be deleted as long as it is used somewhere in python, preventing (important) source of crashes.
=== modified file 'doc/sphinx/user.rst'
--- doc/sphinx/user.rst 2010-07-05 16:01:00 +0000
+++ doc/sphinx/user.rst 2010-07-06 08:14:52 +0000
@@ -774,7 +774,7 @@
.. note:: Only types that can be `pickled <http://docs.python.org/library/pickle.html>`_ can be passed to :yref:`yade.utils.saveVars`.
-.. warning:: The :yref:`yade.utils.saveVars` mechanism inherits all problems of global variables (such as shadowing, as shown above). Take care when using it. In particular, conflicting names can he far-reaching consequences.
+.. warning:: The :yref:`yade.utils.saveVars` mechanism inherits all problems of global variables (such as shadowing, as shown above). Take care when using it. In particular, conflicting names can have far-reaching consequences.
=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp 2010-07-05 16:01:00 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp 2010-07-06 08:14:52 +0000
@@ -132,6 +132,7 @@
.def_readonly("strain",&TriaxialStressController::strain,"Current strain (logarithmic).")
.def_readonly("porosity",&TriaxialStressController::porosity,"Porosity of the packing.")
.def_readonly("boxVolume",&TriaxialStressController::boxVolume,"Total packing volume.")
+ .def_readonly("spheresVolume",&TriaxialStressController::spheresVolume,"Total volume pf spheres.")
.def_readonly("max_vel1",&TriaxialStressController::max_vel1,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
.def_readonly("max_vel2",&TriaxialStressController::max_vel2,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
.def_readonly("max_vel3",&TriaxialStressController::max_vel3,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
Follow ups