@@ -212,7 +212,7 @@ void ShowAndEditDipoles::loadData()
212212 }
213213
214214 bool zeroVector = false ;
215- for (uint i = 0 ; i < scale_.size (); i++)
215+ for (size_t 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 (uint i = 0 ; i < pos_.size (); i++)
229+ for (size_t 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 (uint i = 0 ; i < positions.size (); i++)
253+ for (size_t 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 (uint i = 0 ; i < pos_.size (); i++)
268+ for (size_t 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 ()));
@@ -299,7 +299,7 @@ void ShowAndEditDipoles::toggleLastVectorShown()
299299 auto bbox = fh->vmesh ()->get_bounding_box ();
300300 auto state = get_state ();
301301
302- int last_id = pos_.size () - 1 ;
302+ size_t last_id = pos_.size () - 1 ;
303303 // Destroy last dipole
304304 pointWidgets_[last_id]->erase (pointWidgets_[last_id]->begin (), pointWidgets_[last_id]->end ());
305305
@@ -318,9 +318,9 @@ void ShowAndEditDipoles::generateGeomsList()
318318 geoms_.resize (0 );
319319
320320 // Rewrite all existing geom
321- for (uint d = 0 ; d < pointWidgets_.size (); d++)
321+ for (size_t d = 0 ; d < pointWidgets_.size (); d++)
322322 {
323- for (uint w = 0 ; w < pointWidgets_[d]->size (); w++)
323+ for (size_t w = 0 ; w < pointWidgets_[d]->size (); w++)
324324 geoms_.push_back ((*pointWidgets_[d])[w]);
325325 }
326326 if (state->getValue (ShowLines).toBool ())
@@ -334,8 +334,8 @@ void ShowAndEditDipoles::processWidgetFeedback(const ModuleFeedback& var)
334334 auto vsf = dynamic_cast <const ViewSceneFeedback&>(var);
335335 if (vsf.matchesWithModuleId (id ()))
336336 {
337- int widgetType = - 1 ;
338- int widgetID = - 1 ;
337+ size_t widgetType;
338+ size_t widgetID;
339339 try
340340 {
341341 // Check if correct module
@@ -357,20 +357,20 @@ void ShowAndEditDipoles::processWidgetFeedback(const ModuleFeedback& var)
357357 }
358358
359359 // Remove parantheses
360- for (uint i = 0 ; i < matches.size (); i++)
360+ for (size_t i = 0 ; i < matches.size (); i++)
361361 {
362362 matches[i] = matches[i].substr (1 , matches[i].length ()-2 );
363363 }
364- // Cast to int
365- widgetType = boost::lexical_cast<int >(matches[0 ]);
366- widgetID = boost::lexical_cast<int >(matches[1 ]);
364+ // Cast to size_t
365+ widgetType = boost::lexical_cast<size_t >(matches[0 ]);
366+ widgetID = boost::lexical_cast<size_t >(matches[1 ]);
367+ adjustPositionFromTransform (vsf.transform , widgetType, widgetID);
367368 }
368369 catch (...)
369370 {
370371 logWarning (" Failure parsing widget id" );
371372 }
372- adjustPositionFromTransform (vsf.transform , widgetType, widgetID);
373- enqueueExecuteAgain (false );
373+ enqueueExecuteAgain (false );
374374 }
375375 }
376376 catch (std::bad_cast&)
@@ -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 (uint i = 0 ; i < pos_.size (); i++)
389+ for (size_t i = 0 ; i < pos_.size (); i++)
390390 {
391391 pos_[i] += dist;
392392 }
@@ -395,7 +395,7 @@ void ShowAndEditDipoles::calculatePointMove(Point& oldPos, Point& newPos)
395395 oldPos = newPos;
396396}
397397
398- void ShowAndEditDipoles::adjustPositionFromTransform (const Transform& transformMatrix, int type, int id)
398+ void ShowAndEditDipoles::adjustPositionFromTransform (const Transform& transformMatrix, size_t type, size_t id)
399399{
400400 auto state = get_state ();
401401 DenseMatrix center (4 , 1 );
@@ -461,7 +461,7 @@ void ShowAndEditDipoles::ReceiveInputPoints()
461461 pos_.clear ();
462462 for (const auto & node : fh->mesh ()->getFacade ()->nodes ())
463463 {
464- int index = node.index ();
464+ size_t index = node.index ();
465465 vf->get_center (p, index);
466466 pos_.push_back (p);
467467 }
@@ -475,7 +475,7 @@ void ShowAndEditDipoles::ReceiveInputDirections()
475475 direction_.clear ();
476476 for (const auto & node : fh->mesh ()->getFacade ()->nodes ())
477477 {
478- int index = node.index ();
478+ size_t index = node.index ();
479479 vf->get_value (v, index);
480480 direction_.push_back (v.normal ());
481481 }
@@ -491,7 +491,7 @@ void ShowAndEditDipoles::ReceiveInputScales()
491491 double newLargest = 0.0 ;
492492 for (const auto & node : fh->mesh ()->getFacade ()->nodes ())
493493 {
494- int index = node.index ();
494+ size_t index = node.index ();
495495 vf->get_value (v, index);
496496 scale_.push_back (v.length ());
497497 newLargest = std::max (newLargest, std::abs (v.length ()));
@@ -502,7 +502,7 @@ void ShowAndEditDipoles::ReceiveInputScales()
502502void ShowAndEditDipoles::makeScalesPositive ()
503503{
504504 // If dipole is scaled below 0, make the scale positive and flip the direction
505- for (uint i = 0 ; i < scale_.size (); i++)
505+ for (size_t i = 0 ; i < scale_.size (); i++)
506506 {
507507 if (scale_[i] < 0.0 )
508508 {
@@ -525,7 +525,7 @@ void ShowAndEditDipoles::ReceiveInputField()
525525 double newLargest = 0.0 ;
526526 for (const auto & node : fh->mesh ()->getFacade ()->nodes ())
527527 {
528- int index = node.index ();
528+ size_t index = node.index ();
529529 vf->get_center (p, index);
530530 vf->get_value (v, index);
531531 pos_.push_back (p);
@@ -546,7 +546,7 @@ void ShowAndEditDipoles::GenerateOutputGeom()
546546 pointWidgets_.resize (pos_.size ());
547547
548548 // Create all but last dipole as vector
549- for (uint i = 0 ; i < pos_.size () - 1 ; i++)
549+ for (size_t i = 0 ; i < pos_.size () - 1 ; i++)
550550 {
551551 double scale = scale_[i];
552552 if (state->getValue (Sizing).toInt () == SizingType::NORMALIZE_BY_LARGEST_VECTOR)
@@ -556,7 +556,7 @@ void ShowAndEditDipoles::GenerateOutputGeom()
556556 }
557557
558558 // Create last dipoles separately to check if shown as vector
559- int last_id = pos_.size () - 1 ;
559+ size_t last_id = pos_.size () - 1 ;
560560
561561 double scale = scale_[last_id];
562562 if (state->getValue (Sizing).toInt () == SizingType::NORMALIZE_BY_LARGEST_VECTOR)
@@ -567,14 +567,14 @@ void ShowAndEditDipoles::GenerateOutputGeom()
567567 lastVectorShown_ = state->getValue (ShowLastAsVector).toBool ();
568568}
569569
570- std::string ShowAndEditDipoles::widgetName (int i, int id, int iter)
570+ std::string ShowAndEditDipoles::widgetName (size_t i, size_t id, size_t iter)
571571{
572572 return " SAED(" + std::to_string (i) + " )" +
573573 " (" + std::to_string (id) + " )" +
574574 " (" + std::to_string (iter) + " )" ;
575575}
576576
577- void ShowAndEditDipoles::createDipoleWidget (BBox& bbox, Point& pos, Vector dir, double scale, int widget_num, bool show_as_vector)
577+ void ShowAndEditDipoles::createDipoleWidget (BBox& bbox, Point& pos, Vector dir, double scale, size_t widget_num, bool show_as_vector)
578578{
579579 Point bmin = pos;
580580 Point bmax = pos + dir * scale;
@@ -683,9 +683,9 @@ GeometryHandle ShowAndEditDipoles::addLines()
683683 renState.set (RenderState::USE_DEFAULT_COLOR, true );
684684
685685 // Create lines between every point
686- for (uint a = 0 ; a < pos_.size (); a++)
686+ for (size_t a = 0 ; a < pos_.size (); a++)
687687 {
688- for (uint b = a + 1 ; b < pos_.size (); b++)
688+ for (size_t b = a + 1 ; b < pos_.size (); b++)
689689 {
690690 glyphs.addLine (pos_[a], pos_[b], lineCol_, lineCol_);
691691 }
@@ -703,7 +703,7 @@ FieldHandle ShowAndEditDipoles::makePointCloud()
703703 auto field = ofield->vfield ();
704704 auto state = get_state ();
705705
706- for (int i = 0 ; i < pointWidgets_.size (); i++)
706+ for (size_t i = 0 ; i < pointWidgets_.size (); i++)
707707 {
708708 VMesh::Node::index_type pcindex = mesh->add_point (pos_[i]);
709709 field->resize_fdata ();
0 commit comments