yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10699
[Branch ~yade-pkg/yade/git-trunk] Rev 3902: Use bool return type for force calculation.
------------------------------------------------------------
revno: 3902
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2014-04-09 16:03:16 +0200
message:
Use bool return type for force calculation.
Would be good to implement it for all Law_*, like
discussed recently.
modified:
pkg/common/SPHEngine.cpp
pkg/common/SPHEngine.hpp
pkg/dem/ViscoelasticPM.cpp
pkg/dem/ViscoelasticPM.hpp
--
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/common/SPHEngine.cpp'
--- pkg/common/SPHEngine.cpp 2014-04-09 14:03:16 +0000
+++ pkg/common/SPHEngine.cpp 2014-04-09 14:03:16 +0000
@@ -315,7 +315,7 @@
}
}
-void computeForceSPH(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force) {
+bool computeForceSPH(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force) {
const ScGeom& geom=*static_cast<ScGeom*>(_geom.get());
Scene* scene=Omega::instance().getScene().get();
@@ -386,9 +386,9 @@
phys.kernelFunctionCurrentVisco(xixj.norm(), phys.h);
}
force = fpressure*geom.normal + fvisc;
- return;
+ return true;
} else {
- return;
+ return false;
}
}
YADE_PLUGIN((SPHEngine));
=== modified file 'pkg/common/SPHEngine.hpp'
--- pkg/common/SPHEngine.hpp 2014-04-09 14:03:16 +0000
+++ pkg/common/SPHEngine.hpp 2014-04-09 14:03:16 +0000
@@ -41,6 +41,6 @@
KernelFunction returnKernelFunction(const int a, const int b, const typeKernFunctions typeF);
-void computeForceSPH(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force);
+bool computeForceSPH(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force);
#endif
=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp 2014-04-09 14:03:16 +0000
+++ pkg/dem/ViscoelasticPM.cpp 2014-04-09 14:03:16 +0000
@@ -32,8 +32,7 @@
Vector3r force = Vector3r::Zero();
Vector3r torque1 = Vector3r::Zero();
Vector3r torque2 = Vector3r::Zero();
- computeForceTorqueViscEl(_geom, _phys, I, force, torque1, torque2);
- if (I->isActive) {
+ if (computeForceTorqueViscEl(_geom, _phys, I, force, torque1, torque2) and (I->isActive)) {
const int id1 = I->getId1();
const int id2 = I->getId2();
@@ -41,10 +40,14 @@
addForce (id2, force,scene);
addTorque(id1, torque1,scene);
addTorque(id2, torque2,scene);
- }
+ return;
+ } else {
+ scene->interactions->requestErase(I);
+ return;
+ }
}
-void computeForceTorqueViscEl(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force, Vector3r & torque1, Vector3r & torque2) {
+bool computeForceTorqueViscEl(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force, Vector3r & torque1, Vector3r & torque2) {
ViscElPhys& phys=*static_cast<ViscElPhys*>(_phys.get());
const ScGeom& geom=*static_cast<ScGeom*>(_geom.get());
Scene* scene=Omega::instance().getScene().get();
@@ -52,8 +55,11 @@
#ifdef YADE_SPH
//=======================================================================================================
if (phys.SPHmode) {
- computeForceSPH(_geom, _phys, I, force);
- return;
+ if (computeForceSPH(_geom, _phys, I, force)) {
+ return true;
+ } else {
+ return false;
+ }
}
//=======================================================================================================
#endif
=== modified file 'pkg/dem/ViscoelasticPM.hpp'
--- pkg/dem/ViscoelasticPM.hpp 2014-04-09 14:03:16 +0000
+++ pkg/dem/ViscoelasticPM.hpp 2014-04-09 14:03:16 +0000
@@ -97,4 +97,4 @@
REGISTER_SERIALIZABLE(Law2_ScGeom_ViscElPhys_Basic);
Real contactParameterCalculation(const Real& l1,const Real& l2);
-void computeForceTorqueViscEl(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force, Vector3r & torque1, Vector3r & torque2);
+bool computeForceTorqueViscEl(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I, Vector3r & force, Vector3r & torque1, Vector3r & torque2);