[vtkusers] Patch to fix vtkExtractVectorComponents.cxx bugs

Nicholas Brealey nick.brealey at culham.com
Fri Apr 5 07:09:39 EST 2002


Hi

Here is a patch which fixes 3 bugs in vtkExtractVectorComponents.cxx:

1) Execute() crashes if there are no point data vectors.

2) Cell data scalars given 3 components instead of 1.

3) z component of cell data vector not set correctly.

Regards

Nick
-------------- next part --------------
--- vtkExtractVectorComponents.cxx.orig	Thu Mar 21 21:25:32 2002
+++ vtkExtractVectorComponents.cxx	Wed Apr  3 10:53:41 2002
@@ -230,7 +230,21 @@
     return;
     }
 
-  const char* name = vectors->GetName();
+
+  const char* name;
+  if ( vectors )
+    {
+    name = vectors->GetName();
+    }
+  else if ( vectorsc )
+    {
+    name = vectorsc->GetName();
+    }
+  else 
+    {
+    name = 0;
+    }
+
   char* newName=0;
   if (name)
     {
@@ -293,18 +307,15 @@
   if (vectorsc)
     {
     vxc = vtkDataArray::CreateDataArray(vectorsc->GetDataType());
-    vxc->SetNumberOfComponents(3);
     vxc->SetNumberOfTuples(numVectorsc);
     sprintf(newName, "%s-x", name);
     vxc->SetName(newName);
     vyc = vtkDataArray::CreateDataArray(vectorsc->GetDataType());
-    vyc->SetNumberOfComponents(3);
     vyc->SetNumberOfTuples(numVectorsc);
     sprintf(newName, "%s-y", name);
     vyc->SetName(newName);
     vzc = vtkDataArray::CreateDataArray(vectorsc->GetDataType());
-    vzc->SetNumberOfComponents(3);
-    vzc->SetNumberOfTuples(numVectors);
+    vzc->SetNumberOfTuples(numVectorsc);
     sprintf(newName, "%s-z", name);
     vzc->SetName(newName);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nick.brealey.vcf
Type: text/x-vcard
Size: 364 bytes
Desc: Card for Nicholas Brealey
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020405/ec9102a6/attachment.vcf>


More information about the vtkusers mailing list