yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #12608
[Branch ~yade-pkg/yade/git-trunk] Rev 3834: Add prefix std:: to isnan and isinf.
------------------------------------------------------------
revno: 3834
author: Anton Gladky <gladky.anton@xxxxxxxxx>
committer: Anton Gladky <gladk@xxxxxxxxxx>
timestamp: Tue 2016-04-12 06:37:00 +0200
message:
Add prefix std:: to isnan and isinf.
Fix compilation with glibc_2.23.
Thanks to Graham Inggs <ginggs@xxxxxxxxxx> for pointing
this out.
modified:
gui/qt4/GLViewer.cpp
gui/qt5/GLViewer.cpp
lib/triangulation/FlowBoundingSphere.ipp
lib/triangulation/PeriodicFlow.hpp
pkg/common/Cylinder.cpp
pkg/common/Facet.cpp
pkg/common/Gl1_NormPhys.cpp
pkg/common/InsertionSortCollider.cpp
pkg/common/MatchMaker.cpp
pkg/common/ZECollider.cpp
pkg/dem/ConcretePM.cpp
pkg/dem/GeneralIntegratorInsertionSortCollider.cpp
pkg/dem/Ig2_PP_PP_ScGeom.cpp
pkg/dem/KnKsLaw.cpp
pkg/dem/NewtonIntegrator.cpp
pkg/dem/PeriIsoCompressor.cpp
pkg/dem/Polyhedra_Ig2.cpp
pkg/dem/Polyhedra_support.cpp
pkg/dem/ScGeom.cpp
pkg/dem/Shop_02.cpp
pkg/dem/UniaxialStrainer.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 'gui/qt4/GLViewer.cpp'
--- gui/qt4/GLViewer.cpp 2015-11-06 20:00:30 +0000
+++ gui/qt4/GLViewer.cpp 2016-04-12 04:37:00 +0000
@@ -352,7 +352,7 @@
if(not(rb->bound)){ rb->updateBound();}
min=rb->bound->min; max=rb->bound->max;
- bool hasNan=(isnan(min[0])||isnan(min[1])||isnan(min[2])||isnan(max[0])||isnan(max[1])||isnan(max[2]));
+ bool hasNan=(std::isnan(min[0])||std::isnan(min[1])||std::isnan(min[2])||std::isnan(max[0])||std::isnan(max[1])||std::isnan(max[2]));
Real minDim=std::min(max[0]-min[0],std::min(max[1]-min[1],max[2]-min[2]));
if(minDim<=0 || hasNan){
// Aabb is not yet calculated...
@@ -364,7 +364,7 @@
max=max.cwiseMax(b->state->pos);
min=min.cwiseMin(b->state->pos);
}
- if(isinf(min[0])||isinf(min[1])||isinf(min[2])||isinf(max[0])||isinf(max[1])||isinf(max[2])){ LOG_DEBUG("No min/max computed from bodies either, setting cube (-1,-1,-1)×(1,1,1)"); min=-Vector3r::Ones(); max=Vector3r::Ones(); }
+ if(std::isinf(min[0])||std::isinf(min[1])||std::isinf(min[2])||std::isinf(max[0])||std::isinf(max[1])||std::isinf(max[2])){ LOG_DEBUG("No min/max computed from bodies either, setting cube (-1,-1,-1)×(1,1,1)"); min=-Vector3r::Ones(); max=Vector3r::Ones(); }
} else {LOG_DEBUG("Using scene's Aabb");}
LOG_DEBUG("Got scene box min="<<min<<" and max="<<max);
=== modified file 'gui/qt5/GLViewer.cpp'
--- gui/qt5/GLViewer.cpp 2015-11-06 20:00:30 +0000
+++ gui/qt5/GLViewer.cpp 2016-04-12 04:37:00 +0000
@@ -352,7 +352,7 @@
if(not(rb->bound)){ rb->updateBound();}
min=rb->bound->min; max=rb->bound->max;
- bool hasNan=(isnan(min[0])||isnan(min[1])||isnan(min[2])||isnan(max[0])||isnan(max[1])||isnan(max[2]));
+ bool hasNan=(std::isnan(min[0])||std::isnan(min[1])||std::isnan(min[2])||std::isnan(max[0])||std::isnan(max[1])||std::isnan(max[2]));
Real minDim=std::min(max[0]-min[0],std::min(max[1]-min[1],max[2]-min[2]));
if(minDim<=0 || hasNan){
// Aabb is not yet calculated...
@@ -364,7 +364,7 @@
max=max.cwiseMax(b->state->pos);
min=min.cwiseMin(b->state->pos);
}
- if(isinf(min[0])||isinf(min[1])||isinf(min[2])||isinf(max[0])||isinf(max[1])||isinf(max[2])){ LOG_DEBUG("No min/max computed from bodies either, setting cube (-1,-1,-1)×(1,1,1)"); min=-Vector3r::Ones(); max=Vector3r::Ones(); }
+ if(std::isinf(min[0])||std::isinf(min[1])||std::isinf(min[2])||std::isinf(max[0])||std::isinf(max[1])||std::isinf(max[2])){ LOG_DEBUG("No min/max computed from bodies either, setting cube (-1,-1,-1)×(1,1,1)"); min=-Vector3r::Ones(); max=Vector3r::Ones(); }
} else {LOG_DEBUG("Using scene's Aabb");}
LOG_DEBUG("Got scene box min="<<min<<" and max="<<max);
=== modified file 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp 2016-03-10 18:31:27 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp 2016-04-12 04:37:00 +0000
@@ -895,7 +895,7 @@
} else {
/// INCOMPRESSIBLE
m += (cell->info().kNorm())[j2] * cell->neighbor(j2)->info().p();
- if ( isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().p() = " << cell->neighbor(j2)->info().p() << endl;
+ if ( std::isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().p() = " << cell->neighbor(j2)->info().p() << endl;
if (j==0) n += (cell->info().kNorm())[j2];
}
}
=== modified file 'lib/triangulation/PeriodicFlow.hpp'
--- lib/triangulation/PeriodicFlow.hpp 2014-10-29 16:49:20 +0000
+++ lib/triangulation/PeriodicFlow.hpp 2016-04-12 04:37:00 +0000
@@ -406,7 +406,7 @@
if (j==0) n += compFlowFactor*(cell->info().kNorm())[j2];
} else {
m += (cell->info().kNorm())[j2]*cell->neighbor(j2)->info().shiftedP();
- if ( isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().shiftedP() = " << cell->neighbor(j2)->info().shiftedP() << endl;
+ if ( std::isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().shiftedP() = " << cell->neighbor(j2)->info().shiftedP() << endl;
if (j==0) n += (cell->info().kNorm())[j2];
}
}
=== modified file 'pkg/common/Cylinder.cpp'
--- pkg/common/Cylinder.cpp 2014-10-15 06:44:01 +0000
+++ pkg/common/Cylinder.cpp 2016-04-12 04:37:00 +0000
@@ -450,7 +450,7 @@
ChainedCylinder *cc1=static_cast<ChainedCylinder*>(cm1.get());
ChainedCylinder *cc2=static_cast<ChainedCylinder*>(cm2.get());
- if(isnan(dist)){ //now if we didn't found a suitable distance because the segments don't cross each other, we try to find a sphere-cylinder distance.
+ if(std::isnan(dist)){ //now if we didn't found a suitable distance because the segments don't cross each other, we try to find a sphere-cylinder distance.
Vector3r pointsToCheck[4]={A,A+a,B,B+b}; Real resultDist=dist, resultProj=dist ; int whichCaseIsCloser=-1 ;
for (int i=0;i<4;i++){ //loop on the 4 cylinder's extremities and look at the extremity-cylinder distance
Vector3r S=pointsToCheck[i], C=(i<2)?B:A, vec=(i<2)?b:a; Vector3r CS=S-C;
@@ -458,7 +458,7 @@
if(d<0.) resultDist=CS.norm();
else if(d>vec.norm()) resultDist=(C+vec-S).norm();
else resultDist=(CS.cross(vec)).norm()/(vec.norm());
- if(dist>resultDist or isnan(dist)){dist=resultDist ; whichCaseIsCloser=i; resultProj=d;}
+ if(dist>resultDist or std::isnan(dist)){dist=resultDist ; whichCaseIsCloser=i; resultProj=d;}
}
//we know which extremity may be in contact (i), so k and m are computed to generate the right fictiousStates.
insideCyl1=1 ; insideCyl2=1;
=== modified file 'pkg/common/Facet.cpp'
--- pkg/common/Facet.cpp 2014-05-23 13:05:19 +0000
+++ pkg/common/Facet.cpp 2016-04-12 04:37:00 +0000
@@ -20,7 +20,7 @@
// in the future, a fixed-size array should be used instead of vector<Vector3r> for vertices
// this is prevented by yade::serialization now IIRC
if(vertices.size()!=3){ throw runtime_error(("Facet must have exactly 3 vertices (not "+boost::lexical_cast<string>(vertices.size())+")").c_str()); }
- if(isnan(vertices[0][0])) return; // not initialized, nothing to do
+ if(std::isnan(vertices[0][0])) return; // not initialized, nothing to do
Vector3r e[3] = {vertices[1]-vertices[0] ,vertices[2]-vertices[1] ,vertices[0]-vertices[2]};
#define CHECK_EDGE(i) if(e[i].squaredNorm()==0){LOG_FATAL("Facet has coincident vertices "<<i<<" ("<<vertices[i]<<") and "<<(i+1)%3<<" ("<<vertices[(i+1)%3]<<")!");}
CHECK_EDGE(0); CHECK_EDGE(1);CHECK_EDGE(2);
=== modified file 'pkg/common/Gl1_NormPhys.cpp'
--- pkg/common/Gl1_NormPhys.cpp 2014-10-15 06:44:01 +0000
+++ pkg/common/Gl1_NormPhys.cpp 2016-04-12 04:37:00 +0000
@@ -34,7 +34,7 @@
fnNorm=std::abs(fnNorm);
Real radiusScale=1.;
// weak/strong fabric, only used if maxWeakFn is set
- if(!isnan(maxWeakFn)){
+ if(!std::isnan(maxWeakFn)){
if(fnNorm*fnSign<maxWeakFn){ // weak fabric
if(weakFilter>0) return;
radiusScale=weakScale;
=== modified file 'pkg/common/InsertionSortCollider.cpp'
--- pkg/common/InsertionSortCollider.cpp 2015-12-09 07:35:43 +0000
+++ pkg/common/InsertionSortCollider.cpp 2016-04-12 04:37:00 +0000
@@ -234,9 +234,9 @@
if(!s) continue;
minR=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 (std::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
- verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
+ verletDist=std::isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// if interactions are dirty, force reinitialization
if(scene->interactions->dirty){
=== modified file 'pkg/common/MatchMaker.cpp'
--- pkg/common/MatchMaker.cpp 2014-10-15 06:44:01 +0000
+++ pkg/common/MatchMaker.cpp 2016-04-12 04:37:00 +0000
@@ -9,7 +9,7 @@
if(((int)m[0]==id1 && (int)m[1]==id2) || ((int)m[0]==id2 && (int)m[1]==id1)) return m[2];
}
// no match
- if(fbNeedsValues && (isnan(val1) || isnan(val2))) throw std::invalid_argument("MatchMaker: no match for ("+boost::lexical_cast<string>(id1)+","+boost::lexical_cast<string>(id2)+"), and values required for algo computation '"+algo+"' not specified.");
+ if(fbNeedsValues && (std::isnan(val1) || std::isnan(val2))) throw std::invalid_argument("MatchMaker: no match for ("+boost::lexical_cast<string>(id1)+","+boost::lexical_cast<string>(id2)+"), and values required for algo computation '"+algo+"' not specified.");
return computeFallback(val1,val2);
}
=== modified file 'pkg/common/ZECollider.cpp'
--- pkg/common/ZECollider.cpp 2015-12-09 07:35:43 +0000
+++ pkg/common/ZECollider.cpp 2016-04-12 04:37:00 +0000
@@ -66,7 +66,7 @@
minR=min(s->radius,minR);
}
// if no spheres, disable stride
- verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
+ verletDist=std::isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// update bounds via boundDispatcher
=== modified file 'pkg/dem/ConcretePM.cpp'
--- pkg/dem/ConcretePM.cpp 2014-11-08 09:56:26 +0000
+++ pkg/dem/ConcretePM.cpp 2016-04-12 04:37:00 +0000
@@ -43,14 +43,14 @@
// check unassigned values
if (!mat1->neverDamage) {
- assert(!isnan(mat1->sigmaT));
- assert(!isnan(mat1->epsCrackOnset));
- assert(!isnan(mat1->relDuctility));
+ assert(!std::isnan(mat1->sigmaT));
+ assert(!std::isnan(mat1->epsCrackOnset));
+ assert(!std::isnan(mat1->relDuctility));
}
if (!mat2->neverDamage) {
- assert(!isnan(mat2->sigmaT));
- assert(!isnan(mat2->epsCrackOnset));
- assert(!isnan(mat2->relDuctility));
+ assert(!std::isnan(mat2->sigmaT));
+ assert(!std::isnan(mat2->epsCrackOnset));
+ assert(!std::isnan(mat2->relDuctility));
}
cpmPhys->damLaw = mat1->damLaw;
@@ -273,7 +273,7 @@
#ifdef YADE_DEBUG
#define CPM_YADE_DEBUG_A \
- if(isnan(epsN)){\
+ if(std::isnan(epsN)){\
/*LOG_FATAL("refLength="<<geom->refLength<<"; pos1="<<geom->se31.position<<"; pos2="<<geom->se32.position<<"; displacementN="<<geom->displacementN());*/ \
throw runtime_error("!! epsN==NaN !!");\
}
@@ -283,8 +283,8 @@
#define YADE_VERIFY(condition) if(!(condition)){LOG_FATAL("Verification `"<<#condition<<"' failed!"); LOG_FATAL("in interaction #"<<I->getId1()<<"+#"<<I->getId2()); Omega::instance().saveSimulation("/tmp/verificationFailed.xml"); throw;}
-#define NNAN(a) YADE_VERIFY(!isnan(a));
-#define NNANV(v) YADE_VERIFY(!isnan(v[0])); assert(!isnan(v[1])); assert(!isnan(v[2]));
+#define NNAN(a) YADE_VERIFY(!std::isnan(a));
+#define NNANV(v) YADE_VERIFY(!std::isnan(v[0])); assert(!std::isnan(v[1])); assert(!std::isnan(v[2]));
bool Law2_ScGeom_CpmPhys_Cpm::go(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I){
TIMING_DELTAS_START();
=== modified file 'pkg/dem/GeneralIntegratorInsertionSortCollider.cpp'
--- pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2015-12-09 07:35:43 +0000
+++ pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2016-04-12 04:37:00 +0000
@@ -83,9 +83,9 @@
if(!s) continue;
minR=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 (std::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
- verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
+ verletDist=std::isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// update bounds via boundDispatcher
=== modified file 'pkg/dem/Ig2_PP_PP_ScGeom.cpp'
--- pkg/dem/Ig2_PP_PP_ScGeom.cpp 2016-01-22 22:27:43 +0000
+++ pkg/dem/Ig2_PP_PP_ScGeom.cpp 2016-04-12 04:37:00 +0000
@@ -164,7 +164,7 @@
scm->precompute(state1,state2,scene,c,avgNormal,!(hasGeom),Vector3r(0,0,0)/*shift 2 */, false /* avoidGranularRatcheting */); //Assign contact point and normal after precompute!!!!
scm->contactPoint = contactPt;
scm->penetrationDepth=penetrationDepth;
- if(isnan(avgNormal.norm())) {
+ if(std::isnan(avgNormal.norm())) {
//std::cout<<"avgNormal: "<<avgNormal<<endl;
}
scm->normal = avgNormal;
@@ -424,7 +424,7 @@
Real Fdy = fdx * Q1(0,1) + fdy*Q1(1,1) + fdz*Q1(2,1);
Real Fdz = fdx * Q1(0,2) + fdy*Q1(1,2) + fdz*Q1(2,2);
- if (isnan(Fdx) == true || isnan(Fdy) == true || isnan(Fdz)==true) {
+ if (std::isnan(Fdx) == true || std::isnan(Fdy) == true || std::isnan(Fdz)==true) {
//std::cout<<"Q1(0,0): "<<Q1(0,0)<<","<<Q1(0,1)<<","<<Q1(0,2)<<","<<Q1(1,0)<<","<<Q1(1,1)<<","<<Q1(1,2)<<","<<Q1(2,0)<<","<<Q1(2,1)<<","<<Q1(2,2)<<", q:"<<q0<<","<<q1<<","<<q2<<","<<q3<<", fd: "<<fdx<<","<<fdy<<","<<fdz<<endl;
}
=== modified file 'pkg/dem/KnKsLaw.cpp'
--- pkg/dem/KnKsLaw.cpp 2016-01-22 22:27:43 +0000
+++ pkg/dem/KnKsLaw.cpp 2016-04-12 04:37:00 +0000
@@ -228,7 +228,7 @@
//we need to use correct branches in the periodic case, the following apply for spheres only
Vector3r force = -phys->normalForce-dampedShearForce;
- if(isnan(force.norm())) {
+ if(std::isnan(force.norm())) {
//std::cout<<"shearForce: "<<shearForce<<", normalForce: "<<phys->normalForce<<", debugFn: "<<debugFn<<", viscous: "<<phys->normalViscous<<", normal: "<<phys->normal<<", geom normal: "<<geom->normal<<", effective_phi: "<<phys->effective_phi<<", shearIncrement: "<<shearIncrement<<", id1: "<<id1<<", id2: "<<id2<<", shearForceBeforeRotate: "<<shearForceBeforeRotate<<", shearForceAfterRotate: " <<shearForceAfterRotate<<endl;
}
scene->forces.addForce(id1,force);
=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp 2015-07-01 18:36:34 +0000
+++ pkg/dem/NewtonIntegrator.cpp 2016-04-12 04:37:00 +0000
@@ -102,7 +102,7 @@
// its velocity will count as max velocity of bodies
// otherwise the collider might not run if only the cell were changing without any particle motion
// FIXME: will not work for pure shear transformation, which does not change Cell::getSize()
- if(scene->isPeriodic && ((prevCellSize!=scene->cell->getSize())) && /* initial value */!isnan(prevCellSize[0]) ){ cellChanged=true; maxVelocitySq=(prevCellSize-scene->cell->getSize()).squaredNorm()/pow(dt,2); }
+ if(scene->isPeriodic && ((prevCellSize!=scene->cell->getSize())) && /* initial value */!std::isnan(prevCellSize[0]) ){ cellChanged=true; maxVelocitySq=(prevCellSize-scene->cell->getSize()).squaredNorm()/pow(dt,2); }
else { maxVelocitySq=0; cellChanged=false; }
#ifdef YADE_BODY_CALLBACK
@@ -144,8 +144,8 @@
//in most cases, the initial force on clumps will be zero and next line is not changing f and m, but make sure we don't miss something (e.g. user defined forces on clumps)
f=scene->forces.getForce(id); m=scene->forces.getTorque(id);
#ifdef YADE_DEBUG
- if(isnan(f[0])||isnan(f[1])||isnan(f[2])) throw runtime_error(("NewtonIntegrator: NaN force acting on #"+boost::lexical_cast<string>(id)+".").c_str());
- if(isnan(m[0])||isnan(m[1])||isnan(m[2])) throw runtime_error(("NewtonIntegrator: NaN torque acting on #"+boost::lexical_cast<string>(id)+".").c_str());
+ if(std::isnan(f[0])||std::isnan(f[1])||std::isnan(f[2])) throw runtime_error(("NewtonIntegrator: NaN force acting on #"+boost::lexical_cast<string>(id)+".").c_str());
+ if(std::isnan(m[0])||std::isnan(m[1])||std::isnan(m[2])) throw runtime_error(("NewtonIntegrator: NaN torque acting on #"+boost::lexical_cast<string>(id)+".").c_str());
if(state->mass<=0 && ((state->blockedDOFs & State::DOF_XYZ) != State::DOF_XYZ)) throw runtime_error(("NewtonIntegrator: #"+boost::lexical_cast<string>(id)+" has some linear accelerations enabled, but State::mass is non-positive."));
if(state->inertia.minCoeff()<=0 && ((state->blockedDOFs & State::DOF_RXRYRZ) != State::DOF_RXRYRZ)) throw runtime_error(("NewtonIntegrator: #"+boost::lexical_cast<string>(id)+" has some angular accelerations enabled, but State::inertia contains non-positive terms."));
#endif
=== modified file 'pkg/dem/PeriIsoCompressor.cpp'
--- pkg/dem/PeriIsoCompressor.cpp 2014-10-15 06:44:01 +0000
+++ pkg/dem/PeriIsoCompressor.cpp 2016-04-12 04:37:00 +0000
@@ -154,7 +154,7 @@
if(doUpdate || min(stiff[0],min(stiff[1],stiff[2])) <=0 || dynCell){ strainStressStiffUpdate(); }
// set mass to be sum of masses, if not set by the user
- if(dynCell && isnan(mass)){
+ if(dynCell && std::isnan(mass)){
mass=0; FOREACH(const shared_ptr<Body>& b, *scene->bodies){ if(b && b->state) mass+=b->state->mass; }
LOG_INFO("Setting cell mass to "<<mass<<" automatically.");}
bool allOk=true;
=== modified file 'pkg/dem/Polyhedra_Ig2.cpp'
--- pkg/dem/Polyhedra_Ig2.cpp 2016-03-24 22:08:26 +0000
+++ pkg/dem/Polyhedra_Ig2.cpp 2016-04-12 04:37:00 +0000
@@ -75,7 +75,7 @@
Vector3r centroid;
P_volume_centroid(Int, &volume, ¢roid);
- if(isnan(volume) || volume<=1E-25 || volume > min(A->GetVolume(),B->GetVolume())) {
+ if(std::isnan(volume) || volume<=1E-25 || volume > min(A->GetVolume(),B->GetVolume())) {
bang->equivalentPenetrationDepth=0;
bang->penetrationVolume=min(A->GetVolume(),B->GetVolume());
bang->normal = (A->GetVolume()>B->GetVolume() ? 1 : -1)*(se32.position+shift2-se31.position);
@@ -185,7 +185,7 @@
Real volume;
Vector3r centroid;
P_volume_centroid(Int, &volume, ¢roid);
- if(isnan(volume) || volume<=1E-25 || volume > B->GetVolume()) {bang->equivalentPenetrationDepth=0; return true;}
+ if(std::isnan(volume) || volume<=1E-25 || volume > B->GetVolume()) {bang->equivalentPenetrationDepth=0; return true;}
if (!Is_inside_Polyhedron(PB, ToCGALPoint(centroid))) {bang->equivalentPenetrationDepth=0; return true;}
//calculate area of projection of Intersection into the normal plane
@@ -281,7 +281,7 @@
Real volume;
Vector3r centroid;
P_volume_centroid(Int, &volume, ¢roid);
- if(isnan(volume) || volume<=1E-25 || volume > B->GetVolume()) {bang->equivalentPenetrationDepth=0; return true;}
+ if(std::isnan(volume) || volume<=1E-25 || volume > B->GetVolume()) {bang->equivalentPenetrationDepth=0; return true;}
if (!Is_inside_Polyhedron(PB, ToCGALPoint(centroid))) {bang->equivalentPenetrationDepth=0; return true;}
//find normal direction
=== modified file 'pkg/dem/Polyhedra_support.cpp'
--- pkg/dem/Polyhedra_support.cpp 2016-03-24 22:08:26 +0000
+++ pkg/dem/Polyhedra_support.cpp 2016-04-12 04:37:00 +0000
@@ -404,7 +404,7 @@
Polyhedron ConvexHull(vector<CGALpoint> &planes){
Polyhedron Int;
for (const auto p : planes) {
- if (isnan(p.x()) || isnan(p.y()) || isnan(p.z())) return Int;
+ if (std::isnan(p.x()) || std::isnan(p.y()) || std::isnan(p.z())) return Int;
}
if (planes.size()>3) CGAL::convex_hull_3(planes.begin(), planes.end(), Int);
return Int;
@@ -683,7 +683,7 @@
const auto pX = -pi->a()/pi->d();
const auto pY = -pi->b()/pi->d();
const auto pZ = -pi->c()/pi->d();
- if (isnan(pX) || isnan(pY) || isnan(pZ)) {
+ if (std::isnan(pX) || std::isnan(pY) || std::isnan(pZ)) {
Polyhedron IntersectionEmpty;
return IntersectionEmpty;
} else {
=== modified file 'pkg/dem/ScGeom.cpp'
--- pkg/dem/ScGeom.cpp 2014-10-15 06:44:01 +0000
+++ pkg/dem/ScGeom.cpp 2016-04-12 04:37:00 +0000
@@ -104,7 +104,7 @@
// add -DYADE_SCGEOM_DEBUG to CXXFLAGS to enable this piece or just do
// #define YADE_SCGEOM_DEBUG //(but do not commit with that enabled in the code)
#ifdef YADE_SCGEOM_DEBUG
- if (isnan(aa.angle())) {
+ if (std::isnan(aa.angle())) {
cerr<<"NaN angle found in angleAxisr(q), for quaternion "<<delta<<", after quaternion product"<<endl;
cerr<<"rbp1.ori * (initialOrientation1.conjugate())) * (initialOrientation2 * (rbp2.ori.conjugate()) with quaternions :"<<endl;
cerr<<rbp1.ori<<" * "<<initialOrientation1<<" * "<<initialOrientation2<<" * "<<rbp2.ori<<endl<<" and sub-products :"<<endl<<rbp1.ori * (initialOrientation1.conjugate())<<" * "<<initialOrientation2 * (rbp2.ori.conjugate())<<endl;
@@ -115,7 +115,7 @@
cerr<<delta<<" "<<bb.angle()<<endl;
}
#else
- if (isnan(aa.angle())) aa.angle()=0;
+ if (std::isnan(aa.angle())) aa.angle()=0;
#endif
if (aa.angle() > Mathr::PI) aa.angle() -= Mathr::TWO_PI; // angle is between 0 and 2*pi, but should be between -pi and pi
twist = (aa.angle() * aa.axis().dot(normal));
=== modified file 'pkg/dem/Shop_02.cpp'
--- pkg/dem/Shop_02.cpp 2015-11-06 20:00:30 +0000
+++ pkg/dem/Shop_02.cpp 2016-04-12 04:37:00 +0000
@@ -87,7 +87,7 @@
else theta=0;
Real hRef=dH_dTheta*(theta-theta0);
long period;
- if(isnan(periodStart)){
+ if(std::isnan(periodStart)){
Real h=Shop::periodicWrap(pt[axis]-hRef,hRef-Mathr::PI*dH_dTheta,hRef+Mathr::PI*dH_dTheta,&period);
return boost::make_tuple(r,h,theta);
}
@@ -235,7 +235,7 @@
Real N=(compressionPositive?-1:1)*phys->normalForce.dot(n);
// Real R=(Body::byId(I->getId2(),scene)->state->pos+cellHsize*I->cellDist.cast<Real>()-Body::byId(I->getId1(),scene)->state->pos).norm();
Real R=.5*(geom->refR1+geom->refR2);
- Real Fsplit=(!isnan(thresholdForce))?thresholdForce:Fmean;
+ Real Fsplit=(!std::isnan(thresholdForce))?thresholdForce:Fmean;
if (compressionPositive?(N<Fsplit):(N>Fsplit)){
for(int i=0; i<3; i++) for(int j=i; j<3; j++){
sigNStrong(i,j)+=R*N*n[i]*n[j];}
@@ -301,7 +301,7 @@
fabricStrong=Matrix3r::Zero();
fabricWeak=Matrix3r::Zero();
int nStrong(0), nWeak(0); // number of strong and weak contacts respectively
- if (!splitTensor & !isnan(thresholdForce)) {LOG_WARN("The bool splitTensor should be set to True if you specified a threshold value for the contact force, otherwise the function will return only the fabric tensor and not the two separate contributions.");}
+ if (!splitTensor & !std::isnan(thresholdForce)) {LOG_WARN("The bool splitTensor should be set to True if you specified a threshold value for the contact force, otherwise the function will return only the fabric tensor and not the two separate contributions.");}
FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
if(!I->isReal()) continue;
GenericSpheresContact* geom=YADE_CAST<GenericSpheresContact*>(I->geom.get());
@@ -309,7 +309,7 @@
const Vector3r& n=geom->normal;
Real f=(revertSign?-1:1)*phys->normalForce.dot(n);
// slipt the tensor according to the mean contact force or a threshold value if this is given
- Real Fsplit=(!isnan(thresholdForce))?thresholdForce:Fmean;
+ Real Fsplit=(!std::isnan(thresholdForce))?thresholdForce:Fmean;
if (revertSign?(f<Fsplit):(f>Fsplit)){ // reminder: forces are compared with their sign
for(int i=0; i<3; i++) for(int j=i; j<3; j++){
fabricStrong(i,j)+=n[i]*n[j];
=== modified file 'pkg/dem/UniaxialStrainer.cpp'
--- pkg/dem/UniaxialStrainer.cpp 2014-10-15 06:44:01 +0000
+++ pkg/dem/UniaxialStrainer.cpp 2016-04-12 04:37:00 +0000
@@ -38,13 +38,13 @@
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!");
- assert(originalLength>0 && !isnan(originalLength));
-
- assert(!isnan(strainRate) || !isnan(absSpeed));
- if(!isnan(std::numeric_limits<Real>::quiet_NaN())){ throw runtime_error("UniaxialStrainer: NaN's are not properly supported (compiled with -ffast-math?), which is required."); }
-
- if(isnan(strainRate)){ strainRate=absSpeed/originalLength; LOG_INFO("Computed new strainRate "<<strainRate); }
+ if(std::isnan(originalLength)) throw logic_error("UniaxialStrainer: Initial length is NaN!");
+ assert(originalLength>0 && !std::isnan(originalLength));
+
+ assert(!std::isnan(strainRate) || !std::isnan(absSpeed));
+ if(!std::isnan(std::numeric_limits<Real>::quiet_NaN())){ throw runtime_error("UniaxialStrainer: NaN's are not properly supported (compiled with -ffast-math?), which is required."); }
+
+ if(std::isnan(strainRate)){ strainRate=absSpeed/originalLength; LOG_INFO("Computed new strainRate "<<strainRate); }
else {absSpeed=strainRate*originalLength;}
if(!setSpeeds){
@@ -77,7 +77,7 @@
b->state->vel[axis]=pNormalized*(v1-v0)+v0;
}
}
- if(isnan(crossSectionArea)){ throw std::invalid_argument("UniaxialStrain.crossSectionArea must be specified."); }
+ if(std::isnan(crossSectionArea)){ throw std::invalid_argument("UniaxialStrain.crossSectionArea must be specified."); }
}
void UniaxialStrainer::action(){
@@ -93,7 +93,7 @@
} else currentStrainRate=strainRate;
// how much do we move (in total, symmetry handled below)
Real dAX=currentStrainRate*originalLength*scene->dt;
- if(!isnan(stopStrain)){
+ if(!std::isnan(stopStrain)){
Real axialLength=axisCoord(posIds[0])-axisCoord(negIds[0]);
Real newStrain=(axialLength+dAX)/originalLength-1;
if((newStrain*stopStrain>0) && std::abs(newStrain)>=stopStrain){ // same sign of newStrain and stopStrain && over the limit from below in abs values