| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0009208 | ParaView | Bug | public | 2009-06-26 04:37 | 2010-03-10 13:05 | ||||
| Reporter | Paul Edwards | ||||||||
| Assigned To | Zhanping Liu | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | closed | Resolution | no change required | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | |||||||||
| Target Version | 3.8 | Fixed in Version | 3.8 | ||||||
| Summary | 0009208: Calculator parsing issue | ||||||||
| Description | There is a problem with the Python parser where it will not recognise a variable that begins with the letters of a mathematical function, e.g. a variable called "absolute" with cause an error because "abs" is a function and it will expect a bracket. Here is a test case: 8<--------------------------------------- from paraview.simple import * cone = Cone() calc = Calculator(cone) calc.Function = "17" calc.ResultArrayName = "absolute" calc2 = Calculator(calc) calc2.ScalarVariable = ["abs", "abs", "0"] calc2.Function = "absolute - 15" calc2.UpdatePipeline() --------------------------------------->8 Here is a patch to fix: 8<--------------------------------------- Index: ./VTK/Common/vtkFunctionParser.cxx =================================================================== RCS file: /cvsroot/ParaView3/ParaView3/VTK/Common/vtkFunctionParser.cxx,v retrieving revision 1.44 diff -r1.44 vtkFunctionParser.cxx 1455,1457c1455,1460 < index += this->GetMathFunctionStringLength(functionNumber); < currentChar = this->Function[index]; < if ( currentChar != '(' ) --- > currentChar = this->Function[index+this->GetMathFunctionStringLength(functionNumber)]; > if ( currentChar == '(' ) > { > index += this->GetMathFunctionStringLength(functionNumber); > } > else 1459,1460d1461 < vtkErrorMacro("Syntax error: input to math function not in " < << "parentheses; see position " << index); 1463c1464 < return 0; --- > return 1; --------------------------------------->8 | ||||||||
| Tags | No tags attached. | ||||||||
| Project | |||||||||
| Topic Name | |||||||||
| Type | |||||||||
| Attached Files | |||||||||
| Relationships | |||||||||||
|
|||||||||||
| Relationships |
| Notes | |
|
(0019712) Zhanping Liu (developer) 2010-03-04 13:10 |
This problem was fixed by making changes to VTK/Common/vtkFunctionParser.h/cxx. Now the name of an array/variable is allowed to contain a standard math function name, e.g., 'absolute' vs 'abs'. |
|
(0019791) Alan Scott (manager) 2010-03-09 22:05 |
I get the following errors: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 >>> from paraview.simple import * paraview version 3.7.0, Date: 2010-03-09 >>> from paraview.simple import * >>> cone=Cone() >>> calc=Calculator(cone) >>> calc.Function = "17" >>> calc.ResultArrayName = "absolute" >>> calc2=Calculator(calc) >>> calc2.ScalarVariable = ["abs", "abs", "0"] Traceback (most recent call last): File "<console>", line 1, in <module> File "F:/alan/paraviewTrunkVisual/bld/ParaView3/Utilities/VTKPythonWrapping/paraview\servermanager.py", line 201, in __setattr__ "to add this attribute.") AttributeError: Attribute ScalarVariable does not exist. This class does not allow addition of new attributes to avoid mistakes due to typos. Use add_attribute() if you really want to add this attribute. >>> |
|
(0019799) Utkarsh Ayachit (administrator) 2010-03-10 09:38 |
The ScalarVariable property has been removed since it's not longer applicable. Just remove that line from the python script. |
|
(0019811) Alan Scott (manager) 2010-03-10 13:05 |
Closed, as per Zhanping. His e-mail thread to me is as follows: The bug reporter intended to type === calc2.ScalarVariable = ["absolute", "absolute", "0"] === (though he actually typed "abs") and this line (referencing "absolute" as a variable) caused a problem (before the fix) because the array calculator was expecting "(" right after 'abs' (since 'abs' is a math function) to make "abs(...)". The fix just allows the calculator to take "absolute" as a valid variable to be distinguishable from 'abs(...)'. |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2009-06-26 04:37 | Paul Edwards | New Issue | |
| 2009-12-09 14:49 | Berk Geveci | Project | @3@ => ParaView |
| 2009-12-29 11:22 | Utkarsh Ayachit | Status | backlog => tabled |
| 2009-12-29 11:22 | Utkarsh Ayachit | Assigned To | => Zhanping Liu |
| 2010-03-04 13:10 | Zhanping Liu | Note Added: 0019712 | |
| 2010-03-04 13:10 | Zhanping Liu | Status | tabled => @80@ |
| 2010-03-04 13:10 | Zhanping Liu | Category | => Bug |
| 2010-03-09 22:05 | Alan Scott | Note Added: 0019791 | |
| 2010-03-09 22:05 | Alan Scott | Status | @80@ => @20@ |
| 2010-03-09 22:05 | Alan Scott | Resolution | open => reopened |
| 2010-03-10 09:38 | Utkarsh Ayachit | Note Added: 0019799 | |
| 2010-03-10 09:38 | Utkarsh Ayachit | Status | @20@ => @80@ |
| 2010-03-10 09:38 | Utkarsh Ayachit | Resolution | reopened => no change required |
| 2010-03-10 09:38 | Utkarsh Ayachit | Fixed in Version | => 3.8 |
| 2010-03-10 09:38 | Utkarsh Ayachit | Target Version | => 3.8 |
| 2010-03-10 13:05 | Alan Scott | Note Added: 0019811 | |
| 2010-03-10 13:05 | Alan Scott | Status | @80@ => closed |
| 2010-05-06 14:11 | Robert Maynard | Relationship added | has duplicate 0010536 |
| 2010-05-06 14:26 | Robert Maynard | Relationship added | has duplicate 0009438 |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |