← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3788: avoid crash when Vh==NULL in FlowEngine. The sphere is ignored in the flow problem, otherwise Flo...

 

------------------------------------------------------------
revno: 3788
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Tue 2014-01-14 23:07:23 +0100
message:
  avoid crash when Vh==NULL in FlowEngine. The sphere is ignored in the flow problem, otherwise FlowEngine runs as usual.
modified:
  lib/triangulation/FlowBoundingSphere.ipp


--
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 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp	2013-11-21 01:28:17 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp	2014-01-14 22:07:23 +0000
@@ -99,7 +99,7 @@
 }
 
 template <class Tesselation> 
-void FlowBoundingSphere<Tesselation>::ResetNetwork() {noCache=true;}
+void FlowBoundingSphere<Tesselation>::ResetNetwork() {T[0].Clear();noCache=true;}
 
 template <class Tesselation> 
 Tesselation& FlowBoundingSphere<Tesselation>::Compute_Action()
@@ -494,10 +494,9 @@
 		perVertexUnitForce.clear(); perVertexPressure.clear();
 // 		vector<const Vecteur*> exf; exf.reserve(20);
 // 		vector<const Real*> exp; exp.reserve(20);
-		perVertexUnitForce.resize(Tri.number_of_vertices());
-		perVertexPressure.resize(Tri.number_of_vertices());}
+		perVertexUnitForce.resize(T[currentTes].max_id+1);
+		perVertexPressure.resize(T[currentTes].max_id+1);}
 	#endif
-
 	Cell_handle neighbour_cell;
 	Vertex_handle mirror_vertex;
 	Vecteur tempVect;
@@ -557,6 +556,7 @@
 		#else
 		#pragma omp parallel for num_threads(ompThreads)
 		for (int vn=0; vn<= T[currentTes].max_id; vn++) {
+			if (T[currentTes].vertexHandles[vn]==NULL) continue;
 			Vertex_handle& v = T[currentTes].vertexHandles[vn];
 // 		for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v){
 			const int& id =  v->info().id();