← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3828: TesselationWrapper : add a security that prevents user to access the strain tensor of a particle ...

 

------------------------------------------------------------
revno: 3828
committer: Francois <francois.kneib@xxxxxxxxx>
timestamp: Wed 2016-03-30 14:14:38 +0200
message:
  TesselationWrapper : add a security that prevents user to access the strain tensor of a particle (aka deformation) outside its boundaries.
modified:
  pkg/dem/TesselationWrapper.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/dem/TesselationWrapper.hpp'
--- pkg/dem/TesselationWrapper.hpp	2015-07-20 12:45:42 +0000
+++ pkg/dem/TesselationWrapper.hpp	2016-03-30 12:14:38 +0000
@@ -82,6 +82,7 @@
 	double	deformation (unsigned int id,unsigned int i,unsigned int j) {
 		if (!mma.analyser->ParticleDeformation.size()) {LOG_ERROR("compute deformations first"); return 0;}
 		if (mma.analyser->ParticleDeformation.size()<id) {LOG_ERROR("id out of bounds"); return 0;}
+		if (i<1 || i>3 || j<1 || j>3) {LOG_ERROR("tensor index must be between 1 and 3"); return 0;}
 		return mma.analyser->ParticleDeformation[id](i,j);}
 
 	/// number of facets in the tesselation (finite branches of the triangulation)