Skip to content
Permalink
Browse files

Fix compiler warnings for signed/unsigned comparisons.

All are due to use of int64_t instead of size_t for pointer index operations/variables
  • Loading branch information...
imikejackson committed May 22, 2019
1 parent 3d50704 commit fd385316a0875502065c2cccac81bf9d72a01ded
@@ -174,7 +174,7 @@ void AbaqusSurfaceMeshWriter::execute()

// Store all the unique Spins
std::set<int32_t> uniqueSpins;
for(int64_t i = 0; i < triangleGeom->getNumberOfTris(); i++)
for(MeshIndexType i = 0; i < triangleGeom->getNumberOfTris(); i++)
{
uniqueSpins.insert(m_SurfaceMeshFaceLabels[i * 2]);
uniqueSpins.insert(m_SurfaceMeshFaceLabels[i * 2 + 1]);
@@ -266,7 +266,7 @@ int32_t AbaqusSurfaceMeshWriter::writeTriangles(FILE* f)
MeshIndexType* triangles = triangleGeom->getTriPointer(0);

fprintf(f, "*ELEMENT, TYPE=%s\n", TRI_ELEMENT_TYPE);
for(int64_t i = 1; i <= numTri; ++i)
for(MeshIndexType i = 1; i <= numTri; ++i)
{
// When we get the node index, add 1 to it because Abaqus number is 1 based.
int64_t nId0 = triangles[(i - 1) * 3] + 1;
@@ -476,9 +476,9 @@ void ReadStlFile::eliminate_duplicate_nodes()
// Create array to hold unique node numbers
Int64ArrayType::Pointer uniqueIdsPtr = Int64ArrayType::CreateArray(nNodes, "uniqueIds");
int64_t* uniqueIds = uniqueIdsPtr->getPointer(0);
for(int64_t i = 0; i < nNodes_; i++)
for(MeshIndexType i = 0; i < nNodes_; i++)
{
uniqueIds[i] = i;
uniqueIds[i] = static_cast<int64_t>(i);
}

#ifdef SIMPL_USE_PARALLEL_ALGORITHMS
@@ -238,15 +238,15 @@ void WriteStlFile::execute()
QMap<int32_t, int32_t> uniqueGrainIdtoPhase;
if(m_GroupByPhase)
{
for(int64_t i = 0; i < nTriangles; i++)
for(MeshIndexType i = 0; i < nTriangles; i++)
{
uniqueGrainIdtoPhase.insert(m_SurfaceMeshFaceLabels[i * 2], m_SurfaceMeshFacePhases[i * 2]);
uniqueGrainIdtoPhase.insert(m_SurfaceMeshFaceLabels[i * 2 + 1], m_SurfaceMeshFacePhases[i * 2 + 1]);
}
}
else
{
for(int64_t i = 0; i < nTriangles; i++)
for(MeshIndexType i = 0; i < nTriangles; i++)
{
uniqueGrainIdtoPhase.insert(m_SurfaceMeshFaceLabels[i * 2], 0);
uniqueGrainIdtoPhase.insert(m_SurfaceMeshFaceLabels[i * 2 + 1], 0);
@@ -298,12 +298,12 @@ void WriteStlFile::execute()
triCount = 0; // Reset this to Zero. Increment for every triangle written

// Loop over all the triangles for this spin
for(int64_t t = 0; t < nTriangles; ++t)
for(MeshIndexType t = 0; t < nTriangles; ++t)
{
// Get the true indices of the 3 nodes
int64_t nId0 = triangles[t * 3];
int64_t nId1 = triangles[t * 3 + 1];
int64_t nId2 = triangles[t * 3 + 2];
MeshIndexType nId0 = triangles[t * 3];
MeshIndexType nId1 = triangles[t * 3 + 1];
MeshIndexType nId2 = triangles[t * 3 + 2];

vert1[0] = static_cast<float>(nodes[nId0 * 3]);
vert1[1] = static_cast<float>(nodes[nId0 * 3 + 1]);
@@ -317,7 +317,7 @@ void WriteStlFile::execute()
{
// winding = 1; // Write it using backward spin
// Switch the 2 node indices
int64_t temp = nId1;
MeshIndexType temp = nId1;
nId1 = nId2;
nId2 = temp;
}
@@ -381,7 +381,7 @@ int32_t WriteStlFile::writeHeader(FILE* f, const QString& header, int32_t triCou
size_t headlength = 80;
if(header.length() < 80)
{
headlength = header.length();
headlength = static_cast<size_t>(header.length());
}

std::string c_str = header.toStdString();
@@ -270,7 +270,7 @@ int32_t LaplacianSmoothing::edgeBasedSmoothing()
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceDataContainerName());
IGeometry2D::Pointer surfaceMesh = sm->getGeometryAs<IGeometry2D>();
float* verts = surfaceMesh->getVertexPointer(0);
int64_t nvert = surfaceMesh->getNumberOfVertices();
MeshIndexType nvert = surfaceMesh->getNumberOfVertices();

// Generate the Lambda Array
err = generateLambdaArray();
@@ -317,16 +317,16 @@ int32_t LaplacianSmoothing::edgeBasedSmoothing()
QString ss = QObject::tr("Iteration %1 of %2").arg(q).arg(m_IterationSteps);
notifyStatusMessage(ss);
// Compute the Deltas for each point
for(int64_t i = 0; i < nedges; i++)
for(MeshIndexType i = 0; i < nedges; i++)
{
int64_t in1 = uedges[2 * i]; // row of the first vertex
int64_t in2 = uedges[2 * i + 1]; // row the second vertex
MeshIndexType in1 = uedges[2 * i]; // row of the first vertex
MeshIndexType in2 = uedges[2 * i + 1]; // row the second vertex

for(int32_t j = 0; j < 3; j++)
for(MeshIndexType j = 0; j < 3; j++)
{
Q_ASSERT(static_cast<size_t>(3 * in1 + j) < static_cast<size_t>(nvert * 3));
Q_ASSERT(static_cast<size_t>(3 * in2 + j) < static_cast<size_t>(nvert * 3));
dlta = verts[3 * in2 + j] - verts[3 * in1 + j];
dlta = static_cast<double>(verts[3 * in2 + j] - verts[3 * in1 + j]);
delta[3 * in1 + j] += dlta;
delta[3 * in2 + j] += -1.0 * dlta;
}
@@ -336,11 +336,11 @@ int32_t LaplacianSmoothing::edgeBasedSmoothing()

// Move each point
float ll = 0.0f;
for(int64_t i = 0; i < nvert; i++)
for(MeshIndexType i = 0; i < nvert; i++)
{
for(int32_t j = 0; j < 3; j++)
for(MeshIndexType j = 0; j < 3; j++)
{
int64_t in0 = 3 * i + j;
MeshIndexType in0 = 3 * i + j;
dlta = delta[in0] / ncon[i];

ll = lambda[i];
@@ -363,10 +363,10 @@ int32_t LaplacianSmoothing::edgeBasedSmoothing()
QString ss = QObject::tr("Iteration %1 of %2").arg(q).arg(m_IterationSteps);
notifyStatusMessage(ss);
// Compute the Delta's
for(int64_t i = 0; i < nedges; i++)
for(MeshIndexType i = 0; i < nedges; i++)
{
int64_t in1 = uedges[2 * i]; // row of the first vertex
int64_t in2 = uedges[2 * i + 1]; // row the second vertex
MeshIndexType in1 = uedges[2 * i]; // row of the first vertex
MeshIndexType in2 = uedges[2 * i + 1]; // row the second vertex

for(int32_t j = 0; j < 3; j++)
{
@@ -382,11 +382,11 @@ int32_t LaplacianSmoothing::edgeBasedSmoothing()

// MOve the points
float ll = 0.0f;
for(int64_t i = 0; i < nvert; i++)
for(MeshIndexType i = 0; i < nvert; i++)
{
for(int32_t j = 0; j < 3; j++)
for(MeshIndexType j = 0; j < 3; j++)
{
int64_t in0 = 3 * i + j;
MeshIndexType in0 = 3 * i + j;
dlta = delta[in0] / ncon[i];

ll = lambda[i] * m_MuFactor;

0 comments on commit fd38531

Please sign in to comment.
You can’t perform that action at this time.