yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11028
[Branch ~yade-pkg/yade/git-trunk] Rev 4054: Replace abs by std::abs.
------------------------------------------------------------
revno: 4054
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2014-07-03 09:16:58 +0200
message:
Replace abs by std::abs.
modified:
gui/qt4/GLViewerDisplay.cpp
lib/triangulation/KinematicLocalisationAnalyser.cpp
pkg/common/Bo1_Box_Aabb.cpp
pkg/common/Cylinder.cpp
pkg/common/Dispatching.cpp
pkg/common/Gl1_NormPhys.cpp
pkg/common/Gl1_Sphere.cpp
pkg/common/GravityEngines.cpp
pkg/common/Grid.cpp
pkg/common/InsertionSortCollider.cpp
pkg/common/KinematicEngines.cpp
pkg/common/ZECollider.cpp
pkg/dem/BubbleMat.cpp
pkg/dem/CapillaryTriaxialTest.cpp
pkg/dem/CohesiveTriaxialTest.cpp
pkg/dem/ConcretePM.cpp
pkg/dem/DomainLimiter.cpp
pkg/dem/FacetTopologyAnalyzer.cpp
pkg/dem/GeneralIntegratorInsertionSortCollider.cpp
pkg/dem/Ig2_Box_Sphere_ScGeom.cpp
pkg/dem/Ig2_Facet_Sphere_ScGeom.cpp
pkg/dem/Integrator.cpp
pkg/dem/JointedCohesiveFrictionalPM.cpp
pkg/dem/KinemSimpleShearBox.cpp
pkg/dem/L3Geom.cpp
pkg/dem/Law2_ScGeom6D_InelastCohFrictPhys_CohesionMoment.cpp
pkg/dem/NewtonIntegrator.cpp
pkg/dem/NormalInelasticityLaw.cpp
pkg/dem/PeriIsoCompressor.cpp
pkg/dem/Polyhedra.cpp
pkg/dem/Polyhedra_support.cpp
pkg/dem/Shop_01.cpp
pkg/dem/SpherePack.cpp
pkg/dem/Tetra.cpp
pkg/dem/TriaxialCompressionEngine.cpp
pkg/dem/TriaxialTest.cpp
pkg/dem/UniaxialStrainer.cpp
pkg/dem/VTKRecorder.cpp
pkg/dem/ViscoelasticPM.cpp
pkg/dem/WirePM.cpp
pkg/lbm/HydrodynamicsLawLBM.cpp
pkg/pfv/FlowEngine.ipp.in
pkg/pfv/PeriodicFlowEngine.cpp
pkg/pfv/SoluteFlowEngine.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/GLViewerDisplay.cpp'
--- gui/qt4/GLViewerDisplay.cpp 2014-07-02 16:11:24 +0000
+++ gui/qt4/GLViewerDisplay.cpp 2014-07-03 07:16:58 +0000
@@ -183,7 +183,7 @@
}
//LOG_DEBUG("Screen offsets for axes: "<<" x("<<screenDxDy[0][0]<<","<<screenDxDy[0][1]<<") y("<<screenDxDy[1][0]<<","<<screenDxDy[1][1]<<") z("<<screenDxDy[2][0]<<","<<screenDxDy[2][1]<<")");
int margin=10; // screen pixels
- int scaleCenter[2]; scaleCenter[0]=abs(extremalDxDy[0])+margin; scaleCenter[1]=abs(extremalDxDy[1])+margin;
+ int scaleCenter[2]; scaleCenter[0]=std::abs(extremalDxDy[0])+margin; scaleCenter[1]=std::abs(extremalDxDy[1])+margin;
//LOG_DEBUG("Center of scale "<<scaleCenter[0]<<","<<scaleCenter[1]);
//displayMessage(QString().sprintf("displayed scene radius %g",displayedSceneRadius()));
startScreenCoordinatesSystem();
=== modified file 'lib/triangulation/KinematicLocalisationAnalyser.cpp'
--- lib/triangulation/KinematicLocalisationAnalyser.cpp 2014-03-21 18:47:45 +0000
+++ lib/triangulation/KinematicLocalisationAnalyser.cpp 2014-07-03 07:16:58 +0000
@@ -173,7 +173,7 @@
&& TS1->inside(T.segment(*ed_it).target())) {
Segment s = T.segment(*ed_it);
CVector v = s.to_vector();
- Real ny = abs(v.y()/sqrt(s.squared_length()));
+ Real ny = std::abs(v.y()/sqrt(s.squared_length()));
if (Nymin < ny && ny <= Nymax) filteredList.push_back(ed_it);
}
@@ -273,7 +273,7 @@
if (!T.is_infinite(*ed_it)) {
Segment s = T.segment(*ed_it);
CVector v = s.to_vector();
- Real xx = abs(v.z()/sqrt(s.squared_length()));
+ Real xx = std::abs(v.z()/sqrt(s.squared_length()));
if (xx>0.95) edges.push_back(ed_it);
}
@@ -285,7 +285,7 @@
if (!T.is_infinite(*ed_it)) {
Segment s = T.segment(*ed_it);
CVector v = s.to_vector();
- Real xx = abs(v.z()/sqrt(s.squared_length()));
+ Real xx = std::abs(v.z()/sqrt(s.squared_length()));
if (xx<0.05) edges.push_back(ed_it);
}
@@ -297,7 +297,7 @@
if (!T.is_infinite(*ed_it)) {
Segment s = T.segment(*ed_it);
CVector v = s.to_vector();
- Real xx = abs(v.z()/sqrt(s.squared_length()));
+ Real xx = std::abs(v.z()/sqrt(s.squared_length()));
if (xx>0.65 && xx<0.75) edges.push_back(ed_it);
}
@@ -540,11 +540,11 @@
for (TriaxialState::ContactIterator cit = (*TS1).contacts_begin(); cit!=cend; ++cit) {
if ((*TS1).inside((*cit)->grain1->sphere.point()) && (*TS1).inside((*cit)->grain2->sphere.point())) {
- row[(int)(abs((*cit)->normal.z()) /DZ)].second += 2;
+ row[(int)(std::abs((*cit)->normal.z()) /DZ)].second += 2;
nc1 += 2;
} else {
if ((*TS1).inside((*cit)->grain1->sphere.point()) || (*TS1).inside((*cit)->grain2->sphere.point())) {
- row[(int)(abs((*cit)->normal.z()) /DZ)].second += 1;
+ row[(int)(std::abs((*cit)->normal.z()) /DZ)].second += 1;
++nc1;
}
//cerr << "(*cit)->normal.z(),DZ : " << (*cit)->normal.z() << " " << DZ << endl;}
@@ -604,12 +604,12 @@
s = T.segment(*ed_it);
if ((*TS1).inside(s.source()) && (*TS1).inside(s.target())) {
v = s.to_vector();
- row[(int)(abs(v.z() /sqrt(s.squared_length())) /DZ)].second += 2;
+ row[(int)(std::abs(v.z() /sqrt(s.squared_length())) /DZ)].second += 2;
nv1 += 2;
} else {
if ((*TS1).inside(s.source()) || (*TS1).inside(s.target())) {
v = s.to_vector();
- row[(int)(abs(v.z() /sqrt(s.squared_length())) /DZ)].second += 1;
+ row[(int)(std::abs(v.z() /sqrt(s.squared_length())) /DZ)].second += 1;
++nv1;
} else ++nv2;
}
=== modified file 'pkg/common/Bo1_Box_Aabb.cpp'
--- pkg/common/Bo1_Box_Aabb.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/Bo1_Box_Aabb.cpp 2014-07-03 07:16:58 +0000
@@ -26,7 +26,7 @@
Vector3r halfSize(Vector3r::Zero());
for( int i=0; i<3; ++i )
for( int j=0; j<3; ++j )
- halfSize[i] += fabs( r(i,j) * box->extents[j] );
+ halfSize[i] += std::abs( r(i,j) * box->extents[j] );
aabb->min = se3.position-halfSize;
aabb->max = se3.position+halfSize;
=== modified file 'pkg/common/Cylinder.cpp'
--- pkg/common/Cylinder.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/Cylinder.cpp 2014-07-03 07:16:58 +0000
@@ -396,17 +396,17 @@
Vector3r N=a.cross(b);
Vector3r normal;
if(N.norm()>1e-14){
- dist=abs(N.dot(B-A)/(N.norm())); //distance between the two LINES.
+ dist=std::abs(N.dot(B-A)/(N.norm())); //distance between the two LINES.
//But we need to check that the intersection point is inside the two SEGMENTS ...
//Projection of B to have a common plan between the two segments.
Vector3r projB1=B+dist*(N/(N.norm())) , projB2=B-dist*(N/(N.norm()));
Real distB1A=(projB1-A).norm() , distB2A=(projB2-A).norm() ;
Vector3r projB=(distB1A<=distB2A)*projB1 + (distB1A>distB2A)*projB2;
int b1=0, b2=1; //base vectors used to compute the segment intersection (if N is aligned with an axis, we can't use this axis)
- if(abs(N[1])<1e-14 && abs(N[2])<1e-14){b1=1;b2=2;}
- if(abs(N[0])<1e-14 && abs(N[2])<1e-14){b1=0;b2=2;}
+ if(std::abs(N[1])<1e-14 && std::abs(N[2])<1e-14){b1=1;b2=2;}
+ if(std::abs(N[0])<1e-14 && std::abs(N[2])<1e-14){b1=0;b2=2;}
Real det=a[b1]*b[b2]-a[b2]*b[b1];
- if(abs(det)>1e-14){ //Check if the two segments are intersected (using k and m)
+ if(std::abs(det)>1e-14){ //Check if the two segments are intersected (using k and m)
k = (b[b2]*(projB[b1]-A[b1])+b[b1]*(A[b2]-projB[b2]))/det;
m = (a[b1]*(-projB[b2]+A[b2])+a[b2]*(projB[b1]-A[b1]))/det;
if( k<0.0 || k>=1.0 || m<0.0 || m>=1.0 ) { //so they are not intersected
=== modified file 'pkg/common/Dispatching.cpp'
--- pkg/common/Dispatching.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/Dispatching.cpp 2014-07-03 07:16:58 +0000
@@ -36,7 +36,7 @@
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 = max(std::abs(disp[0]),max(std::abs(disp[1]),std::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
=== modified file 'pkg/common/Gl1_NormPhys.cpp'
--- pkg/common/Gl1_NormPhys.cpp 2014-05-22 15:26:55 +0000
+++ pkg/common/Gl1_NormPhys.cpp 2014-07-03 07:16:58 +0000
@@ -31,7 +31,7 @@
Real fnNorm=np->normalForce.dot(geom->normal);
if((signFilter>0 && fnNorm<0) || (signFilter<0 && fnNorm>0)) return;
int fnSign=fnNorm>0?1:-1;
- fnNorm=abs(fnNorm);
+ fnNorm=std::abs(fnNorm);
Real radiusScale=1.;
// weak/strong fabric, only used if maxWeakFn is set
if(!isnan(maxWeakFn)){
=== modified file 'pkg/common/Gl1_Sphere.cpp'
--- pkg/common/Gl1_Sphere.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/Gl1_Sphere.cpp 2014-07-03 07:16:58 +0000
@@ -34,7 +34,7 @@
if (wire || wire2) glutWireSphere(r,quality*glutSlices,quality*glutStacks);
else {
//Check if quality has been modified or if previous lists are invalidated (e.g. by creating a new qt view), then regenerate lists
- bool somethingChanged = (abs(quality-prevQuality)>0.001 || glIsList(glStripedSphereList)!=GL_TRUE);
+ bool somethingChanged = (std::abs(quality-prevQuality)>0.001 || glIsList(glStripedSphereList)!=GL_TRUE);
if (somethingChanged) {initStripedGlList(); initGlutGlList(); prevQuality=quality;}
glScalef(r,r,r);
if(stripes) glCallList(glStripedSphereList);
=== modified file 'pkg/common/GravityEngines.cpp'
--- pkg/common/GravityEngines.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/GravityEngines.cpp 2014-07-03 07:16:58 +0000
@@ -77,8 +77,8 @@
Vector2i a=readSysfsFile(hdapsDir+"/position");
lastReading=now;
a-=calibrate;
- if(abs(a[0]-accel[0])>updateThreshold) accel[0]=a[0];
- if(abs(a[1]-accel[1])>updateThreshold) accel[1]=a[1];
+ if(std::abs(a[0]-accel[0])>updateThreshold) accel[0]=a[0];
+ if(std::abs(a[1]-accel[1])>updateThreshold) accel[1]=a[1];
Quaternionr trsf(AngleAxisr(.5*accel[0]*M_PI/180.,-Vector3r::UnitY())*AngleAxisr(.5*accel[1]*M_PI/180.,-Vector3r::UnitX()));
gravity=trsf*zeroGravity;
}
=== modified file 'pkg/common/Grid.cpp'
--- pkg/common/Grid.cpp 2014-07-02 16:11:24 +0000
+++ pkg/common/Grid.cpp 2014-07-03 07:16:58 +0000
@@ -96,10 +96,10 @@
Vector3r pB=B-dist*(N/(N.norm())); //"pB" is the projection of the point "B" in the plane defined by his normal vector "N".
//Now we have pB, so we will compute the intersection of two segments into a plane.
int b0, b1; //2 base vectors used to compute the segment intersection. For more accuracy and to avoid det==0, don't choose the axis where N is max.
- if(abs(N[0])<abs(N[1]) || abs(N[0])<abs(N[2])){b0=0 ; b1=abs(N[1])<abs(N[2])?1:2;}
+ if(std::abs(N[0])<std::abs(N[1]) || std::abs(N[0])<std::abs(N[2])){b0=0 ; b1=std::abs(N[1])<std::abs(N[2])?1:2;}
else { b0=1;b1=2;}
Real det=a[b0]*b[b1]-a[b1]*b[b0];
- if (abs(det)>1e-14){
+ if (std::abs(det)>1e-14){
//Now compute k and m, who are the parameters (relative position on the connections) of the intersection on conn1 ("A" and "a") and conn2 ("B" and "b") respectively.
k = (b[b1]*(pB[b0]-A[b0])+b[b0]*(A[b1]-pB[b1]))/det;
m = (a[b0]*(-pB[b1]+A[b1])+a[b1]*(pB[b0]-A[b0]))/det;
@@ -183,8 +183,8 @@
Vector3r branch = spherePos - gridNo1St->pos;
Vector3r branchN = spherePos - gridNo2St->pos;
for(int i=0;i<3;i++){
- if(abs(branch[i])<1e-14) branch[i]=0.0;
- if(abs(branchN[i])<1e-14) branchN[i]=0.0;
+ if(std::abs(branch[i])<1e-14) branch[i]=0.0;
+ if(std::abs(branchN[i])<1e-14) branchN[i]=0.0;
}
Real relPos = branch.dot(segt)/(len*len);
if(scm->isDuplicate==2 && scm->trueInt!=c->id2)return true; //the contact will be deleted into the Law, no need to compute here.
@@ -213,7 +213,7 @@
Vector3r segtCandidate2 = GC->node2->state->pos - gridNo1St->pos;
Vector3r segtPrev = segtCandidate1.norm()>segtCandidate2.norm() ? segtCandidate1:segtCandidate2;
for(int j=0;j<3;j++){
- if(abs(segtPrev[j])<1e-14) segtPrev[j]=0.0;
+ if(std::abs(segtPrev[j])<1e-14) segtPrev[j]=0.0;
}
Real relPosPrev = (branch.dot(segtPrev))/(segtPrev.norm()*segtPrev.norm());
// ... and check whether the sphere projection is before the neighbours connections too.
@@ -250,7 +250,7 @@
Vector3r segtCandidate2 = GC->node2->state->pos - gridNo2St->pos;
Vector3r segtNext = segtCandidate1.norm()>segtCandidate2.norm() ? segtCandidate1:segtCandidate2;
for(int j=0;j<3;j++){
- if(abs(segtNext[j])<1e-14) segtNext[j]=0.0;
+ if(std::abs(segtNext[j])<1e-14) segtNext[j]=0.0;
}
Real relPosNext = (branchN.dot(segtNext))/(segtNext.norm()*segtNext.norm());
if(relPosNext<=0){ //if the sphere projection is outside both the current Connection AND this neighbouring connection, then create the interaction if the neighbour did not already do it before.
@@ -283,7 +283,7 @@
Vector3r segtCandidate2 = GC->node2->state->pos - gridNo1St->pos;
Vector3r segtPrev = segtCandidate1.norm()>segtCandidate2.norm() ? segtCandidate1:segtCandidate2;
for(int j=0;j<3;j++){
- if(abs(segtPrev[j])<1e-14) segtPrev[j]=0.0;
+ if(std::abs(segtPrev[j])<1e-14) segtPrev[j]=0.0;
}
Real relPosPrev = (branch.dot(segtPrev))/(segtPrev.norm()*segtPrev.norm());
if(relPosPrev<=0){ //the sphere projection is inside the current Connection and outide this neighbour connection.
@@ -313,7 +313,7 @@
Vector3r segtCandidate2 = GC->node2->state->pos - gridNo2St->pos;
Vector3r segtNext = segtCandidate1.norm()>segtCandidate2.norm() ? segtCandidate1:segtCandidate2;
for(int j=0;j<3;j++){
- if(abs(segtNext[j])<1e-14) segtNext[j]=0.0;
+ if(std::abs(segtNext[j])<1e-14) segtNext[j]=0.0;
}
Real relPosNext = (branchN.dot(segtNext))/(segtNext.norm()*segtNext.norm());
if(relPosNext<=0){ //the sphere projection is inside the current Connection and outide this neighbour connection.
=== modified file 'pkg/common/InsertionSortCollider.cpp'
--- pkg/common/InsertionSortCollider.cpp 2014-07-02 16:18:24 +0000
+++ pkg/common/InsertionSortCollider.cpp 2014-07-03 07:16:58 +0000
@@ -250,7 +250,7 @@
}
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
- verletDist=isinf(minR) ? 0 : abs(verletDist)*minR;
+ verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// if interactions are dirty, force reinitialization
if(scene->interactions->dirty){
=== modified file 'pkg/common/KinematicEngines.cpp'
--- pkg/common/KinematicEngines.cpp 2014-04-23 13:38:24 +0000
+++ pkg/common/KinematicEngines.cpp 2014-07-03 07:16:58 +0000
@@ -169,8 +169,8 @@
curVel = (pTerm + iTerm + dTerm); // Calculate current velocity
- if (fabs(curVel) > fabs(maxVelocity)) {
- curVel*=fabs(maxVelocity)/fabs(curVel);
+ if (std::abs(curVel) > std::abs(maxVelocity)) {
+ curVel*=std::abs(maxVelocity)/std::abs(curVel);
}
iterPrevStart = scene->iter;
=== modified file 'pkg/common/ZECollider.cpp'
--- pkg/common/ZECollider.cpp 2014-07-02 16:18:24 +0000
+++ pkg/common/ZECollider.cpp 2014-07-03 07:16:58 +0000
@@ -70,7 +70,7 @@
minR=min(s->radius,minR);
}
// if no spheres, disable stride
- verletDist=isinf(minR) ? 0 : abs(verletDist)*minR;
+ verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// update bounds via boundDispatcher
=== modified file 'pkg/dem/BubbleMat.cpp'
--- pkg/dem/BubbleMat.cpp 2013-06-15 19:17:48 +0000
+++ pkg/dem/BubbleMat.cpp 2014-07-03 07:16:58 +0000
@@ -37,7 +37,7 @@
f = penetrationDepth - ret*c1*ll;
df = -c1*(ll + 1);
ret -= f/df;
- residual = fabs(ret - retOld)/retOld;
+ residual = std::abs(ret - retOld)/retOld;
if (i++ > newtonIter) {
throw runtime_error("BubblePhys::computeForce: no convergence\n");
}
=== modified file 'pkg/dem/CapillaryTriaxialTest.cpp'
--- pkg/dem/CapillaryTriaxialTest.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/CapillaryTriaxialTest.cpp 2014-07-03 07:16:58 +0000
@@ -78,9 +78,9 @@
lowerCorner[1]-thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
Vector3r halfSize = Vector3r(
- wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_bottom_wire);
if(wall_bottom) {
@@ -96,9 +96,9 @@
upperCorner[1]+thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
- wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_top_wire);
if(wall_top) {
@@ -114,8 +114,8 @@
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_1_wire);
if(wall_1) {
scene->bodies->insert(body);
@@ -129,8 +129,8 @@
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_2_wire);
if(wall_2) {
@@ -144,8 +144,8 @@
(lowerCorner[1]+upperCorner[1])/2,
lowerCorner[2]-thickness/2.0);
halfSize = Vector3r(
- wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,wall_3_wire);
if(wall_3) {
@@ -160,8 +160,8 @@
(lowerCorner[1]+upperCorner[1])/2,
upperCorner[2]+thickness/2.0);
halfSize = Vector3r(
- wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,wall_3_wire);
if(wall_4) {
=== modified file 'pkg/dem/CohesiveTriaxialTest.cpp'
--- pkg/dem/CohesiveTriaxialTest.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/CohesiveTriaxialTest.cpp 2014-07-03 07:16:58 +0000
@@ -73,9 +73,9 @@
lowerCorner[1]-thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
Vector3r halfSize = Vector3r(
- 1.5*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ 1.5*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- 1.5*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ 1.5*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_bottom_wire);
if(wall_bottom) {
@@ -93,9 +93,9 @@
upperCorner[1]+thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
- 1.5*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ 1.5*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- 1.5*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ 1.5*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_top_wire);
if(wall_top) {
@@ -111,8 +111,8 @@
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
thickness/2.0,
- 1.5*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- 1.5*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ 1.5*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ 1.5*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_1_wire);
if(wall_1) {
scene->bodies->insert(body);
@@ -126,8 +126,8 @@
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(
thickness/2.0,
- 1.5*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- 1.5*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ 1.5*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ 1.5*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,wall_2_wire);
if(wall_2) {
@@ -141,8 +141,8 @@
(lowerCorner[1]+upperCorner[1])/2,
lowerCorner[2]-thickness/2.0);
halfSize = Vector3r(
- 1.5*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- 1.5*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ 1.5*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ 1.5*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,wall_3_wire);
if(wall_3) {
@@ -157,8 +157,8 @@
(lowerCorner[1]+upperCorner[1])/2,
upperCorner[2]+thickness/2.0);
halfSize = Vector3r(
- 1.5*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- 1.5*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ 1.5*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ 1.5*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,wall_3_wire);
if(wall_4) {
=== modified file 'pkg/dem/ConcretePM.cpp'
--- pkg/dem/ConcretePM.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/ConcretePM.cpp 2014-07-03 07:16:58 +0000
@@ -118,7 +118,7 @@
#endif
Real aux = c*exp(N*ret)+exp(ret);
f = log(aux);
- if (fabs(f) < maxError) return ret;
+ if (std::abs(f) < maxError) return ret;
Real df = (c*N*exp(N*ret)+exp(ret))/aux;
ret -= f/df;
}
@@ -185,7 +185,7 @@
dfg = CpmPhys::funcGDKappa(ret,epsCrackOnset,epsFracture,neverDamage,damLaw);
decr = fg/dfg;
ret -= decr;
- if (fabs(decr/epsCrackOnset) < tol) {
+ if (std::abs(decr/epsCrackOnset) < tol) {
return ret;
}
}
@@ -218,7 +218,7 @@
df = e0i*(1-g-k*dg);
decr = f/df;
k -= decr;
- if (fabs(decr) < tol) {
+ if (std::abs(decr) < tol) {
kappaD = k;
omega = CpmPhys::funcG(k,epsCrackOnset,epsFracture,neverDamage,damLaw);
relResidualStrength = r;
=== modified file 'pkg/dem/DomainLimiter.cpp'
--- pkg/dem/DomainLimiter.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/DomainLimiter.cpp 2014-07-03 07:16:58 +0000
@@ -110,7 +110,7 @@
axX=gsc->normal; /* just in case */ axX.normalize();
if(doInit){ // initialization of the new interaction -- define local axes
// take vector in the y or z direction, depending on its length; arbitrary, but one of them is sure to be non-zero
- axY=axX.cross(abs(axX[1])<abs(axX[2])?Vector3r::UnitY():Vector3r::UnitZ());
+ axY=axX.cross(std::abs(axX[1])<std::abs(axX[2])?Vector3r::UnitY():Vector3r::UnitZ());
axY.normalize();
axZ=axX.cross(axY);
LOG_DEBUG("Initial axes x="<<axX<<", y="<<axY<<", z="<<axZ);
=== modified file 'pkg/dem/FacetTopologyAnalyzer.cpp'
--- pkg/dem/FacetTopologyAnalyzer.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/FacetTopologyAnalyzer.cpp 2014-07-03 07:16:58 +0000
@@ -34,9 +34,9 @@
j=i;
while(++j<nVertices && (vv[j]->coord-vv[i]->coord)<=tolerance){
shared_ptr<VertexData> &vi=vv[i], &vj=vv[j];
- if(abs(vi->pos[0]-vj->pos[0])<=tolerance &&
- abs(vi->pos[1]-vj->pos[1])<=tolerance &&
- abs(vi->pos[2]-vj->pos[2])<=tolerance &&
+ if(std::abs(vi->pos[0]-vj->pos[0])<=tolerance &&
+ std::abs(vi->pos[1]-vj->pos[1])<=tolerance &&
+ std::abs(vi->pos[2]-vj->pos[2])<=tolerance &&
(vi->pos-vj->pos).squaredNorm()<=tolerance*tolerance){
// OK, these two vertices touch
// LOG_TRACE("Vertices "<<vi->id<<"/"<<vi->vertexNo<<" and "<<vj->id<<"/"<<vj->vertexNo<<" close enough.");
=== modified file 'pkg/dem/GeneralIntegratorInsertionSortCollider.cpp'
--- pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/GeneralIntegratorInsertionSortCollider.cpp 2014-07-03 07:16:58 +0000
@@ -88,7 +88,7 @@
}
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
- verletDist=isinf(minR) ? 0 : abs(verletDist)*minR;
+ verletDist=isinf(minR) ? 0 : std::abs(verletDist)*minR;
}
// update bounds via boundDispatcher
=== modified file 'pkg/dem/Ig2_Box_Sphere_ScGeom.cpp'
--- pkg/dem/Ig2_Box_Sphere_ScGeom.cpp 2012-02-29 19:07:56 +0000
+++ pkg/dem/Ig2_Box_Sphere_ScGeom.cpp 2014-07-03 07:16:58 +0000
@@ -52,10 +52,10 @@
shared_ptr<ScGeom> scm;
if (inside){
// sphere center inside box. find largest `cOnBox_boxLocal' value:
- // minCBoxDist_index is the coordinate index that minimizes extents[minCBoxDist_index]-abs(cOnBox_boxLocal[minCBoxDist_index] (sphere center closest to box boundary)
+ // minCBoxDist_index is the coordinate index that minimizes extents[minCBoxDist_index]-std::abs(cOnBox_boxLocal[minCBoxDist_index] (sphere center closest to box boundary)
// where cOnBox_boxLocal is minimal (i.e. where sphere center is closest perpendicularly to the box)
- Real minCBoxDist=extents[0]-fabs(cOnBox_boxLocal[0]); int minCBoxDist_index=0;
- for (int i=1; i<3; i++){Real tt=extents[i]-fabs(cOnBox_boxLocal[i]); if (tt<minCBoxDist){minCBoxDist=tt; minCBoxDist_index=i;}}
+ Real minCBoxDist=extents[0]-std::abs(cOnBox_boxLocal[0]); int minCBoxDist_index=0;
+ for (int i=1; i<3; i++){Real tt=extents[i]-std::abs(cOnBox_boxLocal[i]); if (tt<minCBoxDist){minCBoxDist=tt; minCBoxDist_index=i;}}
// contact normal aligned with box edge along largest `cOnBox_boxLocal' value
Vector3r normal_boxLocal = Vector3r(0,0,0);
=== modified file 'pkg/dem/Ig2_Facet_Sphere_ScGeom.cpp'
--- pkg/dem/Ig2_Facet_Sphere_ScGeom.cpp 2013-04-25 11:35:51 +0000
+++ pkg/dem/Ig2_Facet_Sphere_ScGeom.cpp 2014-07-03 07:16:58 +0000
@@ -180,7 +180,7 @@
const Real radius=static_cast<Sphere*>(cm2.get())->radius;
const int& ax(wall->axis);
Real dist=(state2.pos)[ax]+shift2[ax]-state1.pos[ax]; // signed "distance" between centers
- if(!c->isReal() && abs(dist)>radius && !force) { return false; }// wall and sphere too far from each other
+ if(!c->isReal() && std::abs(dist)>radius && !force) { return false; }// wall and sphere too far from each other
// contact point is sphere center projected onto the wall
Vector3r contPt=state2.pos+shift2; contPt[ax]=state1.pos[ax];
@@ -195,7 +195,7 @@
const shared_ptr<ScGeom>& ws=YADE_PTR_CAST<ScGeom>(c->geom);
ws->radius1=ws->radius2=radius; // do the same as for facet-sphere: wall's "radius" is the same as the sphere's radius
ws->contactPoint=contPt;
- ws->penetrationDepth=-(abs(dist)-radius);
+ ws->penetrationDepth=-(std::abs(dist)-radius);
// ws->normal is assigned by precompute
ws->precompute(state1,state2,scene,c,normal,isNew,shift2,noRatch);
return true;
=== modified file 'pkg/dem/Integrator.cpp'
--- pkg/dem/Integrator.cpp 2014-05-23 13:03:50 +0000
+++ pkg/dem/Integrator.cpp 2014-07-03 07:16:58 +0000
@@ -316,7 +316,7 @@
void Integrator::saveMaximaDisplacement(const shared_ptr<Body>& b){
if (!b->bound) return;//clumps for instance, have no bounds, hence not saved
Vector3r disp=b->state->pos-b->bound->refPos;
- Real maxDisp=max(abs(disp[0]),max(abs(disp[1]),abs(disp[2])));
+ Real maxDisp=max(std::abs(disp[0]),max(std::abs(disp[1]),std::abs(disp[2])));
if (!maxDisp || maxDisp<b->bound->sweepLength) {/*b->bound->isBounding = (updatingDispFactor>0 && (updatingDispFactor*maxDisp)<b->bound->sweepLength);*/
maxDisp=0.5;//not 0, else it will be seen as "not updated" by the collider, but less than 1 means no colliding
}
=== modified file 'pkg/dem/JointedCohesiveFrictionalPM.cpp'
--- pkg/dem/JointedCohesiveFrictionalPM.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/JointedCohesiveFrictionalPM.cpp 2014-07-03 07:16:58 +0000
@@ -34,7 +34,7 @@
if ((smoothJoint) && (phys->isOnJoint)) {
phys->jointNormal = geom->normal.dot(phys->jointNormal)*phys->jointNormal; //to set the joint normal colinear with the interaction normal
phys->jointNormal.normalize();
- phys->initD = abs((b1->state->pos - b2->state->pos).dot(phys->jointNormal)); // to set the initial gap as the equilibrium gap
+ phys->initD = std::abs((b1->state->pos - b2->state->pos).dot(phys->jointNormal)); // to set the initial gap as the equilibrium gap
} else {
phys->initD = geom->penetrationDepth;
}
@@ -44,7 +44,7 @@
if ( phys->more || ( phys->jointCumulativeSliding > (2*min(geom->radius1,geom->radius2)) ) ) {
scene->interactions->requestErase(contact); return;
} else {
- D = phys->initD - abs((b1->state->pos - b2->state->pos).dot(phys->jointNormal));
+ D = phys->initD - std::abs((b1->state->pos - b2->state->pos).dot(phys->jointNormal));
}
} else {
D = geom->penetrationDepth - phys->initD;
@@ -57,7 +57,7 @@
scene->interactions->requestErase(contact); return;
}
- if ( phys->isCohesive && (phys->FnMax>0) && (abs(D)>Dtensile) ) {
+ if ( phys->isCohesive && (phys->FnMax>0) && (std::abs(D)>Dtensile) ) {
// update body state with the number of broken bonds
JCFpmState* st1=dynamic_cast<JCFpmState*>(b1->state.get());
=== modified file 'pkg/dem/KinemSimpleShearBox.cpp'
--- pkg/dem/KinemSimpleShearBox.cpp 2014-05-28 08:55:24 +0000
+++ pkg/dem/KinemSimpleShearBox.cpp 2014-07-03 07:16:58 +0000
@@ -199,9 +199,9 @@
deltaH = (1-wallDamping)*deltaH;
if(LOG) cout << "deltaH apres amortissement :" << deltaH << endl;
- if(abs(deltaH) > max_vel*scene->dt)
+ if(std::abs(deltaH) > max_vel*scene->dt)
{
- deltaH=deltaH/abs(deltaH)*max_vel*scene->dt;
+ deltaH=deltaH/std::abs(deltaH)*max_vel*scene->dt;
if(LOG) cout << "Correction appliquee pour ne pas depasser vmax(comp)" << endl;
}
=== modified file 'pkg/dem/L3Geom.cpp'
--- pkg/dem/L3Geom.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/L3Geom.cpp 2014-07-03 07:16:58 +0000
@@ -66,7 +66,7 @@
const Real& r1=s1->cast<Sphere>().radius; const Real& r2=s2->cast<Sphere>().radius;
Vector3r relPos=state2.pos+shift2-state1.pos;
- Real unDistSq=relPos.squaredNorm()-pow(abs(distFactor)*(r1+r2),2);
+ Real unDistSq=relPos.squaredNorm()-pow(std::abs(distFactor)*(r1+r2),2);
if (unDistSq>0 && !I->isReal() && !force) return false;
// contact exists, go ahead
@@ -97,7 +97,7 @@
// g.trsf.setFromTwoVectors(Vector3r::UnitX(),g.normal); // quaternion just from the X-axis; does not seem to work for some reason?!
const Vector3r& locX(g.normal);
// initial local y-axis orientation, in the xz or xy plane, depending on which component is larger to avoid singularities
- Vector3r locY=normal.cross(abs(normal[1])<abs(normal[2])?Vector3r::UnitY():Vector3r::UnitZ()); locY-=locX*locY.dot(locX); locY.normalize();
+ Vector3r locY=normal.cross(std::abs(normal[1])<std::abs(normal[2])?Vector3r::UnitY():Vector3r::UnitZ()); locY-=locX*locY.dot(locX); locY.normalize();
Vector3r locZ=normal.cross(locY);
#ifdef L3_TRSF_QUATERNION
Matrix3r trsf; trsf.row(0)=locX; trsf.row(1)=locY; trsf.row(2)=locZ;
@@ -177,7 +177,7 @@
currTrsf=Matrix3r(Quaternionr(currTrsf).normalized());
#endif
#ifdef YADE_DEBUG
- if(abs(currTrsf.determinant()-1)>.05){
+ if(std::abs(currTrsf.determinant()-1)>.05){
LOG_ERROR("##"<<I->getId1()<<"+"<<I->getId2()<<", |trsf|="<<currTrsf.determinant());
g.trsf=currTrsf;
throw runtime_error("Transformation matrix far from orthonormal.");
@@ -234,7 +234,7 @@
if(scene->isPeriodic) throw std::logic_error("Ig2_Wall_Sphere_L3Geom does not handle periodic boundary conditions.");
const Real& radius=s2->cast<Sphere>().radius; const int& ax(s1->cast<Wall>().axis); const int& sense(s1->cast<Wall>().sense);
Real dist=state2.pos[ax]+shift2[ax]-state1.pos[ax]; // signed "distance" between centers
- if(!I->isReal() && abs(dist)>radius && !force) { return false; }// wall and sphere too far from each other
+ if(!I->isReal() && std::abs(dist)>radius && !force) { return false; }// wall and sphere too far from each other
// contact point is sphere center projected onto the wall
Vector3r contPt=state2.pos+shift2; contPt[ax]=state1.pos[ax];
Vector3r normal=Vector3r::Zero();
@@ -259,7 +259,7 @@
Vector3r cogLine=state1.ori.conjugate()*(state2.pos+shift2-state1.pos); // connect centers of gravity
Vector3r normal=facet.normal; // trial contact normal
Real planeDist=normal.dot(cogLine);
- if(abs(planeDist)>radius && !I->isReal() && !force) return false; // sphere too far
+ if(std::abs(planeDist)>radius && !I->isReal() && !force) return false; // sphere too far
if(planeDist<0){normal*=-1; planeDist*=-1; }
Vector3r planarPt=cogLine-planeDist*normal; // project sphere center to the facet plane
Vector3r contactPt; // facet's point closes to the sphere
=== modified file 'pkg/dem/Law2_ScGeom6D_InelastCohFrictPhys_CohesionMoment.cpp'
--- pkg/dem/Law2_ScGeom6D_InelastCohFrictPhys_CohesionMoment.cpp 2013-06-25 08:02:13 +0000
+++ pkg/dem/Law2_ScGeom6D_InelastCohFrictPhys_CohesionMoment.cpp 2014-07-03 07:16:58 +0000
@@ -144,14 +144,14 @@
Real twistM=twist*phys->ktw; //elastic twist moment.
bool sgnChanged=0; //whether the twist moment just passed the equilibrium state.
if(!contact->isFresh(scene) && phys->moment_twist.dot(twistM*geom->normal)<0)sgnChanged=1;
- if(abs(twist)>phys->maxTwist){
+ if(std::abs(twist)>phys->maxTwist){
phys->cohesionBroken=1;
twistM=0;
}
else{
- if(abs(twistM)>phys->maxElTw || phys->onPlastTw){ //plastic deformation.
+ if(std::abs(twistM)>phys->maxElTw || phys->onPlastTw){ //plastic deformation.
phys->onPlastTw=1;
- if(abs(phys->maxCrpRchdTw[0])>abs(twist)){ //unloading/reloading
+ if(std::abs(phys->maxCrpRchdTw[0])>std::abs(twist)){ //unloading/reloading
twistM = phys->kTwUnld*(twist-phys->maxCrpRchdTw[0])+phys->maxCrpRchdTw[1];
}
else{//creep loading.
=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp 2014-06-05 13:19:44 +0000
+++ pkg/dem/NewtonIntegrator.cpp 2014-07-03 07:16:58 +0000
@@ -72,7 +72,7 @@
void NewtonIntegrator::saveMaximaDisplacement(const shared_ptr<Body>& b){
if (!b->bound) return;//clumps for instance, have no bounds, hence not saved
Vector3r disp=b->state->pos-b->bound->refPos;
- Real maxDisp=max(abs(disp[0]),max(abs(disp[1]),abs(disp[2])));
+ Real maxDisp=max(std::abs(disp[0]),max(std::abs(disp[1]),std::abs(disp[2])));
if (!maxDisp || maxDisp<b->bound->sweepLength) {/*b->bound->isBounding = (updatingDispFactor>0 && (updatingDispFactor*maxDisp)<b->bound->sweepLength);*/
maxDisp=0.5;//not 0, else it will be seen as "not updated" by the collider, but less than 1 means no colliding
}
=== modified file 'pkg/dem/NormalInelasticityLaw.cpp'
--- pkg/dem/NormalInelasticityLaw.cpp 2014-02-03 11:21:42 +0000
+++ pkg/dem/NormalInelasticityLaw.cpp 2014-07-03 07:16:58 +0000
@@ -136,7 +136,7 @@
// Limitation by plastic threshold of this part of the moment caused by relative twist and bending
if (!momentAlwaysElastic)
{
- Real normeMomentMax = currentContactPhysics->forMaxMoment * std::fabs(Fn);
+ Real normeMomentMax = currentContactPhysics->forMaxMoment * std::abs(Fn);
if(moment.norm()>normeMomentMax)
{
moment *= normeMomentMax/moment.norm();
=== modified file 'pkg/dem/PeriIsoCompressor.cpp'
--- pkg/dem/PeriIsoCompressor.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/PeriIsoCompressor.cpp 2014-07-03 07:16:58 +0000
@@ -48,12 +48,12 @@
Real sigAvg=(sigma[0]+sigma[1]+sigma[2])/3., avgArea=(cellArea[0]+cellArea[1]+cellArea[2])/3., avgSize=(cellSize[0]+cellSize[1]+cellSize[2])/3.;
Real avgGrow=1e-4*(sigmaGoal-sigAvg)*avgArea/(avgStiffness>0?avgStiffness:1);
Real maxToAvg=maxSize/avgSize;
- if(abs(maxToAvg*avgGrow)>maxDisplPerStep) avgGrow=Mathr::Sign(avgGrow)*maxDisplPerStep/maxToAvg;
+ if(std::abs(maxToAvg*avgGrow)>maxDisplPerStep) avgGrow=Mathr::Sign(avgGrow)*maxDisplPerStep/maxToAvg;
Real okGrow=-(minSize-2.1*maxSpan)/maxToAvg;
if(avgGrow<okGrow) throw runtime_error("Unable to shring cell due to maximum body size (although required by stress condition). Increase particle rigidity, increase total sample dimensions, or decrease goal stress.");
// avgGrow=max(avgGrow,-(minSize-2.1*maxSpan)/maxToAvg);
if(avgStiffness>0) { sigma+=(avgGrow*avgStiffness)*Vector3r::Ones(); sigAvg+=avgGrow*avgStiffness; }
- if(abs((sigAvg-sigmaGoal)/sigmaGoal)>5e-3) allStressesOK=false;
+ if(std::abs((sigAvg-sigmaGoal)/sigmaGoal)>5e-3) allStressesOK=false;
cellGrow=(avgGrow/avgSize)*cellSize;
}
else{ // handle each dimension separately
@@ -63,11 +63,11 @@
// FIXME: that is why the fixup 1e-4 is needed here
// FIXME: or perhaps maxDisplaPerStep=1e-2*charLen is too big??
cellGrow[axis]=1e-4*(sigmaGoal-sigma[axis])*cellArea[axis]/(avgStiffness>0?avgStiffness:1); // FIXME: wrong dimensions? See PeriTriaxController
- if(abs(cellGrow[axis])>maxDisplPerStep) cellGrow[axis]=Mathr::Sign(cellGrow[axis])*maxDisplPerStep;
+ if(std::abs(cellGrow[axis])>maxDisplPerStep) cellGrow[axis]=Mathr::Sign(cellGrow[axis])*maxDisplPerStep;
cellGrow[axis]=max(cellGrow[axis],-(cellSize[axis]-2.1*maxSpan));
// crude way of predicting sigma, for steps when it is not computed from intrs
if(avgStiffness>0) sigma[axis]+=cellGrow[axis]*avgStiffness; // FIXME: dimensions
- if(abs((sigma[axis]-sigmaGoal)/sigmaGoal)>5e-3) allStressesOK=false;
+ if(std::abs((sigma[axis]-sigmaGoal)/sigmaGoal)>5e-3) allStressesOK=false;
}
}
TRVAR4(cellGrow,sigma,sigmaGoal,avgStiffness);
@@ -113,7 +113,7 @@
Vector3r branch=Body::byId(I->getId2(),scene)->state->pos + scene->cell->hSize*I->cellDist.cast<Real>() -Body::byId(I->getId1(),scene)->state->pos;
stressTensor+=f*branch.transpose();
if( !dynCell ){
- for ( int i=0; i<3; i++ ) sumStiff[i]+=abs ( gsc->normal[i] ) *nsi->kn+ ( 1-abs ( gsc->normal[i] ) ) *nsi->ks;
+ for ( int i=0; i<3; i++ ) sumStiff[i]+=std::abs ( gsc->normal[i] ) *nsi->kn+ ( 1-std::abs ( gsc->normal[i] ) ) *nsi->ks;
n++;}
}
// Divide by volume as in stressTensor=sum(fi*lj)/Volume (Love equation)
@@ -182,7 +182,7 @@
// steady evolution with fluctuations; see TriaxialStressController
if (!dynCell) strain_rate=(1-growDamping)*strain_rate+.8*prevGrow[axis];
// limit maximum strain rate
- if (abs(strain_rate)>maxStrainRate[axis]) strain_rate = Mathr::Sign(strain_rate)*maxStrainRate[axis];
+ if (std::abs(strain_rate)>maxStrainRate[axis]) strain_rate = Mathr::Sign(strain_rate)*maxStrainRate[axis];
// do not shrink below minimum cell size (periodic collider condition), although it is suboptimal WRT resulting stress
strain_rate=max(strain_rate,-(cellSize[axis]-2.1*maxBodySpan[axis])/scene->dt);
@@ -193,13 +193,13 @@
// signal if condition not satisfied
if(stressMask&(1<<axis)){
Real curr=stress[axis];
- if((goal[axis]!=0 && abs((curr-goal[axis])/goal[axis])>relStressTol) || abs(curr-goal[axis])>absStressTol) allOk=false;
+ if((goal[axis]!=0 && std::abs((curr-goal[axis])/goal[axis])>relStressTol) || std::abs(curr-goal[axis])>absStressTol) allOk=false;
}else{
Real curr=strain[axis];
// since strain is prescribed exactly, tolerances need just to accomodate rounding issues
- if((goal[axis]!=0 && abs((curr-goal[axis])/goal[axis])>1e-6) || abs(curr-goal[axis])>1e-6){
+ if((goal[axis]!=0 && std::abs((curr-goal[axis])/goal[axis])>1e-6) || std::abs(curr-goal[axis])>1e-6){
allOk=false;
- if(doUpdate) LOG_DEBUG("Strain not OK; "<<abs(curr-goal[axis])<<">1e-6");}
+ if(doUpdate) LOG_DEBUG("Strain not OK; "<<std::abs(curr-goal[axis])<<">1e-6");}
}
}
// update stress and strain
@@ -284,7 +284,7 @@
// convert relative progress values of ##Path to absolute values
PATH_OP_OP(i,j,0) *= 1./PATH_OP_OP(i,pathSizes[i]-1,0);
// convert relative stress/strain values of ##Path to absolute stress strain values
- if (abs(PATH_OP_OP(i,pathSizes[i]-1,1)) >= 1e-9) { // the final value is not 0 (otherwise always absolute values are considered)
+ if (std::abs(PATH_OP_OP(i,pathSizes[i]-1,1)) >= 1e-9) { // the final value is not 0 (otherwise always absolute values are considered)
PATH_OP_OP(i,j,1) *= goal(i)/PATH_OP_OP(i,pathSizes[i]-1,1);
}
}
@@ -385,7 +385,7 @@
}
}
- // correction coefficient ix strainRate.maxabs() > maxStrainRate
+ // correction coefficient ix strainRate.maxstd::abs() > maxStrainRate
Real srCorr = (strainRate.cwiseAbs().maxCoeff() > maxStrainRate)? (maxStrainRate/strainRate.cwiseAbs().maxCoeff()):1.;
strainRate *= srCorr;
=== modified file 'pkg/dem/Polyhedra.cpp'
--- pkg/dem/Polyhedra.cpp 2014-07-01 18:14:18 +0000
+++ pkg/dem/Polyhedra.cpp 2014-07-03 07:16:58 +0000
@@ -113,7 +113,7 @@
inertia_tensor = inertia_tensor + Itet1 + Itet2*vtet;
}
- if(abs(inertia_tensor(0,1))+abs(inertia_tensor(0,2))+abs(inertia_tensor(1,2)) < 1E-13){
+ if(std::abs(inertia_tensor(0,1))+std::abs(inertia_tensor(0,2))+std::abs(inertia_tensor(1,2)) < 1E-13){
// no need to rotate, inertia already diagonal
orientation = Quaternionr::Identity();
inertia = Vector3r(inertia_tensor(0,0),inertia_tensor(1,1),inertia_tensor(2,2));
@@ -127,14 +127,14 @@
// set positove direction of vectors - otherwise reloading does not work
Matrix3r sign(Matrix3r::Zero());
double max_v_signed = I_rot(0,0);
- double max_v = abs(I_rot(0,0));
- if (max_v < abs(I_rot(1,0))) {max_v_signed = I_rot(1,0); max_v = abs(I_rot(1,0));}
- if (max_v < abs(I_rot(2,0))) {max_v_signed = I_rot(2,0); max_v = abs(I_rot(2,0));}
+ double max_v = std::abs(I_rot(0,0));
+ if (max_v < std::abs(I_rot(1,0))) {max_v_signed = I_rot(1,0); max_v = std::abs(I_rot(1,0));}
+ if (max_v < std::abs(I_rot(2,0))) {max_v_signed = I_rot(2,0); max_v = std::abs(I_rot(2,0));}
sign(0,0) = max_v_signed/max_v;
max_v_signed = I_rot(0,1);
- max_v = abs(I_rot(0,1));
- if (max_v < abs(I_rot(1,1))) {max_v_signed = I_rot(1,1); max_v = abs(I_rot(1,1));}
- if (max_v < abs(I_rot(2,1))) {max_v_signed = I_rot(2,1); max_v = abs(I_rot(2,1));}
+ max_v = std::abs(I_rot(0,1));
+ if (max_v < std::abs(I_rot(1,1))) {max_v_signed = I_rot(1,1); max_v = std::abs(I_rot(1,1));}
+ if (max_v < std::abs(I_rot(2,1))) {max_v_signed = I_rot(2,1); max_v = std::abs(I_rot(2,1));}
sign(1,1) = max_v_signed/max_v;
sign(2,2) = 1.;
I_rot = I_rot*sign;
@@ -307,7 +307,7 @@
Real fnNorm=np->normalForce.dot(geom->normal);
if((signFilter>0 && fnNorm<0) || (signFilter<0 && fnNorm>0)) return;
int fnSign=fnNorm>0?1:-1;
- fnNorm=abs(fnNorm);
+ fnNorm=std::abs(fnNorm);
Real radiusScale=1.;
maxFn=max(fnNorm,maxFn);
Real realMaxRadius;
=== modified file 'pkg/dem/Polyhedra_support.cpp'
--- pkg/dem/Polyhedra_support.cpp 2014-05-16 11:58:59 +0000
+++ pkg/dem/Polyhedra_support.cpp 2014-07-03 07:16:58 +0000
@@ -79,7 +79,7 @@
// Jacobian of transformation to the reference 4hedron
double detJ=(x2-x1)*(y3-y1)*(z4-z1)+(x3-x1)*(y4-y1)*(z2-z1)+(x4-x1)*(y2-y1)*(z3-z1)
-(x2-x1)*(y4-y1)*(z3-z1)-(x3-x1)*(y2-y1)*(z4-z1)-(x4-x1)*(y3-y1)*(z2-z1);
- detJ=fabs(detJ);
+ detJ=std::abs(detJ);
double a=detJ*(y1*y1+y1*y2+y2*y2+y1*y3+y2*y3+
y3*y3+y1*y4+y2*y4+y3*y4+y4*y4+z1*z1+z1*z2+
z2*z2+z1*z3+z2*z3+z3*z3+z1*z4+z2*z4+z3*z4+z4*z4)/60.;
@@ -470,7 +470,7 @@
if(norm2 < 1E-20) continue;
abs_size = 0.5*sqrt((cross_product(CGALvector(hfc0->vertex()->point(),hfc0->next()->vertex()->point()),CGALvector(hfc0->vertex()->point(),hfc0->next()->next()->vertex()->point()))).squared_length());
// factor 0.5 because this procedure returnes doubles projected area
- if (abs_size>0) area += 0.5*abs_size*abs(CGALnormal*normal2/sqrt(norm2));
+ if (abs_size>0) area += 0.5*abs_size*std::abs(CGALnormal*normal2/sqrt(norm2));
}
return area;
}
@@ -625,8 +625,8 @@
for (Polyhedron::Facet_iterator fIter = B.facets_begin(); fIter != B.facets_end() && !intersection_found; fIter++){
dist_S = Oriented_squared_distance(fIter->plane(), eIter->vertex()->point());
dist_T = Oriented_squared_distance(fIter->plane(), eIter->opposite()->vertex()->point());
- if (dist_S*dist_T >= 0 || abs(dist_S)<lim2 || abs(dist_T)<lim2) continue;
- inside = eIter->vertex()->point() + (eIter->opposite()->vertex()->point()-eIter->vertex()->point())*sqrt(abs(dist_S))/(sqrt(abs(dist_S))+sqrt(abs(dist_T)));
+ if (dist_S*dist_T >= 0 || std::abs(dist_S)<lim2 || std::abs(dist_T)<lim2) continue;
+ inside = eIter->vertex()->point() + (eIter->opposite()->vertex()->point()-eIter->vertex()->point())*sqrt(std::abs(dist_S))/(sqrt(std::abs(dist_S))+sqrt(std::abs(dist_T)));
// the fact that edge intersects the facet (not only its plane) is not explicitely checked, it sufices to check that the resulting point is inside both polyhedras
Plane p1 = fIter->plane();
Plane p2 = eIter->facet()->plane();
=== modified file 'pkg/dem/Shop_01.cpp'
--- pkg/dem/Shop_01.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/Shop_01.cpp 2014-07-03 07:16:58 +0000
@@ -146,7 +146,7 @@
FOREACH(const shared_ptr<Interaction>&I, *rb->interactions){
if(!I->isReal()) continue;
NormShearPhys* nsi=YADE_CAST<NormShearPhys*>(I->phys.get());
- force+=Vector3r(abs(nsi->normalForce[0]+nsi->shearForce[0]),abs(nsi->normalForce[1]+nsi->shearForce[1]),abs(nsi->normalForce[2]+nsi->shearForce[2]));
+ force+=Vector3r(std::abs(nsi->normalForce[0]+nsi->shearForce[0]),std::abs(nsi->normalForce[1]+nsi->shearForce[1]),std::abs(nsi->normalForce[2]+nsi->shearForce[2]));
stiff+=(1/3.)*nsi->kn+(2/3.)*nsi->ks; // count kn in one direction and ks in the other two
n++;
}
=== modified file 'pkg/dem/SpherePack.cpp'
--- pkg/dem/SpherePack.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/SpherePack.cpp 2014-07-03 07:16:58 +0000
@@ -96,7 +96,7 @@
if (hSizeFound && !periodic) LOG_WARN("hSize can be defined only for periodic cells.");
Real volume=hSize.determinant();
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
+ Real area=std::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.");
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.");}
@@ -191,7 +191,7 @@
} 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++){
- if (abs(c1c2[axis])<abs(c1c2[axis] - Mathr::Sign(c1c2[axis]))) dr[axis]=c1c2[axis];
+ if (std::abs(c1c2[axis])<std::abs(c1c2[axis] - Mathr::Sign(c1c2[axis]))) dr[axis]=c1c2[axis];
else dr[axis] = c1c2[axis] - Mathr::Sign(c1c2[axis]);}
dr=hSize*dr;//now in cartesian coordinates
}
=== modified file 'pkg/dem/Tetra.cpp'
--- pkg/dem/Tetra.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/Tetra.cpp 2014-07-03 07:16:58 +0000
@@ -659,7 +659,7 @@
#define v1 iABinfo[i].V[1]
#define v2 iABinfo[i].V[2]
#define v3 iABinfo[i].V[3]
- Real dV=fabs(Vector3r(v1-v0).Dot((v2-v0).Cross(v3-v0)))/6.;
+ Real dV=std::abs(Vector3r(v1-v0).Dot((v2-v0).Cross(v3-v0)))/6.;
V+=dV;
Sg+=dV*(v0+v1+v2+v3)*.25;
vector<Vector3r> t; t.push_back(v0); t.push_back(v1); t.push_back(v2); t.push_back(v3);
@@ -1073,7 +1073,7 @@
// Jacobian of transformation to the reference 4hedron
double detJ=(x2-x1)*(y3-y1)*(z4-z1)+(x3-x1)*(y4-y1)*(z2-z1)+(x4-x1)*(y2-y1)*(z3-z1)
-(x2-x1)*(y4-y1)*(z3-z1)-(x3-x1)*(y2-y1)*(z4-z1)-(x4-x1)*(y3-y1)*(z2-z1);
- detJ=fabs(detJ);
+ detJ=std::abs(detJ);
double a=detJ*(y1*y1+y1*y2+y2*y2+y1*y3+y2*y3+
y3*y3+y1*y4+y2*y4+y3*y4+y4*y4+z1*z1+z1*z2+
z2*z2+z1*z3+z2*z3+z3*z3+z1*z4+z2*z4+z3*z4+z4*z4)/60.;
@@ -1181,9 +1181,9 @@
Real TetrahedronSignedVolume(const Vector3r v[4]) { return (Vector3r(v[3])-Vector3r(v[0])).dot((Vector3r(v[3])-Vector3r(v[1])).cross(Vector3r(v[3])-Vector3r(v[2])))/6.; }
-Real TetrahedronVolume(const Vector3r v[4]) { return fabs(TetrahedronSignedVolume(v)); }
+Real TetrahedronVolume(const Vector3r v[4]) { return std::abs(TetrahedronSignedVolume(v)); }
Real TetrahedronSignedVolume(const vector<Vector3r>& v) { return Vector3r(v[1]-v[0]).dot(Vector3r(v[2]-v[0]).cross(v[3]-v[0]))/6.; }
-Real TetrahedronVolume(const vector<Vector3r>& v) { return fabs(TetrahedronSignedVolume(v)); }
+Real TetrahedronVolume(const vector<Vector3r>& v) { return std::abs(TetrahedronSignedVolume(v)); }
#ifdef YADE_CGAL
Real TetrahedronVolume(const CGAL::Point_3<CGAL::Cartesian<Real> >* v[4]) {
Vector3r vv[4];
=== modified file 'pkg/dem/TriaxialCompressionEngine.cpp'
--- pkg/dem/TriaxialCompressionEngine.cpp 2014-05-23 13:05:19 +0000
+++ pkg/dem/TriaxialCompressionEngine.cpp 2014-07-03 07:16:58 +0000
@@ -84,7 +84,7 @@
if ( (currentState!=STATE_TRIAX_LOADING && currentState==STATE_ISO_COMPACTION) || currentState==STATE_ISO_UNLOADING || currentState==STATE_FIXED_POROSITY_COMPACTION || autoCompressionActivation)
{
- if (UnbalancedForce<=StabilityCriterion && abs ( ( meanStress-sigma_iso ) /sigma_iso ) <0.005 && fixedPoroCompaction==false )
+ if (UnbalancedForce<=StabilityCriterion && std::abs ( ( meanStress-sigma_iso ) /sigma_iso ) <0.005 && fixedPoroCompaction==false )
{
// only go to UNLOADING if it is needed
if ( currentState==STATE_ISO_COMPACTION && autoUnload && sigmaLateralConfinement!=sigmaIsoCompaction ) {
@@ -123,7 +123,7 @@
{
updateParameters ();
maxStress = max(maxStress,stress[wall_top][1]);
- LOG_INFO("UnbalancedForce="<< UnbalancedForce<<", rel stress "<< abs ( ( meanStress-sigma_iso ) /sigma_iso ));
+ LOG_INFO("UnbalancedForce="<< UnbalancedForce<<", rel stress "<< std::abs ( ( meanStress-sigma_iso ) /sigma_iso ));
}
if ( saveSimulation )
{
@@ -163,7 +163,7 @@
if (scene->iter % 100 == 0) LOG_DEBUG("Compression active.");
const Real& dt = scene->dt;
- if (abs(epsilonMax) > abs(strain[1])) {
+ if (std::abs(epsilonMax) > std::abs(strain[1])) {
if ( currentStrainRate != strainRate ) currentStrainRate += ( strainRate-currentStrainRate ) *0.0003;
/* Move top and bottom wall according to strain rate */
State* p_bottom=Body::byId(wall_bottom_id,scene)->state.get();
=== modified file 'pkg/dem/TriaxialTest.cpp'
--- pkg/dem/TriaxialTest.cpp 2014-07-02 16:18:24 +0000
+++ pkg/dem/TriaxialTest.cpp 2014-07-03 07:16:58 +0000
@@ -108,9 +108,9 @@
Vector3r center = Vector3r((lowerCorner[0]+upperCorner[0])/2,
lowerCorner[1]-thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
- Vector3r halfSize = Vector3r(wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ Vector3r halfSize = Vector3r(wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
triaxialcompressionEngine->wall_bottom_id = body->getId();
@@ -118,9 +118,9 @@
center = Vector3r((lowerCorner[0]+upperCorner[0])/2,
upperCorner[1]+thickness/2.0,
(lowerCorner[2]+upperCorner[2])/2);
- halfSize = Vector3r(wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ halfSize = Vector3r(wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
triaxialcompressionEngine->wall_top_id = body->getId();
@@ -129,8 +129,8 @@
(lowerCorner[1]+upperCorner[1])/2,
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
triaxialcompressionEngine->wall_left_id = body->getId();
@@ -139,8 +139,8 @@
(lowerCorner[1]+upperCorner[1])/2,
(lowerCorner[2]+upperCorner[2])/2);
halfSize = Vector3r(thickness/2.0,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[2]-upperCorner[2])/2+thickness);
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[2]-upperCorner[2])/2+thickness);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
@@ -149,8 +149,8 @@
center = Vector3r((lowerCorner[0]+upperCorner[0])/2,
(lowerCorner[1]+upperCorner[1])/2,
lowerCorner[2]-thickness/2.0);
- halfSize = Vector3r(wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ halfSize = Vector3r(wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
@@ -159,8 +159,8 @@
center = Vector3r((lowerCorner[0]+upperCorner[0])/2,
(lowerCorner[1]+upperCorner[1])/2,
upperCorner[2]+thickness/2.0);
- halfSize = Vector3r(wallOversizeFactor*fabs(lowerCorner[0]-upperCorner[0])/2+thickness,
- wallOversizeFactor*fabs(lowerCorner[1]-upperCorner[1])/2+thickness,
+ halfSize = Vector3r(wallOversizeFactor*std::abs(lowerCorner[0]-upperCorner[0])/2+thickness,
+ wallOversizeFactor*std::abs(lowerCorner[1]-upperCorner[1])/2+thickness,
thickness/2.0);
createBox(body,center,halfSize,true);
scene->bodies->insert(body);
=== modified file 'pkg/dem/UniaxialStrainer.cpp'
--- pkg/dem/UniaxialStrainer.cpp 2014-07-02 16:11:24 +0000
+++ pkg/dem/UniaxialStrainer.cpp 2014-07-03 07:16:58 +0000
@@ -89,7 +89,7 @@
//nothing to do
if(posIds.size()==0 || negIds.size()==0) return;
// linearly increase strain to the desired value
- if(abs(currentStrainRate)<abs(strainRate)){
+ if(std::abs(currentStrainRate)<std::abs(strainRate)){
if(initAccelTime_s!=0) currentStrainRate=(scene->time/initAccelTime_s)*strainRate;
else currentStrainRate=strainRate;
} else currentStrainRate=strainRate;
@@ -98,7 +98,7 @@
if(!isnan(stopStrain)){
Real axialLength=axisCoord(posIds[0])-axisCoord(negIds[0]);
Real newStrain=(axialLength+dAX)/originalLength-1;
- if((newStrain*stopStrain>0) && abs(newStrain)>=stopStrain){ // same sign of newStrain and stopStrain && over the limit from below in abs values
+ if((newStrain*stopStrain>0) && std::abs(newStrain)>=stopStrain){ // same sign of newStrain and stopStrain && over the limit from below in abs values
dAX=originalLength*(stopStrain+1)-axialLength;
LOG_INFO("Reached stopStrain "<<stopStrain<<", deactivating self and stopping in "<<idleIterations+1<<" iterations.");
this->active=false;
=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp 2014-06-17 10:18:00 +0000
+++ pkg/dem/VTKRecorder.cpp 2014-07-03 07:16:58 +0000
@@ -378,7 +378,7 @@
const GenericSpheresContact* geom = YADE_CAST<GenericSpheresContact*>(I->geom.get());
// gives _signed_ scalar of normal force, following the convention used in the respective constitutive law
float fn=phys->normalForce.dot(geom->normal);
- float fs[3]={ (float) abs(phys->shearForce[0]), (float) abs(phys->shearForce[1]), (float) abs(phys->shearForce[2])};
+ float fs[3]={ (float) std::abs(phys->shearForce[0]), (float) std::abs(phys->shearForce[1]), (float) std::abs(phys->shearForce[2])};
// add the value once for each interaction object that we created (might be 2 for the periodic boundary)
for(int i=0; i<numAddValues; i++){
intrAbsForceT->InsertNextTupleValue(fs);
=== modified file 'pkg/dem/ViscoelasticPM.cpp'
--- pkg/dem/ViscoelasticPM.cpp 2014-07-03 07:15:45 +0000
+++ pkg/dem/ViscoelasticPM.cpp 2014-07-03 07:16:58 +0000
@@ -196,10 +196,10 @@
ks1 = ks2 = 2.0/7.0 /Tc/Tc * ( Mathr::PI*Mathr::PI + pow(log(Et),2) )*massR;
cs1 = cs2 = -2.0/7.0 /Tc * log(Et)*massR;
- if (abs(cn1) <= Mathr::ZERO_TOLERANCE ) cn1=0;
- if (abs(cn2) <= Mathr::ZERO_TOLERANCE ) cn2=0;
- if (abs(cs1) <= Mathr::ZERO_TOLERANCE ) cs1=0;
- if (abs(cs2) <= Mathr::ZERO_TOLERANCE ) cs2=0;
+ if (std::abs(cn1) <= Mathr::ZERO_TOLERANCE ) cn1=0;
+ if (std::abs(cn2) <= Mathr::ZERO_TOLERANCE ) cn2=0;
+ if (std::abs(cs1) <= Mathr::ZERO_TOLERANCE ) cs1=0;
+ if (std::abs(cs2) <= Mathr::ZERO_TOLERANCE ) cs2=0;
} else if ((isfinite(mat1->kn)) and (isfinite(mat1->ks)) and (isfinite(mat1->cn)) and (isfinite(mat1->cs))) {
//Set parameters explicitly
kn1 = mat1->kn;
=== modified file 'pkg/dem/WirePM.cpp'
--- pkg/dem/WirePM.cpp 2013-06-25 04:00:41 +0000
+++ pkg/dem/WirePM.cpp 2014-07-03 07:16:58 +0000
@@ -145,7 +145,7 @@
/* compute a limit value to check how far the interaction is from failing */
Real limitFactor = 0.;
- if (Fn < 0.) limitFactor = fabs(D/(DFValues.back()(0)));
+ if (Fn < 0.) limitFactor = std::abs(D/(DFValues.back()(0)));
phys->limitFactor = limitFactor;
State* st1 = Body::byId(id1,scene)->state.get();
@@ -196,7 +196,7 @@
if ( mat1->id == mat2->id ) { // interaction of two bodies of the same material
crossSection = mat1->as;
SSValues = mat1->strainStressValues;
- if ( (mat1->isDoubleTwist) && (abs(interaction->getId1()-interaction->getId2())==1) ) {// bodies which id differs by 1 are double twisted
+ if ( (mat1->isDoubleTwist) && (std::abs(interaction->getId1()-interaction->getId2())==1) ) {// bodies which id differs by 1 are double twisted
contactPhysics->isDoubleTwist = true;
if ( mat1->type==1 || mat1->type==2 ) {
SSValues = mat1->strainStressValuesDT;
=== modified file 'pkg/lbm/HydrodynamicsLawLBM.cpp'
--- pkg/lbm/HydrodynamicsLawLBM.cpp 2014-07-02 16:18:24 +0000
+++ pkg/lbm/HydrodynamicsLawLBM.cpp 2014-07-03 07:16:58 +0000
@@ -830,8 +830,8 @@
// for (int s=NB_WALLS ; s<NB_BODIES; s++) {FmoyCur = FmoyCur + LBbodies[s].force.norm();}
// FmoyCur = FmoyCur/(NB_DYNGRAINS);
// if (FmoyCur!=0.){
-// Real ErrorA = abs(FmoyCur-FmoyPrev)/abs(FmoyCur);
-// Real ErrorB = abs(FmoyCur-FmoyPrevPrev)/abs(FmoyCur);
+// Real ErrorA = std::abs(FmoyCur-FmoyPrev)/std::abs(FmoyCur);
+// Real ErrorB = std::abs(FmoyCur-FmoyPrevPrev)/std::abs(FmoyCur);
// Error=max(ErrorA,ErrorB);
// FmoyPrevPrev=FmoyPrev;
// FmoyPrev=FmoyCur;
@@ -844,8 +844,8 @@
// /*--------------------------------------------------------*/
// if((LBM_ITER > 100) & (LBM_ITER % 10 == 0)){
// if (VmeanFluidC!=0.){
-// Real ErrorA = abs(VmeanFluidC-PrevVmeanFluidC)/abs(VmeanFluidC);
-// //Real ErrorB = abs(VmeanFluidC-PrevPrevVmeanFluidC)/abs(VmeanFluidC);
+// Real ErrorA = std::abs(VmeanFluidC-PrevVmeanFluidC)/std::abs(VmeanFluidC);
+// //Real ErrorB = std::abs(VmeanFluidC-PrevPrevVmeanFluidC)/std::abs(VmeanFluidC);
// //Error=max(ErrorA,ErrorB);
// Error= ErrorA;
// PrevPrevVmeanFluidC=PrevVmeanFluidC;
=== modified file 'pkg/pfv/FlowEngine.ipp.in'
--- pkg/pfv/FlowEngine.ipp.in 2014-06-20 15:28:21 +0000
+++ pkg/pfv/FlowEngine.ipp.in 2014-07-03 07:16:58 +0000
@@ -391,7 +391,7 @@
case ( 3 ) : cell->info().volume() = volumeCellTripleFictious ( cell ); break;
default: break;
}
- if (flow.fluidBulkModulus>0) { cell->info().invVoidVolume() = 1 / ( abs(cell->info().volume()) - flow.volumeSolidPore(cell) ); }
+ if (flow.fluidBulkModulus>0) { cell->info().invVoidVolume() = 1 / ( std::abs(cell->info().volume()) - flow.volumeSolidPore(cell) ); }
}
if (debug) cout << "Volumes initialised." << endl;
}
@@ -486,7 +486,7 @@
}
}
Real Volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - Wall_coordinate );
- return abs ( Volume );
+ return std::abs ( Volume );
}
template< class _CellInfo, class _VertexInfo, class _Tesselation, class solverT >
template<class Cellhandle>
@@ -521,7 +521,7 @@
Real Vol1=0.5* ( ( A-BS ).cross ( B-BS ) ) [coord[1]]* ( 0.333333333* ( 2*B[coord[1]]+A[coord[1]] )-Wall_coordinate[1] );
//second pyramid with triangular base (A,AS,BS)
Real Vol2=0.5* ( ( AS-BS ).cross ( A-BS ) ) [coord[1]]* ( 0.333333333* ( B[coord[1]]+2*A[coord[1]] )-Wall_coordinate[1] );
- return abs ( Vol1+Vol2 );
+ return std::abs ( Vol1+Vol2 );
}
template< class _CellInfo, class _VertexInfo, class _Tesselation, class solverT >
template<class Cellhandle>
@@ -549,7 +549,7 @@
}
}
Real Volume = ( A[coord[0]]-Wall_coordinate[0] ) * ( A[coord[1]]-Wall_coordinate[1] ) * ( A[coord[2]]-Wall_coordinate[2] );
- return abs ( Volume );
+ return std::abs ( Volume );
}
template< class _CellInfo, class _VertexInfo, class _Tesselation, class solverT >
template<class Cellhandle>
@@ -620,7 +620,7 @@
bool v1fictious = Tes.vertex ( id1 )->info().isFictious;
int bnd = v1fictious? id1 : id2;
int coord = flow.boundary(bnd).coordinate;
- O1O2 = v1fictious ? abs((sph2->state->pos + makeVector3r(Tes.vertex(id2)->info().ghostShift()))[coord] - flow.boundary(bnd).p[coord]) : abs((sph1->state->pos + makeVector3r(Tes.vertex(id1)->info().ghostShift()))[coord] - flow.boundary(bnd).p[coord]);
+ O1O2 = v1fictious ? std::abs((sph2->state->pos + makeVector3r(Tes.vertex(id2)->info().ghostShift()))[coord] - flow.boundary(bnd).p[coord]) : std::abs((sph1->state->pos + makeVector3r(Tes.vertex(id1)->info().ghostShift()))[coord] - flow.boundary(bnd).p[coord]);
if(v1fictious)
normal = makeVector3r(flow.boundary(id1).normal);
else
@@ -725,8 +725,8 @@
// if ( !cell->info().isReal() ) continue;
if ( cell->info().isGhost ) continue;
for ( int i=0;i<3;i++ )
- meanVel[i]=meanVel[i]+ ( ( cell->info().averageVelocity() ) [i] * abs ( cell->info().volume() ) );
- volume+=abs ( cell->info().volume() );
+ meanVel[i]=meanVel[i]+ ( ( cell->info().averageVelocity() ) [i] * std::abs ( cell->info().volume() ) );
+ volume+=std::abs ( cell->info().volume() );
}
return ( meanVel/volume );
}
=== modified file 'pkg/pfv/PeriodicFlowEngine.cpp'
--- pkg/pfv/PeriodicFlowEngine.cpp 2014-07-03 07:15:45 +0000
+++ pkg/pfv/PeriodicFlowEngine.cpp 2014-07-03 07:16:58 +0000
@@ -317,7 +317,7 @@
}
}
Real Volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - Wall_coordinate );
- return abs ( Volume );
+ return std::abs ( Volume );
}
@@ -456,7 +456,7 @@
default: cell->info().volume() = 0; break;
}
//FIXME: the void volume is negative sometimes, hence crashing...
- if (flow.fluidBulkModulus>0) { cell->info().invVoidVolume() = 1. / (max(0.1*cell->info().volume(),abs(cell->info().volume()) - flow.volumeSolidPore(cell)) ); }
+ if (flow.fluidBulkModulus>0) { cell->info().invVoidVolume() = 1. / (max(0.1*cell->info().volume(),std::abs(cell->info().volume()) - flow.volumeSolidPore(cell)) ); }
}
if ( debug ) cout << "Volumes initialised." << endl;
}
=== modified file 'pkg/pfv/SoluteFlowEngine.cpp'
--- pkg/pfv/SoluteFlowEngine.cpp 2014-06-20 20:10:04 +0000
+++ pkg/pfv/SoluteFlowEngine.cpp 2014-07-03 07:16:58 +0000
@@ -101,7 +101,7 @@
// Fill coefficient matrix
FOREACH(CellHandle& cell, solver->T[solver->currentTes].cellHandles){
- cell->info().invVoidVolume() = 1 / ( abs(cell->info().volume()) - abs(solver->volumeSolidPore(cell) ) );
+ cell->info().invVoidVolume() = 1 / ( std::abs(cell->info().volume()) - std::abs(solver->volumeSolidPore(cell) ) );
invdistance=0.0;
@@ -115,15 +115,15 @@
invdistance+=(fluidSurf/sqrt(l.squared_length()));
coeff = deltatime*cell->info().invVoidVolume();
ID = cell->neighbor(ngb)->info().id;
- qin=abs(cell->info().kNorm() [ngb])* ( cell->neighbor ( ngb )->info().p()-cell->info().p());
+ qin=std::abs(cell->info().kNorm() [ngb])* ( cell->neighbor ( ngb )->info().p()-cell->info().p());
Qout=Qout+max(qin,0.0);
- coeff1=-1*coeff*(abs(max(qin,0.0))-(D*invdistancelocal));
+ coeff1=-1*coeff*(std::abs(max(qin,0.0))-(D*invdistancelocal));
if (coeff1 != 0.0){
tripletList2.push_back(ETriplet2(i,ID,coeff1));
}
}
- coeff2=1.0+(coeff*abs(Qout))+(coeff*D*invdistance);
+ coeff2=1.0+(coeff*std::abs(Qout))+(coeff*D*invdistance);
tripletList2.push_back(ETriplet2(i,i,coeff2));
Qout=0.0;
}
@@ -177,10 +177,10 @@
FOREACH(CellHandle& cell, solver->T[solver->currentTes].cellHandles)
{
CGT::Point& p1 = cell->info();
- if (abs(p1[xyz]) < abs(abs(Yobs) + abs(Yr))){
- if(abs(p1[xyz]) > abs(abs(Yobs) - abs(Yr))){
- sumConcentration += cell->info().solute()*(1-(abs(p1[xyz])-abs(Yobs))/abs(Yr));
- sumFraction += (1-(abs(p1[xyz])-abs(Yobs))/abs(Yr));
+ if (std::abs(p1[xyz]) < std::abs(std::abs(Yobs) + std::abs(Yr))){
+ if(std::abs(p1[xyz]) > std::abs(std::abs(Yobs) - std::abs(Yr))){
+ sumConcentration += cell->info().solute()*(1-(std::abs(p1[xyz])-std::abs(Yobs))/std::abs(Yr));
+ sumFraction += (1-(std::abs(p1[xyz])-std::abs(Yobs))/std::abs(Yr));
}
}
}