yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #00545
r1467 - in trunk/pkg: common/Engine/DeusExMachina common/Engine/MetaEngine dem/PreProcessor fem/PreProcessor mass-spring/PreProcessor
Author: cosurgi
Date: 2008-08-14 19:02:33 +0200 (Thu, 14 Aug 2008)
New Revision: 1467
Modified:
trunk/pkg/common/Engine/DeusExMachina/GravityEngines.cpp
trunk/pkg/common/Engine/MetaEngine/BoundingVolumeMetaEngine.cpp
trunk/pkg/dem/PreProcessor/DirectShearCis.cpp
trunk/pkg/dem/PreProcessor/DirectShearCis.hpp
trunk/pkg/dem/PreProcessor/HydraulicTest.cpp
trunk/pkg/dem/PreProcessor/SDECImpactTest.cpp
trunk/pkg/dem/PreProcessor/SDECLinkedSpheres.cpp
trunk/pkg/dem/PreProcessor/STLImporterTest.cpp
trunk/pkg/dem/PreProcessor/ThreePointBending.cpp
trunk/pkg/fem/PreProcessor/FEMBeam.cpp
trunk/pkg/mass-spring/PreProcessor/HangingCloth.cpp
Log:
some small bugfixes that allow all non-broken filegenerators to run. Those based on SDECLinks will never work, so just put "return false;" there to indicate failure.
Modified: trunk/pkg/common/Engine/DeusExMachina/GravityEngines.cpp
===================================================================
--- trunk/pkg/common/Engine/DeusExMachina/GravityEngines.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/common/Engine/DeusExMachina/GravityEngines.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -23,8 +23,8 @@
FOREACH(const shared_ptr<Body>& b, *ncb->bodies){
if(b->isClumpMember()) continue;
shared_ptr<ParticleParameters> p=YADE_PTR_CAST<ParticleParameters>(b->physicalParameters);
- assert(p);
- static_cast<Force*>(ncb->physicalActions->find(b->getId(),cachedForceClassIndex).get())->force+=gravity*p->mass;
+ if(p!=0) //not everything derives from ParticleParameters; this line was assert(p); - Janek
+ static_cast<Force*>(ncb->physicalActions->find(b->getId(),cachedForceClassIndex).get())->force+=gravity*p->mass;
}
}
Modified: trunk/pkg/common/Engine/MetaEngine/BoundingVolumeMetaEngine.cpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/BoundingVolumeMetaEngine.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/common/Engine/MetaEngine/BoundingVolumeMetaEngine.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -20,8 +20,11 @@
const long numBodies=(long)bodies->size();
//#pragma omp parallel for
for(int id=0; id<numBodies; id++){
- const shared_ptr<Body>& b=(*bodies)[id];
- if(b->interactingGeometry && b->boundingVolume) operator()(b->interactingGeometry,b->boundingVolume,b->physicalParameters->se3,b.get());
+ if(bodies->exists(id)) // don't delete this check - Janek
+ {
+ const shared_ptr<Body>& b=(*bodies)[id];
+ if(b->interactingGeometry && b->boundingVolume) operator()(b->interactingGeometry,b->boundingVolume,b->physicalParameters->se3,b.get());
+ }
}
operator()(ncb->interactingGeometry,ncb->boundingVolume,ncb->physicalParameters->se3,ncb);
}
Modified: trunk/pkg/dem/PreProcessor/DirectShearCis.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/DirectShearCis.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/DirectShearCis.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -63,6 +63,7 @@
#include<yade/pkg-common/PhysicalActionVectorVector.hpp>
#include <boost/filesystem/convenience.hpp>
+#include <utility>
using namespace std;
@@ -191,7 +192,7 @@
// GenerateCloud(sphere_list,Vector3r(0,0,-profondeur/2.0),Vector3r(width,height,profondeur/2.0),nBilles,0.3,porosite);
// to use a text file :
- ImportCloud(sphere_list,filename);
+ std::pair<string,bool> res=ImportCloud(sphere_list,filename);
vector<BasicSphere>::iterator it = sphere_list.begin();
vector<BasicSphere>::iterator it_end = sphere_list.end();
@@ -203,8 +204,8 @@
rootBody->bodies->insert(body);
}
-
- return true;
+ message =res.first;
+ return res.second;
}
void DirectShearCis::createSphere(shared_ptr<Body>& body, Vector3r position, Real radius)
@@ -448,7 +449,7 @@
+ lexical_cast<string>(dimensions[2]) + ").";
}
-string DirectShearCis::ImportCloud(vector<BasicSphere>& sphere_list,string importFilename)
+std::pair<string,bool> DirectShearCis::ImportCloud(vector<BasicSphere>& sphere_list,string importFilename)
{
sphere_list.clear();
int nombre=0;
@@ -467,12 +468,12 @@
sphere_list.push_back(s);
nombre++;
}
- return "Echantillon correctement genere : " + lexical_cast<string>(nombre) + " billes";
+ return std::make_pair(std::string("Echantillon correctement genere : " + lexical_cast<string>(nombre) + " billes"),true);
}
else
{
- cerr << "PROBLEME AVEC LE FICHIER D ENTREE" << endl;
- return "PROBLEME AVEC LE FICHIER D ENTREE";
+ cerr << "Cannot find input file" << endl;
+ return std::make_pair("Cannot find input file",false);
}
}
Modified: trunk/pkg/dem/PreProcessor/DirectShearCis.hpp
===================================================================
--- trunk/pkg/dem/PreProcessor/DirectShearCis.hpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/DirectShearCis.hpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -67,7 +67,7 @@
//method to create a list (containing the positions of centers and radii) of n non interpenetrating spheres, occupying a rectangle with a given (rather high) porosity (issued from TriaxialTest) :
string GenerateCloud(vector<BasicSphere>& sphere_list,Vector3r lowerCorner,Vector3r upperCorner,long number,Real rad_std_dev, Real porosity);
// to create the same list but by reading a text file containing the informations :
- string ImportCloud(vector<BasicSphere>& sphere_list,string importFilename);
+ std::pair<string,bool> ImportCloud(vector<BasicSphere>& sphere_list,string importFilename);
public :
Modified: trunk/pkg/dem/PreProcessor/HydraulicTest.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/HydraulicTest.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/HydraulicTest.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -132,7 +132,10 @@
}
}
else
- return "Error: cannot load the file that should contain spheres";
+ {
+ message="Error: cannot load the file that should contain spheres";
+ return false;
+ }
/////////////////////////////////////
Vector3r min ( 10000,10000,10000 ),max ( -10000,-10000,-10000 );
{// calc min/max
Modified: trunk/pkg/dem/PreProcessor/SDECImpactTest.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/SDECImpactTest.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/SDECImpactTest.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -241,6 +241,11 @@
}
}
+ else
+ {
+ message="Cannot find input file, you can copy it from examples/ directory";
+ return false;
+ }
// create bigBall
Vector3r position = (upperCorner+lowerCorner)*0.5 + Vector3r(0,bigBallDropHeight,0);
Modified: trunk/pkg/dem/PreProcessor/SDECLinkedSpheres.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/SDECLinkedSpheres.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/SDECLinkedSpheres.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -215,7 +215,7 @@
+ lexical_cast<string>(rootBody->persistentInteractions->size())
+ "\nWARNING: link bonds are nearly working, but the formulas are waiting for total rewrite!"
+"\nWARNING: interactions will not generate any force since we use SpheresContactGeometry instead of SDECLinkGeometry now.";
- return true;
+ return false;
}
Modified: trunk/pkg/dem/PreProcessor/STLImporterTest.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/STLImporterTest.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/STLImporterTest.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -123,6 +123,7 @@
if (!imp.open(stlFileName.c_str()))
{
cerr << "ERROR: Bad file: " << stlFileName << endl;
+ message="Input file not found, you can copy it from examples/ directory or make one using blender 3D modelling";
return false;
}
imp.set_imported_stuff(verticesImport,edgesImport,facetsImport);
Modified: trunk/pkg/dem/PreProcessor/ThreePointBending.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/ThreePointBending.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/dem/PreProcessor/ThreePointBending.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -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 true;
+ return false;
}
Modified: trunk/pkg/fem/PreProcessor/FEMBeam.cpp
===================================================================
--- trunk/pkg/fem/PreProcessor/FEMBeam.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/fem/PreProcessor/FEMBeam.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -129,7 +129,21 @@
imposeTranslation(rootBody,regionMin1,regionMax1,translationAxis1,velocity1);
imposeTranslation(rootBody,regionMin2,regionMax2,translationAxis2,velocity2);
- message="\nNOTE: if it explodes, set smaller time step."; return true;
+ #ifndef YADE_DEBUG
+ message="FEM currently works only in not optimized debug mode and needs to be fixed. If want to try it you must compile with option 'scons optimize=0'";
+ return false;
+ #endif
+
+ if(filesystem::exists(femTxtFile))
+ {
+ message="NOTE: if it explodes, set smaller time step.";
+ return true;
+ }
+ else
+ {
+ message="Cannot find input file, you can copy it from examples/ directory";
+ return false;
+ }
}
Modified: trunk/pkg/mass-spring/PreProcessor/HangingCloth.cpp
===================================================================
--- trunk/pkg/mass-spring/PreProcessor/HangingCloth.cpp 2008-08-12 17:45:31 UTC (rev 1466)
+++ trunk/pkg/mass-spring/PreProcessor/HangingCloth.cpp 2008-08-14 17:02:33 UTC (rev 1467)
@@ -438,6 +438,10 @@
}
}
}
+ #ifndef YADE_DEBUG
+ message="HangingCloth currently works only in not optimized debug mode and needs to be fixed. If want to try it you must compile with option 'scons optimize=0'";
+ return false;
+ #endif
message="total number of permament links created: " + lexical_cast<string>(linksNum);
return true;