yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11012
[Branch ~yade-pkg/yade/git-trunk] Rev 4047: Remove all "using namespace std; "
------------------------------------------------------------
revno: 4047
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2014-07-01 20:19:00 +0200
message:
Remove all "using namespace std;"
modified:
core/BodyContainer.cpp
core/Cell.cpp
core/Clump.cpp
core/Dispatcher.hpp
core/FileGenerator.cpp
core/ForceContainer.hpp
core/Functor.hpp
core/InteractionContainer.cpp
core/Omega.cpp
core/Omega.hpp
core/Scene.cpp
core/Scene.hpp
core/SimulationFlow.cpp
gui/qt4/GLViewer.cpp
gui/qt4/GLViewer.hpp
gui/qt4/GLViewerDisplay.cpp
gui/qt4/_GLViewer.cpp
lib/computational-geometry/Hull2d.hpp
lib/factory/ClassFactory.hpp
lib/factory/DynLibManager.cpp
lib/factory/DynLibManager.hpp
lib/import/STLReader.hpp
lib/import/utils.hpp
lib/multimethods/DynLibDispatcher.hpp
lib/serialization/Serializable.hpp
lib/smoothing/WeightedAverage2d.hpp
lib/triangulation/FlowBoundingSphere.hpp
lib/triangulation/FlowBoundingSphere.ipp
lib/triangulation/FlowBoundingSphereLinSolv.hpp
lib/triangulation/FlowBoundingSphereLinSolv.ipp
lib/triangulation/Network.ipp
lib/triangulation/PeriodicFlowLinSolv.hpp
lib/triangulation/PeriodicFlowLinSolv.ipp
lib/triangulation/Tenseur3.cpp
lib/triangulation/Tesselation.ipp
lib/triangulation/Timer.cpp
lib/triangulation/TriaxialState.h
lib/triangulation/basicVTKwritter.cpp
pkg/common/Bo1_Box_Aabb.cpp
pkg/common/Collider.cpp
pkg/common/Cylinder.cpp
pkg/common/Dispatching.cpp
pkg/common/Gl1_Sphere.cpp
pkg/common/GravityEngines.cpp
pkg/common/Grid.cpp
pkg/common/InsertionSortCollider.cpp
pkg/common/InsertionSortCollider.hpp
pkg/common/InteractionLoop.cpp
pkg/common/MatchMaker.hpp
pkg/common/PersistentTriangulationCollider.cpp
pkg/common/Recorder.cpp
pkg/common/ResetRandomPosition.hpp
pkg/common/SpatialQuickSortCollider.hpp
pkg/common/Wall.cpp
pkg/common/ZECollider.cpp
pkg/dem/CapillaryTriaxialTest.cpp
pkg/dem/CapillaryTriaxialTest.hpp
pkg/dem/CohesiveTriaxialTest.cpp
pkg/dem/Disp2DPropLoadEngine.cpp
pkg/dem/DomainLimiter.cpp
pkg/dem/FacetTopologyAnalyzer.hpp
pkg/dem/GeneralIntegratorInsertionSortCollider.cpp
pkg/dem/JointedCohesiveFrictionalPM.cpp
pkg/dem/L3Geom.cpp
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp
pkg/dem/MicroMacroAnalyser.cpp
pkg/dem/PeriIsoCompressor.cpp
pkg/dem/SampleCapillaryPressureEngine.cpp
pkg/dem/ScGeom.cpp
pkg/dem/Shop.hpp
pkg/dem/Shop_01.cpp
pkg/dem/SimpleShear.cpp
pkg/dem/SimpleShear.hpp
pkg/dem/SnapshotEngine.cpp
pkg/dem/SpherePack.cpp
pkg/dem/SpherePack.hpp
pkg/dem/TesselationWrapper.cpp
pkg/dem/Tetra.cpp
pkg/dem/TriaxialTest.cpp
pkg/dem/TriaxialTest.hpp
pkg/dem/UniaxialStrainer.cpp
pkg/dem/ViscoelasticPM.cpp
pkg/lbm/HydrodynamicsLawLBM.cpp
pkg/pfv/PeriodicFlowEngine.cpp
py/_polyhedra_utils.cpp
py/_utils.cpp
py/pack/_packPredicates.cpp
py/wrapper/yadeWrapper.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/BodyContainer.cpp'
--- core/BodyContainer.cpp 2014-05-21 12:37:11 +0000
+++ core/BodyContainer.cpp 2014-07-01 18:19:00 +0000
@@ -54,7 +54,7 @@
bool BodyContainer::erase(Body::id_t id, bool eraseClumpMembers){//default is false (as before)
if(!exists(id)) return false;
- lowestFree=min(lowestFree,id);
+ lowestFree=std::min(lowestFree,id);
const shared_ptr<Body>& b=Body::byId(id);
=== modified file 'core/Cell.cpp'
--- core/Cell.cpp 2013-04-09 11:46:11 +0000
+++ core/Cell.cpp 2014-07-01 18:19:00 +0000
@@ -13,7 +13,7 @@
prevHSize=hSize;
_vGradTimesPrevH = velGrad*prevHSize;
hSize+=_trsfInc*hSize;
- if(hSize.determinant()==0){ throw runtime_error("Cell is degenerate (zero volume)."); }
+ if(hSize.determinant()==0){ throw std::runtime_error("Cell is degenerate (zero volume)."); }
// lengths of transformed cell vectors, skew cosines
Matrix3r Hnorm; // normalized transformed base vectors
for(int i=0; i<3; i++){
=== modified file 'core/Clump.cpp'
--- core/Clump.cpp 2014-05-23 13:05:19 +0000
+++ core/Clump.cpp 2014-07-01 18:19:00 +0000
@@ -124,7 +124,7 @@
const Sphere* sphere1 = YADE_CAST<Sphere*> (subBody1->shape.get());
const Sphere* sphere2 = YADE_CAST<Sphere*> (subBody2->shape.get());
Real un = (sphere1->radius+sphere2->radius) - dist.norm();
- if (un > 0.001*min(sphere1->radius,sphere2->radius)) {intersecting = true; break;}
+ if (un > 0.001*std::min(sphere1->radius,sphere2->radius)) {intersecting = true; break;}
}
}
if (intersecting) break;
@@ -153,7 +153,7 @@
const Sphere* sphere = YADE_CAST<Sphere*> (subBody->shape.get());
aabb.extend(subBody->state->pos + Vector3r::Constant(sphere->radius));
aabb.extend(subBody->state->pos - Vector3r::Constant(sphere->radius));
- rMin=min(rMin,sphere->radius);
+ rMin=std::min(rMin,sphere->radius);
}
}
//get volume and inertia tensor using regular cubic cell array inside bounding box of the clump:
=== modified file 'core/Dispatcher.hpp'
--- core/Dispatcher.hpp 2014-07-01 18:14:18 +0000
+++ core/Dispatcher.hpp 2014-07-01 18:19:00 +0000
@@ -46,7 +46,7 @@
BOOST_PP_CAT(_YADE_DISPATCHER,BOOST_PP_CAT(Dim,D_FUNCTOR_ADD))(FunctorT,f) \
boost::python::list functors_get(void) const { boost::python::list ret; FOREACH(const shared_ptr<FunctorT>& f, functors){ ret.append(f); } return ret; } \
void functors_set(const vector<shared_ptr<FunctorT> >& ff){ functors.clear(); FOREACH(const shared_ptr<FunctorT>& f, ff) add(f); postLoad(*this); } \
- void pyHandleCustomCtorArgs(boost::python::tuple& t, boost::python::dict& d){ if(boost::python::len(t)==0)return; if(boost::python::len(t)!=1) throw invalid_argument("Exactly one list of " BOOST_PP_STRINGIZE(FunctorT) " must be given."); typedef std::vector<shared_ptr<FunctorT> > vecF; vecF vf=boost::python::extract<vecF>(t[0])(); functors_set(vf); t=boost::python::tuple(); } \
+ void pyHandleCustomCtorArgs(boost::python::tuple& t, boost::python::dict& d){ if(boost::python::len(t)==0)return; if(boost::python::len(t)!=1) throw std::invalid_argument("Exactly one list of " BOOST_PP_STRINGIZE(FunctorT) " must be given."); typedef std::vector<shared_ptr<FunctorT> > vecF; vecF vf=boost::python::extract<vecF>(t[0])(); functors_set(vf); t=boost::python::tuple(); } \
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(DispatcherT,Dispatcher,"Dispatcher calling :yref:`functors<" BOOST_PP_STRINGIZE(FunctorT) ">` based on received argument type(s).\n\n" doc, \
((vector<shared_ptr<FunctorT> >,functors,,,"Functors active in the dispatch mechanism [overridden below].")) /*additional attrs*/ attrs, \
/*ctor*/ ctor, /*py*/ py .add_property("functors",&DispatcherT::functors_get,&DispatcherT::functors_set,"Functors associated with this dispatcher." " :yattrtype:`vector<shared_ptr<" BOOST_PP_STRINGIZE(FunctorT) "> >` ") \
@@ -74,12 +74,12 @@
shared_ptr<topIndexable> inst=YADE_PTR_DYN_CAST<topIndexable>(ClassFactory::instance().createShared(clss.first));
assert(inst);
if(inst->getClassIndex()<0 && inst->getClassName()!=top->getClassName()){
- throw logic_error("Class "+inst->getClassName()+" didn't use REGISTER_CLASS_INDEX("+inst->getClassName()+","+top->getClassName()+") and/or forgot to call createIndex() in the ctor. [[ Please fix that! ]]");
+ throw std::logic_error("Class "+inst->getClassName()+" didn't use REGISTER_CLASS_INDEX("+inst->getClassName()+","+top->getClassName()+") and/or forgot to call createIndex() in the ctor. [[ Please fix that! ]]");
}
if(inst->getClassIndex()==idx) return clss.first;
}
}
- throw runtime_error("No class with index "+boost::lexical_cast<string>(idx)+" found (top-level indexable is "+topName+")");
+ throw std::runtime_error("No class with index "+boost::lexical_cast<string>(idx)+" found (top-level indexable is "+topName+")");
}
//! Return class index of given indexable
@@ -107,7 +107,7 @@
template<typename DispatcherT>
std::vector<shared_ptr<typename DispatcherT::functorType> > Dispatcher_functors_get(shared_ptr<DispatcherT> self){
std::vector<shared_ptr<typename DispatcherT::functorType> > ret;
- FOREACH(const shared_ptr<Functor>& functor, self->functors){ shared_ptr<typename DispatcherT::functorType> functorRightType(YADE_PTR_DYN_CAST<typename DispatcherT::functorType>(functor)); if(!functorRightType) throw logic_error("Internal error: Dispatcher of type "+self->getClassName()+" did not contain Functor of the required type "+typeid(typename DispatcherT::functorType).name()+"?"); ret.push_back(functorRightType); }
+ FOREACH(const shared_ptr<Functor>& functor, self->functors){ shared_ptr<typename DispatcherT::functorType> functorRightType(YADE_PTR_DYN_CAST<typename DispatcherT::functorType>(functor)); if(!functorRightType) throw std::logic_error("Internal error: Dispatcher of type "+self->getClassName()+" did not contain Functor of the required type "+typeid(typename DispatcherT::functorType).name()+"?"); ret.push_back(functorRightType); }
return ret;
}
=== modified file 'core/FileGenerator.cpp'
--- core/FileGenerator.cpp 2012-09-21 19:03:18 +0000
+++ core/FileGenerator.cpp 2014-07-01 18:19:00 +0000
@@ -14,7 +14,7 @@
CREATE_LOGGER(FileGenerator);
-bool FileGenerator::generate(std::string& msg){ throw invalid_argument("Calling abstract FileGenerator::generate() does not make sense."); }
+bool FileGenerator::generate(std::string& msg){ throw std::invalid_argument("Calling abstract FileGenerator::generate() does not make sense."); }
bool FileGenerator::generateAndSave(const string& outputFileName, string& message)
=== modified file 'core/ForceContainer.hpp'
--- core/ForceContainer.hpp 2014-06-04 08:44:44 +0000
+++ core/ForceContainer.hpp 2014-07-01 18:19:00 +0000
@@ -63,15 +63,15 @@
inline void ensureSize(Body::id_t id, int threadN){
assert(nThreads>omp_get_thread_num());
- const Body::id_t idMaxTmp = max(id, _maxId[threadN]);
+ const Body::id_t idMaxTmp = std::max(id, _maxId[threadN]);
_maxId[threadN] = 0;
if (threadN<0) {
- resizePerm(min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)));
+ resizePerm(std::min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)));
} else if (sizeOfThreads[threadN]<=(size_t)idMaxTmp) {
- resize(min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)),threadN);
+ resize(std::min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)),threadN);
}
}
- inline void ensureSynced(){ if(!synced) throw runtime_error("ForceContainer not thread-synchronized; call sync() first!"); }
+ inline void ensureSynced(){ if(!synced) throw std::runtime_error("ForceContainer not thread-synchronized; call sync() first!"); }
// dummy function to avoid template resolution failure
friend class boost::serialization::access; template<class ArchiveT> void serialize(ArchiveT & ar, unsigned int version){}
@@ -228,9 +228,9 @@
size_t size;
size_t permSize;
inline void ensureSize(Body::id_t id){
- const Body::id_t idMaxTmp = max(id, _maxId);
+ const Body::id_t idMaxTmp = std::max(id, _maxId);
_maxId = 0;
- if(size<=(size_t)idMaxTmp) resize(min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)));
+ if(size<=(size_t)idMaxTmp) resize(std::min((size_t)1.5*(idMaxTmp+100),(size_t)(idMaxTmp+2000)));
}
#if 0
const Vector3r& getForceUnsynced (Body::id_t id){ return getForce(id);}
=== modified file 'core/Functor.hpp'
--- core/Functor.hpp 2014-07-01 18:14:18 +0000
+++ core/Functor.hpp 2014-07-01 18:19:00 +0000
@@ -51,7 +51,7 @@
public:
typedef _DispatchType1 DispatchType1; typedef _ReturnType ReturnType; typedef _ArgumentTypes ArgumentTypes;
#define FUNCTOR1D(type1) public: std::string get1DFunctorType1(void){return string(#type1);} int checkArgTypes(const shared_ptr<DispatchType1>& arg1){ return (bool)YADE_PTR_DYN_CAST<type1>(arg1)?1:0; }
- virtual std::string get1DFunctorType1(void){throw runtime_error("Class "+this->getClassName()+" did not use FUNCTOR1D to declare its argument type?"); }
+ virtual std::string get1DFunctorType1(void){throw std::runtime_error("Class "+this->getClassName()+" did not use FUNCTOR1D to declare its argument type?"); }
virtual vector<string> getFunctorTypes(void){vector<string> ret; ret.push_back(get1DFunctorType1()); return ret;};
// check that the object can be correctly cast to the derived class handled by the functor (will be used if ever utils.createInteraction can be called with list of functors only)
// virtual bool checkArgTypes(const shared_ptr<DispatchType1>& arg1){ throw runtime_error("Class "+this->getClassName()+" did not use FUNCTOR1D to declare its argument type?"); }
@@ -73,8 +73,8 @@
public:
typedef _DispatchType1 DispatchType1; typedef _DispatchType2 DispatchType2; typedef _ReturnType ReturnType; typedef _ArgumentTypes ArgumentTypes;
#define FUNCTOR2D(type1,type2) public: std::string get2DFunctorType1(void){return string(#type1);}; std::string get2DFunctorType2(void){return string(#type2);}; int checkArgTypes(const shared_ptr<DispatchType1>& arg1, const shared_ptr<DispatchType2>& arg2){ if(YADE_PTR_DYN_CAST<type1>(arg1)&&YADE_PTR_DYN_CAST<type2>(arg2)) return 1; if(YADE_PTR_DYN_CAST<type1>(arg2)&&YADE_PTR_DYN_CAST<type2>(arg1)) return -1; return 0; }
- virtual std::string get2DFunctorType1(void){throw logic_error("Class "+this->getClassName()+" did not use FUNCTOR2D to declare its argument types?");}
- virtual std::string get2DFunctorType2(void){throw logic_error("Class "+this->getClassName()+" did not use FUNCTOR2D to declare its argument types?");}
+ virtual std::string get2DFunctorType1(void){throw std::logic_error("Class "+this->getClassName()+" did not use FUNCTOR2D to declare its argument types?");}
+ virtual std::string get2DFunctorType2(void){throw std::logic_error("Class "+this->getClassName()+" did not use FUNCTOR2D to declare its argument types?");}
virtual vector<string> getFunctorTypes(){vector<string> ret; ret.push_back(get2DFunctorType1()); ret.push_back(get2DFunctorType2()); return ret;};
// check that objects can be correctly cast to derived classes handled by the functor (see comment in Functor1D:: checkArgTypes)
// virtual bool checkArgTypes(const shared_ptr<DispatchType1>&, const shared_ptr<DispatchType2>&){ throw logic_error("Class "+this->getClassName()+" did not use FUNCTOR2D to declare its argument types?"); }
=== modified file 'core/InteractionContainer.cpp'
--- core/InteractionContainer.cpp 2014-06-04 08:51:38 +0000
+++ core/InteractionContainer.cpp 2014-07-01 18:19:00 +0000
@@ -17,7 +17,7 @@
Body::id_t id1=i->getId1();
Body::id_t id2=i->getId2();
- if (id1>id2) swap(id1,id2);
+ if (id1>id2) std::swap(id1,id2);
assert((Body::id_t)bodies->size()>id1); // the bodies must exist already
assert((Body::id_t)bodies->size()>id2);
@@ -54,7 +54,7 @@
bool InteractionContainer::erase(Body::id_t id1,Body::id_t id2, int linPos){
assert(bodies);
boost::mutex::scoped_lock lock(drawloopmutex);
- if (id1>id2) swap(id1,id2);
+ if (id1>id2) std::swap(id1,id2);
if(id2>=(Body::id_t)bodies->size()) return false; // no such interaction
const shared_ptr<Body>& b1((*bodies)[id1]);
@@ -95,7 +95,7 @@
const shared_ptr<Interaction>& InteractionContainer::find(Body::id_t id1,Body::id_t id2){
assert(bodies);
- if (id1>id2) swap(id1,id2);
+ if (id1>id2) std::swap(id1,id2);
// those checks could be perhaps asserts, but pyInteractionContainer has no access to the body container...
if(id2>=(Body::id_t)bodies->size()){ empty=shared_ptr<Interaction>(); return empty; }
const shared_ptr<Body>& b1((*bodies)[id1]);
=== modified file 'core/Omega.cpp'
--- core/Omega.cpp 2014-07-01 18:14:18 +0000
+++ core/Omega.cpp 2014-07-01 18:19:00 +0000
@@ -46,7 +46,7 @@
CREATE_LOGGER(Omega);
SINGLETON_SELF(Omega);
-const map<string,DynlibDescriptor>& Omega::getDynlibsDescriptor(){return dynlibs;}
+const std::map<string,DynlibDescriptor>& Omega::getDynlibsDescriptor(){return dynlibs;}
const shared_ptr<Scene>& Omega::getScene(){return scenes.at(currentSceneNb);}
void Omega::resetCurrentScene(){ RenderMutexLock lock; scenes.at(currentSceneNb) = shared_ptr<Scene>(new Scene);}
@@ -164,28 +164,28 @@
for now, just loop until we succeed; proper solution will be to build graphs of classes
and traverse it from the top. It will be done once all classes are pythonable. */
for(int i=0; i<100 && pythonables.size()>0; i++){
- if(getenv("YADE_DEBUG")) cerr<<endl<<"[[[ Round "<<i<<" ]]]: ";
+ if(getenv("YADE_DEBUG")) std::cerr<<std::endl<<"[[[ Round "<<i<<" ]]]: ";
std::list<string> done;
for(std::list<string>::iterator I=pythonables.begin(); I!=pythonables.end(); ){
shared_ptr<Serializable> s=boost::static_pointer_cast<Serializable>(ClassFactory::instance().createShared(*I));
try{
- if(getenv("YADE_DEBUG")) cerr<<"{{"<<*I<<"}}";
+ if(getenv("YADE_DEBUG")) std::cerr<<"{{"<<*I<<"}}";
s->pyRegisterClass(wrapperScope);
std::list<string>::iterator prev=I++;
pythonables.erase(prev);
} catch (...){
- if(getenv("YADE_DEBUG")){ cerr<<"["<<*I<<"]"; PyErr_Print(); }
+ if(getenv("YADE_DEBUG")){ std::cerr<<"["<<*I<<"]"; PyErr_Print(); }
boost::python::handle_exception();
I++;
}
}
}
- map<string,DynlibDescriptor>::iterator dli = dynlibs.begin();
- map<string,DynlibDescriptor>::iterator dliEnd = dynlibs.end();
+ std::map<string,DynlibDescriptor>::iterator dli = dynlibs.begin();
+ std::map<string,DynlibDescriptor>::iterator dliEnd = dynlibs.end();
for( ; dli!=dliEnd ; ++dli){
- set<string>::iterator bci = (*dli).second.baseClasses.begin();
- set<string>::iterator bciEnd = (*dli).second.baseClasses.end();
+ std::set<string>::iterator bci = (*dli).second.baseClasses.begin();
+ std::set<string>::iterator bciEnd = (*dli).second.baseClasses.end();
for( ; bci!=bciEnd ; ++bci){
string name = *bci;
if (name=="Dispatcher1D" || name=="Dispatcher2D") (*dli).second.baseClasses.insert("Dispatcher");
@@ -230,7 +230,7 @@
abort();
}
}
- list<string>& plugins(ClassFactory::instance().pluginClasses);
+ std::list<string>& plugins(ClassFactory::instance().pluginClasses);
plugins.sort(); plugins.unique();
buildDynlibDatabase(vector<string>(plugins.begin(),plugins.end()));
}
@@ -255,7 +255,7 @@
yade::ObjectIO::load(f,"scene",scene);
}
}
- if(scene->getClassName()!="Scene") throw logic_error("Wrong file format (scene is not a Scene!?) in "+f);
+ if(scene->getClassName()!="Scene") throw std::logic_error("Wrong file format (scene is not a Scene!?) in "+f);
sceneFile=f;
timeInit();
if(!quiet) LOG_DEBUG("Simulation loaded");
@@ -271,7 +271,7 @@
//shared_ptr<Scene>& scene = getScene();
if(boost::algorithm::starts_with(f,":memory:")){
if(memSavedSimulations.count(f)>0 && !quiet) LOG_INFO("Overwriting in-memory saved simulation "<<f);
- ostringstream oss;
+ std::ostringstream oss;
yade::ObjectIO::save<typeof(scene),boost::archive::binary_oarchive>(oss,"scene",scene);
memSavedSimulations[f]=oss.str();
}
=== modified file 'core/Omega.hpp'
--- core/Omega.hpp 2014-05-23 13:03:50 +0000
+++ core/Omega.hpp 2014-07-01 18:19:00 +0000
@@ -49,17 +49,22 @@
class ThreadRunner;
using namespace boost::posix_time;
-using namespace std;
+using std::string;
+using std::vector;
+using std::runtime_error;
+using std::endl;
+using std::cout;
+using std::cerr;
struct DynlibDescriptor{
- set<string> baseClasses;
+ std::set<string> baseClasses;
bool isIndexable, isFactorable, isSerializable;
};
class Omega: public Singleton<Omega>{
shared_ptr<ThreadRunner> simulationLoop;
SimulationFlow simulationFlow_;
- map<string,DynlibDescriptor> dynlibs; // FIXME : should store that in ClassFactory ?
+ std::map<string,DynlibDescriptor> dynlibs; // FIXME : should store that in ClassFactory ?
void buildDynlibDatabase(const vector<string>& dynlibsList); // FIXME - maybe in ClassFactory ?
vector<shared_ptr<Scene> > scenes;
@@ -68,7 +73,7 @@
ptime startupLocalTime;
- map<string,string> memSavedSimulations;
+ std::map<string,string> memSavedSimulations;
// to avoid accessing simulation when it is being loaded (should avoid crashes with the UI)
boost::mutex loadingSimulationMutex;
@@ -83,7 +88,7 @@
void timeInit();
void initTemps();
void cleanupTemps();
- const map<string,DynlibDescriptor>& getDynlibsDescriptor();
+ const std::map<string,DynlibDescriptor>& getDynlibsDescriptor();
void loadPlugins(vector<string> pluginFiles);
bool isInheritingFrom(const string& className, const string& baseClassName );
bool isInheritingFrom_recursive(const string& className, const string& baseClassName );
=== modified file 'core/Scene.cpp'
--- core/Scene.cpp 2014-07-01 18:14:18 +0000
+++ core/Scene.cpp 2014-07-01 18:19:00 +0000
@@ -194,8 +194,8 @@
if(!b) continue;
if(b->bound){
for(int i=0; i<3; i++){
- if(!std::isinf(b->bound->max[i])) mx[i]=max(mx[i],b->bound->max[i]);
- if(!std::isinf(b->bound->min[i])) mn[i]=min(mn[i],b->bound->min[i]);
+ if(!std::isinf(b->bound->max[i])) mx[i]=std::max(mx[i],b->bound->max[i]);
+ if(!std::isinf(b->bound->min[i])) mn[i]=std::min(mn[i],b->bound->min[i]);
}
} else {
mx=mx.cwiseMax(b->state->pos);
=== modified file 'core/Scene.hpp'
--- core/Scene.hpp 2014-05-08 05:57:04 +0000
+++ core/Scene.hpp 2014-07-01 18:19:00 +0000
@@ -40,6 +40,9 @@
};
#endif
+using std::min;
+using std::max;
+
class Scene: public Serializable{
public:
//! Adds material to Scene::materials. It also sets id of the material accordingly and returns it.
@@ -106,7 +109,7 @@
((Body::id_t,selectedBody,-1,,"Id of body that is selected by the user"))
((int,flags,0,Attr::readonly,"Various flags of the scene; 1 (Scene::LOCAL_COORDS): use local coordinate system rather than global one for per-interaction quantities (set automatically from the functor)."))
- ((list<string>,tags,,,"Arbitrary key=value associations (tags like mp3 tags: author, date, version, description etc.)"))
+ ((std::list<string>,tags,,,"Arbitrary key=value associations (tags like mp3 tags: author, date, version, description etc.)"))
((vector<shared_ptr<Engine> >,engines,,Attr::hidden,"Engines sequence in the simulation."))
((vector<shared_ptr<Engine> >,_nextEngines,,Attr::hidden,"Engines to be used from the next step on; is returned transparently by O.engines if in the middle of the loop (controlled by subStep>=0)."))
// NOTE: bodies must come before interactions, since InteractionContainer is initialized with a reference to BodyContainer::body
=== modified file 'core/SimulationFlow.cpp'
--- core/SimulationFlow.cpp 2012-07-16 20:13:46 +0000
+++ core/SimulationFlow.cpp 2014-07-01 18:19:00 +0000
@@ -16,7 +16,7 @@
void SimulationFlow::singleAction()
{
Scene* scene=Omega::instance().getScene().get();
- if (!scene) throw logic_error("SimulationFlow::singleAction: no Scene object?!");
+ if (!scene) throw std::logic_error("SimulationFlow::singleAction: no Scene object?!");
if(scene->subStepping) { LOG_INFO("Sub-stepping disabled when running simulation continuously."); scene->subStepping=false; }
scene->moveToNextTimeStep();
if(scene->stopAtIter>0 && scene->iter==scene->stopAtIter) setTerminate(true);
=== modified file 'gui/qt4/GLViewer.cpp'
--- gui/qt4/GLViewer.cpp 2014-05-23 13:05:19 +0000
+++ gui/qt4/GLViewer.cpp 2014-07-01 18:19:00 +0000
@@ -142,7 +142,7 @@
LOG_DEBUG("State saved to temp file "<<tmpFile);
// read tmp file contents and return it as string
// this will replace all whitespace by space (nowlines will disappear, which is what we want)
- ifstream in(tmpFile.c_str()); string ret; while(!in.eof()){string ss; in>>ss; ret+=" "+ss;}; in.close();
+ std::ifstream in(tmpFile.c_str()); string ret; while(!in.eof()){string ss; in>>ss; ret+=" "+ss;}; in.close();
boost::filesystem::remove(boost::filesystem::path(tmpFile));
return ret;
}
=== modified file 'gui/qt4/GLViewer.hpp'
--- gui/qt4/GLViewer.hpp 2014-05-23 13:05:19 +0000
+++ gui/qt4/GLViewer.hpp 2014-07-01 18:19:00 +0000
@@ -14,6 +14,12 @@
#include<QGLViewer/constraint.h>
#include<set>
+using std::ostringstream;
+using std::setfill;
+using std::setw;
+using std::set;
+using std::setprecision;
+
/*! Class handling user interaction with the openGL rendering of simulation.
*
* Clipping planes:
=== modified file 'gui/qt4/GLViewerDisplay.cpp'
--- gui/qt4/GLViewerDisplay.cpp 2014-05-23 13:05:19 +0000
+++ gui/qt4/GLViewerDisplay.cpp 2014-07-01 18:19:00 +0000
@@ -250,7 +250,7 @@
if(timeDispMask & GLViewer::TIME_ITER){
ostringstream oss;
oss<<"#"<<rb->iter;
- if(rb->stopAtIter>rb->iter) oss<<" ("<<setiosflags(ios::fixed)<<setw(3)<<setprecision(1)<<setfill('0')<<(100.*rb->iter)/rb->stopAtIter<<"%)";
+ if(rb->stopAtIter>rb->iter) oss<<" ("<<setiosflags(std::ios::fixed)<<setw(3)<<setprecision(1)<<setfill('0')<<(100.*rb->iter)/rb->stopAtIter<<"%)";
QGLViewer::drawText(x,y,oss.str().c_str());
y-=lineHt;
}
=== modified file 'gui/qt4/_GLViewer.cpp'
--- gui/qt4/_GLViewer.cpp 2014-05-23 13:05:19 +0000
+++ gui/qt4/_GLViewer.cpp 2014-07-01 18:19:00 +0000
@@ -9,7 +9,7 @@
namespace py=boost::python;
-qglviewer::Vec tuple2vec(py::tuple t){ qglviewer::Vec ret; for(int i=0;i<3;i++){py::extract<Real> e(t[i]); if(!e.check()) throw invalid_argument("Element #"+boost::lexical_cast<string>(i)+" is not a number"); ret[i]=e();} return ret;};
+qglviewer::Vec tuple2vec(py::tuple t){ qglviewer::Vec ret; for(int i=0;i<3;i++){py::extract<Real> e(t[i]); if(!e.check()) throw std::invalid_argument("Element #"+boost::lexical_cast<string>(i)+" is not a number"); ret[i]=e();} return ret;};
py::tuple vec2tuple(qglviewer::Vec v){return py::make_tuple(v[0],v[1],v[2]);};
class pyGLViewer{
@@ -44,7 +44,7 @@
void saveDisplayParameters(size_t n){GLV; glv->saveDisplayParameters(n);}
void useDisplayParameters(size_t n){GLV; glv->useDisplayParameters(n);}
string get_timeDisp(){GLV; const int& m(glv->timeDispMask); string ret; if(m&GLViewer::TIME_REAL) ret+='r'; if(m&GLViewer::TIME_VIRT) ret+="v"; if(m&GLViewer::TIME_ITER) ret+="i"; return ret;}
- void set_timeDisp(string s){GLV; int& m(glv->timeDispMask); m=0; FOREACH(char c, s){switch(c){case 'r': m|=GLViewer::TIME_REAL; break; case 'v': m|=GLViewer::TIME_VIRT; break; case 'i': m|=GLViewer::TIME_ITER; break; default: throw invalid_argument(string("Invalid flag for timeDisp: `")+c+"'");}}}
+ void set_timeDisp(string s){GLV; int& m(glv->timeDispMask); m=0; FOREACH(char c, s){switch(c){case 'r': m|=GLViewer::TIME_REAL; break; case 'v': m|=GLViewer::TIME_VIRT; break; case 'i': m|=GLViewer::TIME_ITER; break; default: throw std::invalid_argument(string("Invalid flag for timeDisp: `")+c+"'");}}}
void set_bgColor(const Vector3r& c){ QColor cc(255*c[0],255*c[1],255*c[2]); GLV; glv->setBackgroundColor(cc);} Vector3r get_bgColor(){ GLV; QColor c(glv->backgroundColor()); return Vector3r(c.red()/255.,c.green()/255.,c.blue()/255.);}
#undef GLV
#undef VEC_GET_SET
=== modified file 'lib/computational-geometry/Hull2d.hpp'
--- lib/computational-geometry/Hull2d.hpp 2009-05-31 09:09:14 +0000
+++ lib/computational-geometry/Hull2d.hpp 2014-07-01 18:19:00 +0000
@@ -10,7 +10,7 @@
Look there for detailed description and more information.
*/
class ConvexHull2d{
- list<Vector2r> raw_points, lower_partition_points, upper_partition_points, hull;
+ std::list<Vector2r> raw_points, lower_partition_points, upper_partition_points, hull;
Vector2r left, right;
static Real direction(const Vector2r& p0, const Vector2r& p1, const Vector2r& p2) {
return ((p0[0]-p1[0])*(p2[1]-p1[1]))-((p2[0]-p1[0])*(p0[1]-p1[1]));
@@ -28,7 +28,7 @@
else lower_partition_points.push_back(p);
}
}
- vector<Vector2r> build_half_hull(list<Vector2r>& in, int factor){
+ vector<Vector2r> build_half_hull(std::list<Vector2r>& in, int factor){
vector<Vector2r> out;
in.push_back(right); out.push_back(left);
while(in.size()>0){
@@ -42,7 +42,7 @@
return out;
}
public:
- ConvexHull2d(const list<Vector2r>& pts){raw_points.assign(pts.begin(),pts.end());};
+ ConvexHull2d(const std::list<Vector2r>& pts){raw_points.assign(pts.begin(),pts.end());};
ConvexHull2d(const vector<Vector2r>& pts){raw_points.assign(pts.begin(),pts.end());};
vector<Vector2r> operator()(void){
partition_points();
=== modified file 'lib/factory/ClassFactory.hpp'
--- lib/factory/ClassFactory.hpp 2010-11-19 12:30:08 +0000
+++ lib/factory/ClassFactory.hpp 2014-07-01 18:19:00 +0000
@@ -159,13 +159,13 @@
\param tp type info of the type to test
\param fundamental is true if the given type is fundamental (Vector3,Quaternion ...)
*/
- bool isFactorable(const type_info& tp,bool& fundamental);
+ bool isFactorable(const std::type_info& tp,bool& fundamental);
bool load(const string& fullFileName);
std::string lastError();
void registerPluginClasses(const char* fileAndClasses[]);
- list<string> pluginClasses;
+ std::list<string> pluginClasses;
virtual string getClassName() const { return "Factorable"; };
virtual string getBaseClassName(int ) const { return "";};
=== modified file 'lib/factory/DynLibManager.cpp'
--- lib/factory/DynLibManager.cpp 2014-05-23 13:03:50 +0000
+++ lib/factory/DynLibManager.cpp 2014-07-01 18:19:00 +0000
@@ -18,9 +18,6 @@
#include "ClassFactory.hpp"
-
-//using namespace std;
-
CREATE_LOGGER(DynLibManager);
=== modified file 'lib/factory/DynLibManager.hpp'
--- lib/factory/DynLibManager.hpp 2010-11-07 11:46:20 +0000
+++ lib/factory/DynLibManager.hpp 2014-07-01 18:19:00 +0000
@@ -18,8 +18,9 @@
#include<yade/lib/base/Logging.hpp>
-using namespace std;
-
+using std::string;
+using std::vector;
+using std::istringstream;
class DynLibManager
{
=== modified file 'lib/import/STLReader.hpp'
--- lib/import/STLReader.hpp 2013-09-23 17:39:59 +0000
+++ lib/import/STLReader.hpp 2014-07-01 18:19:00 +0000
@@ -14,7 +14,8 @@
#include <cmath>
#include "utils.hpp"
-using namespace std;
+using std::pair;
+using std::set;
class STLReader {
public:
=== modified file 'lib/import/utils.hpp'
--- lib/import/utils.hpp 2009-01-27 02:19:40 +0000
+++ lib/import/utils.hpp 2014-07-01 18:19:00 +0000
@@ -1,12 +1,11 @@
#pragma once
#include<utility>
-using namespace std;
template<class T>
-pair<T,T> minmax(const T &a, const T &b)
+std::pair<T,T> minmax(const T &a, const T &b)
{
- return (a<b) ? pair<T,T>(a,b) : pair<T,T>(b,a);
+ return (a<b) ? std::pair<T,T>(a,b) : std::pair<T,T>(b,a);
}
template<class T>
=== modified file 'lib/multimethods/DynLibDispatcher.hpp'
--- lib/multimethods/DynLibDispatcher.hpp 2014-05-23 13:05:19 +0000
+++ lib/multimethods/DynLibDispatcher.hpp 2014-07-01 18:19:00 +0000
@@ -35,9 +35,6 @@
#include<string>
#include<ostream>
-
-using namespace std;
-
struct DynLibDispatcher_Item2D{ int ix1, ix2; std::string functorName; DynLibDispatcher_Item2D(int a, int b, std::string c):ix1(a),ix2(b),functorName(c){}; };
struct DynLibDispatcher_Item1D{ int ix1 ; std::string functorName; DynLibDispatcher_Item1D(int a, std::string c):ix1(a), functorName(c){}; };
///
@@ -182,13 +179,13 @@
shared_ptr<Executor> getExecutor(shared_ptr<BaseClass1>& arg1){
int ix1;
- if(arg1->getClassIndex()<0) throw runtime_error("No functor for type "+arg1->getClassName()+" (index "+boost::lexical_cast<string>(arg1->getClassIndex())+"), since the index is invalid (negative).");
+ if(arg1->getClassIndex()<0) throw std::runtime_error("No functor for type "+arg1->getClassName()+" (index "+boost::lexical_cast<string>(arg1->getClassIndex())+"), since the index is invalid (negative).");
if(locateMultivirtualFunctor1D(ix1,arg1)) return callBacks[ix1];
return shared_ptr<Executor>();
}
shared_ptr<Executor> getExecutor(shared_ptr<BaseClass1>& arg1, shared_ptr<BaseClass2>& arg2){
- if(arg1->getClassIndex()<0 || arg2->getClassIndex()<0) throw runtime_error("No functor for types "+arg1->getClassName()+" (index "+boost::lexical_cast<string>(arg1->getClassIndex())+") + "+arg2->getClassName()+" (index "+boost::lexical_cast<string>(arg2->getClassIndex())+"), since some of the indices is invalid (negative).");
+ if(arg1->getClassIndex()<0 || arg2->getClassIndex()<0) throw std::runtime_error("No functor for types "+arg1->getClassName()+" (index "+boost::lexical_cast<string>(arg1->getClassIndex())+") + "+arg2->getClassName()+" (index "+boost::lexical_cast<string>(arg2->getClassIndex())+"), since some of the indices is invalid (negative).");
int ix1,ix2;
if(locateMultivirtualFunctor2D(ix1,ix2,arg1,arg2)) return callBacks[ix1][ix2];
return shared_ptr<Executor>();
@@ -253,7 +250,7 @@
callBacks[index] = executor;
#if 0
- cerr <<" New class added to DynLibDispatcher 1D: " << libName << endl;
+ std::cerr <<" New class added to DynLibDispatcher 1D: " << libName << std::endl;
#endif
};
@@ -320,7 +317,7 @@
}
#if 0
- cerr <<"Added new 2d functor "<<executor->getClassName()<<", callBacks size is "<<callBacks.size()<<","<<(callBacks.size()>0?callBacks[0].size():0)<<endl;
+ std::cerr <<"Added new 2d functor "<<executor->getClassName()<<", callBacks size is "<<callBacks.size()<<","<<(callBacks.size()>0?callBacks[0].size():0)<<std::endl;
#endif
}
@@ -397,8 +394,8 @@
distTooBig=false;
if(callBacks[ix1][ix2]){
if(foundIx1!=-1 && callBacks[foundIx1][foundIx2]!=callBacks[ix1][ix2]){ // we found a callback, but there already was one at this distance and it was different from the current one
- cerr<<__FILE__<<":"<<__LINE__<<": ambiguous 2d dispatch ("<<"arg1="<<base1->getClassName()<<", arg2="<<base2->getClassName()<<", distance="<<dist<<"), dispatch matrix:"<<endl;
- dumpDispatchMatrix2D(cerr,"AMBIGUOUS: "); throw runtime_error("Ambiguous dispatch.");
+ std::cerr<<__FILE__<<":"<<__LINE__<<": ambiguous 2d dispatch ("<<"arg1="<<base1->getClassName()<<", arg2="<<base2->getClassName()<<", distance="<<dist<<"), dispatch matrix:"<<std::endl;
+ dumpDispatchMatrix2D(std::cerr,"AMBIGUOUS: "); throw std::runtime_error("Ambiguous dispatch.");
}
foundIx1=ix1; foundIx2=ix2;
callBacks[index1][index2]=callBacks[ix1][ix2]; callBacksInfo[index1][index2]=callBacksInfo[ix1][ix2];
=== modified file 'lib/serialization/Serializable.hpp'
--- lib/serialization/Serializable.hpp 2014-05-23 13:03:50 +0000
+++ lib/serialization/Serializable.hpp 2014-07-01 18:19:00 +0000
@@ -36,7 +36,6 @@
#include<yade/lib/base/Math.hpp>
-using namespace std;
// empty functions for ADL
//namespace{
template<typename T> void preLoad(T&){}; template<typename T> void postLoad(T& obj){ /* cerr<<"Generic no-op postLoad("<<typeid(T).name()<<"&) called for "<<obj.getClassName()<<std::endl; */ }
@@ -101,7 +100,7 @@
#define _DEF_READWRITE_BY_VALUE_STATIC(thisClass,attr,doc) _DEF_READWRITE_BY_VALUE(thisClass,attr,doc)
// the conditional yade::py_wrap_ref should be eliminated by compiler at compile-time, as it depends only on types, not their values
// most of this could be written with templates, including flags (ints can be template args)
-#define _DEF_READWRITE_CUSTOM(thisClass,attr) if(!(_ATTR_FLG(attr) & yade::Attr::hidden)){ bool _ro(_ATTR_FLG(attr) & Attr::readonly), _post(_ATTR_FLG(attr) & Attr::triggerPostLoad), _ref(yade::py_wrap_ref<typeof(thisClass::_ATTR_NAM(attr))>::value); std::string docStr(_ATTR_DOC(attr)); docStr+=" :yattrflags:`"+boost::lexical_cast<string>(_ATTR_FLG(attr))+"` "; \
+#define _DEF_READWRITE_CUSTOM(thisClass,attr) if(!(_ATTR_FLG(attr) & yade::Attr::hidden)){ bool _ro(_ATTR_FLG(attr) & Attr::readonly), _post(_ATTR_FLG(attr) & Attr::triggerPostLoad), _ref(yade::py_wrap_ref<typeof(thisClass::_ATTR_NAM(attr))>::value); std::string docStr(_ATTR_DOC(attr)); docStr+=" :yattrflags:`"+boost::lexical_cast<std::string>(_ATTR_FLG(attr))+"` "; \
if ( _ref && !_ro && !_post) _classObj.def_readwrite(_ATTR_NAM_STR(attr),&thisClass::_ATTR_NAM(attr),docStr.c_str()); \
else if ( _ref && !_ro && _post) _classObj.add_property(_ATTR_NAM_STR(attr),boost::python::make_getter(&thisClass::_ATTR_NAM(attr)),make_setter_postLoad<thisClass,typeof(thisClass::_ATTR_NAM(attr)),&thisClass::_ATTR_NAM(attr)>,docStr.c_str()); \
else if ( _ref && _ro) _classObj.def_readonly(_ATTR_NAM_STR(attr),&thisClass::_ATTR_NAM(attr),docStr.c_str()); \
@@ -157,7 +156,7 @@
// print warning about deprecated attribute; thisClass is type name, not string
-#define _DEPREC_WARN(thisClass,deprec) std::cerr<<"WARN: "<<getClassName()<<"."<<BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(deprec))<<" is deprecated, use "<<BOOST_PP_STRINGIZE(thisClass)<<"."<<BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(deprec))<<" instead. "; if(_DEPREC_COMMENT(deprec)){ if(std::string(_DEPREC_COMMENT(deprec))[0]=='!'){ std::cerr<<endl; throw std::invalid_argument(BOOST_PP_STRINGIZE(thisClass) "." BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(deprec)) " is deprecated; throwing exception requested. Reason: " _DEPREC_COMMENT(deprec));} else std::cerr<<"("<<_DEPREC_COMMENT(deprec)<<")"; } std::cerr<<std::endl;
+#define _DEPREC_WARN(thisClass,deprec) std::cerr<<"WARN: "<<getClassName()<<"."<<BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(deprec))<<" is deprecated, use "<<BOOST_PP_STRINGIZE(thisClass)<<"."<<BOOST_PP_STRINGIZE(_DEPREC_NEWNAME(deprec))<<" instead. "; if(_DEPREC_COMMENT(deprec)){ if(std::string(_DEPREC_COMMENT(deprec))[0]=='!'){ std::cerr<<std::endl; throw std::invalid_argument(BOOST_PP_STRINGIZE(thisClass) "." BOOST_PP_STRINGIZE(_DEPREC_OLDNAME(deprec)) " is deprecated; throwing exception requested. Reason: " _DEPREC_COMMENT(deprec));} else std::cerr<<"("<<_DEPREC_COMMENT(deprec)<<")"; } std::cerr<<std::endl;
// getters for individual fields
#define _ATTR_TYP(s) BOOST_PP_TUPLE_ELEM(5,0,s)
@@ -290,7 +289,7 @@
virtual void pyHandleCustomCtorArgs(boost::python::tuple& args, boost::python::dict& kw){ return; }
//! string representation of this object
- std::string pyStr() { return "<"+getClassName()+" instance at "+boost::lexical_cast<string>(this)+">"; }
+ std::string pyStr() { return "<"+getClassName()+" instance at "+boost::lexical_cast<std::string>(this)+">"; }
REGISTER_CLASS_NAME(Serializable);
REGISTER_BASE_CLASS_NAME(Factorable);
@@ -303,7 +302,7 @@
shared_ptr<T> instance;
instance=shared_ptr<T>(new T);
instance->pyHandleCustomCtorArgs(t,d); // can change t and d in-place
- if(boost::python::len(t)>0) throw runtime_error("Zero (not "+boost::lexical_cast<string>(boost::python::len(t))+") non-keyword constructor arguments required [in Serializable_ctor_kwAttrs; Serializable::pyHandleCustomCtorArgs might had changed it after your call].");
+ if(boost::python::len(t)>0) throw std::runtime_error("Zero (not "+boost::lexical_cast<std::string>(boost::python::len(t))+") non-keyword constructor arguments required [in Serializable_ctor_kwAttrs; Serializable::pyHandleCustomCtorArgs might had changed it after your call].");
if(boost::python::len(d)>0){ instance->pyUpdateAttrs(d); instance->callPostLoad(); }
return instance;
}
=== modified file 'lib/smoothing/WeightedAverage2d.hpp'
--- lib/smoothing/WeightedAverage2d.hpp 2014-05-23 13:03:50 +0000
+++ lib/smoothing/WeightedAverage2d.hpp 2014-07-01 18:19:00 +0000
@@ -27,7 +27,8 @@
#ifndef FOREACH
#define FOREACH BOOST_FOREACH
#endif
-using namespace std;
+
+using std::vector;
#include<yade/lib/base/Math.hpp>
@@ -52,7 +53,7 @@
Vector2i xy2cell(Vector2r xy, bool* inGrid=NULL) const {
Vector2i ret((int)(floor((xy[0]-lo[0])/cellSizes[0])),(int)(floor((xy[1]-lo[1])/cellSizes[1])));
if(ret[0]<0 || ret[0]>=nCells[0] || ret[1]<0 || ret[1]>=nCells[1]){
- if(inGrid) *inGrid=false; else throw std::invalid_argument("Cell coordinates outside grid (xy="+boost::lexical_cast<string>(xy[0])+","+boost::lexical_cast<string>(xy[1])+", computed cell coordinates "+boost::lexical_cast<string>(ret[0])+","+boost::lexical_cast<string>(ret[1])+").");
+ if(inGrid) *inGrid=false; else throw std::invalid_argument("Cell coordinates outside grid (xy="+boost::lexical_cast<std::string>(xy[0])+","+boost::lexical_cast<std::string>(xy[1])+", computed cell coordinates "+boost::lexical_cast<std::string>(ret[0])+","+boost::lexical_cast<std::string>(ret[1])+").");
} else {if(inGrid) *inGrid=true;}
return ret;
}
@@ -88,8 +89,8 @@
}
// graphical representation of a set of filtered cells
- string dumpGrid(vector<Vector2i> v){
- vector<vector<bool> > vvb; string ret; vvb.resize(nCells[0]); for(size_t i=0; i<(size_t)nCells[0]; i++) vvb[i].resize(nCells[1],false); FOREACH(Vector2i& vv, v) vvb[vv[0]][vv[1]]=true;
+ std::string dumpGrid(vector<Vector2i> v){
+ vector<vector<bool> > vvb; std::string ret; vvb.resize(nCells[0]); for(size_t i=0; i<(size_t)nCells[0]; i++) vvb[i].resize(nCells[1],false); FOREACH(Vector2i& vv, v) vvb[vv[0]][vv[1]]=true;
for(int cy=nCells[1]-1; cy>=0; cy--){ ret+="|"; for(int cx=0; cx<nCells[0]; cx++){ ret+=vvb[cx][cy]?"@":"."; } ret+="|\n"; }
return ret;
}
=== modified file 'lib/triangulation/FlowBoundingSphere.hpp'
--- lib/triangulation/FlowBoundingSphere.hpp 2014-06-04 17:19:50 +0000
+++ lib/triangulation/FlowBoundingSphere.hpp 2014-07-01 18:19:00 +0000
@@ -17,7 +17,6 @@
typedef pair<pair<int,int>, vector<double> > Constriction;
-using namespace std;
namespace CGT {
template<class _Tesselation>
=== modified file 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp 2014-06-16 14:02:20 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp 2014-07-01 18:19:00 +0000
@@ -31,8 +31,6 @@
// #define USE_FAST_MATH 1
-
-using namespace std;
namespace CGT
{
@@ -1254,7 +1252,7 @@
unsigned int id2 = vi2.id();
edgeIds.push_back(pair<const VertexInfo*,const VertexInfo*>(&vi1,&vi2));
//For persistant edges, we must transfer the lub. force value from the older triangulation structure
- if (id1>id2) swap(id1,id2);
+ if (id1>id2) std::swap(id1,id2);
unsigned int i=0;
//Look for the pair (id1,id2) in lubPairs
while (i<lubPairs[id1].size()) {
=== modified file 'lib/triangulation/FlowBoundingSphereLinSolv.hpp'
--- lib/triangulation/FlowBoundingSphereLinSolv.hpp 2014-06-04 17:19:50 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.hpp 2014-07-01 18:19:00 +0000
@@ -30,8 +30,6 @@
///_____ Declaration ____
-using namespace std;
-
namespace CGT {
template<class _Tesselation, class FlowType=FlowBoundingSphere<_Tesselation> >
=== modified file 'lib/triangulation/FlowBoundingSphereLinSolv.ipp'
--- lib/triangulation/FlowBoundingSphereLinSolv.ipp 2014-03-21 18:47:45 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.ipp 2014-07-01 18:19:00 +0000
@@ -39,8 +39,6 @@
namespace CGT
{
-using namespace std;
-
#ifdef PARDISO
#ifdef AIX
#define F77_FUNC(func) func
@@ -989,4 +987,4 @@
} //namespace CGT
-#endif //FLOW_ENGINE
\ No newline at end of file
+#endif //FLOW_ENGINE
=== modified file 'lib/triangulation/Network.ipp'
--- lib/triangulation/Network.ipp 2014-05-23 13:03:50 +0000
+++ lib/triangulation/Network.ipp 2014-07-01 18:19:00 +0000
@@ -14,8 +14,6 @@
#define FAST
-
-using namespace std;
namespace CGT {
// template<class Tesselation> const double Network<Tesselation>::FAR = 50000;
=== modified file 'lib/triangulation/PeriodicFlowLinSolv.hpp'
--- lib/triangulation/PeriodicFlowLinSolv.hpp 2014-03-21 18:47:45 +0000
+++ lib/triangulation/PeriodicFlowLinSolv.hpp 2014-07-01 18:19:00 +0000
@@ -11,8 +11,6 @@
#ifdef FLOW_ENGINE
-using namespace std;
-
namespace CGT {
template<class _Tesselation>
=== modified file 'lib/triangulation/PeriodicFlowLinSolv.ipp'
--- lib/triangulation/PeriodicFlowLinSolv.ipp 2014-03-21 18:47:45 +0000
+++ lib/triangulation/PeriodicFlowLinSolv.ipp 2014-07-01 18:19:00 +0000
@@ -24,8 +24,6 @@
namespace CGT
{
-using namespace std;
-
#ifdef PARDISO
#ifdef AIX
#define F77_FUNC(func) func
@@ -251,4 +249,4 @@
} //namespace CGT
-#endif //FLOW_ENGINE
\ No newline at end of file
+#endif //FLOW_ENGINE
=== modified file 'lib/triangulation/Tenseur3.cpp'
--- lib/triangulation/Tenseur3.cpp 2014-03-21 18:45:24 +0000
+++ lib/triangulation/Tenseur3.cpp 2014-07-01 18:19:00 +0000
@@ -2,7 +2,6 @@
#include "Tenseur3.h"
#include "RegularTriangulation.h"
-using namespace std;
namespace CGT {
Real Tens::Norme2(void)
@@ -272,7 +271,7 @@
{
os << T(j,i) << " ";
}
- os << endl;
+ os << std::endl;
}
return os;
}
@@ -287,7 +286,7 @@
{
os << T(j,i) << " ";
}
- os << endl;
+ os << std::endl;
}
return os;
}
@@ -300,9 +299,9 @@
{
for (int i=1; i<4; i++)
{
- os << (Real) T(j,i) << (string) " ";
+ os << (Real) T(j,i) << (std::string) " ";
}
- os << endl;
+ os << std::endl;
}
return os;
}
=== modified file 'lib/triangulation/Tesselation.ipp'
--- lib/triangulation/Tesselation.ipp 2014-03-21 18:47:45 +0000
+++ lib/triangulation/Tesselation.ipp 2014-07-01 18:19:00 +0000
@@ -6,10 +6,18 @@
* GNU General Public License v2 or later. See file LICENSE for details. *
*************************************************************************/
-using namespace std;
-
//FIXME: handle that a better way
#define MAX_ID 200000
+using std::endl;
+using std::cout;
+using std::cerr;
+using std::vector;
+using std::string;
+using std::min;
+using std::max;
+using std::ifstream;
+using std::ofstream;
+using std::pair;
namespace CGT {
@@ -322,4 +330,4 @@
return true;
}
-} //namespace CGT
\ No newline at end of file
+} //namespace CGT
=== modified file 'lib/triangulation/Timer.cpp'
--- lib/triangulation/Timer.cpp 2010-08-15 04:19:57 +0000
+++ lib/triangulation/Timer.cpp 2014-07-01 18:19:00 +0000
@@ -1,8 +1,6 @@
#include <string.h>
#include "Timer.h"
-using namespace std;
-
Real_timer::Real_timer() : T1(0), T2(0), elapsed(0.0), started(0.0), interv(0), running(true)
{
T1 = clock();
@@ -52,7 +50,7 @@
return T2;
}
-void Real_timer::top(string Texte)
+void Real_timer::top(std::string Texte)
{
clock_t T3 = clock();
double r = (double) (T3 - T1)/ CLOCKS_PER_SEC;
=== modified file 'lib/triangulation/TriaxialState.h'
--- lib/triangulation/TriaxialState.h 2014-03-21 18:45:24 +0000
+++ lib/triangulation/TriaxialState.h 2014-07-01 18:19:00 +0000
@@ -21,7 +21,6 @@
*/
namespace CGT {
-using namespace std;
class TriaxialState
{
=== modified file 'lib/triangulation/basicVTKwritter.cpp'
--- lib/triangulation/basicVTKwritter.cpp 2012-01-11 21:30:18 +0000
+++ lib/triangulation/basicVTKwritter.cpp 2014-07-01 18:19:00 +0000
@@ -1,10 +1,11 @@
#include "basicVTKwritter.hpp"
-using namespace std;
+using std::endl;
+using std::cerr;
bool basicVTKwritter::open(const char * filename, const char * comment)
{
- file.open(filename,ios_base::out);
+ file.open(filename,std::ios_base::out);
if (!file)
{
cerr << "Cannot open file [" << filename << "]" << endl;
=== modified file 'pkg/common/Bo1_Box_Aabb.cpp'
--- pkg/common/Bo1_Box_Aabb.cpp 2010-11-07 11:46:20 +0000
+++ pkg/common/Bo1_Box_Aabb.cpp 2014-07-01 18:19:00 +0000
@@ -20,7 +20,7 @@
if(!bv){ bv=shared_ptr<Bound>(new Aabb); }
Aabb* aabb=static_cast<Aabb*>(bv.get());
- if(scene->isPeriodic && scene->cell->hasShear()) throw logic_error(__FILE__ "Boxes not (yet?) supported in sheared cell.");
+ if(scene->isPeriodic && scene->cell->hasShear()) throw std::logic_error(__FILE__ "Boxes not (yet?) supported in sheared cell.");
Matrix3r r=se3.orientation.toRotationMatrix();
Vector3r halfSize(Vector3r::Zero());
=== modified file 'pkg/common/Collider.cpp'
--- pkg/common/Collider.cpp 2014-07-01 18:14:18 +0000
+++ pkg/common/Collider.cpp 2014-07-01 18:19:00 +0000
@@ -28,7 +28,7 @@
void Collider::pyHandleCustomCtorArgs(boost::python::tuple& t, boost::python::dict& d){
if(boost::python::len(t)==0) return; // nothing to do
- if(boost::python::len(t)!=1) throw invalid_argument(("Collider optionally takes exactly one list of BoundFunctor's as non-keyword argument for constructor ("+boost::lexical_cast<string>(boost::python::len(t))+" non-keyword ards given instead)").c_str());
+ if(boost::python::len(t)!=1) throw std::invalid_argument(("Collider optionally takes exactly one list of BoundFunctor's as non-keyword argument for constructor ("+boost::lexical_cast<string>(boost::python::len(t))+" non-keyword ards given instead)").c_str());
typedef std::vector<shared_ptr<BoundFunctor> > vecBound;
vecBound vb=boost::python::extract<vecBound>(t[0])();
FOREACH(shared_ptr<BoundFunctor> bf, vb) this->boundDispatcher->add(bf);
=== modified file 'pkg/common/Cylinder.cpp'
--- pkg/common/Cylinder.cpp 2014-05-06 15:32:52 +0000
+++ pkg/common/Cylinder.cpp 2014-07-01 18:19:00 +0000
@@ -8,6 +8,11 @@
#endif
#include<yade/pkg/common/Aabb.hpp>
+using std::cout;
+using std::cerr;
+using std::endl;
+using std::min;
+using std::max;
Cylinder::~Cylinder(){}
ChainedCylinder::~ChainedCylinder(){}
ChainedState::~ChainedState(){}
=== modified file 'pkg/common/Dispatching.cpp'
--- pkg/common/Dispatching.cpp 2014-04-16 10:30:23 +0000
+++ pkg/common/Dispatching.cpp 2014-07-01 18:19:00 +0000
@@ -17,7 +17,7 @@
updateScenePtr();
shared_ptr<BodyContainer>& bodies = scene->bodies;
const long numBodies=(long)bodies->size();
- #pragma omp parallel for num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
+ #pragma omp parallel for num_threads(ompThreads>0 ? std::min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for(int id=0; id<numBodies; id++){
if(!bodies->exists(id)) continue; // don't delete this check - Janek
const shared_ptr<Body>& b=(*bodies)[id];
@@ -36,11 +36,11 @@
Real& sweepLength = b->bound->sweepLength;
if (targetInterv>=0) {
Vector3r disp = b->state->pos-b->bound->refPos;
- Real dist = max(abs(disp[0]),max(abs(disp[1]),abs(disp[2])));
+ Real dist = std::max(abs(disp[0]),std::max(abs(disp[1]),abs(disp[2])));
if (dist){
Real newLength = dist*targetInterv/(scene->iter-b->bound->lastUpdateIter);
- newLength = max(0.9*sweepLength,newLength);//don't decrease size too fast to prevent time consuming oscillations
- sweepLength=max(minSweepDistFactor*sweepDist,min(newLength,sweepDist));}
+ newLength = std::max(0.9*sweepLength,newLength);//don't decrease size too fast to prevent time consuming oscillations
+ sweepLength=std::max(minSweepDistFactor*sweepDist,std::min(newLength,sweepDist));}
else sweepLength=0;
} else sweepLength=sweepDist;
}
@@ -84,12 +84,12 @@
// FIXME: this code is more or less duplicated from InteractionLoop :-(
bool swap=false;
I->functorCache.geom=getFunctor2D(b1->shape,b2->shape,swap);
- if(!I->functorCache.geom) throw invalid_argument("IGeomDispatcher::explicitAction could not dispatch for given types ("+b1->shape->getClassName()+","+b2->shape->getClassName()+").");
+ if(!I->functorCache.geom) throw std::invalid_argument("IGeomDispatcher::explicitAction could not dispatch for given types ("+b1->shape->getClassName()+","+b2->shape->getClassName()+").");
if(swap){I->swapOrder();}
const shared_ptr<Body>& b1=Body::byId(I->getId1(),scene);
const shared_ptr<Body>& b2=Body::byId(I->getId2(),scene);
bool succ=I->functorCache.geom->go(b1->shape,b2->shape,*b1->state,*b2->state,shift2,/*force*/true,I);
- if(!succ) throw logic_error("Functor "+I->functorCache.geom->getClassName()+"::go returned false, even if asked to force IGeom creation. Please report bug.");
+ if(!succ) throw std::logic_error("Functor "+I->functorCache.geom->getClassName()+"::go returned false, even if asked to force IGeom creation. Please report bug.");
return I;
} else {
shared_ptr<Interaction> I(new Interaction(b1->getId(),b2->getId()));
@@ -144,11 +144,11 @@
void IPhysDispatcher::explicitAction(shared_ptr<Material>& pp1, shared_ptr<Material>& pp2, shared_ptr<Interaction>& I){
updateScenePtr();
- if(!I->geom) throw invalid_argument(string(__FILE__)+": explicitAction received interaction without geom.");
+ if(!I->geom) throw std::invalid_argument(string(__FILE__)+": explicitAction received interaction without geom.");
if(!I->functorCache.phys){
bool dummy;
I->functorCache.phys=getFunctor2D(pp1,pp2,dummy);
- if(!I->functorCache.phys) throw invalid_argument("IPhysDispatcher::explicitAction did not find a suitable dispatch for types "+pp1->getClassName()+" and "+pp2->getClassName());
+ if(!I->functorCache.phys) throw std::invalid_argument("IPhysDispatcher::explicitAction did not find a suitable dispatch for types "+pp1->getClassName()+" and "+pp2->getClassName());
I->functorCache.phys->go(pp1,pp2,I);
}
}
=== modified file 'pkg/common/Gl1_Sphere.cpp'
--- pkg/common/Gl1_Sphere.cpp 2013-08-23 15:21:20 +0000
+++ pkg/common/Gl1_Sphere.cpp 2014-07-01 18:19:00 +0000
@@ -137,7 +137,7 @@
glNewList(glGlutSphereList,GL_COMPILE);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
- glutSolidSphere(1.0,max(quality*glutSlices,(Real)2.),max(quality*glutStacks,(Real)3.));
+ glutSolidSphere(1.0,std::max(quality*glutSlices,(Real)2.),std::max(quality*glutStacks,(Real)3.));
glEndList();
}
=== modified file 'pkg/common/GravityEngines.cpp'
--- pkg/common/GravityEngines.cpp 2014-06-05 13:19:44 +0000
+++ pkg/common/GravityEngines.cpp 2014-07-01 18:19:00 +0000
@@ -59,7 +59,7 @@
Vector2i HdapsGravityEngine::readSysfsFile(const string& name){
char buf[256];
- ifstream f(name.c_str());
+ std::ifstream f(name.c_str());
if(!f.is_open()) throw std::runtime_error(("HdapsGravityEngine: unable to open file "+name).c_str());
f.read(buf,256);f.close();
const boost::regex re("\\(([0-9+-]+),([0-9+-]+)\\).*");
=== modified file 'pkg/common/Grid.cpp'
--- pkg/common/Grid.cpp 2014-02-12 13:18:59 +0000
+++ pkg/common/Grid.cpp 2014-07-01 18:19:00 +0000
@@ -6,7 +6,8 @@
*************************************************************************/
#include "Grid.hpp"
-
+using std::min;
+using std::max;
//!################## SHAPES #####################
GridNode::~GridNode(){}
@@ -112,8 +113,8 @@
}
else {//should never happen
k=0;m=0;
- cout<<"Error in Ig2_GridConnection_GridConnection_GridCoGridCoGeom : det=="<<det<<endl;
- cout<<"Details : N="<<N<<" b0="<<b0<<" b1="<<b1<<" a="<<a<<" b="<<b<<endl;
+ std::cout<<"Error in Ig2_GridConnection_GridConnection_GridCoGridCoGeom : det=="<<det<<endl;
+ std::cout<<"Details : N="<<N<<" b0="<<b0<<" b1="<<b1<<" a="<<a<<" b="<<b<<endl;
}
}
else{ //this is a special case for perfectly colinear vectors ("a" and "b")
=== modified file 'pkg/common/InsertionSortCollider.cpp'
--- pkg/common/InsertionSortCollider.cpp 2014-07-01 18:14:18 +0000
+++ pkg/common/InsertionSortCollider.cpp 2014-07-01 18:19:00 +0000
@@ -16,8 +16,6 @@
#include<omp.h>
#endif
-using namespace std;
-
YADE_PLUGIN((InsertionSortCollider))
CREATE_LOGGER(InsertionSortCollider);
@@ -89,7 +87,7 @@
for (int kk=0; kk<ompThreads; kk++) newInteractions[kk].reserve(100);
/// First sort, independant in each chunk
- #pragma omp parallel for schedule(dynamic,1) num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
+ #pragma omp parallel for schedule(dynamic,1) num_threads(ompThreads>0 ? std::min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for (unsigned k=0; k<nChunks;k++) {
int threadNum = omp_get_thread_num();
for(long i=chunks[k]+1; i<chunks[k+1]; i++){
@@ -112,7 +110,7 @@
///If sorting requires to move a bound past half-chunk, the algorithm is not thread safe,
/// if it happens we roll-back and run the 1-thread sort + send warning
bool parallelFailed=false;
- #pragma omp parallel for schedule(dynamic,1) num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
+ #pragma omp parallel for schedule(dynamic,1) num_threads(ompThreads>0 ? std::min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for (unsigned k=1; k<nChunks;k++) {
int threadNum = omp_get_thread_num();
@@ -153,7 +151,7 @@
vector<Body::id_t> InsertionSortCollider::probeBoundingVolume(const Bound& bv){
- if(periodic){ throw invalid_argument("InsertionSortCollider::probeBoundingVolume: handling periodic boundary not implemented."); }
+ if(periodic){ throw std::invalid_argument("InsertionSortCollider::probeBoundingVolume: handling periodic boundary not implemented."); }
vector<Body::id_t> ret;
for( vector<Bounds>::iterator
it=BB[0].vec.begin(),et=BB[0].vec.end(); it < et; ++it)
@@ -248,7 +246,7 @@
if(!b || !b->shape) continue;
Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
if(!s) continue;
- minR=min(s->radius,minR);
+ minR=std::min(s->radius,minR);
}
if (isinf(minR)) LOG_ERROR("verletDist is set to 0 because no spheres were found. It will result in suboptimal performances, consider setting a positive verletDist in your script.");
// if no spheres, disable stride
@@ -290,7 +288,7 @@
ISC_CHECKPOINT("bound");
// copy bounds along given axis into our arrays
- #pragma omp parallel for schedule(guided) num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
+ #pragma omp parallel for schedule(guided) num_threads(ompThreads>0 ? std::min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for(long i=0; i<2*nBodies; i++){
// const long cacheIter = scene->iter;
for(int j=0; j<3; j++){
=== modified file 'pkg/common/InsertionSortCollider.hpp'
--- pkg/common/InsertionSortCollider.hpp 2014-05-23 13:05:19 +0000
+++ pkg/common/InsertionSortCollider.hpp 2014-07-01 18:19:00 +0000
@@ -136,7 +136,7 @@
// normalize given index to the right range (wraps around)
long norm(long i) const { if(i<0) i+=size; long ret=i%size; assert(ret>=0 && ret<size); return ret;}
VecBounds(): axis(-1), size(0), loIdx(0){}
- void dump(ostream& os){ string ret; for(size_t i=0; i<vec.size(); i++) os<<((long)i==loIdx?"@@ ":"")<<vec[i].coord<<"(id="<<vec[i].id<<","<<(vec[i].flags.isMin?"min":"max")<<",p"<<vec[i].period<<") "; os<<endl;}
+ void dump(std::ostream& os){ string ret; for(size_t i=0; i<vec.size(); i++) os<<((long)i==loIdx?"@@ ":"")<<vec[i].coord<<"(id="<<vec[i].id<<","<<(vec[i].flags.isMin?"min":"max")<<",p"<<vec[i].period<<") "; os<<std::endl;}
};
private:
//! storage for bounds
=== modified file 'pkg/common/InteractionLoop.cpp'
--- pkg/common/InteractionLoop.cpp 2014-06-06 19:26:47 +0000
+++ pkg/common/InteractionLoop.cpp 2014-07-01 18:19:00 +0000
@@ -5,7 +5,7 @@
void InteractionLoop::pyHandleCustomCtorArgs(boost::python::tuple& t, boost::python::dict& d){
if(boost::python::len(t)==0) return; // nothing to do
- if(boost::python::len(t)!=3) throw invalid_argument("Exactly 3 lists of functors must be given");
+ if(boost::python::len(t)!=3) throw std::invalid_argument("Exactly 3 lists of functors must be given");
// parse custom arguments (3 lists) and do in-place modification of args
typedef std::vector<shared_ptr<IGeomFunctor> > vecGeom;
typedef std::vector<shared_ptr<IPhysFunctor> > vecPhys;
@@ -53,7 +53,7 @@
#ifdef YADE_OPENMP
const long size=scene->interactions->size();
- #pragma omp parallel for schedule(guided) num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
+ #pragma omp parallel for schedule(guided) num_threads(ompThreads>0 ? std::min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for(long i=0; i<size; i++){
const shared_ptr<Interaction>& I=(*scene->interactions)[i];
#else
=== modified file 'pkg/common/MatchMaker.hpp'
--- pkg/common/MatchMaker.hpp 2010-12-09 15:02:38 +0000
+++ pkg/common/MatchMaker.hpp 2014-07-01 18:19:00 +0000
@@ -15,8 +15,8 @@
#if 1
Real fbZero(Real v1, Real v2) const{ return 0.; }
Real fbAvg(Real v1, Real v2) const{ return (v1+v2)/2.; }
- Real fbMin(Real v1, Real v2) const{ return min(v1,v2); }
- Real fbMax(Real v1, Real v2) const{ return max(v1,v2); }
+ Real fbMin(Real v1, Real v2) const{ return std::min(v1,v2); }
+ Real fbMax(Real v1, Real v2) const{ return std::max(v1,v2); }
Real fbHarmAvg(Real v1, Real v2) const { return 2*v1*v2/(v1+v2); }
Real fbVal(Real v1, Real v2) const { return val; }
Real (MatchMaker::*fbPtr)(Real,Real) const;
=== modified file 'pkg/common/PersistentTriangulationCollider.cpp'
--- pkg/common/PersistentTriangulationCollider.cpp 2014-03-21 18:45:24 +0000
+++ pkg/common/PersistentTriangulationCollider.cpp 2014-07-01 18:19:00 +0000
@@ -16,24 +16,6 @@
#include<yade/pkg/common/Sphere.hpp>
#include<yade/pkg/common/ElastMat.hpp>
-
-using namespace std;
-
-// PersistentTriangulationCollider::PersistentTriangulationCollider() : Collider()
-// {
-// haveDistantTransient=false;
-// isTriangulated = false;
-// Tes = new ( TesselationWrapper );
-//
-// nbObjects=0;
-// xBounds.clear();
-// yBounds.clear();
-// zBounds.clear();
-// minima.clear();
-// maxima.clear();
-// }
-
-
PersistentTriangulationCollider::~PersistentTriangulationCollider()
{
delete Tes;
=== modified file 'pkg/common/Recorder.cpp'
--- pkg/common/Recorder.cpp 2014-05-23 13:05:19 +0000
+++ pkg/common/Recorder.cpp 2014-07-01 18:19:00 +0000
@@ -9,7 +9,7 @@
std::string fileTemp = file;
if (addIterNum) fileTemp+="-" + boost::lexical_cast<string>(scene->iter);
- if(fileTemp.empty()) throw ios_base::failure(__FILE__ ": Empty filename.");
- out.open(fileTemp.c_str(), truncate ? fstream::trunc : fstream::app);
- if(!out.good()) throw ios_base::failure(__FILE__ ": I/O error opening file `"+fileTemp+"'.");
+ if(fileTemp.empty()) throw std::ios_base::failure(__FILE__ ": Empty filename.");
+ out.open(fileTemp.c_str(), truncate ? std::fstream::trunc : std::fstream::app);
+ if(!out.good()) throw std::ios_base::failure(__FILE__ ": I/O error opening file `"+fileTemp+"'.");
}
=== modified file 'pkg/common/ResetRandomPosition.hpp'
--- pkg/common/ResetRandomPosition.hpp 2012-03-21 08:38:49 +0000
+++ pkg/common/ResetRandomPosition.hpp 2014-07-01 18:19:00 +0000
@@ -14,8 +14,6 @@
#include <vector>
#include <string>
-using namespace std;
-
/// @brief Produces spheres over the course of a simulation.
class ResetRandomPosition : public PeriodicEngine {
public:
=== modified file 'pkg/common/SpatialQuickSortCollider.hpp'
--- pkg/common/SpatialQuickSortCollider.hpp 2010-11-12 08:03:16 +0000
+++ pkg/common/SpatialQuickSortCollider.hpp 2014-07-01 18:19:00 +0000
@@ -11,8 +11,6 @@
#include <yade/core/InteractionContainer.hpp>
#include <vector>
-using namespace std;
-
class SpatialQuickSortCollider : public Collider {
protected:
=== modified file 'pkg/common/Wall.cpp'
--- pkg/common/Wall.cpp 2014-01-13 09:23:51 +0000
+++ pkg/common/Wall.cpp 2014-07-01 18:19:00 +0000
@@ -15,7 +15,7 @@
Wall* wall=static_cast<Wall*>(cm.get());
if(!bv){ bv=shared_ptr<Bound>(new Aabb); }
Aabb* aabb=static_cast<Aabb*>(bv.get());
- if(scene->isPeriodic && scene->cell->hasShear()) throw logic_error(__FILE__ "Walls not supported in sheared cell.");
+ if(scene->isPeriodic && scene->cell->hasShear()) throw std::logic_error(__FILE__ "Walls not supported in sheared cell.");
const Real& inf=std::numeric_limits<Real>::infinity();
aabb->min=Vector3r(-inf,-inf,-inf); aabb->min[wall->axis]=se3.position[wall->axis];
aabb->max=Vector3r( inf, inf, inf); aabb->max[wall->axis]=se3.position[wall->axis];
=== modified file 'pkg/common/ZECollider.cpp'
--- pkg/common/ZECollider.cpp 2014-07-01 18:14:18 +0000
+++ pkg/common/ZECollider.cpp 2014-07-01 18:19:00 +0000
@@ -14,8 +14,6 @@
#include<vector>
#include<boost/static_assert.hpp>
-using namespace std;
-
YADE_PLUGIN((ZECollider))
CREATE_LOGGER(ZECollider);
@@ -69,7 +67,7 @@
if(!b || !b->shape) continue;
Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
if(!s) continue;
- minR=min(s->radius,minR);
+ minR=std::min(s->radius,minR);
}
// if no spheres, disable stride
verletDist=isinf(minR) ? 0 : abs(verletDist)*minR;
=== modified file 'pkg/dem/CapillaryTriaxialTest.cpp'
--- pkg/dem/CapillaryTriaxialTest.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/CapillaryTriaxialTest.cpp 2014-07-01 18:19:00 +0000
@@ -53,9 +53,7 @@
#include <boost/random/variate_generator.hpp>
#include <boost/random/normal_distribution.hpp>
-using namespace std;
-
-typedef pair<Vector3r, Real> BasicSphere;
+typedef std::pair<Vector3r, Real> BasicSphere;
//! generate a list of non-overlapping spheres
string GenerateCloud_water(vector<BasicSphere>& sphere_list, Vector3r lowerCorner, Vector3r upperCorner, long number, Real rad_std_dev, Real porosity);
@@ -180,7 +178,7 @@
if(importFilename!=""){
vector<boost::tuple<Vector3r,Real,int> >sphereListClumpInfo = Shop::loadSpheresFromFile(importFilename,lowerCorner,upperCorner);
FOREACH(tupleVector3rRealInt t, sphereListClumpInfo){
- sphere_list.push_back(make_pair(boost::get<0>(t),boost::get<1>(t)));
+ sphere_list.push_back(std::make_pair(boost::get<0>(t),boost::get<1>(t)));
};
}
else message+=GenerateCloud_water(sphere_list, lowerCorner, upperCorner, numberOfGrains, Rdispersion, 0.75);
=== modified file 'pkg/dem/CapillaryTriaxialTest.hpp'
--- pkg/dem/CapillaryTriaxialTest.hpp 2013-05-30 20:17:45 +0000
+++ pkg/dem/CapillaryTriaxialTest.hpp 2014-07-01 18:19:00 +0000
@@ -58,7 +58,7 @@
void createSphere(shared_ptr<Body>& body, Vector3r position, Real radius,bool big,bool dynamic);
void createActors(shared_ptr<Scene>& scene);
void positionRootBody(shared_ptr<Scene>& scene);
- typedef pair<Vector3r, Real> BasicSphere;
+ typedef std::pair<Vector3r, Real> BasicSphere;
public :
~CapillaryTriaxialTest ();
bool generate(std::string& message);
=== modified file 'pkg/dem/CohesiveTriaxialTest.cpp'
--- pkg/dem/CohesiveTriaxialTest.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/CohesiveTriaxialTest.cpp 2014-07-01 18:19:00 +0000
@@ -49,10 +49,7 @@
#include <boost/random/variate_generator.hpp>
#include <boost/random/normal_distribution.hpp>
-using namespace std;
-
-
-typedef pair<Vector3r, Real> BasicSphere;
+typedef std::pair<Vector3r, Real> BasicSphere;
//! make a list of spheres non-overlapping sphere
string GenerateCloud_cohesive(vector<BasicSphere>& sphere_list, Vector3r lowerCorner, Vector3r upperCorner, long number, Real rad_std_dev, Real porosity);
@@ -178,7 +175,7 @@
if(importFilename!=""){
vector<boost::tuple<Vector3r,Real,int> >sphereListClumpInfo = Shop::loadSpheresFromFile(importFilename,lowerCorner,upperCorner);
FOREACH(tupleVector3rRealInt t, sphereListClumpInfo){
- sphere_list.push_back(make_pair(boost::get<0>(t),boost::get<1>(t)));
+ sphere_list.push_back(std::make_pair(boost::get<0>(t),boost::get<1>(t)));
};
}
else message=GenerateCloud_cohesive(sphere_list, lowerCorner, upperCorner, numberOfGrains, radiusDeviation, 0.75);
=== modified file 'pkg/dem/Disp2DPropLoadEngine.cpp'
--- pkg/dem/Disp2DPropLoadEngine.cpp 2014-05-23 13:05:19 +0000
+++ pkg/dem/Disp2DPropLoadEngine.cpp 2014-07-01 18:19:00 +0000
@@ -13,6 +13,9 @@
#include<yade/core/Scene.hpp>
#include<yade/lib/base/Math.hpp>
+using std::endl;
+using std::cout;
+using std::cerr;
YADE_PLUGIN((Disp2DPropLoadEngine));
=== modified file 'pkg/dem/DomainLimiter.cpp'
--- pkg/dem/DomainLimiter.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/DomainLimiter.cpp 2014-07-01 18:19:00 +0000
@@ -39,8 +39,8 @@
void LawTester::postLoad(LawTester&){
if(ids.size()==0) return; // uninitialized object, don't do nothing at all
if(ids.size()!=2) throw std::invalid_argument("LawTester.ids: exactly two values must be given.");
- if(disPath.empty() && rotPath.empty()) throw invalid_argument("LawTester.{disPath,rotPath}: at least one point must be given.");
- if(pathSteps.empty()) throw invalid_argument("LawTester.pathSteps: at least one value must be given.");
+ if(disPath.empty() && rotPath.empty()) throw std::invalid_argument("LawTester.{disPath,rotPath}: at least one point must be given.");
+ if(pathSteps.empty()) throw std::invalid_argument("LawTester.pathSteps: at least one value must be given.");
size_t pathSize=max(disPath.size(),rotPath.size());
// update path points
_path.clear(); _path.push_back(Vector6r::Zero());
@@ -306,7 +306,7 @@
void GlExtra_OctreeCubes::postLoad(GlExtra_OctreeCubes&){
if(boxesFile.empty()) return;
boxes.clear();
- ifstream txt(boxesFile.c_str());
+ std::ifstream txt(boxesFile.c_str());
while(!txt.eof()){
Real data[8];
for(int i=0; i<8; i++){ if(i<7 && txt.eof()) goto done; txt>>data[i]; }
=== modified file 'pkg/dem/FacetTopologyAnalyzer.hpp'
--- pkg/dem/FacetTopologyAnalyzer.hpp 2010-10-13 16:23:08 +0000
+++ pkg/dem/FacetTopologyAnalyzer.hpp 2014-07-01 18:19:00 +0000
@@ -2,6 +2,9 @@
#pragma once
#include<yade/core/GlobalEngine.hpp>
#include<yade/core/Interaction.hpp>
+
+using std::min;
+using std::max;
/*! Initializer for filling adjacency geometry data for facets.
*
* Common vertices and common edges are identified and mutual angle between facet faces
=== modified file 'pkg/dem/GeneralIntegratorInsertionSortCollider.cpp'
--- pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2014-07-01 18:19:00 +0000
@@ -12,8 +12,6 @@
#include<vector>
#include<boost/static_assert.hpp>
-using namespace std;
-
YADE_PLUGIN((GeneralIntegratorInsertionSortCollider))
CREATE_LOGGER(GeneralIntegratorInsertionSortCollider);
=== modified file 'pkg/dem/JointedCohesiveFrictionalPM.cpp'
--- pkg/dem/JointedCohesiveFrictionalPM.cpp 2014-06-10 14:27:43 +0000
+++ pkg/dem/JointedCohesiveFrictionalPM.cpp 2014-07-01 18:19:00 +0000
@@ -70,10 +70,10 @@
// create a text file to record properties of the broken bond (iteration, position, type (tensile), cross section and contact normal orientation)
if (recordCracks){
std::ofstream file (fileCracks.c_str(), !cracksFileExist ? std::ios::trunc : std::ios::app);
- if(file.tellp()==0){ file <<"i p0 p1 p2 t s norm0 norm1 norm2"<<endl; }
+ if(file.tellp()==0){ file <<"i p0 p1 p2 t s norm0 norm1 norm2"<<std::endl; }
Vector3r crackNormal=Vector3r::Zero();
if ((smoothJoint) && (phys->isOnJoint)) { crackNormal=phys->jointNormal; } else {crackNormal=geom->normal;}
- file << boost::lexical_cast<string> ( scene->iter )<<" "<< boost::lexical_cast<string> ( geom->contactPoint[0] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[1] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[2] ) <<" "<< 0 <<" "<< boost::lexical_cast<string> ( 0.5*(geom->radius1+geom->radius2) ) <<" "<< boost::lexical_cast<string> ( crackNormal[0] ) <<" "<< boost::lexical_cast<string> ( crackNormal[1] ) <<" "<< boost::lexical_cast<string> ( crackNormal[2] ) << endl;
+ file << boost::lexical_cast<string> ( scene->iter )<<" "<< boost::lexical_cast<string> ( geom->contactPoint[0] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[1] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[2] ) <<" "<< 0 <<" "<< boost::lexical_cast<string> ( 0.5*(geom->radius1+geom->radius2) ) <<" "<< boost::lexical_cast<string> ( crackNormal[0] ) <<" "<< boost::lexical_cast<string> ( crackNormal[1] ) <<" "<< boost::lexical_cast<string> ( crackNormal[2] ) << std::endl;
}
cracksFileExist=true;
@@ -133,10 +133,10 @@
// create a text file to record properties of the broken bond (iteration, position, type (shear), cross section and contact normal orientation)
if (recordCracks){
std::ofstream file (fileCracks.c_str(), !cracksFileExist ? std::ios::trunc : std::ios::app);
- if(file.tellp()==0){ file <<"i p0 p1 p2 t s norm0 norm1 norm2"<<endl; }
+ if(file.tellp()==0){ file <<"i p0 p1 p2 t s norm0 norm1 norm2"<<std::endl; }
Vector3r crackNormal=Vector3r::Zero();
if ((smoothJoint) && (phys->isOnJoint)) { crackNormal=phys->jointNormal; } else {crackNormal=geom->normal;}
- file << boost::lexical_cast<string> ( scene->iter )<<" "<< boost::lexical_cast<string> ( geom->contactPoint[0] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[1] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[2] ) <<" "<< 1 <<" "<< boost::lexical_cast<string> ( 0.5*(geom->radius1+geom->radius2) ) <<" "<< boost::lexical_cast<string> ( crackNormal[0] ) <<" "<< boost::lexical_cast<string> ( crackNormal[1] ) <<" "<< boost::lexical_cast<string> ( crackNormal[2] ) << endl;
+ file << boost::lexical_cast<string> ( scene->iter )<<" "<< boost::lexical_cast<string> ( geom->contactPoint[0] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[1] ) <<" "<< boost::lexical_cast<string> ( geom->contactPoint[2] ) <<" "<< 1 <<" "<< boost::lexical_cast<string> ( 0.5*(geom->radius1+geom->radius2) ) <<" "<< boost::lexical_cast<string> ( crackNormal[0] ) <<" "<< boost::lexical_cast<string> ( crackNormal[1] ) <<" "<< boost::lexical_cast<string> ( crackNormal[2] ) << std::endl;
}
cracksFileExist=true;
=== modified file 'pkg/dem/L3Geom.cpp'
--- pkg/dem/L3Geom.cpp 2013-08-23 15:21:20 +0000
+++ pkg/dem/L3Geom.cpp 2014-07-01 18:19:00 +0000
@@ -246,7 +246,7 @@
// check that the normal did not change orientation (would be abrup here)
if(I->geom && I->geom->cast<L3Geom>().normal!=normal){
- ostringstream oss; oss<<"Ig2_Wall_Sphere_L3Geom: normal changed from ("<<I->geom->cast<L3Geom>().normal<<" to "<<normal<<" in Wall+Sphere ##"<<I->getId1()<<"+"<<I->getId2()<<" (with Wall.sense=0, a particle might cross the Wall plane, if Δt is too high)"; throw std::logic_error(oss.str().c_str());
+ std::ostringstream oss; oss<<"Ig2_Wall_Sphere_L3Geom: normal changed from ("<<I->geom->cast<L3Geom>().normal<<" to "<<normal<<" in Wall+Sphere ##"<<I->getId1()<<"+"<<I->getId2()<<" (with Wall.sense=0, a particle might cross the Wall plane, if Δt is too high)"; throw std::logic_error(oss.str().c_str());
}
handleSpheresLikeContact(I,state1,state2,shift2,/*is6Dof*/false,normal,contPt,uN,/*r1*/0,/*r2*/radius);
return true;
@@ -274,8 +274,8 @@
case 3: contactPt=facet.vertices[1]; break; // ++- (v1)
case 5: contactPt=facet.vertices[0]; break; // +-+ (v0)
case 6: contactPt=facet.vertices[2]; break; // -++ (v2)
- case 7: throw logic_error("Ig2_Facet_Sphere_L3Geom: Impossible sphere-facet intersection (all points are outside the edges). (please report bug)"); // +++ (impossible)
- default: throw logic_error("Ig2_Facet_Sphere_L3Geom: Nonsense intersection value. (please report bug)");
+ case 7: throw std::logic_error("Ig2_Facet_Sphere_L3Geom: Impossible sphere-facet intersection (all points are outside the edges). (please report bug)"); // +++ (impossible)
+ default: throw std::logic_error("Ig2_Facet_Sphere_L3Geom: Nonsense intersection value. (please report bug)");
}
normal=cogLine-contactPt; // normal is now the contact normal, still in local coords
if(!I->isReal() && normal.squaredNorm()>radius*radius && !force) { return false; } // fast test before sqrt
=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp 2014-03-21 18:45:24 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp 2014-07-01 18:19:00 +0000
@@ -27,8 +27,6 @@
YADE_PLUGIN((Law2_ScGeom_CapillaryPhys_Capillarity));
-using namespace std;
-
void Law2_ScGeom_CapillaryPhys_Capillarity::postLoad(Law2_ScGeom_CapillaryPhys_Capillarity&){
capillary = shared_ptr<capillarylaw>(new capillarylaw);
@@ -66,7 +64,7 @@
void Law2_ScGeom_CapillaryPhys_Capillarity::action()
{
- if (!scene) cerr << "scene not defined!";
+ if (!scene) std::cerr << "scene not defined!";
if (!capillary) postLoad(*this);//when the script does not define arguments, postLoad is never called
shared_ptr<BodyContainer>& bodies = scene->bodies;
if (fusionDetection && !bodiesMenisciiList.initialized) bodiesMenisciiList.prepare(scene);
@@ -190,7 +188,7 @@
//BINARY VERSION : if fusionNumber!=0 then no capillary force
short int& fusionNumber = hertzOn?mindlinContactPhysics->fusionNumber:cundallContactPhysics->fusionNumber;
if (binaryFusion) {
- if (fusionNumber!=0) { //cerr << "fusion" << endl;
+ if (fusionNumber!=0) { //std::cerr << "fusion" << std::endl;
hertzOn?mindlinContactPhysics->fCap:cundallContactPhysics->fCap = Vector3r::Zero();
continue;
}
@@ -259,9 +257,9 @@
if (i == (*currentMeniscus)->getId1()) angle2=mindlinInteractionPhysics2->Delta1;//get angle of meniscus2 on body i
else angle2=mindlinInteractionPhysics2->Delta2;
}
- if (angle1==0 || angle2==0) cerr << "THIS SHOULD NOT HAPPEN!!"<< endl;
+ if (angle1==0 || angle2==0) std::cerr << "THIS SHOULD NOT HAPPEN!!"<< std::endl;
- //cerr << "angle1 = " << angle1 << " | angle2 = " << angle2 << endl;
+ //std::cerr << "angle1 = " << angle1 << " | angle2 = " << angle2 << std::endl;
Vector3r normalFirstMeniscus = YADE_CAST<ScGeom*>((*firstMeniscus)->geom.get())->normal;
Vector3r normalCurrentMeniscus = YADE_CAST<ScGeom*>((*currentMeniscus)->geom.get())->normal;
@@ -285,7 +283,7 @@
}
MeniscusParameters capillarylaw::interpolate(Real R1, Real R2, Real D, Real P, int* index)
-{ //cerr << "interpolate" << endl;
+{ //std::cerr << "interpolate" << std::endl;
if (R1 > R2) {
Real R3 = R1;
R1 = R2;
@@ -293,7 +291,7 @@
}
Real R = R2/R1;
- //cerr << "R = " << R << endl;
+ //std::cerr << "R = " << R << std::endl;
MeniscusParameters result_inf;
MeniscusParameters result_sup;
@@ -303,7 +301,7 @@
for ( ; i < (NB_R_VALUES); i++)
{
Real data_R = data_complete[i].R;
- //cerr << "i = " << i << endl;
+ //std::cerr << "i = " << i << std::endl;
if (data_R > R) // Attention a l'ordre ds lequel vont etre ranges les tableau R (croissant)
{
@@ -321,14 +319,14 @@
result.delta2 = result_inf.delta2*(1-r) + r*result_sup.delta2;
i=NB_R_VALUES;
- //cerr << "i = " << i << endl;
+ //std::cerr << "i = " << i << std::endl;
}
else if (data_complete[i].R == R)
{
result = data_complete[i].Interpolate2(D,P, index[0], index[1]);
i=NB_R_VALUES;
- //cerr << "i = " << i << endl;
+ //std::cerr << "i = " << i << std::endl;
}
}
return result;
@@ -340,9 +338,9 @@
Tableau::Tableau(const char* filename)
{
- ifstream file (filename);
+ std::ifstream file (filename);
file >> R;
- //cerr << "r = " << R << endl;
+ //std::cerr << "r = " << R << std::endl;
int n_D; //number of D values
file >> n_D;
@@ -351,7 +349,7 @@
static bool first=true;
if(first)
{
- cout << "WARNING: cannot open files used for capillary law, all forces will be null. Instructions on how to download and install them is found here : https://yade-dem.org/wiki/CapillaryTriaxialTest." << endl;
+ cout << "WARNING: cannot open files used for capillary law, all forces will be null. Instructions on how to download and install them is found here : https://yade-dem.org/wiki/CapillaryTriaxialTest." << std::endl;
first=false;
}
return;
@@ -367,7 +365,7 @@
MeniscusParameters Tableau::Interpolate2(Real D, Real P, int& index1, int& index2)
-{ //cerr << "interpolate2" << endl;
+{ //std::cerr << "interpolate2" << std::endl;
MeniscusParameters result;
MeniscusParameters result_inf;
MeniscusParameters result_sup;
@@ -403,13 +401,13 @@
TableauD::TableauD()
{}
-TableauD::TableauD(ifstream& file)
+TableauD::TableauD(std::ifstream& file)
{
int i=0;
Real x;
int n_lines; //pb: n_lines is real!!!
file >> n_lines;
- //cout << n_lines << endl;
+ //cout << n_lines << std::endl;
file.ignore(200, '\n'); // saute les caract�res (200 au maximum) jusque au caract�re \n (fin de ligne)*_
@@ -426,7 +424,7 @@
}
MeniscusParameters TableauD::Interpolate3(Real P, int& index)
-{ //cerr << "interpolate3" << endl;
+{ //std::cerr << "interpolate3" << std::endl;
MeniscusParameters result;
int dataSize = data.size();
@@ -458,10 +456,10 @@
//compteur2+=1;
for (int k=1; k < dataSize; ++k) // Length(data) ??
- { //cerr << "k = " << k << endl;
+ { //std::cerr << "k = " << k << std::endl;
if ( data[k][1] > P) // OK si P rangés ds l'ordre croissant
- { //cerr << "if" << endl;
+ { //std::cerr << "if" << std::endl;
Real Pinf=data[k-1][1];
Real Finf=data[k-1][3];
Real Vinf=data[k-1][2];
@@ -484,7 +482,7 @@
}
else if (data[k][1] == P)
- { //cerr << "elseif" << endl;
+ { //std::cerr << "elseif" << std::endl;
result.V = data[k][2];
result.F = data[k][3];
result.delta1 = data[k][4];
@@ -503,16 +501,16 @@
std::ostream& operator<<(std::ostream& os, Tableau& T)
{
- os << "Tableau : R=" << T.R << endl;
+ os << "Tableau : R=" << T.R << std::endl;
for (unsigned int i=0; i<T.full_data.size(); i++) {
- os << "TableauD : D=" << T.full_data[i].D << endl;
+ os << "TableauD : D=" << T.full_data[i].D << std::endl;
for (unsigned int j=0; j<T.full_data[i].data.size();j++) {
for (unsigned int k=0; k<T.full_data[i].data[j].size(); k++)
os << T.full_data[i].data[j][k] << " ";
- os << endl;
+ os << std::endl;
}
}
- os << endl;
+ os << std::endl;
return os;
}
@@ -524,7 +522,7 @@
bool BodiesMenisciiList::prepare(Scene * scene)
{
- //cerr << "preparing bodiesInteractionsList" << endl;
+ //std::cerr << "preparing bodiesInteractionsList" << std::endl;
interactionsOnBody.clear();
shared_ptr<BodyContainer>& bodies = scene->bodies;
@@ -595,18 +593,18 @@
if ( !interactionsOnBody[i].empty() )
{
lastMeniscus = interactionsOnBody[i].end();
- //cerr << "size = "<<interactionsOnBody[i].size() << " empty="<<interactionsOnBody[i].empty() <<endl;
+ //std::cerr << "size = "<<interactionsOnBody[i].size() << " empty="<<interactionsOnBody[i].empty() <<std::endl;
for ( firstMeniscus=interactionsOnBody[i].begin(); firstMeniscus!=lastMeniscus; ++firstMeniscus )
{
if ( *firstMeniscus ){
if ( firstMeniscus->get() )
- cerr << "(" << ( *firstMeniscus )->getId1() << ", " << ( *firstMeniscus )->getId2() <<") ";
- else cerr << "(void)";
+ std::cerr << "(" << ( *firstMeniscus )->getId1() << ", " << ( *firstMeniscus )->getId2() <<") ";
+ else std::cerr << "(void)";
}
}
- cerr << endl;
+ std::cerr << std::endl;
}
- else cerr << "empty" << endl;
+ else std::cerr << "empty" << std::endl;
}
}
=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp 2014-04-16 09:32:47 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp 2014-07-01 18:19:00 +0000
@@ -20,6 +20,9 @@
#include <fstream>
#include <string>
+using std::vector;
+using std::list;
+
/**
This law allows one to take into account capillary forces/effects between spheres coming from the presence of interparticular liquid bridges (menisci).
refs:
=== modified file 'pkg/dem/MicroMacroAnalyser.cpp'
--- pkg/dem/MicroMacroAnalyser.cpp 2014-03-21 18:47:45 +0000
+++ pkg/dem/MicroMacroAnalyser.cpp 2014-07-01 18:19:00 +0000
@@ -21,6 +21,7 @@
#include<boost/iostreams/device/file.hpp>
#include<yade/pkg/dem/TriaxialCompressionEngine.hpp>
#include "MicroMacroAnalyser.hpp"
+using std::ostringstream;
YADE_PLUGIN((MicroMacroAnalyser));
CREATE_LOGGER(MicroMacroAnalyser);
=== modified file 'pkg/dem/PeriIsoCompressor.cpp'
--- pkg/dem/PeriIsoCompressor.cpp 2014-05-22 15:26:55 +0000
+++ pkg/dem/PeriIsoCompressor.cpp 2014-07-01 18:19:00 +0000
@@ -8,8 +8,6 @@
#include<yade/pkg/dem/DemXDofGeom.hpp>
#include<yade/lib/pyutil/gil.hpp>
-using namespace std;
-
YADE_PLUGIN((PeriIsoCompressor)(PeriTriaxController)(Peri3dController))
CREATE_LOGGER(PeriIsoCompressor);
=== modified file 'pkg/dem/SampleCapillaryPressureEngine.cpp'
--- pkg/dem/SampleCapillaryPressureEngine.cpp 2014-05-23 13:03:50 +0000
+++ pkg/dem/SampleCapillaryPressureEngine.cpp 2014-07-01 18:19:00 +0000
@@ -16,8 +16,6 @@
#include<yade/lib/base/Math.hpp>
#include <boost/lexical_cast.hpp>
-using namespace std;
-
YADE_PLUGIN((SampleCapillaryPressureEngine));
CREATE_LOGGER(SampleCapillaryPressureEngine);
@@ -38,12 +36,12 @@
if ( Phase1 && UnbalancedForce<=StabilityCriterion && !pressureVariationActivated) {
Real S = meanStress;
- cerr << "Smoy = " << meanStress << endl;
+ std::cerr << "Smoy = " << meanStress << endl;
if ((S > (sigma_iso - (sigma_iso*SigmaPrecision))) && (S < (sigma_iso + (sigma_iso*SigmaPrecision)))) {
- string fileName = "../data/" + Phase1End + "_" +
- boost::lexical_cast<string>(scene->iter) + ".xml";
- cerr << "saving snapshot: " << fileName << " ...";
+ std::string fileName = "../data/" + Phase1End + "_" +
+ boost::lexical_cast<std::string>(scene->iter) + ".xml";
+ std::cerr << "saving snapshot: " << fileName << " ...";
Omega::instance().saveSimulation(fileName);
pressureVariationActivated = true;
}
@@ -56,7 +54,7 @@
TriaxialStressController::action();
if (pressureVariationActivated)
{
- if (scene->iter % 100 == 0) cerr << "pressure variation!!" << endl;
+ if (scene->iter % 100 == 0) std::cerr << "pressure variation!!" << endl;
if ((Pressure>=0) && (Pressure<=1000000000)) Pressure += PressureVariation;
capillaryCohesiveLaw->capillaryPressure = Pressure;
@@ -67,7 +65,7 @@
else { capillaryCohesiveLaw->capillaryPressure = Pressure;
capillaryCohesiveLaw->fusionDetection = fusionDetection;
capillaryCohesiveLaw->binaryFusion = binaryFusion;}
- if (scene->iter % 100 == 0) cerr << "capillary pressure = " << Pressure << endl;
+ if (scene->iter % 100 == 0) std::cerr << "capillary pressure = " << Pressure << endl;
capillaryCohesiveLaw->scene=scene;;
capillaryCohesiveLaw->action();
UnbalancedForce = ComputeUnbalancedForce(scene);
=== modified file 'pkg/dem/ScGeom.cpp'
--- pkg/dem/ScGeom.cpp 2012-10-09 09:09:02 +0000
+++ pkg/dem/ScGeom.cpp 2014-07-01 18:19:00 +0000
@@ -71,7 +71,7 @@
}
Vector3r ScGeom::getIncidentVel_py(shared_ptr<Interaction> i, bool avoidGranularRatcheting){
- if(i->geom.get()!=this) throw invalid_argument("ScGeom object is not the same as Interaction.geom.");
+ if(i->geom.get()!=this) throw std::invalid_argument("ScGeom object is not the same as Interaction.geom.");
Scene* scene=Omega::instance().getScene().get();
return getIncidentVel(Body::byId(i->getId1(),scene)->state.get(),Body::byId(i->getId2(),scene)->state.get(),
scene->dt,
@@ -86,7 +86,7 @@
}
Vector3r ScGeom::getRelAngVel_py(shared_ptr<Interaction> i){
- if(i->geom.get()!=this) throw invalid_argument("ScGeom object is not the same as Interaction.geom.");
+ if(i->geom.get()!=this) throw std::invalid_argument("ScGeom object is not the same as Interaction.geom.");
Scene* scene=Omega::instance().getScene().get();
return getRelAngVel(Body::byId(i->getId1(),scene)->state.get(),Body::byId(i->getId2(),scene)->state.get(),scene->dt);
}
=== modified file 'pkg/dem/Shop.hpp'
--- pkg/dem/Shop.hpp 2014-05-23 13:05:19 +0000
+++ pkg/dem/Shop.hpp 2014-07-01 18:19:00 +0000
@@ -23,8 +23,6 @@
class FrictMat;
class Interaction;
-using namespace std;
-using boost::shared_ptr;
namespace py = boost::python;
/*! Miscillaneous utility functions which are believed to be generally useful.
=== modified file 'pkg/dem/Shop_01.cpp'
--- pkg/dem/Shop_01.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/Shop_01.cpp 2014-07-01 18:19:00 +0000
@@ -288,7 +288,7 @@
void Shop::saveSpheresToFile(string fname){
const shared_ptr<Scene>& scene=Omega::instance().getScene();
- ofstream f(fname.c_str());
+ std::ofstream f(fname.c_str());
if(!f.good()) throw runtime_error("Unable to open file `"+fname+"'");
FOREACH(shared_ptr<Body> b, *scene->bodies){
@@ -409,7 +409,7 @@
throw std::invalid_argument(string("File with spheres `")+fname+"' doesn't exist.");
}
vector<boost::tuple<Vector3r,Real,int> > spheres;
- ifstream sphereFile(fname.c_str());
+ std::ifstream sphereFile(fname.c_str());
if(!sphereFile.good()) throw std::runtime_error("File with spheres `"+fname+"' couldn't be opened.");
Vector3r C;
Real r=0;
=== modified file 'pkg/dem/SimpleShear.cpp'
--- pkg/dem/SimpleShear.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/SimpleShear.cpp 2014-07-01 18:19:00 +0000
@@ -41,8 +41,6 @@
#include <boost/filesystem/convenience.hpp>
#include <utility>
-using namespace std;
-
YADE_PLUGIN((SimpleShear))
CREATE_LOGGER(SimpleShear);
@@ -282,7 +280,7 @@
int nombre=0;
if(importFilename.size() != 0 && boost::filesystem::exists(importFilename) )
{
- ifstream loadFile(importFilename.c_str()); // cree l'objet loadFile de la classe ifstream qui va permettre de lire ce qu'il y a dans importFilename
+ std::ifstream loadFile(importFilename.c_str()); // cree l'objet loadFile de la classe ifstream qui va permettre de lire ce qu'il y a dans importFilename
// Real zJF;
// while( !loadFile.eof() ) // tant qu'on n'est pas a la fin du fichier
=== modified file 'pkg/dem/SimpleShear.hpp'
--- pkg/dem/SimpleShear.hpp 2012-11-22 14:32:53 +0000
+++ pkg/dem/SimpleShear.hpp 2014-07-01 18:19:00 +0000
@@ -11,12 +11,9 @@
#include<yade/core/FileGenerator.hpp>
-typedef pair<Vector3r, Real> BasicSphere;
+typedef std::pair<Vector3r, Real> BasicSphere;
//! make a list of spheres non-overlapping sphere
-using namespace std;
-
-
class SimpleShear : public FileGenerator
{
void createBox(shared_ptr<Body>& body, Vector3r position, Vector3r extents);
=== modified file 'pkg/dem/SnapshotEngine.cpp'
--- pkg/dem/SnapshotEngine.cpp 2012-11-01 21:42:22 +0000
+++ pkg/dem/SnapshotEngine.cpp 2014-07-01 18:19:00 +0000
@@ -6,7 +6,7 @@
CREATE_LOGGER(SnapshotEngine);
void SnapshotEngine::action(){
- if(!OpenGLManager::self) throw logic_error("No OpenGLManager instance?!");
+ if(!OpenGLManager::self) throw std::logic_error("No OpenGLManager instance?!");
if(OpenGLManager::self->views.size()==0){
int viewNo=OpenGLManager::self->waitForNewView(deadTimeout);
if(viewNo<0){
=== modified file 'pkg/dem/SpherePack.cpp'
--- pkg/dem/SpherePack.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/SpherePack.cpp 2014-07-01 18:19:00 +0000
@@ -17,11 +17,8 @@
CREATE_LOGGER(SpherePack);
-using namespace std;
-
namespace py=boost::python;
-
void SpherePack::fromList(const py::list& l){
pack.clear();
size_t len=py::len(l);
@@ -60,8 +57,8 @@
}
void SpherePack::toFile(const string fname) const {
- ofstream f(fname.c_str());
- if(!f.good()) throw runtime_error("Unable to open file `"+fname+"'");
+ std::ofstream f(fname.c_str());
+ if(!f.good()) throw std::runtime_error("Unable to open file `"+fname+"'");
if(cellSize!=Vector3r::Zero()){ f<<"##PERIODIC:: "<<cellSize[0]<<" "<<cellSize[1]<<" "<<cellSize[2]<<endl; }
FOREACH(const Sph& s, pack){
//if(s.clumpId>=0) throw std::invalid_argument("SpherePack with clumps cannot be (currently) exported to a text file.");
@@ -100,7 +97,7 @@
Matrix3r invHsize =hSize.inverse();
Real area=abs(size[0]*size[2]+size[0]*size[1]+size[1]*size[2]);//2 terms will be null if one coordinate is 0, the other is the area
if (!volume) {
- if (hSizeFound) throw invalid_argument("The period defined by hSize has null length in at least one direction, this is not supported. Define flat boxes via min-max and keep hSize undefined if you want a 2D packing.");
+ if (hSizeFound) throw std::invalid_argument("The period defined by hSize has null length in at least one direction, this is not supported. Define flat boxes via min-max and keep hSize undefined if you want a 2D packing.");
else LOG_WARN("The volume of the min-max box is null, we will assume that the packing is 2D. If it is not what you want then you defined wrong input values; check that min and max corners are defined correctly.");}
int mode=-1; bool err=false;
// determine the way we generate radii
@@ -112,15 +109,15 @@
// the term (1+rRelFuzz²) comes from the mean volume for uniform distribution : Vmean = 4/3*pi*Rmean*(1+rRelFuzz²)
if (volume) rMean=pow(volume*(1-porosity)/(Mathr::PI*(4/3.)*(1+rRelFuzz*rRelFuzz)*num),1/3.);
else {//The volume is null, we will generate a 2D packing with the following rMean
- if (!area) throw invalid_argument("The box defined has null volume AND null surface. Define at least maxCorner of the box, or hSize if periodic.");
+ if (!area) throw std::invalid_argument("The box defined has null volume AND null surface. Define at least maxCorner of the box, or hSize if periodic.");
rMean=pow(area*(1-porosity)/(Mathr::PI*(1+rRelFuzz*rRelFuzz)*num),0.5);}
}
// transform sizes and cummulated fractions values in something convenient for the generation process
if(psdSizes.size()>0){
err=(mode>=0); mode=RDIST_PSD;
- if(psdSizes.size()!=psdCumm.size()) throw invalid_argument(("SpherePack.makeCloud: psdSizes and psdCumm must have same dimensions ("+boost::lexical_cast<string>(psdSizes.size())+"!="+boost::lexical_cast<string>(psdCumm.size())).c_str());
- if(psdSizes.size()<=1) throw invalid_argument("SpherePack.makeCloud: psdSizes must have at least 2 items");
- if((*psdCumm.begin())!=0. && (*psdCumm.rbegin())!=1.) throw invalid_argument("SpherePack.makeCloud: first and last items of psdCumm *must* be exactly 0 and 1.");
+ if(psdSizes.size()!=psdCumm.size()) throw std::invalid_argument(("SpherePack.makeCloud: psdSizes and psdCumm must have same dimensions ("+boost::lexical_cast<string>(psdSizes.size())+"!="+boost::lexical_cast<string>(psdCumm.size())).c_str());
+ if(psdSizes.size()<=1) throw std::invalid_argument("SpherePack.makeCloud: psdSizes must have at least 2 items");
+ if((*psdCumm.begin())!=0. && (*psdCumm.rbegin())!=1.) throw std::invalid_argument("SpherePack.makeCloud: first and last items of psdCumm *must* be exactly 0 and 1.");
psdRadii.reserve(psdSizes.size());
for(size_t i=0; i<psdSizes.size(); i++) {
psdRadii.push_back(/* radius, not diameter */ .5*psdSizes[i]);
@@ -131,7 +128,7 @@
}
LOG_DEBUG(i<<". "<<psdRadii[i]<<", cdf="<<psdCumm[i]<<", cdf2="<<(distributeMass?boost::lexical_cast<string>(psdCumm2[i]):string("--")));
// check monotonicity
- if(i>0 && (psdSizes[i-1]>psdSizes[i] || psdCumm[i-1]>psdCumm[i])) throw invalid_argument("SpherePack:makeCloud: psdSizes and psdCumm must be both non-decreasing.");
+ if(i>0 && (psdSizes[i-1]>psdSizes[i] || psdCumm[i-1]>psdCumm[i])) throw std::invalid_argument("SpherePack:makeCloud: psdSizes and psdCumm must be both non-decreasing.");
}
// check the consistency between sizes, num, and poro if all three are imposed. If target number will not fit in (1-poro)*volume, scale down particles sizes
if (num>1){
@@ -150,7 +147,7 @@
//Normalize psdCumm2 so it's between 0 and 1
if(distributeMass) for(size_t i=1; i<psdSizes.size(); i++) psdCumm2[i]/=psdCumm2[psdSizes.size()-1];
}
- if(err || mode<0) throw invalid_argument("SpherePack.makeCloud: at least one of rMean, porosity, psdSizes & psdCumm arguments must be specified. rMean can't be combined with psdSizes.");
+ if(err || mode<0) throw std::invalid_argument("SpherePack.makeCloud: at least one of rMean, porosity, psdSizes & psdCumm arguments must be specified. rMean can't be combined with psdSizes.");
// adjust uniform distribution parameters with distributeMass; rMean has the meaning (dimensionally) of _volume_
const int maxTry=1000;
if(periodic && volume && !hSizeFound)(cellSize=size);
@@ -189,7 +186,7 @@
for(size_t j=0; j<packSize; j++){
Vector3r dr=Vector3r::Zero();
if (!hSizeFound) {//The box is axis-aligned, use the wrap methods
- for(int axis=0; axis<3; axis++) dr[axis]=size[axis]? min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis])) : 0;
+ for(int axis=0; axis<3; axis++) dr[axis]=size[axis]? std::min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis])) : 0;
} else {//not aligned, find closest neighbor in a cube of size 1, then transform distance to cartesian coordinates
Vector3r c1c2=invHsize*(pack[j].c-c);
for(int axis=0; axis<3; axis++){
@@ -260,17 +257,17 @@
Real minD=std::numeric_limits<Real>::infinity(); Real maxD=-minD;
// volume, but divided by π*4/3
Real vol=0; long N=pack.size();
- FOREACH(const Sph& s, pack){ maxD=max(2*s.r,maxD); minD=min(2*s.r,minD); vol+=pow(s.r,3); }
+ FOREACH(const Sph& s, pack){ maxD=max(2*s.r,maxD); minD=std::min(2*s.r,minD); vol+=pow(s.r,3); }
if(minD==maxD){ minD-=.5; maxD+=.5; } // emulates what numpy.histogram does
// create bins and bin edges
vector<Real> hist(bins,0); vector<Real> cumm(bins+1,0); /* cummulative values compute from hist at the end */
vector<Real> edges(bins+1); for(int i=0; i<=bins; i++){ edges[i]=minD+i*(maxD-minD)/bins; }
// weight each grain by its "volume" relative to overall "volume"
FOREACH(const Sph& s, pack){
- int bin=int(bins*(2*s.r-minD)/(maxD-minD)); bin=min(bin,bins-1); // to make sure
+ int bin=int(bins*(2*s.r-minD)/(maxD-minD)); bin=std::min(bin,bins-1); // to make sure
if (mass) hist[bin]+=pow(s.r,3)/vol; else hist[bin]+=1./N;
}
- for(int i=0; i<bins; i++) cumm[i+1]=min((Real)1.,cumm[i]+hist[i]); // cumm[i+1] is OK, cumm.size()==bins+1
+ for(int i=0; i<bins; i++) cumm[i+1]=std::min((Real)1.,cumm[i]+hist[i]); // cumm[i+1] is OK, cumm.size()==bins+1
return py::make_tuple(edges,cumm);
}
@@ -358,7 +355,7 @@
} else {
for(size_t j=0; j<packSize; j++){
Vector3r dr;
- for(int axis=0; axis<3; axis++) dr[axis]=min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
+ for(int axis=0; axis<3; axis++) dr[axis]=std::min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
if(pow(pack[j].r+r,2)>= dr.squaredNorm()){ overlap=true; break; }
}
}
@@ -411,7 +408,7 @@
} else {
for(size_t j=0; j<packSize; j++){
Vector3r dr=Vector3r::Zero();
- for(int axis=0; axis<2; axis++) dr[axis]=min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
+ for(int axis=0; axis<2; axis++) dr[axis]=std::min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
if(pow(pack[j].r+r,2)>= dr.squaredNorm()){ overlap=true; break; }
}
}
@@ -511,7 +508,7 @@
for(size_t j=0; j<pack.size(); j++){
const Vector3r& c(C.pack[i].c); const Real& r(C.pack[i].r);
Vector3r dr;
- for(int axis=0; axis<3; axis++) dr[axis]=min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
+ for(int axis=0; axis<3; axis++) dr[axis]=std::min(cellWrapRel(c[axis],pack[j].c[axis],pack[j].c[axis]+size[axis]),cellWrapRel(pack[j].c[axis],c[axis],c[axis]+size[axis]));
if(pow(pack[j].r+r,2)>= dr.squaredNorm()) goto overlap;
}
}
=== modified file 'pkg/dem/SpherePack.hpp'
--- pkg/dem/SpherePack.hpp 2014-05-23 13:03:50 +0000
+++ pkg/dem/SpherePack.hpp 2014-07-01 18:19:00 +0000
@@ -2,11 +2,14 @@
#pragma once
-#include<vector>
-#include<string>
-#include<limits>
-#include<iostream>
-using namespace std; // sorry
+#include <vector>
+#include <string>
+#include <limits>
+#include <iostream>
+#include <stdexcept>
+
+using std::vector;
+using std::string;
#include<boost/python.hpp>
#include<boost/python/object.hpp>
@@ -38,7 +41,7 @@
}
Real periPtDistSq(const Vector3r& p1, const Vector3r& p2){
Vector3r dr;
- for(int ax=0; ax<3; ax++) dr[ax]=min(cellWrapRel(p1[ax],p2[ax],p2[ax]+cellSize[ax]),cellWrapRel(p2[ax],p1[ax],p1[ax]+cellSize[ax]));
+ for(int ax=0; ax<3; ax++) dr[ax]=std::min(cellWrapRel(p1[ax],p2[ax],p2[ax]+cellSize[ax]),cellWrapRel(p2[ax],p1[ax],p1[ax]+cellSize[ax]));
return dr.squaredNorm();
}
struct ClumpInfo{ int clumpId; Vector3r center; Real rad; int minId, maxId; };
@@ -140,7 +143,7 @@
// iteration
size_t len() const{ return pack.size(); }
- boost::python::tuple getitem(size_t idx){ if(idx>=pack.size()) throw runtime_error("Index "+boost::lexical_cast<string>(idx)+" out of range 0.."+boost::lexical_cast<string>(pack.size()-1)); return pack[idx].asTuple(); }
+ boost::python::tuple getitem(size_t idx){ if(idx>=pack.size()) throw std::runtime_error("Index "+boost::lexical_cast<string>(idx)+" out of range 0.."+boost::lexical_cast<string>(pack.size()-1)); return pack[idx].asTuple(); }
struct _iterator{
const SpherePack& sPack; size_t pos;
_iterator(const SpherePack& _sPack): sPack(_sPack), pos(0){}
=== modified file 'pkg/dem/TesselationWrapper.cpp'
--- pkg/dem/TesselationWrapper.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/TesselationWrapper.cpp 2014-07-01 18:19:00 +0000
@@ -163,7 +163,6 @@
bool TesselationWrapper::insert(double x, double y, double z, double rad, unsigned int id)
{
- using namespace std;
checkMinMax(x,y,z,rad);
mean_radius += rad;
++n_spheres;
@@ -172,20 +171,20 @@
void TesselationWrapper::checkMinMax(double x, double y, double z, double rad)
{
- using namespace std;
- Pmin = CGT::Point(min(Pmin.x(), x-rad), min(Pmin.y(), y-rad), min(Pmin.z(), z-rad));
- Pmax = CGT::Point(max(Pmax.x(), x+rad), max(Pmax.y(), y+rad), max(Pmax.z(), z+rad));
+ using std::min;
+ using std::max;
+ Pmin = CGT::Point(std::min(Pmin.x(), x-rad), std::min(Pmin.y(), y-rad), std::min(Pmin.z(), z-rad));
+ Pmax = CGT::Point(std::max(Pmax.x(), x+rad), std::max(Pmax.y(), y+rad), std::max(Pmax.z(), z+rad));
}
bool TesselationWrapper::move(double x, double y, double z, double rad, unsigned int id)
{
- using namespace std;
checkMinMax(x,y,z,rad);
if (Tes->move(x,y,z,rad,id)!=NULL)
return true;
else {
- cerr << "Tes->move(x,y,z,rad,id)==NULL" << endl; return false;
+ std::cerr << "Tes->move(x,y,z,rad,id)==NULL" << std::endl; return false;
}
}
=== modified file 'pkg/dem/Tetra.cpp'
--- pkg/dem/Tetra.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/Tetra.cpp 2014-07-01 18:19:00 +0000
@@ -15,6 +15,8 @@
#include <CGAL/intersections.h>
#endif
+using std::list;
+
YADE_PLUGIN(/* self-contained in hpp: */ (Tetra) (TTetraGeom) (TTetraSimpleGeom) (Bo1_Tetra_Aabb)
/* some code in cpp (this file): */ (TetraVolumetricLaw)
(Ig2_Tetra_Tetra_TTetraGeom)
=== modified file 'pkg/dem/TriaxialTest.cpp'
--- pkg/dem/TriaxialTest.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/TriaxialTest.cpp 2014-07-01 18:19:00 +0000
@@ -56,8 +56,6 @@
CREATE_LOGGER(TriaxialTest);
YADE_PLUGIN((TriaxialTest));
-using namespace std;
-
TriaxialTest::~TriaxialTest () {}
bool TriaxialTest::generate(string& message)
=== modified file 'pkg/dem/TriaxialTest.hpp'
--- pkg/dem/TriaxialTest.hpp 2013-09-19 08:50:04 +0000
+++ pkg/dem/TriaxialTest.hpp 2014-07-01 18:19:00 +0000
@@ -56,7 +56,7 @@
void createSphere(shared_ptr<Body>& body, Vector3r position, Real radius,bool big,bool dynamic);
void createActors(shared_ptr<Scene>& scene);
void positionRootBody(shared_ptr<Scene>& scene);
- typedef pair<Vector3r, Real> BasicSphere;
+ typedef std::pair<Vector3r, Real> BasicSphere;
public :
~TriaxialTest ();
bool generate(string& message);
=== modified file 'pkg/dem/UniaxialStrainer.cpp'
--- pkg/dem/UniaxialStrainer.cpp 2014-05-23 13:05:19 +0000
+++ pkg/dem/UniaxialStrainer.cpp 2014-07-01 18:19:00 +0000
@@ -40,7 +40,7 @@
if(originalLength<=0) throw runtime_error(("UniaxialStrainer: Initial length is negative or zero (swapped reference particles?)! "+boost::lexical_cast<string>(originalLength)).c_str());
/* this happens is nan propagates from e.g. brefcom consitutive law in case 2 bodies have _exactly_ the same position
* (the the normal strain is 0./0.=nan). That is an user's error, however and should not happen. */
- if(isnan(originalLength)) throw logic_error("UniaxialStrainer: Initial length is NaN!");
+ if(isnan(originalLength)) throw std::logic_error("UniaxialStrainer: Initial length is NaN!");
assert(originalLength>0 && !isnan(originalLength));
assert(!isnan(strainRate) || !isnan(absSpeed));
=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp 2014-04-14 11:52:51 +0000
+++ pkg/dem/ViscoelasticPM.cpp 2014-07-01 18:19:00 +0000
@@ -10,6 +10,8 @@
#include<yade/pkg/common/SPHEngine.hpp>
#endif
+using std::isfinite;
+
YADE_PLUGIN((ViscElMat)(ViscElPhys)(Ip2_ViscElMat_ViscElMat_ViscElPhys)(Law2_ScGeom_ViscElPhys_Basic));
/* ViscElMat */
=== modified file 'pkg/lbm/HydrodynamicsLawLBM.cpp'
--- pkg/lbm/HydrodynamicsLawLBM.cpp 2014-03-31 16:01:57 +0000
+++ pkg/lbm/HydrodynamicsLawLBM.cpp 2014-07-01 18:19:00 +0000
@@ -33,7 +33,6 @@
namespace bfs=boost::filesystem;
-using namespace std;
template<class Scalar> VECTOR3_TEMPLATE(Scalar) operator*(Scalar s, const VECTOR3_TEMPLATE(Scalar)& v) {return v*s;}
inline Vector3i vect3rToVect3i(Vector3r vect){Vector3i newvect((int)vect[0],(int)vect[1],(int)vect[2]);return(newvect);}
=== modified file 'pkg/pfv/PeriodicFlowEngine.cpp'
--- pkg/pfv/PeriodicFlowEngine.cpp 2014-06-20 17:48:57 +0000
+++ pkg/pfv/PeriodicFlowEngine.cpp 2014-07-01 18:19:00 +0000
@@ -14,6 +14,7 @@
/// See below the commented exemple, for a possible solution
#include "FlowEngine_FlowEngine_PeriodicInfo.hpp"
+using std::max;
class PeriodicCellInfo : public FlowCellInfo_FlowEngine_PeriodicInfo
{
@@ -434,7 +435,7 @@
totVol+=newVol;
dVol=cell->info().volumeSign * ( newVol - cell->info().volume() );
totDVol+=dVol;
- epsVolMax = max ( epsVolMax, abs ( dVol/newVol ) );
+ epsVolMax = max ( epsVolMax, fabs ( dVol/newVol ) );
cell->info().dv() = dVol * invDeltaT;
cell->info().volume() = newVol;
}
=== modified file 'py/_polyhedra_utils.cpp'
--- py/_polyhedra_utils.cpp 2014-07-01 18:14:18 +0000
+++ py/_polyhedra_utils.cpp 2014-07-01 18:19:00 +0000
@@ -16,9 +16,10 @@
#include<numpy/ndarrayobject.h>
-using namespace std;
namespace py = boost::python;
-
+using std::min;
+using std::max;
+using std::ofstream;
//**********************************************************************************
//print polyhedron in basic position
@@ -177,7 +178,7 @@
myfile.open ("sieve_curve.dat");
for(std::vector< std::pair<double,double> > :: iterator i = sieve_volume.begin(); i != sieve_volume.end(); ++i) {
cumul_vol += i->second/total_volume;
- myfile << i->first << "\t" << cumul_vol << endl;
+ myfile << i->first << "\t" << cumul_vol << std::endl;
}
myfile.close();
}
@@ -193,7 +194,7 @@
if(!b || !b->shape) continue;
shared_ptr<Polyhedra> p=YADE_PTR_DYN_CAST<Polyhedra>(b->shape);
if(p){
- myfile << SizeOfPolyhedra(p) << endl;
+ myfile << SizeOfPolyhedra(p) << std::endl;
}
}
myfile.close();
@@ -313,7 +314,7 @@
}
}
- cout << "generated " << count << " polyhedrons"<< endl;
+ std::cout << "generated " << count << " polyhedrons"<< std::endl;
//can't be used - no information about material
Scene* scene=Omega::instance().getScene().get();
@@ -485,7 +486,7 @@
}
}
- cout << "generated " << count << " polyhedrons"<< endl;
+ std::cout << "generated " << count << " polyhedrons"<< std::endl;
//can't be used - no information about material
Scene* scene=Omega::instance().getScene().get();
=== modified file 'py/_utils.cpp'
--- py/_utils.cpp 2014-07-01 18:14:18 +0000
+++ py/_utils.cpp 2014-07-01 18:19:00 +0000
@@ -17,14 +17,13 @@
#include<numpy/ndarrayobject.h>
-using namespace std;
namespace py = boost::python;
bool isInBB(Vector3r p, Vector3r bbMin, Vector3r bbMax){return p[0]>bbMin[0] && p[0]<bbMax[0] && p[1]>bbMin[1] && p[1]<bbMax[1] && p[2]>bbMin[2] && p[2]<bbMax[2];}
/* \todo implement groupMask */
py::tuple aabbExtrema(Real cutoff=0.0, bool centers=false){
- if(cutoff<0. || cutoff>1.) throw invalid_argument("Cutoff must be >=0 and <=1.");
+ if(cutoff<0. || cutoff>1.) throw std::invalid_argument("Cutoff must be >=0 and <=1.");
Real inf=std::numeric_limits<Real>::infinity();
Vector3r minimum(inf,inf,inf),maximum(-inf,-inf,-inf);
FOREACH(const shared_ptr<Body>& b, *Omega::instance().getScene()->bodies){
@@ -77,7 +76,7 @@
Real RayleighWaveTimeStep(){return Shop::RayleighWaveTimeStep();};
py::tuple interactionAnglesHistogram(int axis, int mask=0, size_t bins=20, py::tuple aabb=py::tuple(), Real minProjLen=1e-6){
- if(axis<0||axis>2) throw invalid_argument("Axis must be from {0,1,2}=x,y,z.");
+ if(axis<0||axis>2) throw std::invalid_argument("Axis must be from {0,1,2}=x,y,z.");
Vector3r bbMin(Vector3r::Zero()), bbMax(Vector3r::Zero()); bool useBB=py::len(aabb)>0; if(useBB){bbMin=py::extract<Vector3r>(aabb[0])();bbMax=py::extract<Vector3r>(aabb[1])();}
Real binStep=Mathr::PI/bins; int axis2=(axis+1)%3, axis3=(axis+2)%3;
vector<Real> cummProj(bins,0.);
@@ -235,7 +234,7 @@
case none: wire=false; break;
case all: wire=true; break;
case noSpheres: wire=!(bool)(YADE_PTR_DYN_CAST<Sphere>(b->shape)); break;
- default: throw logic_error("No such case possible");
+ default: throw std::logic_error("No such case possible");
}
b->shape->wire=wire;
}
@@ -267,8 +266,8 @@
Real testx=py::extract<double>(xy[0])(),testy=py::extract<double>(xy[1])();
char** vertData; int rows, cols; PyArrayObject* vert=(PyArrayObject*)vertices.ptr();
int result=PyArray_As2D((PyObject**)&vert /* is replaced */ ,&vertData,&rows,&cols,PyArray_DOUBLE);
- if(result!=0) throw invalid_argument("Unable to cast vertices to 2d array");
- if(cols!=2 || rows<3) throw invalid_argument("Vertices must have 2 columns (x and y) and at least 3 rows.");
+ if(result!=0) throw std::invalid_argument("Unable to cast vertices to 2d array");
+ if(cols!=2 || rows<3) throw std::invalid_argument("Vertices must have 2 columns (x and y) and at least 3 rows.");
int i /*current node*/, j/*previous node*/; bool inside=false;
for(i=0,j=rows-1; i<rows; j=i++){
double vx_i=*(double*)(vert->data+i*vert->strides[0]), vy_i=*(double*)(vert->data+i*vert->strides[0]+vert->strides[1]), vx_j=*(double*)(vert->data+j*vert->strides[0]), vy_j=*(double*)(vert->data+j*vert->strides[0]+vert->strides[1]);
@@ -287,7 +286,7 @@
*/
Real approxSectionArea(Real coord, int axis){
std::list<Vector2r> cloud;
- if(axis<0 || axis>2) throw invalid_argument("Axis must be ∈ {0,1,2}");
+ if(axis<0 || axis>2) throw std::invalid_argument("Axis must be ∈ {0,1,2}");
const int ax1=(axis+1)%3, ax2=(axis+2)%3;
const Real sqrt3=sqrt(3);
Vector2r mm,mx; int i=0;
=== modified file 'py/pack/_packPredicates.cpp'
--- py/pack/_packPredicates.cpp 2013-03-07 18:28:01 +0000
+++ py/pack/_packPredicates.cpp 2014-07-01 18:19:00 +0000
@@ -8,7 +8,6 @@
#include<iostream>
namespace py=boost::python;
-using namespace std;
/*
This file contains various predicates that say whether a given point is within the solid,
@@ -306,7 +305,7 @@
}
/* Helper function for inGtsSurface::aabb() */
-static void vertex_aabb(GtsVertex *vertex, pair<Vector3r,Vector3r> *bb)
+static void vertex_aabb(GtsVertex *vertex, std::pair<Vector3r,Vector3r> *bb)
{
GtsPoint *_p=GTS_POINT(vertex);
Vector3r p(_p->x,_p->y,_p->z);
@@ -326,16 +325,16 @@
GNode* tree;
public:
inGtsSurface(py::object _surf, bool _noPad=false): pySurf(_surf), noPad(_noPad), noPadWarned(false) {
- if(!pygts_surface_check(_surf.ptr())) throw invalid_argument("Ctor must receive a gts.Surface() instance.");
+ if(!pygts_surface_check(_surf.ptr())) throw std::invalid_argument("Ctor must receive a gts.Surface() instance.");
surf=PYGTS_SURFACE_AS_GTS_SURFACE(PYGTS_SURFACE(_surf.ptr()));
- if(!gts_surface_is_closed(surf)) throw invalid_argument("Surface is not closed.");
+ if(!gts_surface_is_closed(surf)) throw std::invalid_argument("Surface is not closed.");
is_open=gts_surface_volume(surf)<0.;
- if((tree=gts_bb_tree_surface(surf))==NULL) throw runtime_error("Could not create GTree.");
+ if((tree=gts_bb_tree_surface(surf))==NULL) throw std::runtime_error("Could not create GTree.");
}
~inGtsSurface(){g_node_destroy(tree);}
py::tuple aabb() const {
Real inf=std::numeric_limits<Real>::infinity();
- pair<Vector3r,Vector3r> bb; bb.first=Vector3r(inf,inf,inf); bb.second=Vector3r(-inf,-inf,-inf);
+ std::pair<Vector3r,Vector3r> bb; bb.first=Vector3r(inf,inf,inf); bb.second=Vector3r(-inf,-inf,-inf);
gts_surface_foreach_vertex(surf,(GtsFunc)vertex_aabb,&bb);
return vvec2tuple(bb.first,bb.second);
}
=== modified file 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp 2014-07-01 18:14:18 +0000
+++ py/wrapper/yadeWrapper.cpp 2014-07-01 18:19:00 +0000
@@ -63,8 +63,8 @@
#include<locale>
#include<boost/archive/codecvt_null.hpp>
-using namespace std;
namespace py = boost::python;
+using std::vector;
#include<yade/lib/serialization/ObjectIO.hpp>
@@ -493,7 +493,7 @@
if(i) return i; else { PyErr_SetString(PyExc_IndexError,"No such interaction"); py::throw_error_already_set(); /* make compiler happy; never reached */ return shared_ptr<Interaction>(); }
}
else if(id12.size()==1){ return (*proxee)[id12[0]];}
- else throw invalid_argument("2 integers (id1,id2) or 1 integer (nth) required.");
+ else throw std::invalid_argument("2 integers (id1,id2) or 1 integer (nth) required.");
}
/* return nth _real_ iteration from the container (0-based index); this is to facilitate picking random interaction */
shared_ptr<Interaction> pyNth(long n){
@@ -675,7 +675,7 @@
void reload(bool quiet=false){ load(OMEGA.sceneFile,quiet);}
void saveTmp(string mark="", bool quiet=false){ save(":memory:"+mark,quiet);}
void loadTmp(string mark="", bool quiet=false){ load(":memory:"+mark,quiet);}
- py::list lsTmp(){ py::list ret; typedef pair<std::string,string> strstr; FOREACH(const strstr& sim,OMEGA.memSavedSimulations){ string mark=sim.first; boost::algorithm::replace_first(mark,":memory:",""); ret.append(mark); } return ret; }
+ py::list lsTmp(){ py::list ret; typedef std::pair<std::string,string> strstr; FOREACH(const strstr& sim,OMEGA.memSavedSimulations){ string mark=sim.first; boost::algorithm::replace_first(mark,":memory:",""); ret.append(mark); } return ret; }
void tmpToFile(string mark, string filename){
if(OMEGA.memSavedSimulations.count(":memory:"+mark)==0) throw runtime_error("No memory-saved simulation named "+mark);
boost::iostreams::filtering_ostream out;
@@ -700,7 +700,7 @@
int addScene(){return OMEGA.addScene();}
void switchToScene(int i){OMEGA.switchToScene(i);}
string sceneToString(){
- ostringstream oss;
+ std::ostringstream oss;
yade::ObjectIO::save<typeof(OMEGA.getScene()),boost::archive::binary_oarchive>(oss,"scene",OMEGA.getScene());
oss.flush();
return oss.str();
@@ -756,7 +756,7 @@
py::list listChildClassesNonrecursive(const string& base){
py::list ret;
- for(map<string,DynlibDescriptor>::const_iterator di=Omega::instance().getDynlibsDescriptor().begin();di!=Omega::instance().getDynlibsDescriptor().end();++di) if (Omega::instance().isInheritingFrom((*di).first,base)) ret.append(di->first);
+ for(std::map<string,DynlibDescriptor>::const_iterator di=Omega::instance().getDynlibsDescriptor().begin();di!=Omega::instance().getDynlibsDescriptor().end();++di) if (Omega::instance().isInheritingFrom((*di).first,base)) ret.append(di->first);
return ret;
}
@@ -765,7 +765,7 @@
}
py::list plugins_get(){
- const map<string,DynlibDescriptor>& plugins=Omega::instance().getDynlibsDescriptor();
+ const std::map<string,DynlibDescriptor>& plugins=Omega::instance().getDynlibsDescriptor();
std::pair<string,DynlibDescriptor> p; py::list ret;
FOREACH(p, plugins) ret.append(p.first);
return ret;