View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013088ParaView(No Category)public2012-04-13 10:102012-10-29 17:04
ReporterSebastien Jourdain 
Assigned ToSebastien Jourdain 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.98.0 
Summary0013088: Calculator produce invalid results
DescriptionThe calculator gives incorrect results for multiblock unless the variables have the same index internally. This can be reproduced with the steps below:
 
1. Create a python source that outputs vtkUnstructuredGrid with the following script:

def add_scalar(ds, val):
                arr = vtk.vtkDoubleArray()
                arr.SetName("Scalar"+str(val))
                arr.SetNumberOfComponents(1)
                arr.SetNumberOfTuples(8)
                for i in range(8):
                                arr.SetTuple1(i, float(val))
                output.GetPointData().AddArray(arr)
 
output = self.GetOutput()
npts = 8
pts = vtk.vtkPoints()
pts.InsertNextPoint(-3.0, -1.0, -1.0)
pts.InsertNextPoint(-1.0, -1.0, -1.0)
pts.InsertNextPoint(-1.0, 1.0, -1.0)
pts.InsertNextPoint(-3.0, 1.0, -1.0)
pts.InsertNextPoint(-3.0, -1.0, 1.0)
pts.InsertNextPoint(-1.0, -1.0, 1.0)
pts.InsertNextPoint(-1.0, 1.0, 1.0)
pts.InsertNextPoint(-3.0, 1.0, 1.0)
output.SetPoints(pts)
output.Allocate(1,1)
ids = vtk.vtkIdList()
for i in range(npts):
    ids.InsertId(i,i)
add_scalar(output, 1)
add_scalar(output, 2)
output.InsertNextCell(vtk.VTK_HEXAHEDRON, ids)
2. Create a second python source that outputs vtkUnstructuredGrid with the following script (notice the change in order when adding the scalars):

def add_scalar(ds, val):
                arr = vtk.vtkDoubleArray()
                arr.SetName("Scalar"+str(val))
                arr.SetNumberOfComponents(1)
                arr.SetNumberOfTuples(8)
                for i in range(8):
                                arr.SetTuple1(i, float(val))
                output.GetPointData().AddArray(arr)
 
output = self.GetOutput()
npts = 8
pts = vtk.vtkPoints()
pts.InsertNextPoint(-3.0, -1.0, -1.0)
pts.InsertNextPoint(-1.0, -1.0, -1.0)
pts.InsertNextPoint(-1.0, 1.0, -1.0)
pts.InsertNextPoint(-3.0, 1.0, -1.0)
pts.InsertNextPoint(-3.0, -1.0, 1.0)
pts.InsertNextPoint(-1.0, -1.0, 1.0)
pts.InsertNextPoint(-1.0, 1.0, 1.0)
pts.InsertNextPoint(-3.0, 1.0, 1.0)
output.SetPoints(pts)
output.Allocate(1,1)
ids = vtk.vtkIdList()
for i in range(npts):
    ids.InsertId(i,i)
add_scalar(output, 2)
add_scalar(output, 1)
output.InsertNextCell(vtk.VTK_HEXAHEDRON, ids)
3. Group the two python sources together

4. Use the Calculator filter to pass through Scalar1

 
See output below:
 

 
TagsNo tags attached.
ProjectTBD
Topic Name13088-calculator-multi-block-fix
Typeincorrect functionality
Attached Filespng file icon image001.png [^] (29,544 bytes) 2012-04-13 10:10


zip file icon MultiBlock-ArrayDifferentOrder.zip [^] (2,205 bytes) 2012-07-19 16:25

 Relationships
has duplicate 0012929closedSebastien Jourdain Calculator gives incorrect results for multiblock datasets 

  Notes
(0028483)
Sebastien Jourdain (manager)
2012-04-17 11:05

diff --git a/ParaViewCore/VTKExtensions/vtkPVArrayCalculator.cxx b/ParaViewCore/VTKExtensions/vtkPVArrayCalculator.cxx
index 37eec77..9cc728f 100644
--- a/ParaViewCore/VTKExtensions/vtkPVArrayCalculator.cxx
+++ b/ParaViewCore/VTKExtensions/vtkPVArrayCalculator.cxx
@@ -17,6 +17,7 @@
 #include "vtkCellData.h"
 #include "vtkDataObject.h"
 #include "vtkDataSet.h"
+#include "vtkFunctionParser.h"
 #include "vtkGraph.h"
 #include "vtkInformation.h"
 #include "vtkInformationVector.h"
