← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3872: getSpheres*() functions: getting rid of dynamic test, see http://www.mail-archive.com/yade-dev@li...

 

------------------------------------------------------------
revno: 3872
committer: jduriez <jerome.duriez@xxxxxxxxxxx>
timestamp: Thu 2016-05-26 10:30:41 -0600
message:
  getSpheres*() functions: getting rid of dynamic test, see http://www.mail-archive.com/yade-dev@xxxxxxxxxxxxxxxxxxx/msg11956.html
modified:
  pkg/dem/Shop_01.cpp
  pkg/dem/Shop_02.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	2015-11-06 20:00:30 +0000
+++ pkg/dem/Shop_01.cpp	2016-05-26 16:30:41 +0000
@@ -305,7 +305,7 @@
 	const shared_ptr<Scene> scene=(_scene?_scene:Omega::instance().getScene());
 	Real vol=0;
 	FOREACH(shared_ptr<Body> b, *scene->bodies){
-		if (!b || !b->isDynamic()) continue;
+		if (!b) continue;
 		Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
 		if((!s) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
 		vol += (4/3.)*Mathr::PI*pow(s->radius,3);
@@ -317,7 +317,7 @@
 	const shared_ptr<Scene> scene=(_scene?_scene:Omega::instance().getScene());
 	Real mass=0;
 	FOREACH(shared_ptr<Body> b, *scene->bodies){
-		if (!b || !b->isDynamic()) continue;
+		if (!b) continue;
 		Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
 		if((!s) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
 		mass += b->state->mass;

=== modified file 'pkg/dem/Shop_02.cpp'
--- pkg/dem/Shop_02.cpp	2016-04-13 22:33:31 +0000
+++ pkg/dem/Shop_02.cpp	2016-05-26 16:30:41 +0000
@@ -701,7 +701,7 @@
 	const shared_ptr<Scene> scene=(_scene?_scene:Omega::instance().getScene());
 	Real vol=0;
 	FOREACH(shared_ptr<Body> b, *scene->bodies){
-		if (!b || !b->isDynamic()) continue;
+		if (!b) continue;
 		Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
 		if((!s) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
 		vol += Mathr::PI*pow(s->radius,2);

=== modified file 'py/_utils.cpp'
--- py/_utils.cpp	2016-04-13 22:33:31 +0000
+++ py/_utils.cpp	2016-05-26 16:30:41 +0000
@@ -460,8 +460,8 @@
 
 	py::def("PWaveTimeStep",PWaveTimeStep,"Get timestep accoring to the velocity of P-Wave propagation; computed from sphere radii, rigidities and masses.");
 	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("getSpheresVolume",Shop__getSpheresVolume,(py::arg("mask")=-1),"Compute the total volume of spheres in the simulation, mask parameter is considered");
+	py::def("getSpheresMass",Shop__getSpheresMass,(py::arg("mask")=-1),"Compute the total mass of spheres in the simulation, 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 $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",Shop::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");
@@ -516,7 +516,7 @@
 	py::def("TetrahedronWithLocalAxesPrincipal",TetrahedronWithLocalAxesPrincipal,"TODO");
 	py::def("momentum",Shop::momentum,"TODO");
 	py::def("angularMomentum",Shop::angularMomentum,(py::args("origin")=Vector3r(Vector3r::Zero())),"TODO");
-	py::def("getSpheresVolume2D",Shop__getSpheresVolume2D,(py::arg("mask")=-1),"Compute the total volume of discs in the simulation (might crash for now if dynamic bodies are not discs), mask parameter is considered");
+	py::def("getSpheresVolume2D",Shop__getSpheresVolume2D,(py::arg("mask")=-1),"Compute the total volume of discs in the simulation, mask parameter is considered");
 	py::def("voidratio2D",Shop__getVoidRatio2D,(py::arg("zlen")=1),"Compute 2D packing void ratio $\\frac{V-V_s}{V_s}$ where $V$ is overall volume and $V_s$ is volume of disks.\n\n:param float zlen: length in the third direction.\n");
 	py::def("getStressAndTangent",Shop__getStressAndTangent,(py::args("volume")=0,py::args("symmetry")=true),"Compute overall stress of periodic cell using the same equation as function getStress. In addition, the tangent operator is calculated using the equation published in [Kruyt and Rothenburg1998]_:\n\n.. math:: S_{ijkl}=\\frac{1}{V}\\sum_{c}(k_n n_i l_j n_k l_l + k_t t_i l_j t_k l_l)\n\n:param float volume: same as in function getStress\n:param bool symmetry: make the tensors symmetric.\n\n:return: macroscopic stress tensor and tangent operator as py::tuple");
 	py::def("setBodyPosition",setBodyPosition,(py::args("id"),py::args("pos"),py::args("axis")="xyz"),"Set a body position from its id and a new vector3r.\n\n:param int id: the body id.\n:param Vector3 pos: the desired updated position.\n:param str axis: the axis along which the position has to be updated (ex: if axis==\"xy\" and pos==Vector3r(r0,r1,r2), r2 will be ignored and the position along z will not be updated).");