← Back to team overview

yade-dev team mailing list archive

[svn] r1482 - in trunk: gui/py pkg/dem/DataClass/InteractionGeometry pkg/dem/PreProcessor

 

Author: eudoxos
Date: 2008-08-20 14:50:38 +0200 (Wed, 20 Aug 2008)
New Revision: 1482

Modified:
   trunk/gui/py/PythonUI_rc.py
   trunk/gui/py/yadeControl.cpp
   trunk/pkg/dem/DataClass/InteractionGeometry/SpheresContactGeometry.cpp
   trunk/pkg/dem/PreProcessor/ThreePointBending.cpp
Log:
1. Fix nan's in SpheresContactGeometry 
2. Fix ThreePointBending returning false on success (?!)
3. Add Preprocessor().load() method to python wrapper that generates to tempfile and loads it immediately.


Modified: trunk/gui/py/PythonUI_rc.py
===================================================================
--- trunk/gui/py/PythonUI_rc.py	2008-08-20 12:21:01 UTC (rev 1481)
+++ trunk/gui/py/PythonUI_rc.py	2008-08-20 12:50:38 UTC (rev 1482)
@@ -31,7 +31,7 @@
 	# an exception from python would propagate to c++ unhandled and cause crash
 	try: execfile(runtime.script)
 	except SystemExit: raise # re-raise sys.exit
-	except:
+	except: # all other exceptions
 		import traceback
 		traceback.print_exc()
 		if(runtime.nonInteractive or runtime.stopAfter): sys.exit(1)

Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp	2008-08-20 12:21:01 UTC (rev 1481)
+++ trunk/gui/py/yadeControl.cpp	2008-08-20 12:50:38 UTC (rev 1482)
@@ -347,11 +347,7 @@
 };
 
 
-BASIC_PY_PROXY_HEAD(pyFileGenerator,FileGenerator)
-	void generate(string outFile){ensureAcc(); proxee->setFileName(outFile); proxee->setSerializationLibrary("XMLFormatManager"); bool ret=proxee->generateAndSave(); LOG_INFO((ret?"SUCCESS:\n":"FAILURE:\n")<<proxee->message); if(ret==false) throw runtime_error("Generator reported error: "+proxee->message); };
-BASIC_PY_PROXY_TAIL;
 
-
 class pyOmega{
 	private:
 		// can be safely removed now, since pyOmega makes an empty rootBody in the constructor, if there is none
@@ -467,9 +463,13 @@
 
 	pyTags tags_get(void){assertRootBody(); return pyTags(OMEGA.getRootBody());}
 };
-	
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(omega_run_overloads,run,0,2);
 
+BASIC_PY_PROXY_HEAD(pyFileGenerator,FileGenerator)
+	void generate(string outFile){ensureAcc(); proxee->setFileName(outFile); proxee->setSerializationLibrary("XMLFormatManager"); bool ret=proxee->generateAndSave(); LOG_INFO((ret?"SUCCESS:\n":"FAILURE:\n")<<proxee->message); if(ret==false) throw runtime_error("Generator reported error: "+proxee->message); };
+	void load(){ ensureAcc(); char tmpnam_str [L_tmpnam]; tmpnam(tmpnam_str); string xml(tmpnam_str+string(".xml.bz2")); LOG_DEBUG("Using temp file "<<xml); this->generate(xml); pyOmega().load(xml); }
+BASIC_PY_PROXY_TAIL;
+
 class pySTLImporter : public STLImporter {
     public:
 	void py_import(pyBodyContainer bc, unsigned int begin=0) { import(bc.proxee,begin); }
@@ -573,7 +573,8 @@
 	BASIC_PY_PROXY_WRAPPER(pyPhysicalAction,"Action");
 
 	BASIC_PY_PROXY_WRAPPER(pyFileGenerator,"Preprocessor")
-		.def("generate",&pyFileGenerator::generate);
+		.def("generate",&pyFileGenerator::generate)
+		.def("load",&pyFileGenerator::load);
 
 	boost::python::class_<pySTLImporter>("STLImporter")
 	    .def("open",&pySTLImporter::open)

Modified: trunk/pkg/dem/DataClass/InteractionGeometry/SpheresContactGeometry.cpp
===================================================================
--- trunk/pkg/dem/DataClass/InteractionGeometry/SpheresContactGeometry.cpp	2008-08-20 12:21:01 UTC (rev 1481)
+++ trunk/pkg/dem/DataClass/InteractionGeometry/SpheresContactGeometry.cpp	2008-08-20 12:50:38 UTC (rev 1482)
@@ -10,7 +10,7 @@
 #include "SpheresContactGeometry.hpp"
 YADE_PLUGIN("SpheresContactGeometry");
 
-SpheresContactGeometry::SpheresContactGeometry() : InteractionGeometry(){createIndex();}
+SpheresContactGeometry::SpheresContactGeometry(): InteractionGeometry(), radius1(0),radius2(0),contactPoint(Vector3r::ZERO){createIndex();}
 SpheresContactGeometry::~SpheresContactGeometry(){}
 void SpheresContactGeometry::registerAttributes()
 {

Modified: trunk/pkg/dem/PreProcessor/ThreePointBending.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/ThreePointBending.cpp	2008-08-20 12:21:01 UTC (rev 1481)
+++ trunk/pkg/dem/PreProcessor/ThreePointBending.cpp	2008-08-20 12:50:38 UTC (rev 1482)
@@ -252,7 +252,7 @@
 		+ lexical_cast<string>(rootBody->persistentInteractions->size()) 
 		+ "\nWARNING: link bonds are nearly working, but the formulas are waiting for total rewrite!"+
 		+"\nWARNING: The results are meaningless, since ElasticCohesiveLaw works only with (unused) SDECLinkGeometry.";
-	return false;
+	return true;
 }