Commit 5cc9ff6d authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot

Merge topic 'fix_dynamic_analysis_issues'

3154b525 fix some dynamic analysis issues
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !4535
parents 39f1798c 3154b525
...@@ -179,6 +179,17 @@ void vtkLandmarkTransform::InternalUpdate() ...@@ -179,6 +179,17 @@ void vtkLandmarkTransform::InternalUpdate()
sb += b[0]*b[0]+b[1]*b[1]+b[2]*b[2]; sb += b[0]*b[0]+b[1]*b[1]+b[2]*b[2];
} }
// if source or destination is degenerate then only report
// translation
if (sa == 0.0 || sb == 0.0)
{
this->Matrix->Identity();
this->Matrix->Element[0][3] = target_centroid[0] - source_centroid[0];
this->Matrix->Element[1][3] = target_centroid[1] - source_centroid[1];
this->Matrix->Element[2][3] = target_centroid[2] - source_centroid[2];
return;
}
if(this->Mode == VTK_LANDMARK_AFFINE) if(this->Mode == VTK_LANDMARK_AFFINE)
{ {
// AAT = (a.a^t)^-1 // AAT = (a.a^t)^-1
......
...@@ -1624,19 +1624,31 @@ int vtkExodusIIWriter::CreateSetsMetadata (vtkModelMetadata* em) ...@@ -1624,19 +1624,31 @@ int vtkExodusIIWriter::CreateSetsMetadata (vtkModelMetadata* em)
em->SetNodeSetNames (nodeSetNames); em->SetNodeSetNames (nodeSetNames);
int *nodeSetIds_a = new int[nodeSetIds->GetNumberOfTuples ()]; int *nodeSetIds_a = new int[nodeSetIds->GetNumberOfTuples ()];
memcpy (nodeSetIds_a, nodeSetIds->GetPointer (0), nodeSetIds->GetNumberOfTuples () * sizeof(int)); if (nodeSetIds->GetPointer (0))
{
memcpy (nodeSetIds_a, nodeSetIds->GetPointer (0), nodeSetIds->GetNumberOfTuples () * sizeof(int));
}
em->SetNodeSetIds (nodeSetIds_a); em->SetNodeSetIds (nodeSetIds_a);
int *nodeSetSizes_a = new int[nodeSetSizes->GetNumberOfTuples ()]; int *nodeSetSizes_a = new int[nodeSetSizes->GetNumberOfTuples ()];
memcpy (nodeSetSizes_a, nodeSetSizes->GetPointer (0), nodeSetSizes->GetNumberOfTuples () * sizeof(int)); if (nodeSetSizes->GetPointer (0))
{
memcpy (nodeSetSizes_a, nodeSetSizes->GetPointer (0), nodeSetSizes->GetNumberOfTuples () * sizeof(int));
}
em->SetNodeSetSize (nodeSetSizes_a); em->SetNodeSetSize (nodeSetSizes_a);
int *nodeSetNumDF_a = new int[nodeSetNumDF->GetNumberOfTuples ()]; int *nodeSetNumDF_a = new int[nodeSetNumDF->GetNumberOfTuples ()];
memcpy (nodeSetNumDF_a, nodeSetNumDF->GetPointer (0), nodeSetNumDF->GetNumberOfTuples () * sizeof(int)); if (nodeSetNumDF->GetPointer (0))
{
memcpy (nodeSetNumDF_a, nodeSetNumDF->GetPointer (0), nodeSetNumDF->GetNumberOfTuples () * sizeof(int));
}
em->SetNodeSetNumberOfDistributionFactors (nodeSetNumDF_a); em->SetNodeSetNumberOfDistributionFactors (nodeSetNumDF_a);
int *nodeIds_a = new int[nodeIds->GetNumberOfTuples ()]; int *nodeIds_a = new int[nodeIds->GetNumberOfTuples ()];
memcpy (nodeIds_a, nodeIds->GetPointer (0), nodeIds->GetNumberOfTuples() * sizeof(int)); if (nodeIds->GetPointer (0))
{
memcpy (nodeIds_a, nodeIds->GetPointer (0), nodeIds->GetNumberOfTuples() * sizeof(int));
}
em->SetNodeSetNodeIdList (nodeIds_a); em->SetNodeSetNodeIdList (nodeIds_a);
em->SetNumberOfSideSets (numSideSets); em->SetNumberOfSideSets (numSideSets);
...@@ -1644,23 +1656,38 @@ int vtkExodusIIWriter::CreateSetsMetadata (vtkModelMetadata* em) ...@@ -1644,23 +1656,38 @@ int vtkExodusIIWriter::CreateSetsMetadata (vtkModelMetadata* em)
em->SetSideSetNames (sideSetNames); em->SetSideSetNames (sideSetNames);
int *sideSetIds_a = new int[sideSetIds->GetNumberOfTuples ()]; int *sideSetIds_a = new int[sideSetIds->GetNumberOfTuples ()];
memcpy (sideSetIds_a, sideSetIds->GetPointer (0), sideSetIds->GetNumberOfTuples() * sizeof(int)); if (sideSetIds->GetPointer (0))
{
memcpy (sideSetIds_a, sideSetIds->GetPointer (0), sideSetIds->GetNumberOfTuples() * sizeof(int));
}
em->SetSideSetIds (sideSetIds_a); em->SetSideSetIds (sideSetIds_a);
int *sideSetSizes_a = new int[sideSetSizes->GetNumberOfTuples ()]; int *sideSetSizes_a = new int[sideSetSizes->GetNumberOfTuples ()];
memcpy (sideSetSizes_a, sideSetSizes->GetPointer (0), sideSetSizes->GetNumberOfTuples() * sizeof(int)); if (sideSetSizes->GetPointer (0))
{
memcpy (sideSetSizes_a, sideSetSizes->GetPointer (0), sideSetSizes->GetNumberOfTuples() * sizeof(int));
}
em->SetSideSetSize (sideSetSizes_a); em->SetSideSetSize (sideSetSizes_a);
int *sideSetNumDF_a = new int[sideSetNumDF->GetNumberOfTuples ()]; int *sideSetNumDF_a = new int[sideSetNumDF->GetNumberOfTuples ()];
memcpy (sideSetNumDF_a, sideSetNumDF->GetPointer (0), sideSetNumDF->GetNumberOfTuples() * sizeof(int)); if (sideSetNumDF->GetPointer (0))
{
memcpy (sideSetNumDF_a, sideSetNumDF->GetPointer (0), sideSetNumDF->GetNumberOfTuples() * sizeof(int));
}
em->SetSideSetNumDFPerSide (sideSetNumDF_a); em->SetSideSetNumDFPerSide (sideSetNumDF_a);
int *sideSetElementList_a = new int[sideSetElementList->GetNumberOfTuples ()]; int *sideSetElementList_a = new int[sideSetElementList->GetNumberOfTuples ()];
memcpy (sideSetElementList_a, sideSetElementList->GetPointer (0), sideSetElementList->GetNumberOfTuples() * sizeof(int)); if (sideSetElementList->GetPointer (0))
{
memcpy (sideSetElementList_a, sideSetElementList->GetPointer (0), sideSetElementList->GetNumberOfTuples() * sizeof(int));
}
em->SetSideSetElementList (sideSetElementList_a); em->SetSideSetElementList (sideSetElementList_a);
int *sideSetSideList_a = new int[sideSetSideList->GetNumberOfTuples ()]; int *sideSetSideList_a = new int[sideSetSideList->GetNumberOfTuples ()];
memcpy (sideSetSideList_a, sideSetSideList->GetPointer (0), sideSetSideList->GetNumberOfTuples() * sizeof(int)); if (sideSetSideList->GetPointer (0))
{
memcpy (sideSetSideList_a, sideSetSideList->GetPointer (0), sideSetSideList->GetNumberOfTuples() * sizeof(int));
}
em->SetSideSetSideList (sideSetSideList_a); em->SetSideSetSideList (sideSetSideList_a);
} }
return 1; return 1;
......
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