X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FvtkExtractGroup.cxx;h=1db4ee4975a34415338d9e917fc951cafa492f14;hb=a833b1388f958c887b2b0886fc40a8be0256e2c8;hp=fe83064e5e162b53bab7292561c1619807536ede;hpb=7bf9aeffd21c07b465405d8abf56c15d0f9822b5;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/vtkExtractGroup.cxx b/src/Plugins/MEDReader/IO/vtkExtractGroup.cxx index fe83064e..1db4ee49 100644 --- a/src/Plugins/MEDReader/IO/vtkExtractGroup.cxx +++ b/src/Plugins/MEDReader/IO/vtkExtractGroup.cxx @@ -52,6 +52,8 @@ #include "vtkDemandDrivenPipeline.h" #include "vtkDataObjectTreeIterator.h" #include "vtkThreshold.h" +#include "vtkMultiBlockDataGroupFilter.h" +#include "vtkCompositeDataToUnstructuredGridFilter.h" #include #include @@ -471,14 +473,14 @@ void vtkExtractGroup::SetSIL(vtkMutableDirectedGraph *mdg) } template -vtkDataSet *FilterFamilies(vtkDataSet *input, const std::set& idsToKeep, bool insideOut, const char *arrNameOfFamilyField, +vtkDataSet *FilterFamilies(vtkSmartPointer& thres, + vtkDataSet *input, const std::set& idsToKeep, bool insideOut, const char *arrNameOfFamilyField, const char *associationForThreshold, bool& catchAll, bool& catchSmth) { static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate::VTK_DATA_ARRAY_DELETE; static const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@"; vtkDataSet *output(input->NewInstance()); output->ShallowCopy(input); - vtkSmartPointer thres(vtkSmartPointer::New()); thres->SetInputData(output); vtkDataSetAttributes *dscIn(input->GetCellData()),*dscIn2(input->GetPointData()); vtkDataSetAttributes *dscOut(output->GetCellData()),*dscOut2(output->GetPointData()); @@ -567,7 +569,8 @@ int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector * std::set idsToKeep(this->Internal->getIdsToKeep()); // first shrink the input bool catchAll,catchSmth; - vtkDataSet *tryOnCell(FilterFamilies(input,idsToKeep,this->InsideOut, + vtkSmartPointer thres1(vtkSmartPointer::New()),thres2(vtkSmartPointer::New()); + vtkDataSet *tryOnCell(FilterFamilies(thres1,input,idsToKeep,this->InsideOut, MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_CELL_NAME,"vtkDataObject::FIELD_ASSOCIATION_CELLS",catchAll,catchSmth)); if(tryOnCell) { @@ -581,13 +584,20 @@ int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector * { if(catchSmth) { - vtkDataSet *tryOnNode(FilterFamilies(tryOnCell,idsToKeep,this->InsideOut, + vtkDataSet *tryOnNode(FilterFamilies(thres2,input,idsToKeep,this->InsideOut, MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_NODE_NAME,"vtkDataObject::FIELD_ASSOCIATION_POINTS",catchAll,catchSmth)); if(tryOnNode && catchSmth) { - output->ShallowCopy(tryOnNode); + vtkSmartPointer mb(vtkSmartPointer::New()); + vtkSmartPointer cd(vtkSmartPointer::New()); + mb->AddInputConnection(thres1->GetOutputPort()); + mb->AddInputConnection(thres2->GetOutputPort()); + cd->SetInputConnection(mb->GetOutputPort()); + cd->SetMergePoints(0); + cd->Update(); + output->ShallowCopy(cd->GetOutput()); tryOnCell->Delete(); - tryOnNode->Delete();// + tryOnNode->Delete(); return 1; } else @@ -601,7 +611,7 @@ int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector * } else { - vtkDataSet *tryOnNode(FilterFamilies(input,idsToKeep,this->InsideOut, + vtkDataSet *tryOnNode(FilterFamilies(thres1,input,idsToKeep,this->InsideOut, MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_NODE_NAME,"vtkDataObject::FIELD_ASSOCIATION_POINTS",catchAll,catchSmth)); if(tryOnNode) { @@ -621,7 +631,7 @@ int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector * } else { - vtkDataSet *tryOnNode(FilterFamilies(input,idsToKeep,this->InsideOut, + vtkDataSet *tryOnNode(FilterFamilies(thres1,input,idsToKeep,this->InsideOut, MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_NODE_NAME,"vtkDataObject::FIELD_ASSOCIATION_POINTS",catchAll,catchSmth)); if(tryOnNode) {