X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FvtkMEDReader.cxx;h=68add794dc13c89ae5f74dad9eab8619e394ce21;hb=f50743d07c99b985dd078aad0fb4bbf7337851cc;hp=7b526f4d898f8b8d7545510d36cecafaa17f7be5;hpb=be8bef3a5736aeddbab65c92809abf84e16fa5bf;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 7b526f4d..68add794 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -44,6 +44,9 @@ #include "vtkCellArray.h" #include "vtkDoubleArray.h" #include "vtkObjectFactory.h" +#ifdef MEDREADER_USE_MPI +#include "vtkMultiProcessController.h" +#endif #include "MEDFileFieldRepresentationTree.hxx" @@ -259,8 +262,12 @@ void vtkMEDReader::SetFileName(const char *fname) { int iPart(-1),nbOfParts(-1); #ifdef MEDREADER_USE_MPI - MPI_Comm_rank(MPI_COMM_WORLD,&iPart); - MPI_Comm_size(MPI_COMM_WORLD,&nbOfParts); + vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController()); + if(vmpc) + { + iPart=vmpc->GetLocalProcessId(); + nbOfParts=vmpc->GetNumberOfProcesses(); + } #endif this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv,iPart,nbOfParts); if(!this->Internal->PK.arePropertiesOnTreeToSetAfter()) @@ -297,7 +304,6 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect try { vtkInformation *outInfo(outputVector->GetInformationObject(0)); - outInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),-1); outInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkMultiBlockDataSet"); this->UpdateSIL(outInfo); // @@ -306,7 +312,13 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect } catch(INTERP_KERNEL::Exception& e) { - std::cerr << "Exception has been thrown in vtkMEDReader::RequestInformation : " << e.what() << std::endl; + std::ostringstream oss; + oss << "Exception has been thrown in vtkMEDReader::RequestInformation : " << e.what() << std::endl; + if(this->HasObserver("ErrorEvent") ) + this->InvokeEvent("ErrorEvent",const_cast(oss.str().c_str())); + else + vtkOutputWindowDisplayErrorText(const_cast(oss.str().c_str())); + vtkObject::BreakOnError(); return 0; } return 1; @@ -333,7 +345,7 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector **in } catch(INTERP_KERNEL::Exception& e) { - std::cerr << "Exception has been thrown in vtkMEDReader::RequestInformation : " << e.what() << std::endl; + std::cerr << "Exception has been thrown in vtkMEDReader::RequestData : " << e.what() << std::endl; return 0; } return 1;