Commit dceece9f authored by Joachim Pouderoux's avatar Joachim Pouderoux
Browse files

Fix sign/unsigned warnings in HTG.

Change-Id: I30c2ba92d542f3ab62c5de9d47e5a4cce3d7e785
parent 39b7a345
......@@ -361,7 +361,7 @@ public:
// Public only for vtkCompactHyperTree.
vtkIdType GetChildHistorySize()
{
return this->ChildHistory.size();
return static_cast<vtkIdType>( this->ChildHistory.size() );
}
protected:
......@@ -645,7 +645,7 @@ public:
//---------------------------------------------------------------------------
virtual vtkIdType GetNumberOfIndex()
{
return this->LeafParent.size();
return static_cast<vtkIdType>( this->LeafParent.size() );
}
//---------------------------------------------------------------------------
......@@ -682,7 +682,7 @@ public:
virtual vtkIdType GetNumberOfLevels()
{
assert( "post: result_greater_or_equal_to_one"
&& this->NumberOfLevels >= 1);
&& this->NumberOfLevels >= 1 );
return this->NumberOfLevels;
}
......@@ -692,7 +692,7 @@ public:
vtkCompactHyperTreeNode<N>* GetNode( int nodeIdx )
{
assert( "pre: valid_range" && nodeIdx >= 0
&& nodeIdx < this->Nodes.size() );
&& nodeIdx < this->GetNumberOfNodes() );
return &this->Nodes[nodeIdx];
}
......@@ -706,7 +706,7 @@ public:
int GetLeafParent( int leafIdx )
{
assert( "pre: valid_range" && leafIdx >= 0
&& leafIdx < this->LeafParent.size());
&& leafIdx < this->GetNumberOfIndex() );
assert( "post: valid_result" && this->LeafParent[leafIdx] >= 0
&& this->LeafParent[leafIdx] < this->GetNumberOfNodes() );
return this->LeafParent[leafIdx];
......@@ -732,10 +732,10 @@ public:
// The leaf becomes a node and is not anymore a leaf
cursor->SetIsLeaf( false ); // let the cursor know about that change.
size_t nodeIndex = cursor->GetNodeId();
vtkIdType nodeIndex = cursor->GetNodeId();
// Nodes get constructed with leaf flags set to 1.
if ( this->Nodes.size() <= nodeIndex )
if ( this->GetNumberOfNodes() <= nodeIndex )
{
this->Nodes.resize( nodeIndex + 1 );
}
......@@ -760,7 +760,7 @@ public:
for ( int i = 0; i < N; ++ i, ++ nextLeaf )
{
this->Nodes[nodeIndex].SetChild( i, static_cast<int>( nextLeaf ) );
this->LeafParent[nextLeaf] = static_cast<int>( nodeIndex );
this->LeafParent[nextLeaf] = nodeIndex;
this->Nodes[nodeIndex].SetLeafFlag( i, true );
}
......@@ -909,7 +909,8 @@ private:
};
//-----------------------------------------------------------------------------
vtkHyperTree* vtkHyperTree::CreateInstance( int factor, int dimension )
vtkHyperTree* vtkHyperTree::CreateInstance( unsigned int factor,
unsigned int dimension )
{
switch ( factor )
{
......@@ -938,7 +939,7 @@ vtkHyperTree* vtkHyperTree::CreateInstance( int factor, int dimension )
vtkGenericWarningMacro( "Bad dimension " << dimension );
}
default:
vtkGenericWarningMacro( "Bad branching factor " << factor);
vtkGenericWarningMacro( "Bad branching factor " << factor );
}
return NULL;
......
......@@ -160,7 +160,8 @@ public:
// Return an instance of a templated hypertree for given branch
// factor and dimension
// This is done to hide templates.
static vtkHyperTree* CreateInstance( int branchFactor, int dimension );
static vtkHyperTree* CreateInstance( unsigned int branchFactor,
unsigned int dimension );
// Description:
// Find the Index, Parent Index and IsLeaf() parameters of a child for hypertree.
......
......@@ -275,7 +275,7 @@ void vtkHyperTreeGrid::SetGridSize( unsigned int n[3] )
//-----------------------------------------------------------------------------
// Set the dimension of the tree with `dim'. See GetDimension() for details.
// \pre valid_dim: dim>=1 && dim<=3
// \pre valid_dim: dim >= 1 && dim <= 3
// \post dimension_is_set: GetDimension()==dim
void vtkHyperTreeGrid::SetDimension( unsigned int dim )
{
......@@ -301,7 +301,7 @@ void vtkHyperTreeGrid::SetDimension( unsigned int dim )
// \post dimension_is_set: GetBranchFactor()==dim
void vtkHyperTreeGrid::SetBranchFactor( unsigned int factor )
{
assert( "pre: valid_factor" && factor>=2 && factor<=3 );
assert( "pre: valid_factor" && factor >= 2 && factor <= 3 );
if ( this->BranchFactor == factor )
{
return;
......@@ -810,7 +810,7 @@ vtkIdType vtkHyperTreeGrid::RecursiveFindPoint( double x[3],
vtkHyperTreeSimpleCursor newCursor = *cursor;
double newSize[3];
double newOrigin[3];
unsigned char child = 0;
int child = 0;
for ( int i = 0; i < 3; ++ i )
{
newSize[i] = size[i] * 0.5;
......@@ -850,8 +850,8 @@ vtkIdType vtkHyperTreeGrid::FindCell( double x[3], vtkCell* cell,
double closestPoint[3];
double dist2;
int num = cellIds->GetNumberOfIds();
for ( int i = 0; i < num; ++ i )
vtkIdType num = cellIds->GetNumberOfIds();
for ( vtkIdType i = 0; i < num; ++ i )
{
cellId = cellIds->GetId( i );
if ( gencell )
......@@ -968,9 +968,9 @@ vtkIdTypeArray* vtkHyperTreeGrid::GetConnectivity()
//-----------------------------------------------------------------------------
void vtkHyperTreeGrid::GetLevelZeroCoordsFromIndex( vtkIdType index,
vtkIdType &i,
vtkIdType &j,
vtkIdType &k )
unsigned int &i,
unsigned int &j,
unsigned int &k )
{
if ( !this->TransposedRootIndexing )
{
......@@ -992,7 +992,7 @@ void vtkHyperTreeGrid::GetLevelZeroCoordsFromIndex( vtkIdType index,
void vtkHyperTreeGrid::InitializeSuperCursor( vtkHyperTreeGridSuperCursor* sc,
vtkIdType index )
{
vtkIdType i, j, k;
unsigned int i, j, k;
this->GetLevelZeroCoordsFromIndex( index, i, j, k );
// Initialize center cursor
this->InitializeSuperCursor( sc, i, j, k, index );
......@@ -1066,7 +1066,7 @@ void vtkHyperTreeGrid::InitializeSuperCursor( vtkHyperTreeGridSuperCursor* sc,
//-----------------------------------------------------------------------------
void vtkHyperTreeGrid::InitializeSuperCursorChild( vtkHyperTreeGridSuperCursor* parent,
vtkHyperTreeGridSuperCursor* child,
int childIdx )
unsigned int childIdx )
{
// Retrieve child's parameters that are identical to parent's ones
child->NumberOfCursors = parent->NumberOfCursors;
......@@ -1078,7 +1078,7 @@ void vtkHyperTreeGrid::InitializeSuperCursorChild( vtkHyperTreeGridSuperCursor*
child->Size[2] = parent->Size[2] / double( this->BranchFactor );
// Compute origin of child
int x, y, z;
unsigned int x, y, z;
if ( this->BranchFactor == 2 )
{
x = childIdx & 1;
......@@ -1410,10 +1410,10 @@ void vtkHyperTreeGrid::TraverseDualMaskedLeaf(
case 3:
{
// Check across (D-1)-face neighbors (edges)
unsigned int tpa1 = 1;
int tpa1 = 1;
for ( int a1 = 0; a1 < 2; ++ a1, tpa1 *= 3 )
{
unsigned int tpa2 = 3 * tpa1;
int tpa2 = 3 * tpa1;
for ( int a2 = a1 + 1; a2 < 3; ++ a2, tpa2 *= 3 )
{
for ( int o2 = -1; o2 < 2; o2 += 2 )
......@@ -1562,10 +1562,10 @@ void vtkHyperTreeGrid::TraverseDualLeaf( vtkHyperTreeGridSuperCursor* superCurso
bool movedToEdge = false;
// Check across (D-1)-face neighbors (edges)
unsigned int tpa1 = 1;
int tpa1 = 1;
for ( int a1 = 0; a1 < 2; ++ a1, tpa1 *= 3 )
{
unsigned int tpa2 = 3 * tpa1;
int tpa2 = 3 * tpa1;
for ( int a2 = a1 + 1; a2 < 3; ++ a2, tpa2 *= 3 )
{
for ( int o2 = -1; o2 < 2; o2 += 2 )
......@@ -1620,7 +1620,7 @@ void vtkHyperTreeGrid::TraverseDualLeaf( vtkHyperTreeGridSuperCursor* superCurso
} // if ( ! movedToDFace )
// Retrieve global index of center cursor
int id0 = cursor0->GetGlobalNodeIndex();
vtkIdType id0 = cursor0->GetGlobalNodeIndex();
// Insert dual point corresponding to current primal cell
this->Points->SetPoint( id0, pt );
......@@ -1693,7 +1693,7 @@ void vtkHyperTreeGrid::TraverseDualLeaf( vtkHyperTreeGridSuperCursor* superCurso
// This table is used to move a 3x3x3 neighborhood of cursors through the tree.
void vtkHyperTreeGrid::GenerateSuperCursorTraversalTable()
{
int bf = this->BranchFactor;
int bf = static_cast<int>( this->BranchFactor );
int xChildDim = bf;
int yChildDim = this->Dimension > 1 ? bf : 1;
......
......@@ -328,18 +328,20 @@ public:
// This will not work in place.
void InitializeSuperCursorChild( vtkHyperTreeGridSuperCursor* parent,
vtkHyperTreeGridSuperCursor* child,
int childIdx );
unsigned int childIdx );
#endif
//ETX
// Description:
// The number of children each node can have.
vtkGetMacro(NumberOfChildren, int);
vtkGetMacro(NumberOfChildren, unsigned int);
// Description:
// Convert a level 0 index to its ijk coordinates according the grid size.
void GetLevelZeroCoordsFromIndex( vtkIdType index,
vtkIdType &i, vtkIdType &j, vtkIdType &k );
unsigned int &i,
unsigned int &j,
unsigned int &k );
protected:
// Constructor with default bounds (0,1, 0,1, 0,1).
......
......@@ -428,7 +428,7 @@ int vtkHyperTreeGridSource::RequestData( vtkInformation*,
this->Output->InitializeTreeIterator( it );
while ( vtkHyperTree* tree = it.GetNextTree( index ) )
{
vtkIdType i, j, k;
unsigned int i, j, k;
//if ( this->TransposedRootIndexing )
// {
// this->Output->GetLevelZeroCoordsFromIndex( index, k, j, i );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment