View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0012778 | VTK | (No Category) | public | 2011-12-08 08:01 | 2016-08-12 09:55 | ||||
Reporter | Felipe Bordeu | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | 5.8.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0012778: Use of Fielddata in the VTKArrayCalculator | ||||||||
Description | I came with this solution to use field data in the vtkArrayCalculator: the idea is very simple: we retrieve the field data and we put it into the inFieldData variable, Then If a field is not found in the point/cell data, then we search in the fielddata. diff --git a/Graphics/vtkArrayCalculator.cxx b/Graphics/vtkArrayCalculator.cxx index a2db7ae..d7c53eb 100644 --- a/Graphics/vtkArrayCalculator.cxx +++ b/Graphics/vtkArrayCalculator.cxx @@ -225,6 +225,7 @@ int vtkArrayCalculator::RequestData( double scalarResult[1]; vtkDataArray* resultArray = 0; vtkPoints* resultPoints = 0; + vtkFieldData* inFieldData = 0; this->FunctionParser->SetReplaceInvalidValues(this->ReplaceInvalidValues); this->FunctionParser->SetReplacementValue(this->ReplacementValue); @@ -252,6 +253,7 @@ int vtkArrayCalculator::RequestData( attributeDataType = 1; numTuples = dsInput->GetNumberOfCells(); } + inFieldData = dsInput->GetFieldData(); } else if (graphInput) { @@ -270,6 +272,7 @@ int vtkArrayCalculator::RequestData( attributeDataType = 1; numTuples = graphInput->GetNumberOfEdges(); } + inFieldData = graphInput->GetFieldData(); } if (numTuples < 1) @@ -301,8 +304,30 @@ int vtkArrayCalculator::RequestData( } else { - vtkErrorMacro("Invalid array name: " << this->ScalarArrayNames[i]); - return 1; + // now we search in the fielddata for the array + currentArray = inFieldData->GetArray(this->ScalarArrayNames[i]); + if (currentArray) + { + if (currentArray->GetNumberOfComponents() > + this->SelectedScalarComponents[i]) + { + this->FunctionParser-> + SetScalarVariableValue( + this->ScalarVariableNames[i], + currentArray->GetComponent(0, this->SelectedScalarComponents[i])); + } + else + { + vtkErrorMacro("Array " << this->ScalarArrayNames[i] + << " does not contain the selected component."); + return 1; + } + } + else + { + vtkErrorMacro("Invalid array name: " << this->ScalarArrayNames[i]); + return 1; + } } } @@ -334,8 +359,36 @@ int vtkArrayCalculator::RequestData( } else { - vtkErrorMacro("Invalid array name: " << this->VectorArrayNames[i]); - return 1; + // now we search in the fielddata for the array + currentArray = inFieldData->GetArray(this->VectorArrayNames[i]); + if (currentArray) + { + if ((currentArray->GetNumberOfComponents() > + this->SelectedVectorComponents[i][0]) && + (currentArray->GetNumberOfComponents() > + this->SelectedVectorComponents[i][1]) && + (currentArray->GetNumberOfComponents() > + this->SelectedVectorComponents[i][2])) + { + this->FunctionParser-> + SetVectorVariableValue( + this->VectorVariableNames[i], + currentArray->GetComponent(0, this->SelectedVectorComponents[i][0]), + currentArray->GetComponent(0, this->SelectedVectorComponents[i][1]), + currentArray->GetComponent(0, this->SelectedVectorComponents[i][2])); + } + else + { + vtkErrorMacro("Array " << this->VectorArrayNames[i] + << " does not contain the selected component."); + return 1; + } + } + else + { + vtkErrorMacro("Invalid array name: " << this->VectorArrayNames[i]); + return 1; + } } } @@ -448,19 +501,21 @@ int vtkArrayCalculator::RequestData( for (j = 0; j < this->NumberOfScalarArrays; j++) { currentArray = inFD->GetArray(this->ScalarArrayNames[j]); - this->FunctionParser-> - SetScalarVariableValue( - j, currentArray->GetComponent(i, this->SelectedScalarComponents[j])); + if (currentArray) + this->FunctionParser-> + SetScalarVariableValue( + j, currentArray->GetComponent(i, this->SelectedScalarComponents[j])); } for (j = 0; j < this->NumberOfVectorArrays; j++) { currentArray = inFD->GetArray(this->VectorArrayNames[j]); - this->FunctionParser-> - SetVectorVariableValue( - j, currentArray->GetComponent(i, this->SelectedVectorComponents[j][0]), - currentArray->GetComponent( - i, this->SelectedVectorComponents[j][1]), - currentArray->GetComponent(i, this->SelectedVectorComponents[j][2])); + if (currentArray) + this->FunctionParser-> + SetVectorVariableValue( + j, currentArray->GetComponent(i, this->SelectedVectorComponents[j][0]), + currentArray->GetComponent( + i, this->SelectedVectorComponents[j][1]), + currentArray->GetComponent(i, this->SelectedVectorComponents[j][2])); } if(attributeDataType == 0) { | ||||||||
Tags | No tags attached. | ||||||||
Project | Kitware | ||||||||
Type | feature | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0029079) Kyle Lutz (viewer) 2012-08-27 13:29 |
Patch pushed to gerrit for review: http://review.source.kitware.com/#/t/1139/ [^] |
(0033560) Cory Quammen (developer) 2014-10-02 18:54 |
The patch above was abandoned for not sufficiently addressing the problem. |
(0033591) Felipe Bordeu (reporter) 2014-10-06 03:39 |
What do you mean by "no sufficiently addressing the problem"? |
(0033605) Cory Quammen (developer) 2014-10-06 13:05 |
Please see the reviewer comments for the gerrit topic: http://review.source.kitware.com/#/t/1139/ [^] notably, this comment from Utkarsh: "This is not a good solution for the problem. It does not address field data with more than 1 tuple correctly. In practice, e.g. Exodus, field data often has values for each time-step and this patch doesn't provide any means to access those." |
(0036248) Berk Geveci (administrator) 2016-07-06 16:48 |
Setting to status of bugs that have not been updated in the last year to expired. Please re-open if still important. |
(0037259) Kitware Robot (administrator) 2016-08-12 09:55 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2011-12-08 08:01 | Felipe Bordeu | New Issue | |
2012-08-27 10:08 | Utkarsh Ayachit | Assigned To | => Kyle Lutz |
2012-08-27 10:08 | Utkarsh Ayachit | Status | backlog => tabled |
2012-08-27 13:29 | Kyle Lutz | Note Added: 0029079 | |
2012-08-27 13:29 | Kyle Lutz | Status | tabled => active development |
2012-08-27 13:29 | Kyle Lutz | Resolution | open => fixed |
2013-12-16 13:17 | Dave DeMarle | Assigned To | Kyle Lutz => |
2013-12-16 13:17 | Dave DeMarle | Status | active development => backlog |
2014-10-02 18:54 | Cory Quammen | Note Added: 0033560 | |
2014-10-06 03:39 | Felipe Bordeu | Note Added: 0033591 | |
2014-10-06 13:05 | Cory Quammen | Note Added: 0033605 | |
2016-07-06 16:48 | Berk Geveci | Status | backlog => expired |
2016-07-06 16:48 | Berk Geveci | Note Added: 0036248 | |
2016-08-12 09:55 | Kitware Robot | Note Added: 0037259 | |
2016-08-12 09:55 | Kitware Robot | Status | expired => closed |
2016-08-12 09:55 | Kitware Robot | Resolution | fixed => moved |
2016-08-12 09:55 | Kitware Robot | Assigned To | => Kitware Robot |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |