← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2931: Fix crash in capillary law (removed bodies were not checked)

 

------------------------------------------------------------
revno: 2931
fixes bug: https://launchpad.net/bugs/845456
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-10-14 17:18:27 +0200
message:
  Fix crash in capillary law (removed bodies were not checked)
modified:
  pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp	2010-12-31 14:35:21 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp	2011-10-14 15:18:27 +0000
@@ -105,7 +105,11 @@
                         const shared_ptr<Interaction>& interaction = *ii;
                         unsigned int id1 = interaction->getId1();
                         unsigned int id2 = interaction->getId2();
-
+                        
+                        Body* b1 = (*bodies)[id1].get();
+                        Body* b2 = (*bodies)[id2].get();
+                        
+                        if (b1 and b2) {
 
                         /// interaction geometry search (this test is to compute capillarity only between spheres (probably a better way to do that)
 			int geometryIndex1 = (*bodies)[id1]->shape->getClassIndex(); // !!!
@@ -115,8 +119,6 @@
 
                         /// definition of interacting objects (not necessarily in contact)
 
-			Body* b1 = (*bodies)[id1].get();
-			Body* b2 = (*bodies)[id2].get();
 
                         ScGeom* currentContactGeometry = static_cast<ScGeom*>(interaction->geom.get());
                         CapillaryPhys* currentContactPhysics = static_cast<CapillaryPhys*>(interaction->phys.get());
@@ -191,6 +193,7 @@
                                 currentContactPhysics->Delta2 = min(solution.delta1,solution.delta2);
                         }
                         else if (fusionDetection) bodiesMenisciiList.remove((*ii));//If the interaction is not real, it should not be in the list
+          }
 		} else if (fusionDetection) bodiesMenisciiList.remove((*ii));//
         }