@@ -73,6 +74,9 @@ void vtkPVArrayCalculator::UpdateArrayAndVariableNames
 {
   unsigned long mtime = this->GetMTime();
 
+ // Make sure we reparse the function based on the current array order
+ this->FunctionParser->InvalidateFunction();
+
   // Look at the data-arrays available in the input and register them as
   // variables with the superclass.
   // It's safe to call these methods in RequestData() since they don't call
(0028484)
Sebastien Jourdain (manager)
2012-04-17 11:07
edited on: 2012-05-23 11:30

diff --git a/Common/vtkFunctionParser.cxx b/Common/vtkFunctionParser.cxx
index e955af7..da7f678 100644
--- a/Common/vtkFunctionParser.cxx
+++ b/Common/vtkFunctionParser.cxx
@@ -564,6 +564,12 @@ int vtkFunctionParser::DisambiguateOperators()
 }
 
 //-----------------------------------------------------------------------------
+void vtkFunctionParser::InvalidateFunction()
+{
+ this->FunctionMTime.Modified();
+}
+
+//-----------------------------------------------------------------------------
 bool vtkFunctionParser::Evaluate()
 {
   int numBytesProcessed;
diff --git a/Common/vtkFunctionParser.h b/Common/vtkFunctionParser.h
index f81ff2c..e3c7724 100644
--- a/Common/vtkFunctionParser.h
+++ b/Common/vtkFunctionParser.h
@@ -234,6 +234,10 @@ public:
   // Check the validity of the function expression.
   void CheckExpression(int &pos, char **error);
 
+ // Description:
+ // Allow the user to force the function to be re-parsed
+ void InvalidateFunction();
+
 protected:
   vtkFunctionParser();
   ~vtkFunctionParser();

====> Done (http://review.source.kitware.com/#/t/702/ [^])

(0028485)
Sebastien Jourdain (manager)
2012-04-17 11:09

Those are the 2 patch needed to fix the issue. Although with the current changes on VTK, we will wait to apply them once VTK/master will be in synch with ParaView/master.

Otherwise user that need it could patch their current sources...
(0028500)
Utkarsh Ayachit (administrator)
2012-04-20 13:51

merged into master, where applicable.
(0028637)
Sebastien Jourdain (manager)
2012-05-23 08:02

Now that ParaView is using VTK/master, we can apply this patch...
(0028669)
Utkarsh Ayachit (administrator)
2012-06-01 14:41

Merged in master, if applicable.
(0028873)
Sebastien Jourdain (manager)
2012-07-19 16:27

Tested by loading the multi-block file and apply a calculator computation using on of the array and make sure the result is the same on both block regardless the ordering of the array names that differ for each block...

 Issue History
Date Modified Username Field Change
2012-04-13 10:10 Sebastien Jourdain New Issue
2012-04-13 10:10 Sebastien Jourdain Assigned To => Sebastiennn Jourdain
2012-04-13 10:10 Sebastien Jourdain File Added: image001.png
2012-04-13 11:42 Sebastien Jourdain Relationship added has duplicate 0012929
2012-04-17 09:02 Sebastien Jourdain Status backlog => todo
2012-04-17 09:02 Sebastien Jourdain Status todo => active development
2012-04-17 11:05 Sebastien Jourdain Note Added: 0028483
2012-04-17 11:07 Sebastien Jourdain Note Added: 0028484
2012-04-17 11:09 Sebastien Jourdain Note Added: 0028485
2012-04-17 11:10 Sebastien Jourdain Status active development => gatekeeper review
2012-04-17 11:10 Sebastien Jourdain Resolution open => fixed
2012-04-17 11:16 Sebastien Jourdain Topic Name => 13088-calculator-fix (On Seb computer...)
2012-04-20 13:50 Utkarsh Ayachit Fixed in Version => git-master
2012-04-20 13:51 Utkarsh Ayachit Status gatekeeper review => customer review
2012-04-20 13:51 Utkarsh Ayachit Note Added: 0028500
2012-05-23 08:02 Sebastien Jourdain Note Added: 0028637
2012-05-23 08:02 Sebastien Jourdain Status customer review => active development
2012-05-23 11:30 Sebastien Jourdain Note Edited: 0028484
2012-05-29 13:30 Sebastien Jourdain Topic Name 13088-calculator-fix (On Seb computer...) => 13088-calculator-multi-block-fix
2012-05-29 13:33 Sebastien Jourdain Status active development => gatekeeper review
2012-06-01 14:41 Utkarsh Ayachit Status gatekeeper review => customer review
2012-06-01 14:41 Utkarsh Ayachit Note Added: 0028669
2012-07-19 16:25 Sebastien Jourdain File Added: MultiBlock-ArrayDifferentOrder.zip
2012-07-19 16:27 Sebastien Jourdain Note Added: 0028873
2012-07-19 16:27 Sebastien Jourdain Status customer review => closed
2012-10-29 17:04 Utkarsh Ayachit Fixed in Version git-master => 3.98.0


Copyright © 2000 - 2018 MantisBT Team