]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
1. To introduce self introspection methods for VISU::Result IDL interface
authorapo <apo@opencascade.com>
Wed, 4 Jul 2007 07:57:19 +0000 (07:57 +0000)
committerapo <apo@opencascade.com>
Wed, 4 Jul 2007 07:57:19 +0000 (07:57 +0000)
2. To introduce Get/SetResolution methods for VISU::Result to support VISU MULTIPR extension

idl/VISU_Gen.idl
src/VISU_I/VISU_MultiResult_i.cc
src/VISU_I/VISU_MultiResult_i.hh
src/VISU_I/VISU_ResultUtils.cc
src/VISU_I/VISU_ResultUtils.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh

index 5bc063ed07b32e9b0dbd608c0731a02033f0fd02..85c6d1a1d1b4c18db1e230df3a0cd46bd49be69f 100644 (file)
@@ -57,12 +57,13 @@ module VISU {
    * This enumeration contains a set of elements defining the
    * type of the %entity (topological units) constituting a mesh.
    */
-  enum Entity{ NODE, /*!< Node corresponds to a geometrical point. */
-               EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
-              FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
-              CELL,  /*!< Cell is a volumic element of a mesh */
-              NONE  /*!< Indicates undefined entity value */
-              };
+  enum Entity {
+    NODE, /*!< Node corresponds to a geometrical point. */
+    EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
+    FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
+    CELL,  /*!< Cell is a volumic element of a mesh */
+    NONE  /*!< Indicates undefined entity value */
+  };
 
   /*!
    * This enumeration contains a set of elements defining the type of the %VISU object.
@@ -1335,7 +1336,8 @@ module VISU {
    * <BR><B>Time stamp</B> represents a subfield: the results
    * of calculations are taken in one definite moment.
    */
-  interface Animation : Base {
+  interface Animation : Base 
+  {
     /*!
    * This enumeration contains a set of available animation modes.
    */
@@ -1549,13 +1551,15 @@ module VISU {
     void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs);
   };
 
+  
   /*! \brief Interface %Result
    *
    * This interface serves for inner representation of data generated
    * in other sources (MED object or file). This data is needed
    * for further construction of graphical presentations.
    */
-  interface Result : RemovableObject, SALOME::GenericObj {
+  interface Result : RemovableObject, SALOME::GenericObj 
+  {
     /*! Reads all data from the corresponding sources. By default the data is loaded on demand.
      */
     boolean BuildAll();
@@ -1583,6 +1587,58 @@ module VISU {
 
     /*! Allow to check is min / max calculation over field's components already perfrormed or not */
     boolean IsMinMaxDone();
+
+    /*! Allow to check is corresponding multi resolution structure already loaded or not */
+    boolean IsPartsDone();
+
+    typedef sequence<Entity> Entities;
+
+    typedef string EntityName;
+
+    typedef sequence<EntityName> EntityNames;
+
+    typedef long TimeStampNumber;
+
+    typedef sequence<TimeStampNumber> TimeStampNumbers;
+
+    enum Resolution {
+      FULL,
+      MEDIUM,
+      LOW,
+      HIDDEN
+    };
+
+    typedef sequence<Resolution> Resolutions;
+
+    /*! Gets existing mesh names */
+    EntityNames GetMeshNames();
+
+    /*! Gets existing mesh entites for the given mesh name */
+    Entities GetEntities(in EntityName theMeshName);
+
+    /*! Gets existing families for the given mesh name and entity */
+    EntityNames GetFamilies(in EntityName theMeshName, in Entity theEntity);
+
+    /*! Gets existing families for the given mesh name */
+    EntityNames GetGroups(in EntityName theMeshName);
+
+    /*! Gets existing fields for the given mesh name and entity */
+    EntityNames GetFields(in EntityName theMeshName, in Entity theEntity);
+
+    /*! Gets existing fields for the given mesh name, entity and name of field */
+    TimeStampNumbers GetTimeStampNumbers(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
+
+    /*! Gets existing parts of multi resolution structure for the given mesh name */
+    EntityNames GetParts(in EntityName theMeshName);
+
+    /*! Gets available resolutions of multi resolution structure for the given mesh and part names */
+    Resolutions GetResolutions(in EntityName theMeshName, in EntityName thePartName);
+
+    /*! Gets current resolution of multi resolution structure for the given mesh and part names */
+    Resolution GetResolution(in EntityName theMeshName, in EntityName thePartName);
+
+    /*! Gets current resolution of multi resolution structure for the given mesh and part names */
+    void SetResolution(in EntityName theMeshName, in EntityName thePartName, in Resolution theResolution);
   };
 
   //-------------------------------------------------------
@@ -1594,7 +1650,8 @@ module VISU {
    * post-processing presentations from given %Result and %Table object reference,
    * using the views provided by %ViewManager.
    */
-  interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base {
+  interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base 
+  {
     /*! Sets a definite study to be current.
      */
     void SetCurrentStudy(in SALOMEDS::Study theStudy);
@@ -1704,11 +1761,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName,
                               in Entity theEntity, in string theFieldName,
-                              in long theIteration);
+                              in long theTimeStampNumber);
 
     /*!
      * Creates a Gauss Points presentation.
@@ -1716,11 +1773,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in long theIteration);
+                                  in long theTimeStampNumber);
 
     /*!
      * Creates a deformed shape presentation.
@@ -1728,11 +1785,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName,
                                       in Entity theEntity, in string theFieldName,
-                                      in long theIteration);
+                                      in long theTimeStampNumber);
 
     /*!
      * Creates a deformed shape presentation.
@@ -1740,11 +1797,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName,
                                                             in Entity theEntity, in string theFieldName,
-                                                            in long theIteration);
+                                                            in long theTimeStampNumber);
 
     /*!
      * Creates a vector presentation.
@@ -1752,11 +1809,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     Vectors VectorsOnField(in Result theResult, in string theMeshName,
                           in Entity theEntity, in string theFieldName,
-                          in long theIteration);
+                          in long theTimeStampNumber);
 
     /*!
      * Creates an iso surface presentation.
@@ -1764,11 +1821,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in long theIteration);
+                                  in long theTimeStampNumber);
 
     /*!
      * Creates an stream lines presentation.
@@ -1776,11 +1833,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     StreamLines StreamLinesOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in long theIteration);
+                                  in long theTimeStampNumber);
 
     /*!
      * Creates a presentation of cut planes.
@@ -1788,11 +1845,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName,
                               in Entity theEntity, in string theFieldName,
-                              in long theIteration);
+                              in long theTimeStampNumber);
 
     /*!
      * Creates a presentation of cut lines.
@@ -1800,11 +1857,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     CutLines CutLinesOnField(in Result theResult, in string theMeshName,
                             in Entity theEntity, in string theFieldName,
-                            in long theIteration);
+                            in long theTimeStampNumber);
 
     /*!
      * Creates a Plot3D presentation.
@@ -1812,11 +1869,11 @@ module VISU {
      * \param theMeshName  One of the meshes presented in MED file
      * \param theEntity    Type of entity where the field is defined
      * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
-     * \param theIteration Number of iteration on the field
+     * \param theTimeStampNumber Number of iteration on the field
      */
     Plot3D Plot3DOnField(in Result theResult, in string theMeshName,
                         in Entity theEntity, in string theFieldName,
-                        in long theIteration);
+                        in long theTimeStampNumber);
 
     /*!
      * Creates a table presentation.
index 1b5af1c680ad457f424d2677fb9a7d485d312326..794fbe963d89f421a560d9f40c1561c97ac74549 100644 (file)
@@ -30,9 +30,9 @@
 #include "VISU_ResultUtils.hh"
 
 #include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include "MULTIPR_API.hxx"
-#include "MULTIPR_Obj.hxx"
 
 #include "SALOMEDS_Tool.hxx"
 
 
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
+static int MYTIMEDEBUG = 0;
 #else
 static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
 #endif
 
 
@@ -109,101 +111,114 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  typedef std::set<MultiResult_i::TPartName> TSubParts;
-  typedef std::map<MultiResult_i::TPartName, TSubParts> TMain2SubParts;
-
   inline
-  std::string
-  GetResolutions(const TMain2SubParts& theMain2SubParts,
+  MultiResult_i::TResolutions
+  GetResolutions(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
                 const std::string& thePartName)
   {
-    std::string aResolution = "F";
+    MultiResult_i::TResolutions aResolutions;
+    aResolutions.insert(VISU::Result::FULL);
 
     MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
-    TMain2SubParts::const_iterator anIter = theMain2SubParts.find(aMainPart);
-    if(anIter != theMain2SubParts.end()){
-      const TSubParts& aSubParts = anIter->second;
+    MultiResult_i::TMainPart2SubParts::const_iterator anIter = theMainPart2SubParts.find(aMainPart);
+    if(anIter != theMainPart2SubParts.end()){
+      const MultiResult_i::TSubParts& aSubParts = anIter->second;
 
       if(aSubParts.find(aMainPart + "_LOW") != aSubParts.end())
-       aResolution += "L";
+       aResolutions.insert(VISU::Result::LOW);
 
       if(aSubParts.find(aMainPart + "_MED") != aSubParts.end())
-       aResolution += "M";
+       aResolutions.insert(VISU::Result::MEDIUM);
+    }
+    return aResolutions;
+  }
+
+
+  std::string
+  Resolutions2String(const MultiResult_i::TResolutions& theResolutions)
+  {
+    std::string aResult;
+    MultiResult_i::TResolutions::const_iterator anIter = theResolutions.begin();
+    for(; anIter != theResolutions.end(); anIter++){
+      VISU::Result::Resolution aResolution = *anIter;
+      if(aResolution == VISU::Result::FULL)
+       aResult += "F";
+      if(aResolution == VISU::Result::LOW)
+       aResult += "L";
+      if(aResolution == VISU::Result::MEDIUM)
+       aResult += "M";
     }
-    return aResolution;
+    return aResult;
   }
 
 
   //---------------------------------------------------------------
   inline
-  MultiResult_i::TResolutionID
-  GetResolutionID(const TMain2SubParts& theMain2SubParts,
+  VISU::Result::Resolution
+  GetResolution(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
                  const std::string& thePartName)
   {
-    std::string aResolutions = GetResolutions(theMain2SubParts,
-                                             thePartName);
-    if(aResolutions.find('L') != std::string::npos)
-      return 'L';
+    MultiResult_i::TResolutions aResolutions = GetResolutions(theMainPart2SubParts, thePartName);
 
-    if(aResolutions.find('M') != std::string::npos)
-      return 'M';
+    if(aResolutions.find(VISU::Result::LOW) != aResolutions.end())
+      return VISU::Result::LOW;
 
-    return 'F';
+    if(aResolutions.find(VISU::Result::MEDIUM) != aResolutions.end())
+      return VISU::Result::MEDIUM;
+
+    return VISU::Result::FULL;
   }
 
 
   //---------------------------------------------------------------
   inline
   std::string
-  GetIconName(const TMain2SubParts& theMain2SubParts,
+  GetIconName(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
              const std::string& thePartName)
   {
-    MultiResult_i::TResolutionID aResolutionID = GetResolutionID(theMain2SubParts,
-                                                                thePartName);
-    if(aResolutionID == 'L')
+    VISU::Result::Resolution aResolution = GetResolution(theMainPart2SubParts,
+                                                        thePartName);
+    if(aResolution == VISU::Result::LOW)
       return "ICON_MULTIPR_VIEW_LOW";
 
-    if(aResolutionID == 'M')
+    if(aResolution == VISU::Result::MEDIUM)
       return "ICON_MULTIPR_VIEW_MEDIUM";
 
     return "ICON_MULTIPR_VIEW_FULL";
   }
 
 
-  //---------------------------------------------------------------
+  //----------------------------------------------------------------------------
   void 
   BuildParts(Result_i* theResult,
             Result_i::PInput theInput,
-            const QFileInfo& theMultiFileInfo,
+            multipr::Obj* theMultiprObj,
             MultiResult_i::TPartInfos* thePartInfos,
             MultiResult_i::TPartName2FileName* thePartName2FileName,
-            MultiResult_i::TPartName2ResolutionID* thePartName2ResolutionID,
+            MultiResult_i::TPartName2Resolution* thePartName2Resolution,
+            MultiResult_i::TMainPart2SubParts* theMainPart2SubParts,
             CORBA::Boolean* theIsDone,
             CORBA::Boolean theIsBuild,
             _PTR(Study) theStudy)
   {
     if(!theIsBuild || *theIsDone)
       return;
-
-    // if MED file is not a distributed MED file (created with MULTIPR),
-    // then it is not necessary to build parts
-    if (theMultiFileInfo.filePath().isEmpty())
-      return;
-
+    
+    TTimerLog aTimerLog(MYTIMEDEBUG, "BuildParts");
+    TResultManager aResultManager(theResult);
+    TTransactionManager aTransactionManager(theStudy);
+    
     try {
-      multipr::Obj aMultiprObj;
-      aMultiprObj.create(theMultiFileInfo.filePath().latin1());
-      if (aMultiprObj.isValidDistributedMEDFile()) {
+       multipr::Obj& aMultiprObj = *theMultiprObj;
        const VISU::TMeshMap& aMeshMap = theInput->GetMeshMap();
        VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
        const VISU::PMesh& aMesh = aMeshMapIter->second;
-
-       typedef std::vector<MultiResult_i::TPartName> TParts;
-       TParts aParts = aMultiprObj.getParts();
-
+       
+       MultiResult_i::TParts aParts = aMultiprObj.getParts();
+       
        QString aComment = "Sub-parts: #";
        aComment += QString::number(aParts.size());
-
+       
        CreateAttributes(theStudy,
                         aMesh->myPartsEntry,
                         NO_ICON,
@@ -212,24 +227,24 @@ namespace VISU
                         NO_PERFSITENT_REF,
                         aComment.latin1(),
                         false);
-
-       MultiResult_i::TPartInfos& myPartInfos = *thePartInfos;
+       
+       MultiResult_i::TPartInfos& aPartInfos = *thePartInfos;
        MultiResult_i::TPartName2FileName& aPartName2FileName = *thePartName2FileName;
-       MultiResult_i::TPartName2ResolutionID& aPartName2ResolutionID = *thePartName2ResolutionID;
-
-       TMain2SubParts aMain2SubParts;
-
+       MultiResult_i::TPartName2Resolution& aPartName2Resolution = *thePartName2Resolution;
+       
+       MultiResult_i::TMainPart2SubParts& aMainPart2SubParts = *theMainPart2SubParts;
+       
        for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
          const MultiResult_i::TPartName& aPartName = aParts[aPartID];
          MultiResult_i::TPartName aMainPart = ExtractMainPart(aPartName);
-         aMain2SubParts[aMainPart].insert(aPartName);
+         aMainPart2SubParts[aMainPart].insert(aPartName);
        }
-
+       
        std::string aLastEntry;
        for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
          const MultiResult_i::TPartName& aPartName = aParts[aPartID];
          std::string aStringInfo = aMultiprObj.getPartInfo(aPartName.c_str());
-
+         
          MultiResult_i::TPartInfo aPartInfo;
          std::istrstream anOutputStream(aStringInfo.c_str());
          anOutputStream>>(aPartInfo.myMeshName);
@@ -237,19 +252,20 @@ namespace VISU
          anOutputStream>>(aPartInfo.myName);
          anOutputStream>>(aPartInfo.myPath);
          anOutputStream>>(aPartInfo.myFileName);
-
+         
          QFileInfo aFileInfo(aPartInfo.myFileName.c_str());
-         myPartInfos[aFileInfo.fileName()] = aPartInfo;
-
+         aPartInfos[aFileInfo.fileName()] = aPartInfo;
+         
          aPartName2FileName[aPartInfo.myName] = aPartInfo.myFileName;
-
+         
          QString aComment = "";
-         std::string aResoltutions = GetResolutions(aMain2SubParts, aPartInfo.myName);
+         MultiResult_i::TResolutions aResoltutions = GetResolutions(aMainPart2SubParts, aPartInfo.myName);
+         std::string aResoltutionsString = Resolutions2String(aResoltutions);
          if ( IsFullResolution(aPartInfo.myName) ) {
-           std::string anIconName = GetIconName(aMain2SubParts, aPartInfo.myName);
-           MultiResult_i::TResolutionID aResolutionID = GetResolutionID(aMain2SubParts, aPartInfo.myName);
-           aComment.sprintf("myComment=PART;myFile=%s;myResolutions=%s;myState=%c", 
-                            aPartInfo.myFileName.c_str(), aResoltutions.c_str(), aResolutionID); 
+           std::string anIconName = GetIconName(aMainPart2SubParts, aPartInfo.myName);
+           VISU::Result::Resolution aResolution = GetResolution(aMainPart2SubParts, aPartInfo.myName);
+           aComment.sprintf("myComment=PART;myMeshName=%s;myFile=%s;myResolutions=%s;myState=%c", 
+                            aPartInfo.myMeshName.c_str(), aPartInfo.myFileName.c_str(), aResoltutionsString.c_str(), aResolution); 
            aLastEntry = CreateAttributes(theStudy,
                                          aMesh->myPartsEntry,
                                          anIconName,
@@ -258,10 +274,10 @@ namespace VISU
                                          NO_PERFSITENT_REF,
                                          aComment.latin1(),
                                          true);
-           aPartName2ResolutionID[aPartInfo.myName] = aResolutionID;
+           aPartName2Resolution[aPartInfo.myName] = aResolution;
          } else {
-           aComment.sprintf("myComment=PART;myFile=%s;myResolutions=%s", 
-                            aPartInfo.myFileName.c_str(), aResoltutions.c_str()); 
+           aComment.sprintf("myComment=PART;myMeshName=%s;myFile=%s;myResolutions=%s", 
+                             aPartInfo.myMeshName.c_str(), aPartInfo.myFileName.c_str(), aResoltutionsString.c_str()); 
            CreateAttributes(theStudy,
                             aLastEntry,
                             NO_ICON,
@@ -272,20 +288,73 @@ namespace VISU
                             true);
          }
        }
-      } else {
-       INFOS("invalid distributed MED file"); 
-      }
-      *theIsDone = true;
+       
+       *theIsDone = true;
     }catch(std::exception& exc){
-      INFOS("Follow exception was occured :\n"<<exc.what());
+       INFOS("Follow exception was occured :\n"<<exc.what());
     }catch(...){
-      INFOS("Unknown exception was occured!");
+       INFOS("Unknown exception was occured!");
     }
-
+    
     ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(), theIsDone));
   }
 
 
+  //---------------------------------------------------------------
+  struct TBuildPartsArgs
+  {
+    Result_i* myResult;
+    Result_i::PInput myInput;
+    multipr::Obj* myMultiprObj;
+    MultiResult_i::TPartInfos* myPartInfos;
+    MultiResult_i::TPartName2FileName* myPartName2FileName;
+    MultiResult_i::TPartName2Resolution* myPartName2Resolution;
+    MultiResult_i::TMainPart2SubParts* myMainPart2SubParts;
+    CORBA::Boolean* myIsDone;
+    CORBA::Boolean myIsBuild;
+    _PTR(Study) myStudy;
+
+    TBuildPartsArgs(Result_i* theResult,
+                   Result_i::PInput theInput,
+                   multipr::Obj* theMultiprObj,
+                   MultiResult_i::TPartInfos* thePartInfos,
+                   MultiResult_i::TPartName2FileName* thePartName2FileName,
+                   MultiResult_i::TPartName2Resolution* thePartName2Resolution,
+                   MultiResult_i::TMainPart2SubParts* theMainPart2SubParts,
+                   CORBA::Boolean* theIsDone,
+                   CORBA::Boolean theIsBuild,
+                   _PTR(Study) theStudy):
+      myResult(theResult),
+      myInput(theInput),
+      myMultiprObj(theMultiprObj),
+      myPartInfos(thePartInfos),
+      myPartName2FileName(thePartName2FileName),
+      myPartName2Resolution(thePartName2Resolution),
+      myMainPart2SubParts(theMainPart2SubParts),
+      myIsDone(theIsDone),
+      myIsBuild(theIsBuild),
+      myStudy(theStudy)
+    {}
+  };
+
+
+  //----------------------------------------------------------------------------
+  void 
+  BuildParts(const TBuildPartsArgs& theArgs)
+  {
+    BuildParts(theArgs.myResult,
+              theArgs.myInput,
+              theArgs.myMultiprObj,
+              theArgs.myPartInfos,
+              theArgs.myPartName2FileName,
+              theArgs.myPartName2Resolution,
+              theArgs.myMainPart2SubParts,
+              theArgs.myIsDone,
+              theArgs.myIsBuild,
+              theArgs.myStudy);
+  }
+
+
   //---------------------------------------------------------------
 }
 
@@ -333,10 +402,11 @@ VISU::MultiResult_i
   if(theIsAtOnce){
     BuildParts(this,
               GetInput(),
-              myMultiFileInfo,
+              &myMultiprObj,
               &myPartInfos,
               &myPartName2FileName,
-              &myPartName2ResolutionID,
+              &myPartName2Resolution,
+              &myMainPart2SubParts,
               &myIsPartsDone,
               myIsBuildParts,
               myStudy);
@@ -361,16 +431,18 @@ VISU::MultiResult_i
                myIsBuildParts,
                myStudy);
   {
-    boost::thread aThread(boost::bind(&BuildParts,
-                                     this,
-                                     GetInput(),
-                                     myMultiFileInfo,
-                                     &myPartInfos,
-                                     &myPartName2FileName,
-                                     &myPartName2ResolutionID,
-                                     &myIsPartsDone,
-                                     myIsBuildParts,
-                                     myStudy));
+    TBuildPartsArgs anArgs(this,
+                          GetInput(),
+                          &myMultiprObj,
+                          &myPartInfos,
+                          &myPartName2FileName,
+                          &myPartName2Resolution,
+                          &myMainPart2SubParts,
+                          &myIsPartsDone,
+                          myIsBuildParts,
+                          myStudy);
+
+    boost::thread aThread(boost::bind(&BuildParts, anArgs));
   }
   {
     boost::thread aThread(boost::bind(&BuildGroups,
@@ -402,29 +474,11 @@ VISU::MultiResult_i
   QFileInfo aFileInfo(theFileName);
   QString aTargetFileName = aFileInfo.filePath();
   if(aTargetFileName.endsWith("_grains_maitre.med")){
-    // retrieve source MED file (sequential MED file)
-    FILE* aFile = fopen(theFileName, "rt");
-    QString aSourceFileName("");
-    char aBuf[1024];
-    while (!feof(aFile)) {
-      fgets(aBuf, 1024, aFile);
-      char* strTag = NULL;
-      if ((aBuf[0] == '#') && ((strTag = strstr(aBuf, "[SOURCE]=")) != NULL)) {
-       char aFileName[256];
-       int ret = sscanf(strTag, "[SOURCE]=%s", aFileName);
-       if (ret == 1) {
-         aSourceFileName = aFileName;
-         break;
-       }
-      }
+    myMultiprObj.create(theFileName);
+    if (myMultiprObj.isValidDistributedMEDFile()) {
+      aTargetFileName = myMultiprObj.getSequentialMEDFilename();
+      myIsBuildParts = true;
     }
-    fclose(aFile);
-    if (aSourceFileName.isEmpty()) 
-      throw std::runtime_error("distributed MED file; bad format"); 
-
-    myMultiFileInfo.setFile(theFileName);
-    aTargetFileName = aSourceFileName;
-    myIsBuildParts = true;
   }
 
   return TSuperClass::Create(aTargetFileName);
@@ -439,11 +493,11 @@ VISU::MultiResult_i
   TSuperClass::ToStream(theStr);
 
   std::ostringstream aPartNames, aResolutions;
-  TPartName2ResolutionID::const_iterator anIter = myPartName2ResolutionID.begin();
-  for ( ; anIter != myPartName2ResolutionID.end() ; anIter++) {
+  TPartName2Resolution::const_iterator anIter = myPartName2Resolution.begin();
+  for ( ; anIter != myPartName2Resolution.end() ; anIter++) {
     const TPartName& aPartName = anIter->first;
     aPartNames<<aPartName<<"|";
-    const TResolutionID& aResolution = anIter->second;
+    const VISU::Result::Resolution& aResolution = anIter->second;
     aResolutions<<aResolution<<"|";
   }
 
@@ -472,7 +526,12 @@ VISU::MultiResult_i
     const QString& aPartName = aPartNames[anId];
     const QString& aResolution = aResolutions[anId];
     if(MYDEBUG) MESSAGE("MultiResult_i::Restore - aPartName = '"<<aPartName<<"' = "<<aResolution);
-    myPartName2ResolutionID[aPartName.latin1()] = aResolution[0];
+    if(aResolution[0] == 'F')
+      myPartName2Resolution[aPartName.latin1()] = VISU::Result::FULL;
+    if(aResolution[0] == 'M')
+      myPartName2Resolution[aPartName.latin1()] = VISU::Result::MEDIUM;
+    if(aResolution[0] == 'L')
+      myPartName2Resolution[aPartName.latin1()] = VISU::Result::LOW;
   }
   
   return this;
@@ -490,53 +549,130 @@ VISU::MultiResult_i
 
 
 //---------------------------------------------------------------
+VISU::Result::EntityNames* 
 VISU::MultiResult_i
-::~MultiResult_i()
+::GetParts(const char* theMeshName)
 {
-  if(MYDEBUG) MESSAGE("MultiResult_i::~MultiResult_i - this = "<<this<<": "<<myRepresentation2Input.size());
-  TRepresentation2Input::iterator anIter = myRepresentation2Input.begin();
-  for ( ; anIter != myRepresentation2Input.end() ; anIter++) {
-    const PInput& anInput = anIter->second;
-    std::string aFileName = anInput->GetName();
-    if(MYDEBUG) MESSAGE("'"<<aFileName<<"'; ");
-    QFileInfo aFileInfo(aFileName.c_str());
-    QFile(aFileInfo.absFilePath()).remove();
-    QDir().rmdir(aFileInfo.dirPath(TRUE));
+  MultiResult_i::TParts aMeshParts;
+  MultiResult_i::TParts aParts = myMultiprObj.getParts();
+  for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
+    const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+    if(!IsFullResolution(aPartName))
+      continue;
+
+    std::string aStringInfo = myMultiprObj.getPartInfo(aPartName.c_str());
+    std::istrstream anOutputStream(aStringInfo.c_str());
+         
+    TMeshName aMeshName;
+    anOutputStream>>aMeshName;
+    if(aMeshName == theMeshName)
+      aMeshParts.push_back(aPartName);
+  }
+
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  if(aMeshParts.empty())
+    return aResult._retn();
+
+  aResult->length(aMeshParts.size());
+  for (size_t aPartID = 0 ; aPartID < aMeshParts.size() ; aPartID++) {
+    const MultiResult_i::TPartName& aPartName = aMeshParts[aPartID];
+    aResult[aPartID] = aPartName.c_str();
   }
+
+  return aResult._retn();
 }
 
+VISU::Result::Resolutions* 
+VISU::MultiResult_i
+::GetResolutions(const char* theMeshName, 
+                const char* thePartName)
+{
+  VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
+  MultiResult_i::TParts aParts = myMultiprObj.getParts();
+  for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
+    const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+    MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
+    if(aMainPart != thePartName)
+      continue;
+
+    std::string aStringInfo = myMultiprObj.getPartInfo(aPartName.c_str());       
+    std::istrstream anOutputStream(aStringInfo.c_str());
+
+    TMeshName aMeshName;
+    anOutputStream>>aMeshName;
+    if(aMeshName != theMeshName)
+      continue;
+
+    MultiResult_i::TResolutions aResolutions = VISU::GetResolutions(myMainPart2SubParts, thePartName);
+    if(aResolutions.empty())
+      return aResult._retn();
+
+    aResult->length(aResolutions.size());
+    MultiResult_i::TResolutions::const_iterator anIter = aResolutions.end();
+    for(size_t anId = 0; anIter != aResolutions.end(); anIter++, anId++){
+      const VISU::Result::Resolution& aResolution = *anIter;
+      aResult[anId] = aResolution;
+    }
 
-//---------------------------------------------------------------
-void
+    break;
+  }
+
+  return aResult._retn();
+}
+
+VISU::Result::Resolution
+VISU::MultiResult_i
+::GetResolution(const char* theMeshName, 
+               const char* thePartName)
+{
+  TPartName2Resolution::iterator anIter = myPartName2Resolution.find(thePartName);
+  if(anIter == myPartName2Resolution.end())
+    return VISU::Result::HIDDEN;
+
+  const VISU::Result::Resolution& aResolution = anIter->second;
+  return aResolution;
+}
+
+void 
 VISU::MultiResult_i
-::SetResolution(const std::string& thePartName, 
-               TResolutionID theNewResolution)
+::SetResolution(const char* theMeshName, 
+               const char* thePartName, 
+               VISU::Result::Resolution theResolution)
 {
   if(!IsFullResolution(thePartName))
     return;
 
-  TPartName2FileName::iterator anIter = myPartName2FileName.find(thePartName);
-  if(anIter == myPartName2FileName.end())
+  TPartName2Resolution::iterator anIter = myPartName2Resolution.find(thePartName);
+  VISU::Result::Resolution& aResolution = anIter->second;
+  if(aResolution == theResolution)
     return;
 
-  TResolutionID& aNewResolution = myPartName2ResolutionID[thePartName];
-  if(aNewResolution == theNewResolution)
+  TPartName2FileName::iterator aFileNameIter = myPartName2FileName.find(thePartName);
+  if(aFileNameIter == myPartName2FileName.end())
     return;
-
-  aNewResolution = theNewResolution;
+  const TFileName& aFileName = aFileNameIter->second;
 
   VISU::Storable::TRestoringMap aRestoringMap;
-  const TFileName& aFileName = anIter->second;
   aRestoringMap["myComment"] = "PART";
+  aRestoringMap["myMeshName"] = theMeshName;
   aRestoringMap["myFile"] = aFileName;
-  std::string aFatherEntry = GetEntry(aRestoringMap);
+
+  const VISU::TMeshMap& aMeshMap = Result_i::GetInput()->GetMeshMap();
+  VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(theMeshName);
+  if(aMeshIter == aMeshMap.end())
+    return;
+
+  const VISU::PMesh& aMesh = aMeshIter->second;    
+  std::string aFatherEntry = Storable::FindEntry(GetStudyDocument(),
+                                                aMesh->myPartsEntry,
+                                                aRestoringMap);
 
   std::string anIconName = "ICON_MULTIPR_VIEW_HIDE";
-  if(theNewResolution == 'F')
+  if(theResolution == VISU::Result::FULL)
     anIconName = "ICON_MULTIPR_VIEW_FULL";
-  else if(theNewResolution == 'M')
+  else if(theResolution == VISU::Result::MEDIUM)
     anIconName = "ICON_MULTIPR_VIEW_MEDIUM";
-  else if(theNewResolution == 'L')
+  else if(theResolution == VISU::Result::LOW)
     anIconName = "ICON_MULTIPR_VIEW_LOW";
 
   _PTR(Study) aStudy = GetStudy();
@@ -546,8 +682,9 @@ VISU::MultiResult_i
   std::ostrstream anOutputStream;
   anOutputStream<<"myComment=PART;";
   anOutputStream<<"myFile="<<aFileName<<";";
+  anOutputStream<<"myMeshName="<<theMeshName<<";";
   anOutputStream<<"myResolutions="<<aRestoringMap["myResolutions"]<<";";
-  anOutputStream<<"myState="<<theNewResolution;
+  anOutputStream<<"myState="<<theResolution;
 
   CreateAttributes(aStudy,
                   aFatherEntry,
@@ -557,6 +694,25 @@ VISU::MultiResult_i
                   NO_PERFSITENT_REF,
                   anOutputStream.str(),
                   false);
+
+  aResolution = theResolution;
+}
+
+
+//---------------------------------------------------------------
+VISU::MultiResult_i
+::~MultiResult_i()
+{
+  if(MYDEBUG) MESSAGE("MultiResult_i::~MultiResult_i - this = "<<this<<": "<<myRepresentation2Input.size());
+  TRepresentation2Input::iterator anIter = myRepresentation2Input.begin();
+  for ( ; anIter != myRepresentation2Input.end() ; anIter++) {
+    const PInput& anInput = anIter->second;
+    std::string aFileName = anInput->GetName();
+    if(MYDEBUG) MESSAGE("'"<<aFileName<<"'; ");
+    QFileInfo aFileInfo(aFileName.c_str());
+    QFile(aFileInfo.absFilePath()).remove();
+    QDir().rmdir(aFileInfo.dirPath(TRUE));
+  }
 }
 
 
@@ -580,22 +736,22 @@ namespace VISU
   //---------------------------------------------------------------
   MultiResult_i::TRepresentationKey
   GetRepresentation(const MultiResult_i::TPartName2FileName& thePartName2FileName,
-                   const MultiResult_i::TPartName2ResolutionID& thePartName2ResolutionID)
+                   const MultiResult_i::TPartName2Resolution& thePartName2Resolution)
   {
     // name of selected parts
     MultiResult_i::TRepresentationKey aRepresentationKey;
 
     // for each part of the mesh
-    MultiResult_i::TPartName2ResolutionID::const_iterator anIter = thePartName2ResolutionID.begin();
-    for ( ; anIter != thePartName2ResolutionID.end() ; anIter++) {
+    MultiResult_i::TPartName2Resolution::const_iterator anIter = thePartName2Resolution.begin();
+    for ( ; anIter != thePartName2Resolution.end() ; anIter++) {
       const MultiResult_i::TPartName& aPartName = anIter->first;
       if(IsFullResolution(aPartName)){
-       const MultiResult_i::TResolutionID& aResolutionID = anIter->second;
-       if(aResolutionID == 'F'
+       const VISU::Result::Resolution& aResolution = anIter->second;
+       if(aResolution == VISU::Result::FULL
          UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName);
-       if(aResolutionID == 'M'
+       if(aResolution == VISU::Result::MEDIUM
          UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName + "_MED");
-       else if(aResolutionID == 'L'
+       else if(aResolution == VISU::Result::LOW
          UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName + "_LOW");
       }
     }
@@ -606,17 +762,17 @@ namespace VISU
   //---------------------------------------------------------------
   bool 
   UseInitialInput(const MultiResult_i::TPartName2FileName& thePartName2FileName,
-                 const MultiResult_i::TPartName2ResolutionID& thePartName2ResolutionID)
+                 const MultiResult_i::TPartName2Resolution& thePartName2Resolution)
   {
     bool aResult = true;
     MultiResult_i::TPartName2FileName::const_iterator anIter = thePartName2FileName.begin();
     for ( ; anIter != thePartName2FileName.end() ; anIter++) {
       const MultiResult_i::TPartName& aPartName = anIter->first;
       if(IsFullResolution(aPartName)){
-       MultiResult_i::TPartName2ResolutionID::const_iterator anIter2 = thePartName2ResolutionID.find(aPartName);
-       if(anIter2 != thePartName2ResolutionID.end()){
-         const MultiResult_i::TResolutionID& aResolutionID = anIter2->second;
-         if(aResolutionID == 'F')
+       MultiResult_i::TPartName2Resolution::const_iterator anIter2 = thePartName2Resolution.find(aPartName);
+       if(anIter2 != thePartName2Resolution.end()){
+         const VISU::Result::Resolution& aResolution = anIter2->second;
+         if(aResolution == VISU::Result::FULL)
            continue;
        }
        aResult = false;
@@ -642,11 +798,11 @@ VISU::MultiResult_i
   if(!myIsPartsDone) // If corresponding data is not ready yet
     return TSuperClass::GetInput();
 
-  if(UseInitialInput(myPartName2FileName, myPartName2ResolutionID)) 
+  if(UseInitialInput(myPartName2FileName, myPartName2Resolution)) 
     return TSuperClass::GetInput();
 
   MultiResult_i::TRepresentationKey aRepresentationKey = 
-    GetRepresentation(myPartName2FileName, myPartName2ResolutionID);
+    GetRepresentation(myPartName2FileName, myPartName2Resolution);
 
   typedef std::vector<TFileName> TFileNames;
   TFileNames aFileNames(aRepresentationKey.begin(), aRepresentationKey.end());
index fe100b8c5a18d2ff95632bac7fccf8a568b404e1..40961be7acb70ecf1a67208a4efc3e8df28131db 100644 (file)
@@ -33,6 +33,7 @@
 #  define RESULT_CLASS_NAME MultiResult_i
 
 #include "VISU_Result_i.hh"
+#include "MULTIPR_Obj.hxx"
 
 #include <set>
 
@@ -61,11 +62,34 @@ namespace VISU
     CORBA::Boolean
     IsDone();
 
-    typedef std::string TMeshName;
+    virtual
+    VISU::Result::EntityNames* 
+    GetParts(const char* theMeshName);
+
+    virtual
+    VISU::Result::Resolutions* 
+    GetResolutions(const char* theMeshName, 
+                  const char* thePartName);
+
+    virtual
+    VISU::Result::Resolution
+    GetResolution(const char* theMeshName, 
+                 const char* thePartName);
+
+    virtual
+    void 
+    SetResolution(const char* theMeshName, 
+                 const char* thePartName, 
+                 VISU::Result::Resolution theResolution);
+
+
     typedef std::string TPartName;
+    typedef std::vector<TPartName> TParts;
+
     typedef size_t TPartID;
     typedef std::string TPath;
     typedef std::string TFileName;
+    typedef std::string TMeshName;
 
     struct TPartInfo
     {
@@ -80,15 +104,20 @@ namespace VISU
     TPartInfos myPartInfos;
 
     typedef std::map<TPartName, TFileName> TPartName2FileName;
-    typedef std::map<TPartName, TResolutionID> TPartName2ResolutionID;
+    typedef std::map<TPartName, VISU::Result::Resolution> TPartName2Resolution;
+    typedef std::set<VISU::Result::Resolution> TResolutions;
 
     typedef std::set<std::string> TRepresentationKey;
     typedef std::map<TRepresentationKey, PInput> TRepresentation2Input;
 
+    typedef std::set<TPartName> TSubParts;
+    typedef std::map<TPartName, TSubParts> TMainPart2SubParts;
+
   private:
-    QFileInfo myMultiFileInfo;
+    multipr::Obj myMultiprObj;
     TPartName2FileName myPartName2FileName;
-    TPartName2ResolutionID myPartName2ResolutionID;
+    TPartName2Resolution myPartName2Resolution;
+    TMainPart2SubParts myMainPart2SubParts;
 
     TRepresentation2Input myRepresentation2Input;
 
@@ -128,11 +157,6 @@ namespace VISU
             VISU::Entity theEntity = VISU::NONE,
             const std::string& theFieldName = "", 
             CORBA::Long theTimeStampNumber = -1);
-
-    virtual
-    void
-    SetResolution(const std::string& theName, 
-                 TResolutionID theNewResolution); // 'F'=FULL  'M'=MEDIUM  'L'=LOW  'H'=HIDE 
   };
 
 }
index 82bcfdc29d429f081f05f8b8c19e3b29d281a185..afab2a860ef2a95351414c94b88b44eed7045eb0 100644 (file)
@@ -52,6 +52,41 @@ namespace VISU
 
   static TMutex myMutex;
 
+  //----------------------------------------------------------------------------
+  TResultManager
+  ::TResultManager(Result_i* theResult):
+    myResult(theResult)
+  {
+    myResult->Register();
+  }
+
+
+  //----------------------------------------------------------------------------
+  TResultManager
+  ::~TResultManager()
+  {
+    myResult->Destroy();
+  }
+
+
+  //----------------------------------------------------------------------------
+  TTransactionManager
+  ::TTransactionManager(_PTR(Study) theStudyDocument):
+    myStudyBuilder(theStudyDocument->NewBuilder())
+  {
+    TLock aLock(myMutex);
+    myStudyBuilder->NewCommand();
+  }
+
+
+  //----------------------------------------------------------------------------
+  TTransactionManager
+  ::~TTransactionManager()
+  {
+    TLock aLock(myMutex);
+    myStudyBuilder->CommitCommand();
+  }
+
 
   //----------------------------------------------------------------------------
   TUpdateObjBrowser
@@ -88,44 +123,6 @@ namespace VISU
   }
 
 
-  //----------------------------------------------------------------------------
-  struct TResultManager
-  {
-    Result_i* myResult;
-
-    TResultManager(Result_i* theResult):
-      myResult(theResult)
-    {
-      myResult->Register();
-    }
-
-    ~TResultManager()
-    {
-      myResult->Destroy();
-    }
-  };
-
-
-  //----------------------------------------------------------------------------
-  struct TTransactionManager
-  {
-    _PTR(StudyBuilder) myStudyBuilder;
-
-    TTransactionManager(_PTR(Study) theStudyDocument):
-      myStudyBuilder(theStudyDocument->NewBuilder())
-    {
-      TLock aLock(myMutex);
-      myStudyBuilder->NewCommand();
-    }
-
-    ~TTransactionManager()
-    {
-      TLock aLock(myMutex);
-      myStudyBuilder->CommitCommand();
-    }
-  };
-
-
   //----------------------------------------------------------------------------
   QString
   GenerateName(const std::string& theName)
index 2c9b0aaefb1ae7c219a6e0ee71207461c9f79d16..1f93c7cf8203bb81bead7bfd5ef23d287da253ed 100644 (file)
@@ -47,6 +47,28 @@ namespace VISU
   };
 
 
+  //----------------------------------------------------------------------------
+  struct TResultManager
+  {
+    Result_i* myResult;
+
+    TResultManager(Result_i* theResult);
+
+    ~TResultManager();
+  };
+
+
+  //----------------------------------------------------------------------------
+  struct TTransactionManager
+  {
+    _PTR(StudyBuilder) myStudyBuilder;
+
+    TTransactionManager(_PTR(Study) theStudyDocument);
+
+    ~TTransactionManager();
+  };
+
+
   //----------------------------------------------------------------------------
   QString
   GenerateName(const std::string& theName);
index d5ab7ab56d4d435b805b3afed6c274a96766557a..915c63fcc16d1425cc80214d77fa54acaec9353d 100644 (file)
@@ -406,19 +406,14 @@ VISU::Result_i
                theIsAtOnce,
                myStudy);
 
-    BuildFields(this,
-               myInput,
-               &myIsFieldsDone,
-               myIsBuildFields,
-               theIsAtOnce,
-               myStudy);
-    
-    BuildMinMax(this,
-               myInput,
-               &myIsMinMaxDone,
-               myIsBuildMinMax);
-  }
-  else {
+    BuildFieldDataTree(this,
+                      myInput,
+                      &myIsFieldsDone,
+                      myIsBuildFields,
+                      &myIsMinMaxDone,
+                      myIsBuildMinMax,
+                      myStudy);
+  } else {
     boost::thread aThread(boost::bind(boost::bind(&Result_i::BuildDataTree, this, _1),
                                      aResultEntry));
   }
@@ -853,14 +848,6 @@ VISU::Result_i
 }
 
 
-//---------------------------------------------------------------
-void
-VISU::Result_i
-::SetResolution(const std::string& theName, 
-               TResolutionID theNewResolution) 
-{}
-
-
 //---------------------------------------------------------------
 VISU::Result_i::PInput
 VISU::Result_i
@@ -932,6 +919,272 @@ VISU::Result_i
   return myIsMinMaxDone;
 }
 
+CORBA::Boolean 
+VISU::Result_i
+::IsPartsDone()
+{
+  return myIsPartsDone;
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames* 
+VISU::Result_i
+::GetMeshNames()
+{
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return aResult._retn();
+
+  aResult->length(aMeshMap.size());
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.begin();
+  for(size_t anId = 0; anIter != aMeshMap.end(); anIter++, anId++){
+    const std::string& aName = anIter->first;
+    aResult[anId] = aName.c_str();
+  }
+  return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::Entities* 
+VISU::Result_i
+::GetEntities(const char* theMeshName)
+{
+  VISU::Result::Entities_var anEntities = new VISU::Result::Entities();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return anEntities._retn();
+
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+  if(anIter == aMeshMap.end())
+    return anEntities._retn();
+  
+  const VISU::PMesh& aMesh = anIter->second;
+  const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  if(aMeshOnEntityMap.empty())
+    return anEntities._retn();
+
+  {
+    anEntities->length(aMeshOnEntityMap.size());
+    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.end();
+    for(size_t anId = 0; anIter != aMeshOnEntityMap.end(); anIter++, anId++){
+      const VISU::TEntity& anEntity = anIter->first;
+      anEntities[anId] = VISU::Entity(anEntity);
+    }
+  }
+
+  return anEntities._retn();
+}
+
+VISU::Result::EntityNames* 
+VISU::Result_i
+::GetFamilies(const char* theMeshName, 
+             VISU::Entity theEntity)
+{
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return aResult._retn();
+
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+  if(anIter == aMeshMap.end())
+    return aResult._retn();
+  
+  const VISU::PMesh& aMesh = anIter->second;
+  const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  if(aMeshOnEntityMap.empty())
+    return aResult._retn();
+
+  {
+    VISU::TEntity anEntity = VISU::TEntity(theEntity);
+    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+    if(anIter == aMeshOnEntityMap.end())
+      return aResult._retn();
+
+    const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+    const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+    if(aFamilyMap.empty())
+      return aResult._retn();
+    
+    {
+      aResult->length(aFamilyMap.size());
+      VISU::TFamilyMap::const_iterator anIter = aFamilyMap.end();
+      for(size_t anId = 0; anIter != aFamilyMap.end(); anIter++, anId++){
+       const std::string& aName = anIter->first;
+       aResult[anId] = aName.c_str();
+      }
+    }
+  }
+
+  return aResult._retn();
+}
+
+VISU::Result::EntityNames* 
+VISU::Result_i
+::GetGroups(const char* theMeshName)
+{
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return aResult._retn();
+
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+  if(anIter == aMeshMap.end())
+    return aResult._retn();
+  
+  const VISU::PMesh& aMesh = anIter->second;
+  const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+  if(aGroupMap.empty())
+    return aResult._retn();
+
+  {
+    aResult->length(aGroupMap.size());
+    VISU::TGroupMap::const_iterator anIter = aGroupMap.end();
+    for(size_t anId = 0; anIter != aGroupMap.end(); anIter++, anId++){
+      const std::string& aName = anIter->first;
+      aResult[anId] = aName.c_str();
+    }
+  }
+
+  return aResult._retn();
+}
+
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetFields(const char* theMeshName, 
+           VISU::Entity theEntity)
+{
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return aResult._retn();
+
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+  if(anIter == aMeshMap.end())
+    return aResult._retn();
+  
+  const VISU::PMesh& aMesh = anIter->second;
+  const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  if(aMeshOnEntityMap.empty())
+    return aResult._retn();
+
+  {
+    VISU::TEntity anEntity = VISU::TEntity(theEntity);
+    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+    if(anIter == aMeshOnEntityMap.end())
+      return aResult._retn();
+
+    const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+    const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+    if(aFieldMap.empty())
+      return aResult._retn();
+    
+    {
+      aResult->length(aFieldMap.size());
+      VISU::TFieldMap::const_iterator anIter = aFieldMap.end();
+      for(size_t anId = 0; anIter != aFieldMap.end(); anIter++, anId++){
+       const std::string& aName = anIter->first;
+       aResult[anId] = aName.c_str();
+      }
+    }
+  }
+
+  return aResult._retn();
+}
+
+VISU::Result::TimeStampNumbers* 
+VISU::Result_i
+::GetTimeStampNumbers(const char* theMeshName, 
+                     VISU::Entity theEntity, 
+                     const char* theFieldName)
+{
+  VISU::Result::TimeStampNumbers_var aResult = new VISU::Result::TimeStampNumbers();
+  const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+  if(aMeshMap.empty())
+    return aResult._retn();
+
+  VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+  if(anIter == aMeshMap.end())
+    return aResult._retn();
+  
+  const VISU::PMesh& aMesh = anIter->second;
+  const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  if(aMeshOnEntityMap.empty())
+    return aResult._retn();
+
+  {
+    VISU::TEntity anEntity = VISU::TEntity(theEntity);
+    VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+    if(anIter == aMeshOnEntityMap.end())
+      return aResult._retn();
+
+    const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+    const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+    if(aFieldMap.empty())
+      return aResult._retn();
+
+    {
+      VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
+      if(anIter == aFieldMap.end())
+       return aResult._retn();
+
+      {
+       const VISU::PField& aField = anIter->second;
+       const VISU::TValField& aValField = aField->myValField;
+       if(aValField.empty())
+         return aResult._retn();
+
+       {
+         aResult->length(aValField.size());
+         VISU::TValField::const_iterator anIter = aValField.end();
+         for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
+           const vtkIdType& aTimeStampNumber = anIter->first;
+           aResult[anId] = aTimeStampNumber;
+         }
+       }
+      }
+    }
+  }
+
+  return aResult._retn();
+}
+
+VISU::Result::EntityNames* 
+VISU::Result_i
+::GetParts(const char* theMeshName)
+{
+  VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+  return aResult._retn();
+}
+
+VISU::Result::Resolutions* 
+VISU::Result_i
+::GetResolutions(const char* theMeshName, 
+                const char* thePartName)
+{
+  VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
+  return aResult._retn();
+}
+
+VISU::Result::Resolution
+VISU::Result_i
+::GetResolution(const char* theMeshName, 
+               const char* thePartName)
+{
+  return VISU::Result::HIDDEN;
+}
+
+void 
+VISU::Result_i
+::SetResolution(const char* theMeshName, 
+               const char* thePartName, 
+               VISU::Result::Resolution theResolution)
+{}
+
+
 //---------------------------------------------------------------
 VISU::Result_i*
 VISU::Result_i
index c4a14f5b61d2b88d1b874af827ac0fe6f61a5005..31bdfae5b837d867ba7063a9e0901c23ccfb8367 100644 (file)
@@ -126,6 +126,58 @@ namespace VISU
     CORBA::Boolean
     IsMinMaxDone();
 
+    virtual
+    CORBA::Boolean 
+    IsPartsDone();
+
+    virtual
+    VISU::Result::EntityNames* 
+    GetMeshNames();
+
+    virtual
+    VISU::Result::Entities* 
+    GetEntities(const char* theMeshName);
+
+    virtual
+    VISU::Result::EntityNames* 
+    GetFamilies(const char* theMeshName, 
+               Entity theEntity);
+
+    virtual
+    VISU::Result::EntityNames* 
+    GetGroups(const char* theMeshName);
+
+    virtual
+    VISU::Result::EntityNames*
+    GetFields(const char* theMeshName, 
+             Entity theEntity);
+
+    virtual
+    VISU::Result::TimeStampNumbers* 
+    GetTimeStampNumbers(const char* theMeshName, 
+                       Entity theEntity, 
+                       const char* theFieldName);
+
+    virtual
+    VISU::Result::EntityNames* 
+    GetParts(const char* theMeshName);
+
+    virtual
+    VISU::Result::Resolutions* 
+    GetResolutions(const char* theMeshName, 
+                  const char* thePartName);
+
+    virtual
+    VISU::Result::Resolution
+    GetResolution(const char* theMeshName, 
+                 const char* thePartName);
+
+    virtual
+    void 
+    SetResolution(const char* theMeshName, 
+                 const char* thePartName, 
+                 VISU::Result::Resolution theResolution);
+
     virtual 
     void
     UpdateObservers();
@@ -267,13 +319,6 @@ namespace VISU
 
     static const std::string myComment;
 
-    typedef char TResolutionID;
-
-    virtual
-    void
-    SetResolution(const std::string& theName, 
-                 TResolutionID theNewResolution);
-
     virtual
     PInput 
     GetInput(const std::string& theMeshName = "",