]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Make the // MEDReader working even in builtin mode. V7_5_0a1
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Oct 2014 07:23:52 +0000 (09:23 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Oct 2014 07:23:52 +0000 (09:23 +0200)
src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx
src/Plugins/MEDReader/IO/vtkMEDReader.cxx
src/Plugins/MEDReader/Test/testMEDReader13.py

index 11bb8031f8641e14b08d79f7dabe03d9702fabf3..3669c63cb5462ec53c42ebe7f40dbf6f6a78b47c 100644 (file)
@@ -1095,13 +1095,21 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam
 {
   if(isMEDOrSauv)
     {
+      if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1))
+        {
+          _ms=MEDFileMeshes::New(fileName);
+          _fields=MEDFileFields::New(fileName,false);//false is important to not read the values
+        }
+      else
+        {
 #ifdef MEDREADER_USE_MPI
-      _ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName);
-      _fields=MEDFileFields::LoadPartOf(fileName,false,_ms);//false is important to not read the values
+          _ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName);
+          _fields=MEDFileFields::LoadPartOf(fileName,false,_ms);//false is important to not read the values
 #else
-      _ms=MEDFileMeshes::New(fileName);
-      _fields=MEDFileFields::New(fileName,false);//false is important to not read the values
+          std::ostringstream oss; oss << "MEDFileFieldRepresentationTree::loadMainStructureOfFile : request for iPart/nbOfParts=" << iPart << "/" << nbOfParts << " whereas Plugin not compiled with MPI !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
 #endif
+        }
     }
   else
     {
index 602d96955385caf9dcab95df4d2cebd2bc0a45c9..b8cc95b9ee0d196a5da2d4d8b5dcabb5e96dd17e 100644 (file)
@@ -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())
@@ -305,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<char *>(oss.str().c_str()));
+      else
+        vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
+      vtkObject::BreakOnError();
       return 0;
     }
   return 1;
index 1aac30031d8bbb505b256d46ddd22608e9ed621f..3282274d1aeb2ab9967ba8e38cedb1b421cfd967 100644 (file)
@@ -55,19 +55,19 @@ RenderView1.CameraClippingRange = [4.276554101433921, 4.384547891874171]
 ELNOMesh3 = ELNOMesh(Input=testMEDReader13_med)
 
 DataRepresentation2 = Show()
-DataRepresentation2.ConstantRadius = 1.9999333620071411
+#DataRepresentation2.ConstantRadius = 1.9999333620071411
 DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]
-DataRepresentation2.PointSpriteDefaultsInitialized = 1
+#DataRepresentation2.PointSpriteDefaultsInitialized = 1
 DataRepresentation2.SelectionPointFieldDataArrayName = 'fieldELNO'
 DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell'
-DataRepresentation2.SelectInputVectors = ['POINTS', 'fieldELNO_Vector']
+#DataRepresentation2.SelectInputVectors = ['POINTS', 'fieldELNO_Vector']
 DataRepresentation2.ScalarOpacityUnitDistance = 1.7746382108908556
 DataRepresentation2.Texture = []
 DataRepresentation2.ExtractedBlockIndex = 1
-DataRepresentation2.RadiusRange = [6.666666740784422e-05, 1.9999333620071411]
+#DataRepresentation2.RadiusRange = [6.666666740784422e-05, 1.9999333620071411]
 DataRepresentation2.ScaleFactor = 0.19998666953397334
 
-DataRepresentation2.RadiusRange = [6.66667e-05, 1.99993]
+#DataRepresentation2.RadiusRange = [6.66667e-05, 1.99993]
 DataRepresentation2.ColorArrayName = ('POINT_DATA', 'fieldELNO_Vector')
 
 a3_fieldELNO_Vector_PVLookupTable = GetLookupTableForArray( "fieldELNO_Vector", 3, RGBPoints=[0.3464101615137755, 0.23, 0.299, 0.754, 1.1258330249197703, 0.865, 0.865, 0.865, 1.9052558883257653, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0 )