Author: chareyre
Date: 2009-06-29 16:44:29 +0200 (Mon, 29 Jun 2009)
New Revision: 1823

Modified:
   trunk/pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp
Log:
-Avoid crash when computing fusion number (it was using pointers to deleted 
interractions)
FIXME : no distant meniscii for now due to deletion by the contact law. 




Modified: trunk/pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp
===================================================================
--- trunk/pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp      
2009-06-29 08:55:00 UTC (rev 1822)
+++ trunk/pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp      
2009-06-29 14:44:29 UTC (rev 1823)
@@ -175,16 +175,15 @@
 //                                 R2=currentContactGeometry->radius1;
 //                         }
 
-
                         Real R1 = 0;
-                        
R1=alpha*std::min(currentContactGeometry->radius2,currentContactGeometry->      
  radius1 ) ;
+                        
R1=alpha*std::min(currentContactGeometry->radius2,currentContactGeometry->radius1
 ) ;
                         Real R2 = 0;
-                        
R2=alpha*std::max(currentContactGeometry->radius2,currentContactGeometry->      
 radius1 ) ;
+                        
R2=alpha*std::max(currentContactGeometry->radius2,currentContactGeometry->radius1
 ) ;
                         //cerr << "R1 = " << R1 << " R2 = "<< R2 << endl;
 
                         /// intergranular distance
 
-                        Real D =                                
alpha*(de2->se3.position-de1->se3.position).Length()-alpha*(                    
   currentContactGeometry->radius1+ currentContactGeometry->radius2);
+                        Real D = 
alpha*(de2->se3.position-de1->se3.position).Length()-alpha*(                    
   currentContactGeometry->radius1+ currentContactGeometry->radius2);
 
 //                     Real intergranularDistance = 
currentContactGeometry->penetrationDepth;
                        //cerr << "D = " << intergranularDistance << endl;
@@ -261,7 +260,8 @@
 
                         } 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));//
         }
 
         if (fusionDetection)
@@ -332,14 +332,15 @@
                        //cerr << "size = "<<bodiesMenisciiList[i].size() << " 
empty="<<bodiesMenisciiList[i].empty() <<endl;
                        for ( firstMeniscus=bodiesMenisciiList[i].begin(); 
firstMeniscus!=lastMeniscus; ++firstMeniscus )//FOR EACH MENISCUS ON THIS 
BODY...
                        {
-                               CapillaryParameters* interactionPhysics1 = 
static_cast<CapillaryParameters*>((*firstMeniscus)->interactionPhysics.get());
+                               //if (*firstMeniscus)->isReal();
+                               CapillaryParameters* interactionPhysics1 = 
YADE_CAST<CapillaryParameters*>((*firstMeniscus)->interactionPhysics.get());
                                currentMeniscus = firstMeniscus; 
++currentMeniscus;
                                
                                if (i == (*firstMeniscus)->getId1()) 
angle1=interactionPhysics1->Delta1;//get angle of meniscus1 on body i
                                else angle1=interactionPhysics1->Delta2;
 
                                for ( ;currentMeniscus!= lastMeniscus; 
++currentMeniscus) {//... CHECK FUSION WITH ALL OTHER MENISCII ON THE BODY
-                                       CapillaryParameters* 
interactionPhysics2 = 
static_cast<CapillaryParameters*>((*currentMeniscus)->interactionPhysics.get());
+                                       CapillaryParameters* 
interactionPhysics2 = 
YADE_CAST<CapillaryParameters*>((*currentMeniscus)->interactionPhysics.get());
 
                                        if (i == (*currentMeniscus)->getId1()) 
angle2=interactionPhysics2->Delta1;//get angle of meniscus2 on body i
                                        else angle2=interactionPhysics2->Delta2;
@@ -348,8 +349,8 @@
 
                                        //cerr << "angle1 = " << angle1 << " | 
angle2 = " << angle2 << endl;    
                                        
-                                       Vector3r normalFirstMeniscus = 
static_cast<SpheresContactGeometry*>((*firstMeniscus)->interactionGeometry.get())->normal;
-                                       Vector3r normalCurrentMeniscus = 
static_cast<SpheresContactGeometry*>((*currentMeniscus)->interactionGeometry.get())->normal;
+                                       Vector3r normalFirstMeniscus = 
YADE_CAST<SpheresContactGeometry*>((*firstMeniscus)->interactionGeometry.get())->normal;
+                                       Vector3r normalCurrentMeniscus = 
YADE_CAST<SpheresContactGeometry*>((*currentMeniscus)->interactionGeometry.get())->normal;
                                        
                                        //if (i != (*firstMeniscus)->getId1()) 
normalFirstMeniscus = -normalFirstMeniscus;
                                        //if (i != 
(*currentMeniscus)->getId1()) normalCurrentMeniscus = -normalCurrentMeniscus;


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-...@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp
_______________________________________________
yade-dev mailing list
yade-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/yade-dev

Reply via email to