MCPcopy Create free account
hub / github.com/Kitware/VTK / InsertPointAndScalar

Method InsertPointAndScalar

Common/DataModel/vtkGenericEdgeTable.cxx:633–680  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

631
632//------------------------------------------------------------------------------
633void vtkGenericEdgeTable::InsertPointAndScalar(vtkIdType ptId, double pt[3], double* s)
634{
635 // sizeof(s)=this->NumberOfComponents
636 vtkIdType pos = this->HashFunction(ptId);
637
638 // Be careful with reference the equal is not overloaded
639 vtkEdgeTablePoints::VectorPointTableType& vect = this->HashPoints->PointVector[pos];
640
641 // Please keep the following:
642#if 0
643 //Need to check size again
644 //Here we just puch_back at the end,
645 //the vector should not be very long and should not contain any empty spot.
646 for (index=0; index<vect.size(); index++)
647 {
648 PointEntry ent = vect[index];
649 if( ent.PointId == ptId )
650 {
651 //The point was already in the table:
652 assert("check: same id" && ent.PointId == ptId );
653 assert("check: same x" && ent.Coord[0] == pt[0]);
654 assert("check: same y" && ent.Coord[1] == pt[1]);
655 assert("check: same z" && ent.Coord[2] == pt[2]);
656 assert("check: same x scalar" && ent.Scalar[0] == s[0]);
657 assert("check: same y scalar" && ent.Scalar[1] == s[1]);
658 assert("check: same z scalar" && ent.Scalar[2] == s[2]);
659
660 vtkErrorMacro( << "The point was already in the table" ); //FIXME
661
662 return;
663 }
664 }
665#endif
666
667 // We did not find any matching point thus insert it
668
669 PointEntry newEntry(this->NumberOfComponents); // = vect.back();
670 newEntry.PointId = ptId;
671 memcpy(newEntry.Coord, pt, sizeof(double) * 3);
672 memcpy(newEntry.Scalar, s, sizeof(double) * this->NumberOfComponents);
673 newEntry.Reference = 1;
674
675 // vtkDebugMacro( << "InsertPointAndScalar:" << ptId << ":"
676 // << pt[0] << "," << pt[1] << "," << pt[2] << "->"
677 // << s[0] << "," << s[1] << "," << s[2] );
678
679 vect.push_back(newEntry);
680}
681
682//------------------------------------------------------------------------------
683void vtkGenericEdgeTable::DumpTable()

Callers 3

TessellateMethod · 0.80

Calls 4

HashFunctionMethod · 0.95
assertFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected