Skip to content

Commit 641c560

Browse files
author
tpat
committed
Changed ints in for loops to uints.
Changed abs() to std::abs() because abs() only works on ints
1 parent f0da44d commit 641c560

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/Modules/Legacy/Visualization/ShowAndEditDipoles.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void ShowAndEditDipoles::loadData()
212212
}
213213

214214
bool zeroVector = false;
215-
for(int i = 0; i < scale_.size(); i++)
215+
for(uint i = 0; i < scale_.size(); i++)
216216
{
217217
if(scale_[i] == 0.0)
218218
{
@@ -226,7 +226,7 @@ void ShowAndEditDipoles::loadData()
226226
&& state->getValue(Sizing).toInt() == SizingType::NORMALIZE_VECTOR_DATA)
227227
{
228228
scale_.clear();
229-
for(int i = 0; i < pos_.size(); i++)
229+
for(uint i = 0; i < pos_.size(); i++)
230230
{
231231
scale_[i] = 1.0;
232232
}
@@ -250,7 +250,7 @@ void ShowAndEditDipoles::loadFromParameters()
250250
pos_.resize(positions.size());
251251
direction_.resize(positions.size());
252252
scale_.resize(positions.size());
253-
for(int i = 0; i < positions.size(); i++)
253+
for(uint i = 0; i < positions.size(); i++)
254254
{
255255
pos_[i] = pointFromString(positions[i].toString());
256256
direction_[i] = vectorFromString(directions[i].toString());
@@ -265,7 +265,7 @@ void ShowAndEditDipoles::saveToParameters()
265265
VariableList positions;
266266
VariableList directions;
267267
VariableList scales;
268-
for(int i = 0; i < pos_.size(); i++)
268+
for(uint i = 0; i < pos_.size(); i++)
269269
{
270270
positions.push_back(makeVariable("dip_pos", pos_[i].get_string()));
271271
directions.push_back(makeVariable("dip_dir", direction_[i].get_string()));
@@ -318,9 +318,9 @@ void ShowAndEditDipoles::generateGeomsList()
318318
geoms_.resize(0);
319319

320320
// Rewrite all existing geom
321-
for(int d = 0; d < pointWidgets_.size(); d++)
321+
for(uint d = 0; d < pointWidgets_.size(); d++)
322322
{
323-
for(int w = 0; w < pointWidgets_[d]->size(); w++)
323+
for(uint w = 0; w < pointWidgets_[d]->size(); w++)
324324
geoms_.push_back((*pointWidgets_[d])[w]);
325325
}
326326
if(state->getValue(ShowLines).toBool())
@@ -357,7 +357,7 @@ void ShowAndEditDipoles::processWidgetFeedback(const ModuleFeedback& var)
357357
}
358358

359359
// Remove parantheses
360-
for(int i = 0; i < matches.size(); i++)
360+
for(uint i = 0; i < matches.size(); i++)
361361
{
362362
matches[i] = matches[i].substr(1, matches[i].length()-2);
363363
}
@@ -386,7 +386,7 @@ void ShowAndEditDipoles::calculatePointMove(Point& oldPos, Point& newPos)
386386
if(state->getValue(MoveDipolesTogether).toBool())
387387
{
388388
Vector dist = newPos - oldPos;
389-
for(int i = 0; i < pos_.size(); i++)
389+
for(uint i = 0; i < pos_.size(); i++)
390390
{
391391
pos_[i] += dist;
392392
}
@@ -494,19 +494,19 @@ void ShowAndEditDipoles::ReceiveInputScales()
494494
int index = node.index();
495495
vf->get_value(v, index);
496496
scale_.push_back(v.length());
497-
newLargest = std::max(newLargest, abs(v.length()));
497+
newLargest = std::max(newLargest, std::abs(v.length()));
498498
}
499499
state->setValue(LargestSize, newLargest);
500500
}
501501

502502
void ShowAndEditDipoles::makeScalesPositive()
503503
{
504504
// If dipole is scaled below 0, make the scale positive and flip the direction
505-
for(int i = 0; i < scale_.size(); i++)
505+
for(uint i = 0; i < scale_.size(); i++)
506506
{
507507
if(scale_[i] < 0.0)
508508
{
509-
scale_[i] = abs(scale_[i]);
509+
scale_[i] = std::abs(scale_[i]);
510510
direction_[i] = -direction_[i];
511511
}
512512
}
@@ -531,7 +531,7 @@ void ShowAndEditDipoles::ReceiveInputField()
531531
pos_.push_back(p);
532532
direction_.push_back(v.normal());
533533
scale_.push_back(v.length());
534-
newLargest = std::max(newLargest, abs(v.length()));
534+
newLargest = std::max(newLargest, std::abs(v.length()));
535535
}
536536
state->setValue(LargestSize, newLargest);
537537
}
@@ -546,7 +546,7 @@ void ShowAndEditDipoles::GenerateOutputGeom()
546546
pointWidgets_.resize(pos_.size());
547547

548548
// Create all but last dipole as vector
549-
for(int i = 0; i < pos_.size() - 1; i++)
549+
for(uint i = 0; i < pos_.size() - 1; i++)
550550
{
551551
double scale = scale_[i];
552552
if(state->getValue(Sizing).toInt() == SizingType::NORMALIZE_BY_LARGEST_VECTOR)
@@ -581,17 +581,17 @@ void ShowAndEditDipoles::createDipoleWidget(BBox& bbox, Point& pos, Vector dir,
581581

582582
// Fix degenerate boxes.
583583
const double size_estimate = std::max((bmax - bmin).length() * 0.01, 1.0e-5);
584-
if (fabs(bmax.x() - bmin.x()) < 1.0e-6)
584+
if (std::abs(bmax.x() - bmin.x()) < 1.0e-6)
585585
{
586586
bmin.x(bmin.x() - size_estimate);
587587
bmax.x(bmax.x() + size_estimate);
588588
}
589-
if (fabs(bmax.y() - bmin.y()) < 1.0e-6)
589+
if (std::abs(bmax.y() - bmin.y()) < 1.0e-6)
590590
{
591591
bmin.y(bmin.y() - size_estimate);
592592
bmax.y(bmax.y() + size_estimate);
593593
}
594-
if (fabs(bmax.z() - bmin.z()) < 1.0e-6)
594+
if (std::abs(bmax.z() - bmin.z()) < 1.0e-6)
595595
{
596596
bmin.z(bmin.z() - size_estimate);
597597
bmax.z(bmax.z() + size_estimate);
@@ -683,9 +683,9 @@ GeometryHandle ShowAndEditDipoles::addLines()
683683
renState.set(RenderState::USE_DEFAULT_COLOR, true);
684684

685685
// Create lines between every point
686-
for(int a = 0; a < pos_.size(); a++)
686+
for(uint a = 0; a < pos_.size(); a++)
687687
{
688-
for(int b = a + 1; b < pos_.size(); b++)
688+
for(uint b = a + 1; b < pos_.size(); b++)
689689
{
690690
glyphs.addLine(pos_[a], pos_[b], lineCol_, lineCol_);
691691
}

0 commit comments

Comments
 (0)