------------------------------------------------------------------------
r1476 | cosurgi | 2008-08-19 21:14:23 +0200 (wto, 19 sie 2008) | 5 lines
Changed paths:
   M /trunk/core/yade.cpp
   M /trunk/pkg/dem/Engine/DeusExMachina/TriaxialCompressionEngine.cpp
   M /trunk/pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp

No idea why dynamic_cast fails while static_cast works in 
TriaxialCompressionEngine:275 and GlobalStiffnessCounter:63 when casting to 
NormalShearInteraction. We will use static_cast for now... 

Added informative message in case when log4cxx enters infinite loop while 
crashing on exit


------------------------------------------------------------------------
Index: pkg/dem/Engine/DeusExMachina/TriaxialCompressionEngine.cpp
===================================================================
--- pkg/dem/Engine/DeusExMachina/TriaxialCompressionEngine.cpp  (revision 1475)
+++ pkg/dem/Engine/DeusExMachina/TriaxialCompressionEngine.cpp  (revision 1476)
@@ -272,7 +272,9 @@
                                const shared_ptr<BodyMacroParameters>& sdec1 = 
YADE_PTR_CAST<BodyMacroParameters>((*bodies)[(body_id_t) 
((*ii)->getId1())]->physicalParameters);
                        const shared_ptr<BodyMacroParameters>& sdec2 = 
YADE_PTR_CAST<BodyMacroParameters>((*bodies)[(body_id_t) 
((*ii)->getId2())]->physicalParameters);
                                                
-                       const shared_ptr<ElasticContactInteraction>& 
contactPhysics = 
YADE_PTR_CAST<ElasticContactInteraction>((*ii)->interactionPhysics);
+                       //FIXME - why dynamic_cast fails here?
+                       //const shared_ptr<ElasticContactInteraction>& 
contactPhysics = 
YADE_PTR_CAST<ElasticContactInteraction>((*ii)->interactionPhysics);
+                       const shared_ptr<ElasticContactInteraction>& 
contactPhysics = 
static_pointer_cast<ElasticContactInteraction>((*ii)->interactionPhysics);
                        
                        Real fa         = sdec1->frictionAngle;
                        Real fb         = sdec2->frictionAngle;
Index: pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp
===================================================================
--- pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp  (revision 1475)
+++ pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp  (revision 1476)
@@ -58,10 +58,11 @@
                if(!contact->isReal) continue;
 
                SpheresContactGeometry* 
geom=YADE_CAST<SpheresContactGeometry*>(contact->interactionGeometry.get()); 
assert(geom);
-               // FIXME: for some reason, the following cast is not 
successful. Please help!
+               // FIXME: for some reason, the following dynamic cast is not 
successful. Please help!
                //cerr<<__FILE__<<":"<<__LINE__<<" Interaction physics of type 
"<<contact->interactionPhysics->getClassName()<<" 
("<<typeid(*contact->interactionPhysics).name()<<")"<<endl;
+               NormalShearInteraction* 
phys=static_cast<NormalShearInteraction*>(contact->interactionPhysics.get()); 
assert(phys);
                //NormalShearInteraction* 
phys=YADE_CAST<NormalShearInteraction*>(contact->interactionPhysics.get()); 
assert(phys);
-               ElasticContactInteraction* 
phys=YADE_CAST<ElasticContactInteraction*>(contact->interactionPhysics.get()); 
assert(phys);
+               //ElasticContactInteraction* 
phys=YADE_CAST<ElasticContactInteraction*>(contact->interactionPhysics.get()); 
assert(phys);
                // all we need for getting stiffness
                Vector3r& normal=geom->normal; Real& kn=phys->kn; Real& 
ks=phys->ks; Real& radius1=geom->radius1; Real& radius2=geom->radius2;
                // FIXME? NormalShearInteraction knows nothing about whether 
the contact is "active" (force!=0) or not;
Index: core/yade.cpp
===================================================================
--- core/yade.cpp       (revision 1475)
+++ core/yade.cpp       (revision 1476)
@@ -37,7 +37,7 @@
 #endif
 
 void nullHandler(int sig){
-       cerr<<"WARN: nullHandler, signal 
"<<(sig==SIGSEGV?"SEGV":"[other]")<<endl;
+       cerr<<"WARN: nullHandler (probably log4cxx error, if it's infinite loop 
then press Ctrl-C or Ctrl-\\ to stop), signal 
"<<(sig==SIGSEGV?"SEGV":"[other]")<<endl;
 }
 
 void
@@ -168,8 +168,8 @@
                // read logging configuration from file and watch it (creates a 
separate thread)
                std::string logConf=configPath+"/logging.conf";
                if(filesystem::exists(logConf)){
+                       log4cxx::PropertyConfigurator::configure(logConf);
                        LOG_INFO("Loading  "<<logConf);
-                       log4cxx::PropertyConfigurator::configure(logConf);
                } else { // otherwise use simple console-directed logging
                        log4cxx::BasicConfigurator::configure();
                        logger->setLevel(log4cxx::Level::WARN);

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to