yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11935
[Branch ~yade-pkg/yade/git-trunk] Rev 3618: some code cleaning in clump methods
------------------------------------------------------------
revno: 3618
committer: Christian Jakob <jakob@xxxxxxxxxxxxxxxxxxx>
timestamp: Sat 2015-03-07 15:58:27 +0100
message:
some code cleaning in clump methods
modified:
core/Clump.cpp
py/wrapper/yadeWrapper.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 'core/Clump.cpp'
--- core/Clump.cpp 2015-02-07 17:49:29 +0000
+++ core/Clump.cpp 2015-03-07 14:58:27 +0000
@@ -157,8 +157,6 @@
}
//get volume and inertia tensor using regular cubic cell array inside bounding box of the clump:
Real dx = rMin/discretization; //edge length of cell
- //Real aabbMax = max(max(aabb.max().x()-aabb.min().x(),aabb.max().y()-aabb.min().y()),aabb.max().z()-aabb.min().z());
- //if (aabbMax/dx > 150) dx = aabbMax/150;//limit dx: leads to bug, when long chain of clump members is created (https://bugs.launchpad.net/yade/+bug/1273172)
Real dv = pow(dx,3); //volume of cell
long nCells=(aabb.sizes()/dx).prod();
if(nCells>1e7) LOG_WARN("Clump::updateProperties: Cell array has "<<nCells<<" cells. Integrate inertia may take a while ...");
=== modified file 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp 2015-03-05 08:18:57 +0000
+++ py/wrapper/yadeWrapper.cpp 2015-03-07 14:58:27 +0000
@@ -251,8 +251,6 @@
//get volume of the clump template using regular cubic cell array inside axis aligned bounding box of the clump:
//(some parts are duplicated from intergration algorithm in Clump::updateProperties)
Real dx = rMin/5.; //edge length of cell
- Real aabbMax = max(max(aabb.max().x()-aabb.min().x(),aabb.max().y()-aabb.min().y()),aabb.max().z()-aabb.min().z());
- if (aabbMax/dx > 150) dx = aabbMax/150;//limit dx
Real dv = pow(dx,3); //volume of a single cell
Vector3r x; //position vector (center) of cell
Real relVolSumTmp = 0.0; //volume of clump template
@@ -265,28 +263,6 @@
}
}
}
- /**
- ### old method, not working for multiple overlaps:
- //check for overlaps and correct volumes (-= volume of spherical caps):
- Real distCMTmp, overlapTmp, hCapjj, hCapkk;
- for (int jj = 0; jj < numCM; jj++) {
- for (int kk = jj; kk < numCM; kk++) {
- if (jj != kk) {
- distCMTmp = (relPosTmp[jj] - relPosTmp[kk]).norm(); //distance between two spheres
- overlapTmp = (relRadTmp[jj] + relRadTmp[kk]) - distCMTmp;//positive if overlapping ...
- if (overlapTmp > 0.0) {//calculation of overlapping spheres, see http://mathworld.wolfram.com/Sphere-SphereIntersection.html
- hCapjj = relRadTmp[jj] - (distCMTmp*distCMTmp - relRadTmp[kk]*relRadTmp[kk] + relRadTmp[jj]*relRadTmp[jj])/(2*distCMTmp);
- hCapkk = relRadTmp[kk] - (distCMTmp*distCMTmp - relRadTmp[jj]*relRadTmp[jj] + relRadTmp[kk]*relRadTmp[kk])/(2*distCMTmp);
- //calculation of spherical cap, see http://en.wikipedia.org/wiki/Spherical_cap
- relVolTmp[jj] -= (1./3.)*Mathr::PI*hCapjj*hCapjj*(3.*relRadTmp[jj] - hCapjj);// correct relative volumes
- relVolTmp[kk] -= (1./3.)*Mathr::PI*hCapkk*hCapkk*(3.*relRadTmp[kk] - hCapkk);
- }
- }
- }
- }
- //get relative volume of the clump:
- for (int jj = 0; jj < numCM; jj++) relVolSumTmp += relVolTmp[jj];
- **/
//get pointer lists of spheres, that should be replaced:
int numReplaceTmp = round(num*amounts[ii]);