yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #12586
[Branch ~yade-pkg/yade/git-trunk] Rev 3815: Minor fixes in Polyhedra_splitter.
------------------------------------------------------------
revno: 3815
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2016-03-24 23:07:41 +0100
message:
Minor fixes in Polyhedra_splitter.
modified:
pkg/dem/Polyhedra_splitter.cpp
pkg/dem/Polyhedra_splitter.hpp
pkg/dem/Polyhedra_support.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/Polyhedra_splitter.cpp'
--- pkg/dem/Polyhedra_splitter.cpp 2015-04-24 06:07:03 +0000
+++ pkg/dem/Polyhedra_splitter.cpp 2016-03-24 22:07:41 +0000
@@ -31,9 +31,9 @@
//*********************************************************************************
/* Size dependent strength */
-double PolyhedraSplitter::getStrength(double volume, double strength){
+double PolyhedraSplitter::getStrength(const double & volume, const double & strength) const{
//equvalent radius
- double r_eq = pow(volume*3./4./Mathr::PI,1./3.);
+ const double r_eq = pow(volume*3./4./Mathr::PI,1./3.);
//r should be in milimeters
return strength/(r_eq/1000.);
}
@@ -104,18 +104,21 @@
//division of stress by volume
// double comp_stress = I_valu(min_i,min_i)/p->GetVolume();
// double tens_stress = I_valu(max_i,max_i)/p->GetVolume();
- Vector3r dirC = I_vect.col(max_i);
- Vector3r dirT = I_vect.col(min_i);
- Vector3r dir1 = dirC.normalized() + dirT.normalized();
- Vector3r dir2 = dirC.normalized() - dirT.normalized();
+ const Vector3r dirC = I_vect.col(max_i);
+ const Vector3r dirT = I_vect.col(min_i);
+ const Vector3r dir1 = dirC.normalized() + dirT.normalized();
+ const Vector3r dir2 = dirC.normalized() - dirT.normalized();
//double sigma_t = -comp_stress/2.+ tens_stress;
- double sigma_t = pow((pow(I_valu(0,0)-I_valu(1,1),2)+pow(I_valu(0,0)-I_valu(2,2),2)+pow(I_valu(1,1)-I_valu(2,2),2))/2.,0.5)/p->GetVolume();
- if (sigma_t > getStrength(p->GetVolume(),m->GetStrength())) {bodies.push_back(b); directions1.push_back(dir1.normalized()); directions2.push_back(dir2.normalized()); sigmas.push_back(sigma_t);};
- }
- }
- for(int i=0; i<int(bodies.size()); i++){
- SplitPolyhedraDouble(bodies[i], directions1[i], directions2[i]);
- }
+ const double sigma_t = pow((pow(I_valu(0,0)-I_valu(1,1),2)+pow(I_valu(0,0)-I_valu(2,2),2)+pow(I_valu(1,1)-I_valu(2,2),2))/2.,0.5)/p->GetVolume();
+ if (sigma_t > getStrength(p->GetVolume(),m->GetStrength())) {
+ bodies.push_back(b);
+ directions1.push_back(dir1.normalized());
+ directions2.push_back(dir2.normalized());
+ sigmas.push_back(sigma_t);
+ }
+ }
+ }
+ for(unsigned int i=0; i<bodies.size(); i++) SplitPolyhedraDouble(bodies[i], directions1[i], directions2[i]);
}
#endif // YADE_CGAL
=== modified file 'pkg/dem/Polyhedra_splitter.hpp'
--- pkg/dem/Polyhedra_splitter.hpp 2014-10-15 06:44:01 +0000
+++ pkg/dem/Polyhedra_splitter.hpp 2016-03-24 22:07:41 +0000
@@ -17,7 +17,7 @@
public:
virtual void action();
- double getStrength(double volume, double strength);
+ double getStrength(const double & volume, const double & strength) const;
void Symmetrize(Matrix3r & bStress);
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(PolyhedraSplitter,PeriodicEngine,"Engine that splits polyhedras.",
=== modified file 'pkg/dem/Polyhedra_support.cpp'
--- pkg/dem/Polyhedra_support.cpp 2014-10-20 08:28:15 +0000
+++ pkg/dem/Polyhedra_support.cpp 2016-03-24 22:07:41 +0000
@@ -814,7 +814,7 @@
//calculate first splitted polyhedrons
Plane B(ToCGALPoint(point-direction*SPLITTER_GAP), ToCGALVector(direction));
Polyhedron S1 = Polyhedron_Plane_intersection(PA, B, ToCGALPoint(se3.position), B.projection(ToCGALPoint(OrigPos)) - 1E-6*ToCGALVector(direction));
- B = Plane(ToCGALPoint(point+direction*SPLITTER_GAP), ToCGALVector((-1.)*direction));
+ B = Plane(ToCGALPoint(point+direction*SPLITTER_GAP), ToCGALVector((-1.)*direction));
Polyhedron S2 = Polyhedron_Plane_intersection(PA, B, ToCGALPoint(se3.position), B.projection(ToCGALPoint(OrigPos)) + 1E-6*ToCGALVector(direction));
Scene* scene=Omega::instance().getScene().get();
//scene->bodies->erase(body->id);