yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11458
[Branch ~yade-pkg/yade/git-trunk] Rev 3454: Merge github.com:yade/trunk into chaoUnsat
Merge authors:
Jérôme Duriez (jduriez)
------------------------------------------------------------
revno: 3454 [merge]
committer: Chao Yuan <chaoyuan2012@xxxxxxxxx>
timestamp: Thu 2014-10-09 18:24:04 +0200
message:
Merge github.com:yade/trunk into chaoUnsat
modified:
pkg/dem/Shop_01.cpp
py/_utils.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/Shop_01.cpp'
--- pkg/dem/Shop_01.cpp 2014-07-19 19:52:41 +0000
+++ pkg/dem/Shop_01.cpp 2014-10-08 20:07:22 +0000
@@ -42,6 +42,9 @@
#include"yade/pkg/common/Gl1_NormPhys.hpp"
#endif
+#include"yade/py/_utils.cpp"
+
+
CREATE_LOGGER(Shop);
/*! Flip periodic cell by given number of cells.
@@ -320,8 +323,12 @@
const shared_ptr<Scene> scene=(_scene?_scene:Omega::instance().getScene());
Real V;
if(!scene->isPeriodic){
- if(_volume<=0) throw std::invalid_argument("utils.porosity must be given (positive) *volume* for aperiodic simulations.");
- V=_volume;
+ if(_volume<=0){// throw std::invalid_argument("utils.porosity must be given (positive) *volume* for aperiodic simulations.");
+ py::tuple extrema = aabbExtrema(); //aabbExtrema() defined in _utils.cpp
+ V = py::extract<Real>( (extrema[1][0] - extrema[0][0])*(extrema[1][1] - extrema[0][1])*(extrema[1][2] - extrema[0][2]) );
+ }
+ else
+ V=_volume;
} else {
V=scene->cell->getVolume();
}
=== modified file 'py/_utils.cpp'
--- py/_utils.cpp 2014-09-03 17:34:07 +0000
+++ py/_utils.cpp 2014-10-09 00:16:52 +0000
@@ -453,7 +453,7 @@
py::def("RayleighWaveTimeStep",RayleighWaveTimeStep,"Determination of time step according to Rayleigh wave speed of force propagation.");
py::def("getSpheresVolume",Shop__getSpheresVolume,(py::arg("mask")=-1),"Compute the total volume of spheres in the simulation (might crash for now if dynamic bodies are not spheres), mask parameter is considered");
py::def("getSpheresMass",Shop__getSpheresMass,(py::arg("mask")=-1),"Compute the total mass of spheres in the simulation (might crash for now if dynamic bodies are not spheres), mask parameter is considered");
- py::def("porosity",Shop__getPorosity,(py::arg("volume")=-1),"Compute packing porosity $\\frac{V-V_s}{V}$ where $V$ is overall volume and $V_s$ is volume of spheres.\n\n:param float volume: overall volume which must be specified for aperiodic simulations. For periodic simulations, current volume of the :yref:`Cell` is used.\n");
+ py::def("porosity",Shop__getPorosity,(py::arg("volume")=-1),"Compute packing porosity $\\frac{V-V_s}{V}$ where $V$ is overall volume and $V_s$ is volume of spheres.\n\n:param float volume: overall volume $V$. For periodic simulations, current volume of the :yref:`Cell` is used. For aperiodic simulations, the value deduced from utils.aabbDim() is used. For compatibility reasons, positive values passed by the user are also accepted in this case.\n");
py::def("voxelPorosity",Shop__getVoxelPorosity,(py::arg("resolution")=200,py::arg("start")=Vector3r(0,0,0),py::arg("end")=Vector3r(0,0,0)),"Compute packing porosity $\\frac{V-V_v}{V}$ where $V$ is a specified volume (from start to end) and $V_v$ is volume of voxels that fall inside any sphere. The calculation method is to divide whole volume into a dense grid of voxels (at given resolution), and count the voxels that fall inside any of the spheres. This method allows one to calculate porosity in any given sub-volume of a whole sample. It is properly excluding part of a sphere that does not fall inside a specified volume.\n\n:param int resolution: voxel grid resolution, values bigger than resolution=1600 require a 64 bit operating system, because more than 4GB of RAM is used, a resolution=800 will use 500MB of RAM.\n:param Vector3 start: start corner of the volume.\n:param Vector3 end: end corner of the volume.\n");
py::def("aabbExtrema",aabbExtrema,(py::arg("cutoff")=0.0,py::arg("centers")=false),"Return coordinates of box enclosing all bodies\n\n:param bool centers: do not take sphere radii in account, only their centroids\n:param float∈〈0…1〉 cutoff: relative dimension by which the box will be cut away at its boundaries.\n\n\n:return: (lower corner, upper corner) as (Vector3,Vector3)\n\n");
py::def("ptInAABB",isInBB,"Return True/False whether the point p is within box given by its min and max corners");