Commit 21cbc7ff authored by Mathieu Westphal's avatar Mathieu Westphal Committed by Kitware Robot

Merge topic 'UsePointDataToCellData'

d1a0788e Using new PointCellData conversion feature
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Michael Migliore's avatarMichael Migliore <michael.migliore@kitware.com>
Acked-by: Nicolas Vuaille's avatarNicolas Vuaille <nicolas.vuaille@kitware.com>
Acked-by: default avatarJoachim Pouderoux <joachim.pouderoux@kitware.com>
Merge-request: !2799
parents 9ade7c3a d1a0788e
Pipeline #120712 failed with stage
in 0 seconds
......@@ -100,6 +100,7 @@ SET (TESTS_WITHOUT_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/OpenHelp.xml
${CMAKE_CURRENT_SOURCE_DIR}/PartialArrayInLineChart.xml
${CMAKE_CURRENT_SOURCE_DIR}/PluginEULA.xml
${CMAKE_CURRENT_SOURCE_DIR}/PointCellDataConversion.xml
${CMAKE_CURRENT_SOURCE_DIR}/Preview.xml
${CMAKE_CURRENT_SOURCE_DIR}/SearchBox.xml
${CMAKE_CURRENT_SOURCE_DIR}/ServerConnectDialog.xml
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="RTAnalyticSource" />
<pqevent object="pqClientMainWindow/1QTabBar2" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="Calculator" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="set_string" arguments="RTData" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="Calculator" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ResultArrayName/ResultArrayName" command="set_string" arguments="Result2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="set_string" arguments="RTData/2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="PointDataToCellData" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ProcessAllArrays/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PointDataArrays/ArraySelectionWidget" command="setCheckState" arguments="0.0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/1QTabBar2" command="set_tab_with_text" arguments="Information" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="0.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="1.0,Result2" />
<pqevent object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" command="setCurrent" arguments="0.0" />
<pqevent object="pqClientMainWindow/1QTabBar2" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="CellDataToPointData" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ProcessAllArrays/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CellDataArrays/ArraySelectionWidget" command="setCheckState" arguments="0.0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/1QTabBar2" command="set_tab_with_text" arguments="Information" />
<pqevent object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" command="setCurrent" arguments="0.0" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="0.0,Result2" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,89,11,/0:0/0:0/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,89,11,/0:0/0:0/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ProcessAllArrays/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,59,9,/0:0/0:0/0:0/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseMove" arguments="1,0,0,60,9,/0:0/0:0/0:0/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,60,9,/0:0/0:0/0:0/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ProcessAllArrays/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Information" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="0.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="1.0,Result2" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="2.0,RTData" />
<pqevent object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" command="setCurrent" arguments="0.0" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PassCellData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Information" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="0.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="1.0,Result2" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="2.0,RTData" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="3.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="4.0,Result2" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="5.0,RTData" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Delete" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PassPointData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/1QTabBar0" command="set_tab_with_text" arguments="Information" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="0.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="1.0,Result2" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="2.0,RTData" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="3.0,Result" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="4.0,Result2" />
<pqcheck object="pqClientMainWindow/informationDock/informationWidgetFrame/informationScrollArea/qt_scrollarea_viewport/informationWidget/groupBox_2/dataArrays" property="modelItemData" arguments="5.0,RTData" />
</pqevents>
* Exposing new PointCellData conversion option
In VTK, the PointData to CellData and CellData to PointData filters
just got new properties to be able to only process certain arrays
instead of systematically processing all arrays. We expose
the properties in the xml of these filter so they can be used
in ParaView.
* Using these properties with AutoConvert properties
AutoConvert properties settings allows user to use
some filter with Point/Cell data even when
they do not accept it. The conversion is done
in vtkPVPostFilter but it used to convert all
arrays instead of only the needed one.
This uses the new PointData to CellData and CellData to
PointData filter properties to be able to convert
only the needed arrays.
......@@ -1223,6 +1223,32 @@
<Documentation>This property specifies the input to the Cell Data to
Point Data filter.</Documentation>
</InputProperty>
<IntVectorProperty command="SetProcessAllArrays"
default_values="1"
name="ProcessAllArrays"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>The value of this property controls whether all input
cell arrays will be processed and converted into point arrays.</Documentation>
</IntVectorProperty>
<StringVectorProperty clean_command="ClearCellDataArrays"
command="AddCellDataArray"
name="CellDataArrays"
label="Cell Data Array to process"
number_of_elements_per_command="1"
repeat_command="1">
<Documentation>Add a cell array by name to be converted to point array.</Documentation>
<ArrayListDomain input_domain_name="input_array" name="array_list">
<RequiredProperties>
<Property function="Input" name="Input" />
</RequiredProperties>
</ArrayListDomain>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ProcessAllArrays" function="boolean_invert" />
</PropertyWidgetDecorator>
</Hints>
</StringVectorProperty>
<IntVectorProperty command="SetPassCellData"
default_values="0"
name="PassCellData"
......@@ -4744,6 +4770,32 @@ array.
<Documentation>This property specifies the input to the Point Data to
Cell Data filter.</Documentation>
</InputProperty>
<IntVectorProperty command="SetProcessAllArrays"
default_values="1"
name="ProcessAllArrays"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>The value of this property controls whether all input
point arrays will be processed and converted into cell arrays.</Documentation>
</IntVectorProperty>
<StringVectorProperty clean_command="ClearPointDataArrays"
command="AddPointDataArray"
name="PointDataArrays"
label="Point Data Array to process"
number_of_elements_per_command="1"
repeat_command="1">
<Documentation>Add a point array by name to be converted to cell array.</Documentation>
<ArrayListDomain input_domain_name="input_array" name="array_list">
<RequiredProperties>
<Property function="Input" name="Input" />
</RequiredProperties>
</ArrayListDomain>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ProcessAllArrays" function="boolean_invert" />
</PropertyWidgetDecorator>
</Hints>
</StringVectorProperty>
<IntVectorProperty command="SetPassPointData"
default_values="0"
name="PassPointData"
......
......@@ -52,6 +52,7 @@ void vtkPVCompositeDataPipeline::CopyDefaultInformation(vtkInformation* request,
// object.
vtkInformationVector* inArrayVec = algorithmInfo->Get(vtkAlgorithm::INPUT_ARRAYS_TO_PROCESS());
int num_arrays = inArrayVec ? inArrayVec->GetNumberOfInformationObjects() : 0;
int informationIndex = 0;
for (int array_index = 0; array_index < num_arrays; array_index++)
{
vtkInformation* arrayInfo = this->Algorithm->GetInputArrayInformation(array_index);
......@@ -73,7 +74,8 @@ void vtkPVCompositeDataPipeline::CopyDefaultInformation(vtkInformation* request,
if (pvpfe)
{
assert(this->Algorithm->GetInputConnection(port, connection)->GetIndex() == 0);
pvpfe->SetPostArrayToProcessInformation(0, arrayInfo);
pvpfe->SetPostArrayToProcessInformation(informationIndex, arrayInfo);
informationIndex++;
}
}
}
......
......@@ -252,14 +252,6 @@ int vtkPVPostFilter::RequestData(
//----------------------------------------------------------------------------
int vtkPVPostFilter::DoAnyNeededConversions(vtkDataObject* output)
{
// get the array to convert info
vtkInformationVector* postVector =
this->Information->Get(vtkPVPostFilterExecutive::POST_ARRAYS_TO_PROCESS());
vtkInformation* postArrayInfo = postVector->GetInformationObject(0);
const char* name = postArrayInfo->Get(vtkDataObject::FIELD_NAME());
int fieldAssociation = postArrayInfo->Get(vtkDataObject::FIELD_ASSOCIATION());
vtkCompositeDataSet* cd = vtkCompositeDataSet::SafeDownCast(output);
if (cd)
{
......@@ -269,29 +261,42 @@ int vtkPVPostFilter::DoAnyNeededConversions(vtkDataObject* output)
vtkDataSet* dataset = vtkDataSet::SafeDownCast(iter->GetCurrentDataObject());
if (dataset)
{
std::string demangled_name, demagled_component_name;
DeMangleArrayName(name, dataset, demangled_name, demagled_component_name);
this->DoAnyNeededConversions(
dataset, name, fieldAssociation, demangled_name.c_str(), demagled_component_name.c_str());
this->DoAnyNeededConversions(dataset);
}
}
iter->Delete();
return 1;
}
else
{
vtkDataSet* dataset = vtkDataSet::SafeDownCast(output);
if (dataset)
{
std::string demangled_name, demagled_component_name;
DeMangleArrayName(name, dataset, demangled_name, demagled_component_name);
return this->DoAnyNeededConversions(
dataset, name, fieldAssociation, demangled_name.c_str(), demagled_component_name.c_str());
this->DoAnyNeededConversions(dataset);
}
}
return 0;
return 1;
}
//----------------------------------------------------------------------------
int vtkPVPostFilter::DoAnyNeededConversions(vtkDataSet* dataset)
{
// get the array to convert info
vtkInformationVector* postVector =
this->Information->Get(vtkPVPostFilterExecutive::POST_ARRAYS_TO_PROCESS());
for (int i = 0; i < postVector->GetNumberOfInformationObjects(); i++)
{
vtkInformation* postArrayInfo = postVector->GetInformationObject(i);
const char* name = postArrayInfo->Get(vtkDataObject::FIELD_NAME());
int fieldAssociation = postArrayInfo->Get(vtkDataObject::FIELD_ASSOCIATION());
std::string demangled_name, demagled_component_name;
DeMangleArrayName(name, dataset, demangled_name, demagled_component_name);
this->DoAnyNeededConversions(
dataset, name, fieldAssociation, demangled_name.c_str(), demagled_component_name.c_str());
}
return 1;
}
//----------------------------------------------------------------------------
......@@ -334,16 +339,26 @@ int vtkPVPostFilter::DoAnyNeededConversions(vtkDataSet* output, const char* requ
if (fieldAssociation == vtkDataObject::FIELD_ASSOCIATION_POINTS)
{
if (cellData->GetAbstractArray(requested_name) || cellData->GetAbstractArray(demangled_name))
vtkAbstractArray* array = cellData->GetAbstractArray(requested_name);
if (!array)
{
array = cellData->GetAbstractArray(demangled_name);
}
if (array)
{
this->CellDataToPointData(output);
this->CellDataToPointData(output, array->GetName());
}
}
else if (fieldAssociation == vtkDataObject::FIELD_ASSOCIATION_CELLS)
{
if (pointData->GetAbstractArray(requested_name) || pointData->GetAbstractArray(demangled_name))
vtkAbstractArray* array = pointData->GetAbstractArray(requested_name);
if (!array)
{
array = pointData->GetAbstractArray(demangled_name);
}
if (array)
{
this->PointDataToCellData(output);
this->PointDataToCellData(output, array->GetName());
}
}
......@@ -364,7 +379,7 @@ int vtkPVPostFilter::DoAnyNeededConversions(vtkDataSet* output, const char* requ
}
//----------------------------------------------------------------------------
void vtkPVPostFilter::CellDataToPointData(vtkDataSet* output)
void vtkPVPostFilter::CellDataToPointData(vtkDataSet* output, const char* name)
{
vtkDataObject* clone = output->NewInstance();
clone->ShallowCopy(output);
......@@ -372,6 +387,8 @@ void vtkPVPostFilter::CellDataToPointData(vtkDataSet* output)
vtkCellDataToPointData* converter = vtkCellDataToPointData::New();
converter->SetInputData(clone);
converter->PassCellDataOn();
converter->ProcessAllArraysOff();
converter->AddCellDataArray(name);
converter->Update();
output->ShallowCopy(converter->GetOutputDataObject(0));
converter->Delete();
......@@ -379,7 +396,7 @@ void vtkPVPostFilter::CellDataToPointData(vtkDataSet* output)
}
//----------------------------------------------------------------------------
void vtkPVPostFilter::PointDataToCellData(vtkDataSet* output)
void vtkPVPostFilter::PointDataToCellData(vtkDataSet* output, const char* name)
{
vtkDataObject* clone = output->NewInstance();
clone->ShallowCopy(output);
......@@ -387,6 +404,8 @@ void vtkPVPostFilter::PointDataToCellData(vtkDataSet* output)
vtkPointDataToCellData* converter = vtkPointDataToCellData::New();
converter->SetInputData(clone);
converter->PassPointDataOn();
converter->ProcessAllArraysOff();
converter->AddPointDataArray(name);
converter->Update();
output->ShallowCopy(converter->GetOutputDataObject(0));
converter->Delete();
......
......@@ -58,10 +58,11 @@ protected:
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
int DoAnyNeededConversions(vtkDataObject* output);
int DoAnyNeededConversions(vtkDataSet* dataset);
int DoAnyNeededConversions(vtkDataSet* output, const char* requested_name, int fieldAssociation,
const char* demangled_name, const char* demagled_component_name);
void CellDataToPointData(vtkDataSet* output);
void PointDataToCellData(vtkDataSet* output);
void CellDataToPointData(vtkDataSet* output, const char* name);
void PointDataToCellData(vtkDataSet* output, const char* name);
int ExtractComponent(vtkDataSetAttributes* dsa, const char* requested_name,
const char* demangled_name, const char* demagled_component_name);
......
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