]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
NRI : Correction 1.1a version.
authornri <nri@opencascade.com>
Fri, 16 May 2003 16:55:26 +0000 (16:55 +0000)
committernri <nri@opencascade.com>
Fri, 16 May 2003 16:55:26 +0000 (16:55 +0000)
22 files changed:
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.py
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_NonIsometricDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_Convertor.cxx
src/VISU_I/VISU_Convertor.hxx
src/VISU_I/VISU_Convertor_impl.cxx
src/VISU_I/VISU_Convertor_impl.hxx
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx
src/VISU_I/VISU_DatConvertor.cxx
src/VISU_I/VISU_MedConvertor.cxx
src/VISU_I/VISU_PrsObject_i.cc
src/VISU_I/VISU_PrsObject_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_ViewManager_i.cc

index 573f74b5737e842bd83e08d1c2b0878bff575f34..b95a9273463c9497dce6ec7b0170efa550595245 100644 (file)
@@ -94,7 +94,6 @@ using namespace std;
 #include <vtkContourFilter.h>
 #include <vtkCellDataToPointData.h>
 #include <vtkShrinkFilter.h>
-#include <vtkTransformPolyDataFilter.h>
 
 // Open CASCADE Include
 #include <TCollection_AsciiString.hxx>
@@ -218,7 +217,7 @@ CORBA::Object_var GetSelectedObj(string& theComment, Handle(SALOME_InteractiveOb
          if(!anIOR->_is_nil()){
            CORBA::String_var aValue = anIOR->Value();
            if(strcmp(aValue,"") != 0){
-             CORBA::ORB_ptr anORB = VISU::Base_i::GetORB();
+             CORBA::ORB_var anORB = VISU::GetORB();
              CORBA::Object_var anObject = anORB->string_to_object(aValue);
              return anObject;
            }
@@ -298,21 +297,9 @@ VISU::Base_i* GetSelectedVisuObj(){
     if (IObject->hasEntry()){
       SALOMEDS::SObject_var aSObject = MYStudyDocument->FindObjectID(IObject->getEntry());
       if(!aSObject->_is_nil()){
-       SALOMEDS::SComponent_var comp = aSObject->GetFatherComponent();
-       if ( !comp->_is_nil() ) {
-         SALOMEDS::GenericAttribute_var anAttr;
-         if (comp->FindAttribute(anAttr, "AttributeName")) {
-           SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-           if (QString(aName->Value()) == QString("Visu")) {
-             CORBA::Object_var aObject = VISU::SObjectToObject(aSObject);
-             if(!CORBA::is_nil(aObject)) {
-               PortableServer::Servant aServant = VISU::GetServant(aObject);
-               if (aServant)
-                 return dynamic_cast<VISU::Base_i*>(aServant);
-             }
-           }
-         }
-       }
+       CORBA::Object_var aObject = VISU::SObjectToObject(aSObject);
+       if(!CORBA::is_nil(aObject))
+         return dynamic_cast<VISU::Base_i*>(VISU::GetServant(aObject));
       }
     }
   }
@@ -460,7 +447,7 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
 
     case 122:
       {
-       //visuGUI->ExportToFile();
+       visuGUI->ExportToFile();
        break;
       }
 
@@ -1620,7 +1607,7 @@ void VisuGUI::CreateMesh() {
   timer.Show();
 #endif
   if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
-    //vtkRenderer *aRenderer = vf->getRenderer();
+    vtkRenderer *aRenderer = vf->getRenderer();
     //visuGUI->ClearViewer(QAD_Application::getDesktop(), aRenderer, -1);
     //visuGUI->ShowTrihedron(true);
 #ifdef CHECKTIME
@@ -1628,8 +1615,7 @@ void VisuGUI::CreateMesh() {
     timer.Start();
 #endif
     vf->AddActor(anActor);
-    vf->AddActor(anActor->EdgeDevice);
-   //    vf->getRenderer()->AddActor(anActor->EdgeDevice);
+    vf->getRenderer()->AddActor(anActor->EdgeDevice);
     vf->getRenderer()->ResetCameraClippingRange();
     vf->onViewFitAll();
 #ifdef CHECKTIME
@@ -1638,7 +1624,7 @@ void VisuGUI::CreateMesh() {
     timer.Show();
 #endif
   }
-  //myActiveStudy->updateObjBrowser(); //not necessary
+  myActiveStudy->updateObjBrowser(); //update Object browser
   myDesktop->putInfo("Ready");
 }
 
@@ -1659,25 +1645,33 @@ static void ShrinkMesh(VISU_Actor *Actor){
     shrink->Delete();
     Actor->EdgeDevice->VisibilityOff();
   }else{
-    vtkDataSetMapper* aMapper = vtkDataSetMapper::SafeDownCast(Actor->GetInitialMapper());
-    if (aMapper) {
-      vtkTransformPolyDataFilter *aTransformFilter = vtkTransformPolyDataFilter::New();
-      aTransformFilter->SetInput(aMapper->GetPolyDataMapper()->GetInput());
-      aTransformFilter->SetTransform (VisuGUI::GetVtkViewFrame()->getNonIsometricTransform());
-      
-      //create new mapper
-      aMapper = vtkDataSetMapper::New();
-      aMapper->SetInput (aTransformFilter->GetOutput());
-      aMapper->ShallowCopy ( Actor->GetMapper());
-      Actor->SetMapper (aMapper);
-                 
-      aTransformFilter->Delete();
-      aMapper->Delete();
-    } else {
-      vtkDataSetMapper *mapper = (vtkDataSetMapper*) (Actor->GetMapper());
-      mapper->SetInput(Actor->DataSource);
+    vtkDataSetMapper *mapper = (vtkDataSetMapper*) (Actor->GetMapper());
+    // mpv: we wish to remove shrink filter only instead of all filters ignore
+//     mapper->SetInput(Actor->DataSource);
+    vtkDataObject* anObject = mapper->GetInput();
+    vtkSource* aPrevSource = (vtkSource*)mapper;
+    while(anObject != Actor->DataSource) {
+      vtkShrinkFilter* aShrink = vtkShrinkFilter::SafeDownCast(anObject->GetSource());
+      if (aShrink) {
+       vtkSource* aSource = aShrink->GetInput()->GetSource();
+       vtkDataObject** Inputs = aPrevSource->GetInputs();
+       vtkDataObject** Outputs = aSource->GetOutputs();
+       Outputs[0]->UnRegister(aShrink);
+       Inputs[0]->UnRegister(aShrink);
+       Outputs[0]->Register(aPrevSource);
+       Inputs[0]->Register(aSource);
+       Inputs[0] = aSource->GetOutputs()[0];
+       aSource->Modified();
+       aSource->Update();
+
+       mapper->Update();
+       break;
+      }
+      aPrevSource = anObject->GetSource();
+      anObject = aPrevSource->GetInputs()[0];
     }
-    //Actor->GetMapper()->Update();
+    
+
     Actor->IsShrunk = false;
     if ( Actor->GetProperty()->GetRepresentation() == 2 )
       Actor->EdgeDevice->VisibilityOn();
@@ -2410,6 +2404,7 @@ void VisuGUI::Sweep() {
       if (aDefPrs) {
        float aScale = aDefPrs->GetScale();
        bool isColored = aDefPrs->isColored();
+       
        vtkWarpVector* aWarp = vtkWarpVector::New();
        if((VISU::Entity)aDefPrs->GetField()->myEntity == VISU::CELL) {
          vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
@@ -2518,13 +2513,22 @@ void VisuGUI::ImportMedField() {
        if(!anIOR->_is_nil()){
          CORBA::String_var aValue = anIOR->Value();
          if(strcmp(aValue,"") != 0){
-           CORBA::ORB_ptr anORB = VISU::Base_i::GetORB();
+           CORBA::ORB_var anORB = VISU::GetORB();
            CORBA::Object_var anObject = anORB->string_to_object(aValue);
            if ( !CORBA::is_nil( anObject ) ) {
-             //SALOME_MED::FIELD_ptr aField = SALOME_MED::FIELD::_narrow( anObject );
-             SALOME_MED::MED_ptr aMED = SALOME_MED::MED::_narrow( anObject );
-             if( !CORBA::is_nil( aMED ) ) {
-               VisuGUI::myComponent->ImportMed( aSObject );
+             SALOME_MED::FIELD_ptr aField = SALOME_MED::FIELD::_narrow( anObject );
+             if( !CORBA::is_nil( aField ) ) {
+               VisuGUI::myComponent->ImportMed( aField );
+               continue;
+             }
+             SALOME_MED::MESH_ptr aMesh = SALOME_MED::MESH::_narrow( anObject );
+             if( !CORBA::is_nil( aMesh ) ) {
+               VisuGUI::myComponent->ImportMedMesh( aMesh );
+               continue;
+             }
+             SALOME_MED::SUPPORT_ptr aSupport = SALOME_MED::SUPPORT::_narrow( anObject );
+             if( !CORBA::is_nil( aSupport ) ) {
+               VisuGUI::myComponent->ImportMedSupport( aSupport );
                continue;
              }
            }
@@ -2853,7 +2857,7 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
 
       case VISU::TRESULT:
        //thePopup->insertItem("Create Mesh", visuGUI, SLOT(CreateMesh()));    
-       //thePopup->insertItem("Export To File", visuGUI, SLOT(ExportToFile()));    
+       thePopup->insertItem("Export To File", visuGUI, SLOT(ExportToFile()));    
        //thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
        break;
        
@@ -2942,7 +2946,7 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
              thePopup->insertItem("Edit Scalar Bar...", visuGUI, SLOT(EditScalarBar()));
              
              if ((aType != VISU::TVECTORS) && (aType != VISU::TSTREAMLINES) && isVTKViewer)
-               thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
+               thePopup->insertItem("Animate", visuGUI, SLOT(Sweep()));
            }
            if (isVTKViewer) {
              if ( theParent == "Viewer" && 
@@ -2978,11 +2982,6 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
     }
     else {
       // possibly this is the MED field/mesh and suppot objects
-      SALOME_MED::MED_ptr aMED = SALOME_MED::MED::_narrow( anObject );
-      if( !CORBA::is_nil( aMED ) ) {
-       thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
-       return false;
-      }
       /*CORBA::Object_var anObj = SALOME_MED::FIELD::_narrow( anObject );
       if( !CORBA::is_nil( anObj ) ) {
        thePopup->insertItem( "Import Field", visuGUI, SLOT( ImportMedField() ) );
@@ -3438,7 +3437,7 @@ PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
   if(pResult){ \
     if(PRSTYPE::IsPossible(pResult,theMeshName,(VISU::Entity)theEntity,theFieldName,theTimeId)){ \
       QApplication::setOverrideCursor( Qt::waitCursor ); \
-      VISU::VISU_Gen_var aVisuGen = VISU::Base_i::GetVisuGenInter(); \
+      VISU::VISU_Gen_var aVisuGen = VISU::GetVisu(); \
       CORBA::Object_var anObject =  \
        aVisuGen->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
       QApplication::restoreOverrideCursor(); \
@@ -3447,7 +3446,7 @@ PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
     } \
   } else { \
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
-                           tr ("The presentation can't be built."), \
+                           tr ("The presentation can't be builded."), \
                            tr ("VISU_BUT_OK") ); \
   } \
   return NULL; \
@@ -3538,29 +3537,21 @@ void VisuGUI::ImportFromFile(){
   //flt.append( "Exportable Files (*.med *.dat)" );
   //flt.append( "Dat Files (*.dat)" );
   flt.append( "Med Files (*.med)" );
-  flt.append( "Dat Files (*.xls)" );
   QString aDir = getVisuInputDir();
-  QFileInfo aFileInfo = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
-                                                aDir,flt,tr("Import From File"),true);
-  if(aFileInfo.exists()){
-    QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
-    aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
+  QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
+                                         aDir,flt,tr("Import From File"),true);
+  if(!aFile.isEmpty()){
+    QAD_Application::getDesktop()->putInfo( "Importing From File " + aFile + "..." );
+    aDir = QAD_Tools::getDirFromPath(aFile);
     QAD_CONFIG->addSetting("Visu:InputDir",aDir);
     QApplication::setOverrideCursor( Qt::waitCursor );
-
-    CORBA::Object_var anObject;
-    if(aFileInfo.extension(false) == "med")
-       anObject = myComponent->ImportFile(aFileInfo.filePath());
-    else if(aFileInfo.extension(false) == "xls")
-       anObject = myComponent->ImportTables(aFileInfo.filePath());
-
-    if(CORBA::is_nil(anObject))
+    VISU::Result_var aResult = myComponent->ImportFile(aFile.latin1());
+    if(aResult->_is_nil())
       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                             tr ("There is an error in imported file"),
                             tr ("VISU_BUT_OK") );
     else
-      QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
-
+      QAD_Application::getDesktop()->putInfo(aFile+" imported.");
     myActiveStudy->updateObjBrowser(); //update Object browser
     QApplication::restoreOverrideCursor();
   }
@@ -3581,7 +3572,7 @@ void VisuGUI::ExportToFile(){
       QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
       if(VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>(aBase)){
        try{
-         //APO - aResult->GetInput()->ToFile(aFile.latin1());
+         aResult->GetInput()->ToFile(aFile.latin1());
          QAD_Application::getDesktop()->putInfo(aFile+" exported.");
        }catch(...){
          QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
index 83c96fb47dcabea037569e451c3fb0549ae192b2..5cf88ec8561ca08ce3934c3a7eb50486e61a7014 100644 (file)
@@ -108,12 +108,13 @@ def AddTablesInStudyFromFile(ffile):
     myBuilder = myStudy.NewBuilder()
     
     # >>> Getting (loading) VISU component =======================================
-    myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
+    myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
     myComponent = myStudy.FindComponent("VISU")
     if not myComponent:
         myComponent = myBuilder.NewComponent("VISU")
         aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
-        aName.SetValue("Visu")
+        #aName.SetValue("Visu")
+       aName.SetValue( salome.sg.getComponentUserName("VISU") )
         myBuilder.DefineComponentInstance(myComponent,myVisu)
         pass
     
index 3e8222a99ddba59591e567a751849b3e24c1511a..a5cc4f6126e2037423f927505477cb69317c801b 100644 (file)
@@ -8,7 +8,6 @@ using namespace std;
 //  $Header$
 
 #include "VisuGUI_IsoSurfacesDlg.h"
-#include <limits.h>
 #include <qlayout.h>
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
@@ -37,14 +36,14 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
 
   QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
   TopGroupLayout->addWidget( LabelMin, 0, 0 );
-  MinIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1 );
+  MinIso = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
   MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MinIso->setMinimumSize( 70, 0 );
   TopGroupLayout->addWidget( MinIso, 0, 1 );
 
   QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
   TopGroupLayout->addWidget( LabelMax, 1, 0 );
-  MaxIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1);
+  MaxIso = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1);
   MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MaxIso->setMinimumSize( 70, 0 );
   TopGroupLayout->addWidget( MaxIso, 1, 1 );
index ab983f84fe57719b8278361b484f2703bfa254ac..8cf133c26b1e1f41a78161c2a7ccec60ac158e81 100644 (file)
@@ -87,7 +87,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
     // Create "X" label
     QLabel* TextLabelX = new QLabel( "X", GroupBox, "TextLabelX" );
     TextLabelX->setAlignment( int( QLabel::AlignCenter ) );
-    //NRI    TextLabelX->setFont( m_font14bi );
+    TextLabelX->setFont( m_font14bi );
     glGroupBox->addWidget ( TextLabelX, 0, 2 );
 
     // Create combobox for selecting scaling function on a X axis
@@ -104,7 +104,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
 
     // Create informative label about the applying scaling function on a X axis
     m_lXFunction = new QLabel( GroupBox, "m_lXFunction" );
-    //NRI    m_lXFunction->setFont( m_font14bi ); 
+    m_lXFunction->setFont( m_font14bi ); 
     m_lXFunction->setAlignment( int( QLabel::AlignCenter ) );
     glGroupBox->addWidget(m_lXFunction, 3, 2 );
 
@@ -113,7 +113,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
     // Create "Y" label
     QLabel* TextLabelY = new QLabel( "Y", GroupBox, "TextLabelY" );
     TextLabelY->setAlignment( int( QLabel::AlignCenter ) );
-    //NRI    TextLabelY->setFont( m_font14bi ); 
+    TextLabelY->setFont( m_font14bi ); 
     glGroupBox->addWidget ( TextLabelY, 0, 3 );
 
     // Create combobox for selecting scaling function on a Y axis
@@ -131,7 +131,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
     // Create informative label about the applying scaling function on a Y axis
     m_lYFunction = new QLabel( GroupBox, "m_lYFunction" );
     m_lYFunction->setAlignment( int( QLabel::AlignCenter ) );
-    //NRI    m_lYFunction->setFont( m_font14bi ); 
+    m_lYFunction->setFont( m_font14bi ); 
     glGroupBox->addWidget(m_lYFunction, 3, 3 );
 
     FillComboBox( m_cbYfunction );
@@ -139,7 +139,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
     // Create "Z" label
     QLabel* TextLabelZ = new QLabel( "Z", GroupBox, "TextLabelZ" );
     TextLabelZ->setAlignment( int( QLabel::AlignCenter ) );
-    //NRI    TextLabelZ->setFont( m_font14bi ); 
+    TextLabelZ->setFont( m_font14bi ); 
     glGroupBox->addWidget ( TextLabelZ, 0, 4 );
 
     // Create combobox for selecting scaling function on a Z axis
@@ -157,7 +157,7 @@ VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* n
     // Create informative label about the applying scaling function on a Z axis
     m_lZFunction = new QLabel( GroupBox, "m_lZFunction" );
     m_lZFunction->setAlignment( int( QLabel::AlignCenter ) );
-    //NRI    m_lZFunction->setFont( m_font14bi ); 
+    m_lZFunction->setFont( m_font14bi ); 
     glGroupBox->addWidget(m_lZFunction, 3, 4 );
 
     FillComboBox( m_cbZfunction );
index 26be0c44f0904f3d2c236c0153d52881ec805232..3b9b32eea17880caaab4e2d4fb273e43f4ab7ef6 100644 (file)
@@ -8,7 +8,6 @@ using namespace std;
 //  $Header$
 
 #include "VisuGUI_ScalarBarDlg.h"
-#include <limits.h>
 #include <qlayout.h>
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
@@ -16,6 +15,7 @@ using namespace std;
 #include "VISU_Convertor.hxx"
 
 
+static double MAXVALUE = 1.0E+300;
 /*!
   Constructor
 */
@@ -58,14 +58,14 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   RBIrange = new QRadioButton( tr( "Use imposed range" ), RangeGroup, "RBIrange" );
   RBIrange->setChecked( true );
 
-  MinSpin = new QAD_SpinBoxDbl( RangeGroup, -DBL_MAX, DBL_MAX, 0.1 );
+  MinSpin = new QAD_SpinBoxDbl( RangeGroup, -MAXVALUE, MAXVALUE, 0.1 );
   MinSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MinSpin->setMinimumWidth( 70 );
   MinSpin->setValue( 0 );
   QLabel* MinLabel = new QLabel( tr( "Min:" ), RangeGroup, "MinLabel" );
   MinLabel->setBuddy(MinSpin);
 
-  MaxSpin = new QAD_SpinBoxDbl( RangeGroup, -DBL_MAX, DBL_MAX, 0.1 );
+  MaxSpin = new QAD_SpinBoxDbl( RangeGroup, -MAXVALUE, MAXVALUE, 0.1 );
   MaxSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MaxSpin->setMinimumWidth( 70 );
   MaxSpin->setValue( 0 );
index b7a04f4c31134a5a3cc0083928257381217a5715..edc926a81646e6c5413d3e3e72d9c9c67ebf6903 100644 (file)
@@ -63,7 +63,7 @@ SetupDlg::SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   aRangeLayout->addWidget(aMinLbl, 1, 0);
   myMinVal = new QAD_SpinBoxDbl(aRangeGrp, -MAXVALUE, MAXVALUE, 0.1 );
   myMinVal->setEnabled(myUseRangeChk->isChecked());
-  myMinVal->setValue( myAnimator->getMinRange() );
+  myMinVal->setValue( 0 );
   connect(myMinVal, SIGNAL( valueChanged(double)),
          this, SLOT( onMinValue(double) ));
   aRangeLayout->addWidget(myMinVal, 1, 1);
@@ -73,7 +73,7 @@ SetupDlg::SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   aRangeLayout->addWidget(aMaxLbl, 1, 2);
   myMaxVal = new QAD_SpinBoxDbl(aRangeGrp, -MAXVALUE, MAXVALUE, 0.1 );
   myMaxVal->setEnabled(myUseRangeChk->isChecked());
-  myMaxVal->setValue( myAnimator->getMaxRange() );
+  myMaxVal->setValue( 0 );
   connect(myMaxVal, SIGNAL( valueChanged(double)),
          this, SLOT( onMaxValue(double) ));
   aRangeLayout->addWidget(myMaxVal, 1, 3);
@@ -516,9 +516,11 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg(SALOMEDS::Study_var theStudy)
   TopLayout->addMultiCellWidget(aPropCheck, 5, 5, 0, 3);
 
   mySaveCheck = new QCheckBox("Save pictures to directory",myPlayFrame);
+  mySaveCheck->setChecked(false);
   TopLayout->addMultiCellWidget(mySaveCheck, 6, 6, 0, 3);
 
   QLabel* aPathLbl = new QLabel("Path:", myPlayFrame);
+  aPathLbl->setEnabled(false);
   connect(mySaveCheck, SIGNAL( toggled(bool)),
          aPathLbl, SLOT( setEnabled(bool) ));
   TopLayout->addWidget(aPathLbl, 7, 0);
@@ -533,8 +535,6 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg(SALOMEDS::Study_var theStudy)
          aBrowseBtn, SLOT( setEnabled(bool) ));
   connect(aBrowseBtn, SIGNAL( clicked()),
          this, SLOT( onBrowse() ));
-
-  mySaveCheck->setChecked(false);
   TopLayout->addWidget(aBrowseBtn, 7, 3);
 
   aMainLayout->addWidget(myPlayFrame);
index 9b73f0590a44491ac9c92e32aaded65f49b2dc9f..cb14bd17fe10928adfa9e4bf71de68168fc90838 100644 (file)
@@ -23,8 +23,6 @@ using namespace std;
 #include CORBA_SERVER_HEADER(MED)
 #include CORBA_SERVER_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
@@ -33,7 +31,6 @@ using namespace std;
 
 namespace VISU{
   //===========================================================================
-  class VISU_Gen_i;
   class Base_i : public virtual POA_VISU::Base,
                  public virtual PortableServer::RefCountServantBase
   {
@@ -45,16 +42,6 @@ namespace VISU{
     static QMutex* myMutex;
     static CORBA::ORB_var myOrb;
     static PortableServer::POA_var myPOA;
-    static SALOME_NamingService* myNamingService;
-    static VISU_Gen_i* myVisuGenImpl;
-    static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
-  public:
-    static CORBA::ORB_ptr GetORB() { return myOrb;}
-    static PortableServer::POA_ptr GetPOA() { return myPOA;}
-    static SALOME_NamingService* GetNS() { return myNamingService;}
-    static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
-    static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
-    static VISU_Gen_var GetVisuGenInter();
   };
   //===========================================================================
   class Mutex{
@@ -70,7 +57,7 @@ namespace VISU{
   protected:
     virtual void ToStream(ostrstream& theStr) = 0;
   public:
-    string ToString();
+    const char* ToString();
     virtual const char* GetComment() const = 0;
     typedef map<string,QString> TRestoringMap;
     typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, 
@@ -89,7 +76,9 @@ namespace VISU{
     static void DataToStream(ostrstream& theStr, const QString& theName, const double theVal);
   };
   //===========================================================================
-  const CORBA::Boolean IsMultifile();
+  CORBA::ORB_var GetORB();
+  PortableServer::POA_var GetPOA();
+  VISU_Gen_var GetVisu();
   PortableServer::Servant GetServant(CORBA::Object_ptr theObject);
   CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
   SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
@@ -100,6 +89,7 @@ namespace VISU{
                          CORBA::Boolean theCreateNew = true);
   string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
                              const char* theComment, int IsAllLevels = true);
+  const CORBA::Boolean IsMultifile();
 }
 
 #endif
index 46a36f9cb167e88779e5c1b490acb984996fec56..138d3cff6558b25d6d767186858143da3e49e2ab 100644 (file)
@@ -7,8 +7,6 @@ using namespace std;
 
 
 #include "VISU_Convertor.hxx"
-#include <fstream>     
-#include <strstream>
 #include <vtkCellType.h>
 #include <qdir.h>
 #include <qfileinfo.h>
@@ -123,30 +121,26 @@ namespace VISU{
   }
 }
 
-const VISU::TMeshMap& VISU_Convertor::GetMeshMap() throw(std::runtime_error&){ 
-  if(!myIsDone) { myIsDone = true;  Build();}
-  return myMeshMap;
+const VISU::TMesh* VISU_Convertor::GetMesh(const string& theMeshName) const {
+  string aMeshName(theMeshName == ""? myMeshMap.begin()->first: theMeshName);
+  VISU::TMeshMap::const_iterator aMeshMapIter = myMeshMap.find(theMeshName);
+  if(aMeshMapIter == myMeshMap.end()) return NULL;
+  return &(aMeshMapIter->second);
 }
 
-const VISU::TField& VISU_Convertor::GetField(const string& theMeshName, 
-                                            VISU::TEntity theEntity, 
-                                            const string& theFieldName) 
-     throw (std::runtime_error&)
+const VISU::TField* VISU_Convertor::GetField(const string& theMeshName, VISU::TEntity theEntity, 
+                                            const string& theFieldName) const
 {
-  if(!myIsDone) { myIsDone = true;  Build();}
   VISU::TMeshMap::const_iterator aMeshMapIter = myMeshMap.find(theMeshName);
-  if(aMeshMapIter == myMeshMap.end())
-    throw std::runtime_error("GetField >> There is no mesh with the name !!!");
+  if(aMeshMapIter == myMeshMap.end()) return NULL;
   const VISU::TMesh& aMesh = aMeshMapIter->second;
   VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMesh.myMeshOnEntityMap.find(theEntity);
-  if(aMeshOnEntityMapIter == aMesh.myMeshOnEntityMap.end())
-    throw std::runtime_error("GetField >> There is no mesh with the entity !!!");
+  if(aMeshOnEntityMapIter == aMesh.myMeshOnEntityMap.end()) return NULL;
   const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
   const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
   VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.find(theFieldName);
-  if(aFieldMapIter == aFieldMap.end())
-    throw std::runtime_error("GetField >> There is no field with the name !!!");
-  return aFieldMapIter->second;
+  if(aFieldMapIter == aFieldMap.end()) return NULL;
+  return &(aFieldMapIter->second);
 }
 
 string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
@@ -180,7 +174,7 @@ string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeI
 void parseFile(const char* theFileName) throw(std::runtime_error&){
   try{
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
-    const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+    const VISU::TMeshMap& aMeshMap = *(aCon->GetMeshMap());
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
@@ -239,106 +233,9 @@ void parseFile(const char* theFileName) throw(std::runtime_error&){
   } 
 }
 
-struct TRow{
-  string myTitle;
-  string myUnit;
-  vector<float> myValues;
-};
-
-struct TTable2D{
-  string myTitle;
-  vector<string> myColumnUnits;
-  vector<string> myColumnTitles;
-  vector<TRow> myRows;
-};
-
-vector<TTable2D> aTables;
-
-int GetLine(ifstream& theStmIn, QString& theString){
-  char tmp;
-  ostrstream aStrOut;
-  while(theStmIn.get(tmp)){
-    aStrOut<<tmp;
-    if(tmp == '\n') break;
-  }
-  aStrOut<<ends;
-  auto_ptr<char> aRet(aStrOut.str());
-  theString = aRet.get();
-  return !theStmIn.eof();
-}
-
 int main(int argc, char** argv){ 
   try{
     if(argc > 1){
-      ifstream aStmIn;
-      aStmIn.open(argv[1]);
-      QString aTmp;
-      while(!aStmIn.eof()){
-       //Find beginning of Table
-       while(GetLine(aStmIn,aTmp) && aTmp.find("#TITLE:") != 0);
-       if(aStmIn.eof()) return 0;
-       cout<<"\n There is new Table2D with Title = ";
-       TTable2D aTable2D;
-       while(!aStmIn.eof() && aTmp != "\n"){
-         if(aTmp.find("#TITLE:") == 0){
-           int aLen = aTmp.find(":") + 1;
-           aTmp.remove(0,aLen);
-           QString aTitle = aTmp.stripWhiteSpace();
-           aTable2D.myTitle = aTitle;
-           cout<<aTitle<<endl;
-         }else if(aTmp.find("#COLUMN_TITLES:") == 0){
-           int aLen = aTmp.find(":") + 1;
-           aTmp.remove(0,aLen);
-           QStringList aStrList = QStringList::split("|",aTmp);
-           cout<<"Its Column Titles : ";
-           for(int i = 0; i < aStrList.count(); i++){
-             aTmp = aStrList[i].stripWhiteSpace();
-             aTable2D.myColumnTitles.push_back(aTmp.latin1());
-             cout<<"\t"<<aTmp;
-           }
-           cout<<endl;
-         }else if(aTmp.find("#COLUMN_UNITS:") == 0){
-           int aLen = aTmp.find(":") + 1;
-           aTmp.remove(0,aLen);
-           QStringList aStrList = QStringList::split(" ",aTmp);
-           cout<<"Its Column Units : ";
-           for(int i = 0; i < aStrList.count(); i++){
-             aTmp = aStrList[i].stripWhiteSpace();
-             aTable2D.myColumnUnits.push_back(aTmp.latin1());
-             cout<<"\t"<<aTmp;
-           }
-           cout<<endl;
-         }else if(aTmp.find("#") == 0){
-           //It is a comment
-         }else if(aTmp.find("#TITLE:") > 0){
-           QStringList aStrList = QStringList::split("#TITLE:",aTmp);
-           QString aTitle = aStrList[1].stripWhiteSpace();
-           TRow aRow; 
-           aRow.myTitle = aTitle;
-           cout<<aTitle<<" : ";
-           QStringList aValList = QStringList::split(" ",aStrList[0]);
-           for(int i = 0; i < aValList.count(); i++){
-             float aVal = aValList[i].toFloat();
-             aRow.myValues.push_back(aVal);
-             cout<<"\t"<<aVal;
-           }
-           aTable2D.myRows.push_back(aRow);
-           cout<<endl;
-         }else{
-           QStringList aValList = QStringList::split(" ",aTmp);
-           TRow aRow; 
-           for(int i = 0; i < aValList.count(); i++){
-             float aVal = aValList[i].toFloat();
-             aRow.myValues.push_back(aVal);
-             cout<<"\t"<<aVal;
-           }
-           aTable2D.myRows.push_back(aRow);
-           cout<<endl;
-         }
-         GetLine(aStmIn,aTmp);
-       }
-      }
-      /*
       for(int i = 0; i < 1; i++){
        QFileInfo fi(argv[1]);
        if ( fi.exists() ) {
@@ -352,15 +249,25 @@ int main(int argc, char** argv){
           }else
            parseFile(argv[1]);
        }
-      }
+      } 
+      /* 
+      aCon->ToString(); 
+      aCon->ToFile((aDir+"a.med").c_str());
+      aCon.reset(CreateConvertor((aDir+"a.med").c_str()));
+      aCon->ToFile((aDir+"a.dat").c_str());
+      auto_ptr<VISU_Convertor> aCon(CreateConvertor(argv[1]));
+      aCon->ToFile((aDir+"a.med").c_str());
+      aCon.reset(CreateConvertor((aDir+"a.med").c_str()));
+      aCon->ToFile((aDir+"a.med").c_str());
+      aCon.reset(CreateConvertor((aDir+"b.med").c_str()));
+      aCon->ToFile((aDir+"c.dat").c_str());
       */
-      aStmIn.close();
       return 0;
     }
   }catch(std::runtime_error& exc){
-    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
+    MESSAGE("Unknown exception was accured in VISU_Convertor_impl");
   } 
   return 1;
 }
index a0f5efcedaae486fdc81568b78017f5f7fac8caa..17c5c20ca40b8c21d4e7f77a668180272f787bb6 100644 (file)
@@ -44,7 +44,6 @@ namespace VISU{
   extern TVtkCellInfoMap aVtkCellInfoMap;
 
   enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
-  //enum  TEntity {CELL_ENTITY, FACE_ENTITY, EDGE_ENTITY, NODE_ENTITY};
   template <class _Tp> class vtk_ptr {
   private:
     _Tp* _M_ptr;
@@ -163,29 +162,34 @@ class VISU_Convertor{
 protected:
   std::string myName;
   VISU::TMeshMap myMeshMap;
-  int myIsDone;
 public:
   virtual ~VISU_Convertor(){};
-  virtual const string& GetName() { return myName;}
-  virtual int IsDone() const { return myIsDone;}
   typedef vtkUnstructuredGridReader OutputType;
-  virtual VISU_Convertor* Build() throw (std::runtime_error&) = 0;
+  const char* GetName() { return myName.c_str();}
+
   virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
                                      const VISU::TEntity& theEntity,
                                      const string& theFamilyName = "")
     throw(std::runtime_error&) = 0;
+
   virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
                                     const string& theGroupName)
     throw(std::runtime_error&) = 0;
+
   virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
                                     const VISU::TEntity& theEntity,
                                     const string& theFieldName,
                                     int theStampsNum)
     throw(std::runtime_error&) = 0;
-  virtual const VISU::TMeshMap& GetMeshMap() throw(std::runtime_error&);
-  virtual const VISU::TField& GetField(const string& theMeshName, VISU::TEntity theEntity, 
-                                      const string& theFieldName)
-    throw(std::runtime_error&);
+
+  virtual int ToMedFile(const string& theFileName) throw(std::runtime_error&) = 0;
+  virtual int ToDatFile(const string& theFileName) throw(std::runtime_error&) = 0;
+  virtual int ToFile(const string& theFileName) throw(std::runtime_error&) = 0;
+
+  const VISU::TMeshMap* GetMeshMap() const { return &myMeshMap;}
+  const VISU::TMesh* GetMesh(const string& theMeshName = "") const;
+  const VISU::TField* GetField(const string& theMeshName, VISU::TEntity theEntity, 
+                              const string& theFieldName) const;
   static string GenerateName(const VISU::TField::TTime& aTime);
   static string GenerateName(const string& theName, unsigned int theTimeId);
 };
index a8f0dcb16186e1cd9c683d9906b661550ac40957..308434d2864e2d94c6d6830de4c17d0f24b3fdda 100644 (file)
@@ -71,10 +71,15 @@ extern "C" {
   }
 }
 
-VISU_Convertor_impl::VISU_Convertor_impl() {
-  myIsDone = false;
+int VISU_Convertor_impl::ToFile(const string& theFileName) throw(std::runtime_error&){
+  if(QFileInfo(theFileName.c_str()).extension(false) == "med")
+    return ToMedFile(theFileName);
+  else
+    return ToDatFile(theFileName);
 }
 
+VISU_Convertor_impl::VISU_Convertor_impl() : myIsDone(false) {}
+
 VISU_Convertor_impl::~VISU_Convertor_impl() {}
 
 VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName, 
@@ -82,7 +87,6 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
                                                                 const string& theFamilyName)
   throw (std::runtime_error&)
 {
-  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG) 
     MESSAGE("GetMeshOnEntity - theMeshName = '"<<theMeshName<<
            "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
@@ -114,18 +118,15 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    auto_ptr<char> aRet(strCellsOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strCellsOut.str()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    aRet.reset(strTypesOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strTypesOut.str()<<endl;
     strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     //aReader->DebugOn();
     aReader->ReadFromInputStringOn();
-    aRet.reset(strOut.str());
-    aReader->SetInputString(aRet.get());
+    aReader->SetInputString(strOut.str());
     //aReader->Update();
     //aReader->Print(cout);
     if(MYDEBUGWITHFILES){
@@ -134,7 +135,7 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + dtos("-%d-",theEntity) + aFamilyName + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<aRet.get();
+      stmOut<<strOut.str();
     }
   }
   return aReader.get();
@@ -145,7 +146,6 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnGroup(const string& th
                                                                const string& theGroupName)
      throw(std::runtime_error&)
 {
-  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG) MESSAGE("GetMeshOnGroup - theMeshName = '"<<theMeshName<<
                      "'; theGroupName = '"<<theGroupName<<"'");
   //Cheching possibility do the query
@@ -180,24 +180,21 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnGroup(const string& th
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    auto_ptr<char> aRet(strCellsOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strCellsOut.str()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    aRet.reset(strTypesOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strTypesOut.str()<<endl;
     strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     aReader->ReadFromInputStringOn();
-    aRet.reset(strOut.str());
-    aReader->SetInputString(aRet.get());
+    aReader->SetInputString(strOut.str());
     if(MYDEBUGWITHFILES){
       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
       string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<aRet.get();
+      stmOut<<strOut.str();
     }
   }
   return aReader.get();
@@ -210,7 +207,6 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetFieldOnMesh(const string& th
                                                                int theStampsNum)
      throw(std::runtime_error&)
 {
-  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG){
     MESSAGE("GetFieldOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
     MESSAGE("GetFieldOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
@@ -253,26 +249,22 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetFieldOnMesh(const string& th
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    auto_ptr<char> aRet(strCellsOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strCellsOut.str()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    aRet.reset(strTypesOut.str());
-    strOut<<aRet.get()<<endl;
+    strOut<<strTypesOut.str()<<endl;
     int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
     strOut<<GetField(aField,aValForTime,aMesh.myDim,aNbPoints,aNbCells);
-    strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     aReader->ReadFromInputStringOn();
-    aRet.reset(strOut.str());
-    aReader->SetInputString(aRet.get());
+    aReader->SetInputString(strOut.str());
     if(MYDEBUGWITHFILES){
       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + dtos("-%d-",theEntity) + aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<aRet.get();
+      stmOut<<strOut.str();
     }
   }
   return aReader.get();
@@ -305,18 +297,15 @@ int VISU_Convertor_impl::GetCells(ostrstream& strCellsOut, ostrstream& strTypesO
   VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
   for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
     const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+    if(MYDEBUG) MESSAGE("GetCells - anArray.size() = "<<anArray.size());
     int aVtkType = aCellsConnIter->first;
-    if(MYDEBUG) MESSAGE("GetCells - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
     if(!isFamilyPresent)
       for(int j = 0, jEnd = anArray.size(); j < jEnd; j++)
        PrintCells(strCellsOut,anArray[j],strTypesOut,aVtkType);
     else{
       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
-      if(aSubMesh.empty()) throw std::runtime_error("GetCells >> There is no elements on the family !!!");
       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
-      if(aSubMeshIter == aSubMesh.end()) continue;
       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-      if(MYDEBUG) MESSAGE("GetCells - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++)
        PrintCells(strCellsOut,anArray[*aSubMeshOnCellTypeIter],strTypesOut,aVtkType);
@@ -332,8 +321,7 @@ string VISU_Convertor_impl::GetHead(const string& theMeshName) const throw (std:
   strOut<<"ASCII\n";
   strOut<<"DATASET UNSTRUCTURED_GRID\n";
   strOut<<ends;
-  auto_ptr<char> aRet(strOut.str());
-  return aRet.get(); 
+  return strOut.str(); 
 }
 
 string VISU_Convertor_impl::GetPoints(const VISU::TMesh& theMesh) const 
@@ -368,8 +356,7 @@ string VISU_Convertor_impl::GetPoints(const VISU::TMesh& theMesh) const
     break;
   }
   strOut<<ends;
-  auto_ptr<char> aRet(strOut.str());
-  return aRet.get(); 
+  return strOut.str(); 
 }
 
 string VISU_Convertor_impl::GetField(const VISU::TField& theField, 
@@ -422,6 +409,5 @@ string VISU_Convertor_impl::GetField(const VISU::TField& theField,
       throw std::runtime_error("GetField - There is algorithm for representation the field !!!");
   }
   strOut<<ends;
-  auto_ptr<char> aRet(strOut.str());
-  return aRet.get(); 
+  return strOut.str(); 
 }
index 68b69e1b3f0227629791040dd92b98d6b4c1d41f..0d8b8f16038f085d0d30bdba449a88706a3520a4 100644 (file)
@@ -21,6 +21,8 @@ extern "C"{
 using namespace std;
 
 class VISU_Convertor_impl: public VISU_Convertor{
+ protected:
+  bool myIsDone;
  private:
   string GetHead(const string& theMeshName) const throw (std::runtime_error&);
   string GetPoints(const VISU::TMesh& theMesh) const throw (std::runtime_error&);
@@ -35,6 +37,10 @@ class VISU_Convertor_impl: public VISU_Convertor{
   VISU_Convertor_impl();
   virtual ~VISU_Convertor_impl();
   virtual VISU_Convertor* Build() throw (std::runtime_error&) { return this;};
+  virtual int ToMedFile(const string& theFileName) throw(std::runtime_error&);
+  virtual int ToDatFile(const string& theFileName) throw(std::runtime_error&);
+  virtual int ToFile(const string& theFileName) throw(std::runtime_error&);
+
   virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
                                      const VISU::TEntity& theEntity,
                                      const string& theFamilyName = "")
index 46ccae6c6742726f722b58239e938b9ac5275537..29eab3d08e4e748c1b372e3cb42b1d4465c590b9 100644 (file)
@@ -18,29 +18,16 @@ static int MYDEBUG = 1;
 static int MYDEBUG = 0;
 #endif
 static med_err ret = 0;
-
-extern "C"
-  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&){
-    return new VISU_MEDConvertor(theMedSObject);
-  }
-
+/*
 typedef map<VISU::TEntity,SALOME_MED::medEntityMesh> TVisu2MedEntity;
 static TVisu2MedEntity aVisu2MedEntity;
-typedef map<SALOME_MED::medEntityMesh,VISU::TEntity> TMed2VisuEntity;
-static TMed2VisuEntity aMed2VisuEntity;
 static int INIT = (
                   aVisu2MedEntity[VISU::CELL_ENTITY] = SALOME_MED::MED_CELL,
                   aVisu2MedEntity[VISU::FACE_ENTITY] = SALOME_MED::MED_FACE,
                   aVisu2MedEntity[VISU::EDGE_ENTITY] = SALOME_MED::MED_EDGE,
                   aVisu2MedEntity[VISU::NODE_ENTITY] = SALOME_MED::MED_NODE,
-
-                  aMed2VisuEntity[SALOME_MED::MED_CELL] = VISU::CELL_ENTITY,
-                  aMed2VisuEntity[SALOME_MED::MED_FACE] = VISU::FACE_ENTITY,
-                  aMed2VisuEntity[SALOME_MED::MED_EDGE] = VISU::EDGE_ENTITY,
-                  aMed2VisuEntity[SALOME_MED::MED_NODE] = VISU::NODE_ENTITY,
-
                   1);
-
+*/
 static int CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
   SALOME_MED::MED_POINT1,
   SALOME_MED::MED_SEG2,
@@ -87,19 +74,26 @@ static int NODEGEOM[1] = {
   SALOME_MED::MED_POINT1,
 };
 
-void GetEntity2Geom(const VISU::TEntity& theEntity, int*& theVector, int* theEnd)
-     throw (std::runtime_error&)
-{
+void Entity2Geom(const VISU::TEntity& theEntity, int* theVector, int* theEnd) {
   switch(theEntity){
   case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
   case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
   case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
   case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
-  default:
-    throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect !!!");
   }
 }
 
+typedef pair<int*,int> TEntity2Geom;
+typedef map<SALOME_MED::medEntityMesh,TEntity2Geom> TEntity2GeomMap;
+static TEntity2GeomMap anEntity2GeomMap;
+static int INIT = (
+  anEntity2GeomMap[SALOME_MED::MED_CELL] = TEntity2Geom(CELLGEOM,MED_NBR_GEOMETRIE_MAILLE),
+  anEntity2GeomMap[SALOME_MED::MED_FACE] = TEntity2Geom(FACEGEOM,MED_NBR_GEOMETRIE_FACE),
+  anEntity2GeomMap[SALOME_MED::MED_EDGE] = TEntity2Geom(EDGEGEOM,MED_NBR_GEOMETRIE_ARETE),
+  anEntity2GeomMap[SALOME_MED::MED_NODE] = TEntity2Geom(NODEGEOM,1),
+  1
+);
+
 struct SalomeMed2vtk {
   SALOME_MED::medGeometryElement medType;
   char *medName;
@@ -131,505 +125,306 @@ static SalomeMed2vtk salome_med2vtk[SALOME_MED::MED_ALL_ELEMENTS] = {
 };
 #undef CORBAMED2VTK
 
-int GetIdMEDType(int medType){
+int FindIdMEDType(int medType){
   for(int i = 0; i < SALOME_MED::MED_ALL_ELEMENTS; i++)
     if(salome_med2vtk[i].medType == medType) return i;
   return -1;
 }
 
-string GetName(SALOMEDS::SObject_ptr aSObject){
-  SALOMEDS::GenericAttribute_var anAttr;
-  if (aSObject->FindAttribute(anAttr,"AttributeName")) {
-    SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-    CORBA::String_var aString = aName->Value();
-    return aString.in();
-  }
-  return "";
+void VISU_MedMeshConvertor::SetMedMesh(SALOME_MED::MESH_ptr theMedMesh) {
+  myMedMesh = SALOME_MED::MESH::_duplicate(theMedMesh);
 }
 
-VISU_Convertor* VISU_MEDConvertor::Build() throw (std::runtime_error&){
-  if(mySObject->_is_nil()) 
-    throw std::runtime_error("VISU_MEDConvertor::Build >> mySObject->_is_nil() !!!");
-  myStudy = mySObject->GetStudy();
-  CORBA::Short aTag = mySObject->Tag();
-  SALOMEDS::SObject_var aMedCompSObj = mySObject->GetFather();
-  SALOMEDS::SObject_var aMeshSObj;
-  CORBA::Boolean aBool = aMedCompSObj->FindSubObject(aTag+1,aMeshSObj);
-  if(!aBool) throw std::runtime_error("VISU_MEDConvertor::Build >> Cann't find MEDMESH label !!!");
-  if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - MEDMESH found.");
-  SALOMEDS::ChildIterator_var aMeshIterator = myStudy->NewChildIterator(aMeshSObj);
-  for(; aMeshIterator->More(); aMeshIterator->Next()){
-    aMeshSObj = aMeshIterator->Value();
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshSObj = '"<<::GetName(aMeshSObj)<<"'");
-    CORBA::Object_var aMedMesh = SObjectToObject(aMeshSObj);
-    if(CORBA::is_nil(aMedMesh)) continue;
-    SALOME_MED::MESH_var aMEDMesh = SALOME_MED::MESH::_narrow(aMedMesh);
-    if(aMEDMesh->_is_nil()) continue;
-    CORBA::String_var aMeshName = aMEDMesh->getName();
-    VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
-    aMesh.myDim = aMEDMesh->getSpaceDimension();
-    aMesh.myName = aMeshName.in();
-    VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-    aMesh2.myMesh = aMEDMesh;
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
-    SALOMEDS::ChildIterator_var aSupportIterator = myStudy->NewChildIterator(aMeshSObj);
-    for(; aSupportIterator->More(); aSupportIterator->Next()){
-      SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
-      CORBA::Object_var aMedSupport = SObjectToObject(aSupportSObj);
-      if(CORBA::is_nil(aMedSupport)) continue;
-      SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport); 
-      if(aMEDSupport->_is_nil()) continue;
-      SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
-      VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
-      CORBA::String_var aSupportName = aMEDSupport->getName();
-      bool isDataPresent = false;
-      if(aMEDSupport->isOnAllElements()){
-       if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' anEntity = "<<anEntity);
-       //Check, if there is any data on the support?
-       SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
-       if(anEntity == VISU::NODE_ENTITY){
-         if(aMeshOnSupport->getNumberOfNodes() > 0) 
-           isDataPresent = true;
-       }else{
-         int iGeomElemEnd;
-         int* aGeomElemVector;
-         GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
-         const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[anEntity];
-         for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
-           int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
-           SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
-           med_int iNumElemEnd = aMeshOnSupport->getNumberOfElements(aMedEntity,aMedType);
-           if(iNumElemEnd > 0) {
-             isDataPresent = true;
-             break;
-           }
-         }
-       }
-       if(!isDataPresent) continue;
-       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-       aMeshOnEntity.myEntity = anEntity;
-       aMeshOnEntity.myMeshName = aMeshName.in();
-       VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
-       aMeshOnEntity2.mySupport = aMEDSupport;
-      }else{
-       SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
-       if(!aMEDFamily->_is_nil()) {
-         if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' anEntity = "<<anEntity);
-         VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-         VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aSupportName.in()];
-         aFamily.myName = aSupportName.in();
-         aFamily.myEntity = anEntity;
-         aFamily.myId = aMEDFamily->getIdentifier();
-         VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
-         VISUMED::TFamily& aFamily2 = aMeshOnEntity2.myFamilyMap[aSupportName.in()];
-         aFamily2.myFamily = aMEDFamily;
-       }
-       SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
-       if(!aMEDGroup->_is_nil()) {
-         if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' anEntity = "<<anEntity);
-         VISUMED::TGroupMap& aGroupMap2 = aMesh2.myGroupMap;
-         VISUMED::TGroup& aGroup2 = aGroupMap2[aSupportName.in()];
-         aGroup2.myGroup = aMEDGroup;
-         //VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
-         //VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-         //VISU::TGroup& aGroup = aGroupMap[aSupportName.in()];
-         //aGroup.myName = aSupportName.in();
-         //aGroup.myMeshName = aMesh.myName;
-         SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
-         int iFamilyEnd = aFamilies->length();
-         for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
-           aMEDFamily = aFamilies[iFamaily];
-           CORBA::String_var aFamilyName = aMEDFamily->getName();
-           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-           VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName.in()];
-           VISU::TBindGroups& aBindGroups = aFamily.myGroups;
-           aBindGroups.insert(aSupportName.in());
-         }
-       }
-      }
-    }
-    //Correction of TMesh.TGroupMap
-    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
-    if(aMeshOnEntityMap.empty()) continue;
-    VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
-    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-      const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
-      if(aFamilyMap.empty()) continue;
-      VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-      for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-       const VISU::TFamily& aFamily = aFamilyMapIter->second;
-       const VISU::TBindGroups& aBindGroups = aFamily.myGroups;
-       if(aBindGroups.empty()) continue;
-       VISU::TBindGroups::const_iterator aBindGroupsIter = aBindGroups.begin();
-       for(; aBindGroupsIter != aBindGroups.end(); aBindGroupsIter++){
-         const string& aGroupName = *aBindGroupsIter;
-         VISU::TGroup& aGroup = aGroupMap[aGroupName];
-         aGroup.myName = aGroupName;
-         aGroup.myMeshName = aMesh.myName;
-         VISU::TFamilyAndEntity aFamilyAndEntity(aFamily.myName,aFamily.myEntity);
-         aGroup.myFamilyAndEntitySet.insert(aFamilyAndEntity);
-       }
-      }
-    }
-  }
-  SALOMEDS::SObject_var aFieldSObj;
-  aBool = aMedCompSObj->FindSubObject(aTag+2,aFieldSObj);
-  if(aBool){
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - MEDFIELD found.");
-    SALOMEDS::ChildIterator_var aFieldIterator = myStudy->NewChildIterator(aFieldSObj);
-    for(int iField = 0; aFieldIterator->More(); aFieldIterator->Next(), iField++){
-      aFieldSObj = aFieldIterator->Value();
-      if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<::GetName(aFieldSObj)<<"'");
-      SALOMEDS::ChildIterator_var aTimeStampIterator = myStudy->NewChildIterator(aFieldSObj);
-      for(; aTimeStampIterator->More(); aTimeStampIterator->Next()){
-       SALOMEDS::SObject_var aTimeStampSObj = aTimeStampIterator->Value();
-       if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<::GetName(aTimeStampSObj)<<"'");
-       CORBA::Object_var aMedField = SObjectToObject(aTimeStampSObj);
-       if(CORBA::is_nil(aMedField)) continue;
-       SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
-       if(aMEDField->_is_nil()) continue;
-       SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
-       if(aMEDSupport->_is_nil()) continue;
-       SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
-       VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
-       SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
-       if(aMEDMesh->_is_nil()) continue;
-       CORBA::String_var aMeshName = aMEDMesh->getName();
-       CORBA::String_var aFieldName = aMEDField->getName();
-       VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
-       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-       VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
-       aField.myId = iField;
-       aField.myName = aFieldName.in();
-       aField.myEntity = anEntity;
-       aField.myMeshName = aMeshName.in();
-       aField.myNbComp = aMEDField->getNumberOfComponents();
-       //int iTimeStamp = aMEDField->getOrderNumber();
-       int iTimeStamp = aMEDField->getIterationNumber();
-       VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
-       aValForTime.myId = iTimeStamp;
-       double dt = aMEDField->getTime();
-       aValForTime.myTime = VISU::TField::TTime(dt,"");
-       VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-       VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
-       VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[aFieldName.in()];
-       VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[iTimeStamp];
-       aValForTime2.myField = aMEDField;
-       if(MYDEBUG) 
-         MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<"'; myEntity = "<<anEntity<<"; myTime = "<<dt);
-      }      
-    }
-  }
-  return this; 
+void VISU_CorbaMedConvertor::SetMedField(SALOME_MED::FIELD_ptr theMedField) {
+  myMedField = SALOME_MED::FIELD::_duplicate(theMedField);
+  if(!myMedField->_is_nil())
+    myMedMesh = myMedField->getSupport()->getMesh();
 }
 
-int VISU_MEDConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                                       const string& theFamilyName)
-     throw (std::runtime_error&) 
-{
-  //Main part of code
-  const string& aMeshName = theMeshOnEntity.myMeshName;
-  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
-  VISU::TMesh& aMesh = myMeshMap[aMeshName];
-  int isPointsUpdated;
-  if(anEntity == VISU::NODE_ENTITY) 
-    isPointsUpdated = LoadPoints(aMesh,theFamilyName);
-  else 
-    isPointsUpdated = LoadPoints(aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity,theFamilyName);
-
-  return (isPointsUpdated || isCellsOnEntityUpdated);
+void VISU_CorbaMedSupportConvertor::SetSupport(SALOME_MED::SUPPORT_ptr theSupport) {
+  mySupport = SALOME_MED::SUPPORT::_duplicate(theSupport);
+  if(!mySupport->_is_nil())
+    myMedMesh = mySupport->getMesh();
 }
-  
-int VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-     throw (std::runtime_error&)
-{
-  //Main part of code
-  int isPointsUpdated = 0;
-  int isCellsOnEntityUpdated = 0;
-  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const string& aFamilyName = aFamilyAndEntitySetIter->first;
-    const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
-    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
-    if(anEntity == VISU::NODE_ENTITY){
-      isPointsUpdated += LoadPoints(theMesh,aFamilyName);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity);
-    }else{
-      isPointsUpdated += LoadPoints(theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity,aFamilyName);
-    }
-  }
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
-}
-
-int VISU_MEDConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                                      VISU::TMeshOnEntity& theMeshOnEntity, 
-                                      VISU::TField& theField, 
-                                      VISU::TField::TValForTime& theValForTime)
-  throw (std::runtime_error&)
-{
-  //Main part of code
-  int isPointsUpdated = LoadPoints(theMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity);
-  int isFieldUpdated = LoadField(theMeshOnEntity,theField,theValForTime);
-  
-  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
-}
-
-int VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
+int ImportPoints(VISU::TMesh& theMesh, SALOME_MED::MESH_ptr theMESH)
   throw (std::runtime_error&) 
 {
-  //Check on existing family
-  VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
-  aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
-  aMeshOnEntity.myMeshName = theMesh.myName;
-  VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
-  bool isFamilyPresent = (pFamily != NULL);
-  VISU::TFamily& aFamily = *pFamily;
-  //Check on loading already done
-  bool isPointsLoaded = !theMesh.myPointsCoord.empty();
-  if(isPointsLoaded) 
-    if(!isFamilyPresent) return 0;
-    else if(!aFamily.mySubMesh.empty()) return 0;
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMesh.myName];
-  SALOME_MED::MESH_var& aMedMesh = aMesh2.myMesh;
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[VISU::NODE_ENTITY];
-  if(MYDEBUG) 
-    MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
-  theMesh.myDim = aMedMesh->getSpaceDimension();
-  int iNumElemEnd = aMedMesh->getNumberOfNodes();
+/*
+  if(MYDEBUG) MESSAGE("ImportPoints - beginning");
+  theMesh.myDim = theMESH->getMeshDimension();
+  int aNbPoints = theMESH->getNumberOfNodes();
   VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
-  if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
-  if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
-  aPointsCoord.resize(theMesh.myDim*iNumElemEnd,0.0);
-  Engines::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
-  if(!isPointsLoaded){
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
-      for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
-       aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
-    if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
-    VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
-    aConnForCellType.resize(iNumElemEnd);
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-      aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
-  }
-  if(isFamilyPresent){
-    if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
-    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
-    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
-    VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
-    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
-    Engines::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
-    int iNumElemEndTmp = iNumElemEnd;
-    iNumElemEnd = aCellNumForType->length();
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-      int tmp = aCellNumForType[iNumElem]-1;
-      if(0 > tmp || tmp >= iNumElemEndTmp) {
-       static QString aString;
-       aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
-       throw std::runtime_error(aString.latin1());
-      }
-      aSubMeshOnCellType.insert(tmp);
-    }
-  }
+  aPointsCoord.resize(theMesh.myDim*aNbPoints,0.0);
+  Engines::double_array_var coord = theMESH->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
+  for (int i = 0 ; i < aNbPoints; i++)
+    for(int j = 0, ij = theMesh.myDim*i; j < theMesh.myDim; j++)
+      aPointsCoord[ij+j] = coord[ij+j];
+  if(MYDEBUG) 
+    MESSAGE("ImportPoints - End : theDim = "<<theMesh.myDim<<"; aNbPoints = "<<aNbPoints);
   return 1;
+*/
 }
 
-int VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+int ImportCells(VISU::TMesh& theMesh, SALOME_MED::MESH_ptr theMESH, 
+               const SALOME_MED::medEntityMesh& theEntity)
      throw (std::runtime_error&) 
 {
-  //Check on existing family
-  VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-  bool isFamilyPresent = (pFamily != NULL);
-  VISU::TFamily& aFamily = *pFamily;
-  //Check on loading already done
-  bool isCellsLoaded = !theMeshOnEntity.myCellsConn.empty();
-  if(isCellsLoaded) 
-    if(!isFamilyPresent) return 0;
-    else if(!aFamily.mySubMesh.empty()) return 0;
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
-  SALOME_MED::SUPPORT_var& aMedSupport = aMeshOnEntity2.mySupport;
-  SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
-  if(MYDEBUG) {
-    MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
-    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
-  }
-  //Main part of code
-  int iGeomElemEnd;
-  int* aGeomElemVector;
-  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
-  GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
-  const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[anEntity];
-  VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
-  int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
-  if(!isCellsLoaded){
-    for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
-      int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
-      int nbMedNodes = salome_med2vtk[medId].medNbNodes;
-      int nbVtkNodes = salome_med2vtk[medId].vtkNbNodes;
-      int aVtkType = salome_med2vtk[medId].vtkType;
-      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
-      med_int iNumElemEnd = aMedMesh->getNumberOfElements(aMedEntity,aMedType);
-      if (iNumElemEnd > 0) {
-       Engines::long_array_var conn = 
-         aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMedEntity,aMedType);
-       VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
-       //APO - aConnForCellType.resize(iNumElemEnd);
-       valarray<med_int> aConnect(nbMedNodes);
-       int aNbConnForElem = conn->length()/iNumElemEnd;
-       if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
-                           "; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         //APO - VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
-         //APO - anArray.resize(nbVtkNodes);
-         VISU::TMeshOnEntity::TConnect anArray(nbVtkNodes);
-         for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
-           aConnect[k] = conn[kj+k] - 1;
-         }
-         switch(aMedType){
-         case SALOME_MED::MED_TETRA4 :
-         case SALOME_MED::MED_TETRA10 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[1];
-           anArray[2] = aConnect[3];  
-           anArray[3] = aConnect[2];  
-           break;
-         case SALOME_MED::MED_PYRA5 :
-         case SALOME_MED::MED_PYRA13 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[3];  
-           anArray[2] = aConnect[2];
-           anArray[3] = aConnect[1];  
-           anArray[4] = aConnect[4];
-           break;
-         default:
-           for (int k = 0; k < nbVtkNodes; k++) 
-             anArray[k] = aConnect[k];
-         }
+/*
+  if(MYDEBUG) MESSAGE("ImportCells - theEntity = "<<theEntity);
+  //TEntity2Geom anEntity2Geom = anEntity2GeomMap[theEntity];
+  //int *iVector = anEntity2Geom->first, iEnd = anEntity2Geom->second;
+  int *iArray, iEnd;
+  VISU::TEntity anEntity = MED2VISUEntity(theEntity);
+  Entity2Geom(anEntity,iArray,&iEnd);
+  int aNbPoints = theMesh.myPointsCoord.size();
+  for (int i = 0; i < iEnd; i++) {
+    int medId = FindIdMEDType(iArray[i]);
+    int nbMedNodes = salome_med2vtk[medId].medNbNodes;
+    int nbVtkNodes = salome_med2vtk[medId].vtkNbNodes;
+    int aVtkType = salome_med2vtk[medId].vtkType;
+    SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+    int jEnd = theMESH->getNumberOfElements(theEntity,aMedType);
+    if(jEnd > 0){
+      VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
+      Engines::long_array_var conn = 
+       theMESH->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,theEntity,aMedType);
+      if(MYDEBUG) MESSAGE("ImportCells - medName = "<<salome_med2vtk[medId].medName<<"; jEnd = "<<jEnd);
+      VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[aVtkType];
+      aConnForCellType.resize(jEnd);
+      valarray<med_int> aConnect(nbMedNodes);
+      for (int j = 0; j < jEnd; j++) {
+       VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[j];
+       anArray.resize(nbVtkNodes);
+       for (int k = 0, kj = j*nbMedNodes; k < nbMedNodes; k++) 
+         aConnect[k] = conn[kj+k] - 1;
+       switch(aMedType){
+       case SALOME_MED::MED_TETRA4 :
+       case SALOME_MED::MED_TETRA10 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[1];
+         anArray[2] = aConnect[3];  
+         anArray[3] = aConnect[2];  
+         break;
+       case SALOME_MED::MED_PYRA5 :
+       case SALOME_MED::MED_PYRA13 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[3];  
+         anArray[2] = aConnect[2];
+         anArray[3] = aConnect[1];  
+         anArray[4] = aConnect[4];
+         break;
+       default:
          for (int k = 0; k < nbVtkNodes; k++) 
-           if(anArray[k] < 0 || aNbPoints <= anArray[k]){
-             static QString aString;
-             aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
-             throw std::runtime_error(aString.latin1());
-           }
-         aConnForCellType.push_back(anArray);
+           anArray[k] = aConnect[k];
        }
-       //Workaround for MED Component data structure
-       int aSize = aConnForCellType.size();
-       aMeshOnEntity2.myCellsFirstIndex[aMedType] = VISUMED::TMeshOnEntity::TIndexAndSize(aCounter,aSize);
-       aCounter += aSize;
+       for (int k = 0; k < nbVtkNodes; k++) 
+         if(anArray[k] < 0 || aNbPoints <= anArray[k])
+           throw std::runtime_error("ImportCells >> anArray[k] < 0 || aNbPoints <= anArray[k]");
       }
+      if(MYDEBUG)
+       MESSAGE("ImportCells - aMeshOnEntity.myCellsConn.size() = "<<aMeshOnEntity.myCellsConn.size());
     }
   }
-  //Filling aFamily SubMesh
-  if(isFamilyPresent){
-    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
-    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
-    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
-    iGeomElemEnd = aGeom->length();
-    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomElemEnd = "<<iGeomElemEnd);
-    for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
-      SALOME_MED::medGeometryElement aGeomType = aGeom[iGeomElem];
-      Engines::long_array_var aCellNumForType = aMedFamily->getNumber(aGeomType);
-      int medId = GetIdMEDType(aGeomType);
-      int aVtkType = salome_med2vtk[medId].vtkType;
-      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
-      VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVtkType]; 
-      med_int iNumElemEndTmp = theMeshOnEntity.myCellsConn[aVtkType].size();
-      med_int iNumElemEnd = aCellNumForType->length();
-      int aCounter = aMeshOnEntity2.myCellsFirstIndex[aMedType].first;
-      if(MYDEBUG) 
-       MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
-               "; iNumElemEnd = "<<iNumElemEnd<<"; aCounter = "<<aCounter);
-      for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-       int tmp = aCellNumForType[iNumElem]-aCounter-1;
-       if(0 > tmp || tmp >= iNumElemEndTmp) {
-         static QString aString;
-         aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
-         throw std::runtime_error(aString.latin1());
-       }
-       aSubMeshOnCellType.insert(tmp);
-      }
-    }
-  }
-  return 1;
+*/
+}
+
+VISU_Convertor* VISU_MedMeshConvertor::Build() throw (std::runtime_error&) {
+/*
+  if(myMedMesh->_is_nil())
+    throw std::runtime_error("VISU_MedMeshConvertor::Build >> myMesh->_is_nil()");
+  CORBA::String_var aName = myMedMesh->getName();
+  myName = aName;
+  TMesh& aMesh = myMeshMap[myName];
+  if(MYDEBUG) MESSAGE("MedInfo - aMeshName = "<<myMeshMap.begin()->first);
+  ::ImportPoints(aMesh,myMedMesh);
+  TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
+  for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++)
+    ::ImportCells(aMesh,myMedMesh,aVisu2MedEntityIter->second);
+  myIsDone = true;
+  return this; 
+*/
 }
 
 template<class TArray> int ImportField(TArray& theArray, 
-                                      const VISU::TMesh& theMesh,
-                                      const VISU::TField& theField,
-                                      VISU::TField::TValForTime& theValForTime,
                                       const VISU::TMeshOnEntity& theMeshOnEntity,
-                                      const VISUMED::TMeshOnEntity& theMeshOnEntity2)
+                                      VISU::TField& theField, 
+                                      const SALOME_MED::medEntityMesh& theEntity,
+                                      const VISU::TField::TTime& theTime)
 {
-  if(theField.myEntity == VISU::NODE_ENTITY){
-    VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[VTK_VERTEX];
-    int iNumElemEnd = theMesh.myPointsCoord.size()/theMesh.myDim*theField.myNbComp;
-    if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
-    aValForCellsWithType.resize(iNumElemEnd);
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
-      aValForCellsWithType[iNumElem] = theArray[iNumElem];
+/*
+  if(MYDEBUG) MESSAGE("ImportField - IEnd = "<<theArray->length()<<"; myNbComp = "<<theField.myNbComp);
+  VISU::TEntity anEntity = MED2VISUEntity(theEntity);
+  VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
+  VISU::TField& aField = aMeshOnEntity.myFieldMap[nomcha]
+  VISU::TField::TValForTime& aValForTime = theField.myValField[theTime];
+  if(theField.myTypeConn == POINT_DATA){
+    VISU::TField::TValForCellsWithType& aValForCellsWithType = aValForTime[VTK_VERTEX];
+    int iEnd = theMesh.myPointsCoord.size()/theMesh.myDim * theField.myNbComp;
+    if(MYDEBUG) MESSAGE("ImportField - iEnd = "<<iEnd);
+    aValForCellsWithType.resize(iEnd);
+    for (int i = 0; i < iEnd; i++)
+      aValForCellsWithType[i] = theArray[i];
   }else{
-    int iGeomElemEnd;
-    int* aGeomElemVector;
-    const VISU::TEntity& anEntity = theField.myEntity;
-    GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
-    for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
-      int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
-      int aVtkType = salome_med2vtk[medId].vtkType;
-      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
-      const VISUMED::TMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity2.myCellsFirstIndex;
-      VISUMED::TMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMedType);
-      if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
-       const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
-       VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
-       const VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aCellsConnIter->second;
-       const VISUMED::TMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
-       int iNumElemEnd = aIndexAndSize.second;
-       if(MYDEBUG) 
-         MESSAGE("ImportField - medName = "<<salome_med2vtk[medId].medName<<
-                 "; aIndexAndSize = {"<<aIndexAndSize.first<<","<<aIndexAndSize.second<<"}");
-       VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[aVtkType];
-       aValForCellsWithType.resize(iNumElemEnd*theField.myNbComp);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-         for (int k = 0, kj = iNumElem*theField.myNbComp; k < theField.myNbComp; k++)
-           aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField.myNbComp+kj+k];
+    int iEnd = VTKCELLGEOMEND, *iArray = VTKCELLGEOM, kEnd = theField.myNbComp;
+    for (int i = 0, I = 0; i < iEnd; i++) {
+      int medId = FindIdMEDType(iArray[i]), aVtkType = salome_med2vtk[medId].vtkType;
+      const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMesh.myCellsConn;
+      VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
+      if(aCellsConnIter != aCellsConn.end()){
+       const VISU::TMesh::TConnForCellType& aConnForCellType = aCellsConnIter->second;
+       int jEnd = aConnForCellType.size();
+       if(MYDEBUG) MESSAGE("ImportField - medName = "<<salome_med2vtk[medId].medName<<
+                           "; vtkName = "<<salome_med2vtk[medId].vtkName<<"; jEnd = "<<jEnd);
+       VISU::TField::TValForCellsWithType& aValForCellsWithType = aValForTime[aVtkType];
+       aValForCellsWithType.resize(jEnd*kEnd);
+       for (int j = 0; j < jEnd; j++)
+         for (int k = 0, kj = j*kEnd; k < kEnd; k++)
+           aValForCellsWithType[kj+k] = theArray[I++];
       }
     }
   }
-  return 1;
+*/
 }
 
-int VISU_MEDConvertor::LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-                                const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
-     throw (std::runtime_error&)
-{
-  //Check on loading already done
-  if(!theValForTime.myValForCells.empty()) return 0;
-  VISU::TMesh& aMesh = myMeshMap[theMeshOnEntity.myMeshName];
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
-  VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[theField.myName];
-  VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[theValForTime.myId];
-  SALOME_MED::FIELD_var aMEDField = aValForTime2.myField;
-  //Main part of code
-  SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
+VISU_Convertor* VISU_CorbaMedConvertor::Build() throw (std::runtime_error&){
+/*
+  if(myMedField->_is_nil())
+    throw std::runtime_error("VISU_CorbaMedConvertor::Build >> myField->_is_nil()");
+  if(VISU_MedMeshConvertor::Build() == NULL) return NULL;
+  CORBA::String_var aName = myMedField->getName();
+  myName = aName;
+  TMeshMap::const_iterator aMeshIter = myMeshMap.begin();
+  const TMesh& aMesh = aMeshIter->second;
+  int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+  int aNbCells = aMesh.GetCellsDims().first;
+  aName = myMedField->getName();
+  aMeshOnEntity.myEntity = theEntity;
+  aMeshOnEntity.myMeshName = theMesh.myName;
+  TField& aField = myFieldMap[aName.in()];
+  aField.myMeshName = aMeshIter->first;
+  SALOME_MED::SUPPORT_var aSupport = myMedField->getSupport();
+  SALOME_MED::medEntityMesh anEntity = aSupport->getEntity();
+  int aSize;
+  if(anEntity == SALOME_MED::MED_NODE){
+    aSize = aNbPoints;
+    aField.myTypeConn = POINT_DATA;
+    if(MYDEBUG) MESSAGE("VISU_CorbaMedConvertor::Build - POINT_DATA = "<<aSize);
+  }else if(anEntity == SALOME_MED::MED_CELL){
+    aSize = aNbCells;
+    aField.myTypeConn = CELL_DATA;
+    if(MYDEBUG) MESSAGE("VISU_CorbaMedConvertor::Build - CELL_DATA = "<<aSize);
+  }
+  aField.myNbComp = myMedField->getNumberOfComponents();
+  if(MYDEBUG) MESSAGE("VISU_CorbaMedConvertor::Build - aField.myNbComp = "<<aField.myNbComp);
+  TField::TTime aTime(myMedField->getTime(),"");
+  SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(myMedField);
   if(!aFieldDouble->_is_nil()){
+    if(MYDEBUG) MESSAGE("VISU_CorbaMedConvertor::Build - There is FIELDDOUBLE");
     Engines::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
-    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+    ::ImportField(anArray,aMesh,aField,anEntity,aTime);
   }
-  SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
+  SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(myMedField);
   if(!aFieldInt->_is_nil()){
+    if(MYDEBUG) MESSAGE("VISU_CorbaMedConvertor::Build - There is FIELDINT");
     Engines::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
-    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+    ::ImportField(anArray,aMesh,aField,anEntity,aTime);
+  }
+  myIsDone = true;
+  return this; 
+*/
+}
+
+int ImportCellsOfSupport(VISU::TMesh& theMesh, SALOME_MED::SUPPORT_ptr theSUPPORT) 
+     throw (std::runtime_error&) 
+{
+/*
+  if(MYDEBUG) MESSAGE("ImportCellsOfSupport - beginning");
+  SALOME_MED::medEntityMesh anEntity = theSUPPORT->getEntity();
+  med_int nmailles[SALOME_MED::MED_ALL_ELEMENTS];
+  if(MYDEBUG) MESSAGE("ImportCellsOfSupport - anEntity = "<<anEntity);
+  if(anEntity == SALOME_MED::MED_NODE){
+    VISU::TMesh::TConnForCellType& aConnForCellType = theMesh.myCellsConn[VTK_VERTEX];
+    if(theSUPPORT->isOnAllElements()){
+      int jEnd = theMesh.myPointsCoord.size()/theMesh.myDim;
+      if(MYDEBUG) MESSAGE("ImportCellsOfSupport - isOnAllElements - "<<jEnd);
+      aConnForCellType.resize(jEnd);
+      for (int j = 0; j < jEnd; j++) 
+       aConnForCellType[j] = vector<int>(1,j);
+    }else{
+      SALOME_MED::medGeometryElement_array_var aGeom = theSUPPORT->getTypes();
+      Engines::long_array_var aCellNumForType = theSUPPORT->getNumber(aGeom[0]);
+      int jEnd = aCellNumForType->length();
+      aConnForCellType.resize(jEnd);
+      for (int j = 0; j < jEnd; j++) 
+       aConnForCellType[j] = vector<int>(1,aCellNumForType[j]-1);
+    }
+  }else{
+    VISU::TMesh aBaseMesh;
+    SALOME_MED::MESH_var aMedMesh = theSUPPORT->getMesh();
+    ::ImportPoints(aBaseMesh,aMedMesh);
+    ::ImportCells(aBaseMesh,aMedMesh,anEntity);
+    if(theSUPPORT->isOnAllElements()){
+      if(MYDEBUG) MESSAGE("ImportCellsOfSupport - isOnAllElements");
+    }else{
+      SALOME_MED::medGeometryElement_array_var aGeom = theSUPPORT->getTypes();
+      int iEnd = aGeom->length();
+      if(MYDEBUG) MESSAGE("ImportCellsOfSupport - aGeom->length() = "<<iEnd);
+      for (int i = 0; i < iEnd; i++) {
+       Engines::long_array_var aCellNumForType = theSUPPORT->getNumber(aGeom[i]);
+       int medId = FindIdMEDType(aGeom[i]);
+       int aVtkType = salome_med2vtk[medId].vtkType;
+       med_int jEnd = aCellNumForType->length();
+       if(MYDEBUG) MESSAGE("ImportCellsOfSupport - medName = "<<salome_med2vtk[medId].medName<<"; jEnd = "<<jEnd);
+       VISU::TMesh::TConnForCellType& aConnForCellType = theMesh.myCellsConn[aVtkType];
+       aConnForCellType.resize(jEnd);
+       VISU::TMesh::TConnForCellType& aBaseConnForCellType = aBaseMesh.myCellsConn[aVtkType];
+       for (int j = 0; j < jEnd; j++) {
+         aConnForCellType[j] = aBaseConnForCellType[aCellNumForType[j]-1];
+       }
+      }
+    }
   }
   return 1;
+*/
+}
+
+VISU_Convertor* VISU_CorbaMedSupportConvertor::Build() throw (std::runtime_error&) {
+/*
+  if(MYDEBUG) MESSAGE("BuildSupport - checking mySupport & mySupport->getMesh()");
+  if(mySupport->_is_nil())
+    throw std::runtime_error("VISU_CorbaMedConvertor::Build >> mySupport->_is_nil()");
+  SALOME_MED::GROUP_var aGroup = SALOME_MED::GROUP::_narrow(mySupport);
+  int aNbCells = 0;
+  if(!aGroup->_is_nil()){
+    CORBA::String_var aName = aGroup->getName();
+    myName = aName;
+    if(MYDEBUG) MESSAGE("BuildSupport aGroup->getName() = "<<myName);
+    SALOME_MED::Family_array_var anArray = aGroup->getFamilies();
+    med_int iEnd = anArray->length();
+    TMesh& aMesh = myMeshMap[myName];
+    if(MYDEBUG) MESSAGE("BuildSupport - aGroup->getFamilies()->length() = "<<iEnd);
+    ::ImportPoints(aMesh,myMedMesh);
+    for(med_int i = 0; i < iEnd; i++){
+      if(MYDEBUG) MESSAGE("BuildSupport - import FAMILY with number = "<<i);
+      SALOME_MED::FAMILY_var aFamily = anArray[i];
+      ::ImportCellsOfSupport(aMesh,aFamily);
+    }
+    aNbCells = aMesh.GetCellsDims().first;
+  }else{
+    CORBA::String_var aName = mySupport->getName();
+    myName = aName;
+    if(MYDEBUG) MESSAGE("mySupport - myName = "<<myName);
+    TMesh& aMesh = myMeshMap[myName];
+    myMedMesh = mySupport->getMesh();
+    ::ImportPoints(aMesh,myMedMesh);
+    ::ImportCellsOfSupport(aMesh,mySupport);
+    aNbCells = aMesh.GetCellsDims().first;
+  }
+  if(aNbCells == 0) 
+    throw std::runtime_error("VISU_MedMeshConvertor::Build >> aNbCells == 0");
+  if(MYDEBUG) MESSAGE("BuildSupport - aNbCells = "<<aNbCells);
+  myIsDone = true;
+  return this; 
+*/
 }
index 4fb887ff9f96523e6ebf8df84866da2fa2016404..6c87c6ee3c1316288b2eab2de735b0e52d52741e 100644 (file)
@@ -14,75 +14,140 @@ extern "C"{
 #include <med.h>
 }  
 
-namespace VISUMED{
+
+class VISU_MEDConvertor: public VISU_Convertor_impl{
+ protected:
+  /*
   struct TFamily{
     SALOME_MED::FAMILY_var myFamily;
+    int myId;
+    string myName;
+    VISU::TEntity myEntity;
+    TBindGroups myGroups;
+    TSubMesh mySubMesh;
   };
   typedef std::map<std::string,TFamily> TFamilyMap;
-  
+
   struct TField{
+    SALOME_MED::FIELD_var myField;
+    int myId;
+    string myName;
+    VISU::TEntity myEntity;
+    string myMeshName;
+    int myNbComp;
+    typedef std::pair<double,std::string> TTime;
     struct TValForTime{
-      SALOME_MED::FIELD_var myField;
+      int myId;
+      TTime myTime;
     };
     typedef std::map<int,TValForTime> TValField;
     TValField myValField;
+    void ShallowCopy(const TField& aField);
   };
   typedef map<string,TField> TFieldMap;
 
   struct TMeshOnEntity{
     SALOME_MED::SUPPORT_var mySupport;
-    typedef pair<int,int> TIndexAndSize;
-    typedef map<int,TIndexAndSize> TCellsFirstIndex;
-    TCellsFirstIndex myCellsFirstIndex;
+    string myMeshName;
+    VISU::TEntity myEntity;
     TFamilyMap myFamilyMap;
     TFieldMap myFieldMap;
   };
-  typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
-  
+  typedef std::map<TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, 
+                    const string& theFamilyName)
+    throw(std::runtime_error&); 
+  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, 
+                    const string& theFamilyName)
+    throw(std::runtime_error&); 
+
+  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
+  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
   struct TGroup{
-    SALOME_MED::GROUP_var myGroup;
+    TVTKReader myStorage;
+    string myName;
+    string myMeshName;
+    TFamilyAndEntitySet myFamilyAndEntitySet;
   };
   typedef std::map<std::string,TGroup> TGroupMap;
 
   struct TMesh{
-    SALOME_MED::MESH_var myMesh;
+    int myDim;
+    string myName;
+    typedef vector<float> TPointsCoord;
+    TPointsCoord myPointsCoord;
     TMeshOnEntityMap myMeshOnEntityMap;
     TGroupMap myGroupMap;
+    void CreateMeshOnNodes();
+    const TField* GetField(const string& theFieldName) const;
   };
   typedef std::map<std::string,TMesh> TMeshMap;
-}
-
-
-class VISU_MEDConvertor: public VISU_Convertor_impl{
- protected:
-  VISUMED::TMeshMap myMeshMap2;
+  */
   SALOMEDS::SObject_var mySObject;
-  SALOMEDS::Study_var myStudy;
  public:
-  VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
+  void SetMedField(SALOME_MED::FIELD_ptr theMedField);
   virtual VISU_Convertor* Build() throw (std::runtime_error&);
  protected:
   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
                               const string& theFamilyName = "")
-    throw (std::runtime_error&);
+    throw (std::runtime_error&) {return 1;}
   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
                              const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-    throw (std::runtime_error&);
+    throw (std::runtime_error&) {return 1;}
   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
                              VISU::TMeshOnEntity& theMeshOnEntity, 
                              VISU::TField& theField, 
                              VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&);
-  int LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName = "") 
-    throw (std::runtime_error&);
-  int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "")
-    throw (std::runtime_error&);
-  int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&);
+    throw (std::runtime_error&) {return 1;}
 };
 
-extern "C"
-  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&);
-#endif
+class VISU_MedMeshConvertor: public VISU_Convertor_impl{
+protected:
+  SALOME_MED::MESH_var myMedMesh;
+public:
+  void SetMedMesh(SALOME_MED::MESH_ptr theMedMesh);
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+ protected:
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&) {return 1;}
+};
+
+class VISU_CorbaMedConvertor: public VISU_MedMeshConvertor{
+protected:
+  SALOME_MED::FIELD_var myMedField;
+public:
+  void SetMedField(SALOME_MED::FIELD_ptr theMedField);
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+};
+
+class VISU_CorbaMedSupportConvertor: public VISU_Convertor_impl{
+protected:
+  SALOME_MED::SUPPORT_var mySupport;
+  SALOME_MED::MESH_var myMedMesh;
+public:
+  void SetSupport(SALOME_MED::SUPPORT_ptr theSupport);
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+ protected:
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&) {return 1;}
+};
 
+#endif
index 2fb3b1492d4fdb8c0d0a8d19128e23bab9942907..8b4242707efa2633bed371c5e75f390b905afe95 100644 (file)
@@ -152,8 +152,8 @@ int VISU_DatConvertor::ImportCells(ifstream* pStmIn, vector<int>* pCellsType)
   return 0;
 }
 
-/*
 int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime_error&){
+  /*
   if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - "<<theFileName);
   if(!myIsDone && Build() != NULL) myIsDone = true;
   ofstream stmOut(theFileName.c_str(),ios::out);
@@ -247,6 +247,6 @@ int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime
       }
     }
   }
+  */
   return 1;
 }
-*/
index 2ae5ff24b44101dced0ca1d43bcbaedbd3ef2a5c..ee9b2e023d8997ea5986432b3511604b1e320a88 100644 (file)
@@ -19,6 +19,9 @@ static int MYDEBUG = 1;
 #endif
 static med_err ret = 0;
 
+static med_entite_maillage MEDENTITY[4] = {
+  MED_MAILLE, MED_NOEUD, MED_ARETE, MED_FACE
+  };
 typedef map<VISU::TEntity,med_entite_maillage> TVisu2MedEntity;
 static TVisu2MedEntity aVisu2MedEntity;
 static int INIT = (
@@ -41,22 +44,20 @@ static med_geometrie_element  CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
   MED_PYRA5, MED_PENTA6, MED_HEXA8, MED_TETRA10, 
   MED_PYRA13, MED_PENTA15, MED_HEXA20
   };
-void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd) 
-     throw (std::runtime_error&)
-{
+void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd) {
   switch(theEntity){
   case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
   case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
   case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
   case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
-  default:
-    throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect");
   }
 }
 
 extern "C"
 VISU_Convertor* CreateMedConvertor(const string& theFileName) throw(std::runtime_error&){
-  return new VISU_MedConvertor(theFileName);
+  VISU_MedConvertor* aConvertor = new VISU_MedConvertor(theFileName);
+  aConvertor->Build();
+  return aConvertor;
 }
 
 int med2vtkCellType(int medType){
@@ -103,7 +104,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
   MedFile aMedFile(myFileInfo.absFilePath());
   med_idt fid = aMedFile.GetFid();
   med_int iMeshEnd = MEDnMaa(fid);  //Get number of meshes
-  if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "<<iMeshEnd<<"; myFileInfo = "<<myFileInfo.filePath());
+  if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "<<iMeshEnd);
   for(int iMesh = 1; iMesh <= iMeshEnd; iMesh++){
     med_int aMeshDim;
     char aMeshName[MED_TAILLE_NOM+1] = "";
@@ -112,6 +113,10 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
     VISU::TMesh &aMesh = myMeshMap[aMeshName];
     aMesh.myDim = aMeshDim;
     aMesh.myName = aMeshName;
+    //Create aMeshOnEntity for entity with type of NODE_ENTITY at any case
+    //VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
+    //aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
+    //aMeshOnEntity.myMeshName = aMeshName;
     typedef map<int,VISU::TEntity> TFamily2EntityMap;
     TFamily2EntityMap aFamily2EntityMap;
     TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
@@ -125,51 +130,35 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
        int medId = getIdMedType(aGeomElemVector[iGeomElem]);
        int aVtkType = med2vtk[medId].vtkType;
        med_geometrie_element aMedType = med2vtk[medId].medType;
-       if(aMedEntity == MED_NOEUD){
-         med_geometrie_element typgeo = (med_geometrie_element)0;
-         med_connectivite typco = (med_connectivite)0;
-         med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
-         if(iNumElemEnd > 0){
-           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-           aMeshOnEntity.myEntity = anEntity;
-           aMeshOnEntity.myMeshName = aMeshName;
-           if(MYDEBUG) 
-             MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<"; iNumElemEnd = "<<iNumElemEnd<<
-                     "; medName = "<<med2vtk[medId].medName<<"; medId = "<<medId);
-           med_booleen iname_elem, inum_elem;
-           valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
-           valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
-           med_repere rep;
-           valarray<char> name_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
-           valarray<char> unit_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
-           valarray<med_float> coord(aMesh.myDim*iNumElemEnd);
-           ret = MEDnoeudsLire(fid,aMeshName,aMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
-                               &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
-                               &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
-           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDnoeudsLire(...)");
-           for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-             if(num_fam_elem[iNumElem] != 0) 
-               aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
-         }
-       }
        //Get number of connectivities
        med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD); 
        if (iNumElemEnd > 0) {
          VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
          aMeshOnEntity.myEntity = anEntity;
          aMeshOnEntity.myMeshName = aMeshName;
+         if(MYDEBUG) 
+           MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<"; medName = "<<med2vtk[medId].medName<<
+                   "; iNumElemEnd = "<<iNumElemEnd);
          med_booleen iname_elem, inum_elem;
          valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
          valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
-         med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
-         if(MYDEBUG) 
-           MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<"; iNumElemEnd = "<<iNumElemEnd<<
-                   "; medName = "<<med2vtk[medId].medName<<"; aNbConnForElem = "<<aNbConnForElem);
-         valarray<med_int> conn(0,aNbConnForElem*iNumElemEnd);
-         ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
-                               &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
-                               &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
-         if (ret < 0) throw std::runtime_error("ImportInfo >> MEDelementsLire(...)");
+         if(aMedEntity == MED_NOEUD){
+           med_repere rep;
+           valarray<char> name_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
+           valarray<char> unit_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
+           valarray<med_float> coord(aMesh.myDim*iNumElemEnd);
+           ret = MEDnoeudsLire(fid,aMeshName,aMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
+                               &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
+                               &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
+           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDnoeudsLire(...)");
+         }else{
+           med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
+           valarray<med_int> conn(aNbConnForElem*iNumElemEnd);
+           ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
+                                 &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
+                                 &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
+           if (ret < 0) throw std::runtime_error("ImportInfo >> MEDelementsLire(...)");
+         }
          for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
            if(num_fam_elem[iNumElem] != 0) 
              aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
@@ -192,9 +181,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
                       &anAttId[0],&anAttVal[0],&anAttDesc[0],&aNbAttrib,
                       &aGroupNames[0],&aNbGroup);
       if(ret < 0) throw std::runtime_error("ImportInfo >> MEDfamInfo");
-      if(0 && MYDEBUG) 
-       MESSAGE("ImportInfo - aFamilyNum = "<<aFamilyNum<<"; aNbGroup = "<<aNbGroup);
-      if(aFamily2EntityMap.find(aFamilyNum) == aFamily2EntityMap.end()) continue;
+      if(0 && MYDEBUG) MESSAGE("ImportInfo - aFamilyNum = "<<aFamilyNum);
       VISU::TEntity anEntity = aFamily2EntityMap[aFamilyNum];
       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
       VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName];
@@ -206,9 +193,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
                "; myName = '"<<aFamilyName<<"'; myId = "<<aFamilyNum);
       VISU::TBindGroups& aBindGroups = aFamily.myGroups;
       for(int iGroup = 0, iPos = 0; iGroup < aNbGroup; iGroup++, iPos += MED_TAILLE_LNOM){
-       char aGroupName[MED_TAILLE_LNOM+1];
-       strncpy(aGroupName,&aGroupNames[iPos],MED_TAILLE_LNOM);
-       aGroupName[MED_TAILLE_LNOM] = '\0';
+       string aGroupName(&aGroupNames[iPos]);
        if(MYDEBUG) MESSAGE("ImportInfo - aGroupName["<<iGroup<<"] = '"<<aGroupName<<"'");
        aBindGroups.insert(aGroupName);
       }
@@ -403,9 +388,7 @@ int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, cons
   //Main part of code
   char aMeshName[MED_TAILLE_NOM+1] = "";
   strcpy(aMeshName,theMesh.myName.c_str());
-  med_geometrie_element typgeo = (med_geometrie_element)0; //MED_POINT1
-  med_connectivite typco = (med_connectivite)0; //MED_NOD
-  med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
+  med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,MED_POINT1,MED_NOD);
   if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> MEDnEntMaa(...)");
   if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
   med_repere rep;
@@ -438,7 +421,7 @@ int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, cons
     for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
       aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
   }
-  if(isFamilyPresent && iNumElemEnd > 0){
+  if(isFamilyPresent){
     if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
     VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
     for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
@@ -452,6 +435,7 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
                                         const string& theFamilyName)
   throw (std::runtime_error&)
 {
+  if(MYDEBUG) MESSAGE("LoadCellsOnEntity - beginning");
   //Check on existing family
   VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
   bool isFamilyPresent = (pFamily != NULL);
@@ -470,7 +454,7 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
   med_geometrie_element* aGeomElemVector;
   const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
   GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
-  const med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
+  med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
   char aMeshName[MED_TAILLE_NOM+1] = "";
   strcpy(aMeshName,theMeshOnEntity.myMeshName.c_str());
   if(MYDEBUG) 
@@ -623,3 +607,5 @@ int VISU_MedConvertor::LoadField(const med_idt& fid, const VISU::TMeshOnEntity&
   }
   return 1; 
 }
+
+int VISU_Convertor_impl::ToMedFile(const string& theFileName) throw(std::runtime_error&){}
index 5faaa071ef139bc79f68ba320b6a576375265cc4..8803a71cb78484938fb5713e40c3d9a0669d717e 100644 (file)
@@ -43,7 +43,7 @@ using namespace VISU;
 #include <vtkFeatureEdges.h>
 
 
-//#define CHECKTIME
+#define CHECKTIME
 #ifdef CHECKTIME
 #include <OSD_Timer.hxx>
 #endif
@@ -132,11 +132,11 @@ VISU_Actor* VISU::Prs3d_i::CreateActor(const Handle(SALOME_InteractiveObject)& t
   float bounds[6];
   static float eps = VTK_LARGE_FLOAT * 0.1 ;
   myMapper->GetBounds(bounds);
-  for (int i = 0; i < 6; ++i) {
+  for (int i =0; i <6; ++i) {
     if (fabs (bounds[i] - myBounds[i]) > eps ) { 
-      MESSAGE("Prs3d_i::CreateActor >> Boundaries of actor do not coincide with boundaries of initial shape !!!");
-      return NULL;
-    }
+      MESSAGE(" Boundaries of actor do not coincide with boundaries of initial shape : \
+                                              error finish of VISU::Prs3d_i::CreateActor");
+      return NULL;}
   }
   VISU_Actor* aActor = VISU_Actor::New();
   if(myMapper->GetInput()->GetNumberOfCells() < 10)
@@ -170,7 +170,7 @@ VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap, in
   myColorRGB[0] = myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
   myColorRGB[1] = myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
   myColorRGB[2] = myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
-  return this;
+  return NULL;
 }
 
 void VISU::Prs3d_i::ToStream(ostrstream& theStr){
@@ -312,8 +312,6 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
     OSD_Timer timer;
     timer.Start();
 #endif
-    if(myResult->GetInput() == NULL) 
-      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
     if(!theRestoring) myName = GenerateName();
     if(myEntity >= 0) 
       if(mySubMeshName == "") 
@@ -328,18 +326,18 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
     switch(myType){
     case VISU::TENTITY : 
       myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity); 
-      aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                      VISU::TENTITY,myMeshName.c_str(),myEntity);
+      aComment.sprintf("myComment=ENTITY;myType=%d;myResultName=%s;myMeshName=%s;myId=%d",
+                      VISU::TENTITY,myResult->GetName(),myMeshName.c_str(),myEntity);
       break;
     case VISU::TFAMILY : 
       myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName);
-      aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                      VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str());
+      aComment.sprintf("myComment=FAMILY;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s",
+                      VISU::TFAMILY,myResult->GetName(),myMeshName.c_str(),myEntity,mySubMeshName.c_str());
       break;
     case VISU::TGROUP : 
       myInput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
-      aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                      VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str());
+      aComment.sprintf("myComment=GROUP;myType=%d;myResultName=%s;myMeshName=%s;myName=%s",
+                      VISU::TGROUP,myResult->GetName(),myMeshName.c_str(),mySubMeshName.c_str());
       break;
     }
     if(myInput == NULL) throw std::runtime_error("Mesh_i::Build - myInput == NULL !!!");
@@ -404,9 +402,6 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th
   aActor->GetMapper()->SetResolveCoincidentTopologyToShiftZBuffer();
   aActor->GetMapper()->SetResolveCoincidentTopologyZShift(0.02);
 
-  aActor->EdgeDevice = VISU_Actor::New();
-  aActor->EdgeDevice->PickableOff();
-
   aActor->EdgeDevice->SetMapper(edgeMapper);
   edgeMapper->Update();
 
@@ -422,16 +417,11 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th
 //==============================================================================
 int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
                                  const char* theFieldName, double theIteration){
-  try{
-    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-    const VISU::TField::TValField& aValField = aField.myValField;
-    return aValField.find((int)theIteration) != aValField.end();
-  }catch(std::runtime_error& exc){
-    MESSAGE("Follow exception was accured :\n"<<exc.what());
-  }catch(...){
-    MESSAGE("Unknown exception was accured!");
-  }
-  return 0;
+  const VISU::TField* aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+  if(aField == NULL) return 0;
+  const VISU::TField::TValField& aValField = aField->myValField;
+  if(aValField.find((int)theIteration) == aValField.end()) return 0;
+  return 1;
 }
 
 int VISU::ScalarMap_i::myNbPresent = 0;
@@ -653,7 +643,7 @@ void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax) {
  
    
 void VISU::ScalarMap_i::CalculateRange() {
-  //myIsFixedRange = false;
+  myIsFixedRange = false;
   myInput->GetUnstructuredGridOutput()->GetScalarRange(myScalarRange);
   if(MYDEBUG) 
     MESSAGE("ScalarMap_i::CalculateRange - myScalarRange[0] = "<<myScalarRange[0]<<
@@ -690,12 +680,6 @@ VISU::ScalarMap_i::~ScalarMap_i(){
 }
 
 
-void VISU::ScalarMap_i::Update() {
-  VISU::Prs3d_i::Update();
-  if (!myIsFixedRange) CalculateRange();
-}
-
-
 VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
   if(MYDEBUG) 
     MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
@@ -704,9 +688,7 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
     OSD_Timer timer;
     timer.Start();
 #endif
-    if(myResult->GetInput() == NULL) 
-      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
-    myField = &(myResult->GetInput()->GetField(myMeshName,(VISU::TEntity)myEntity,myFieldName));
+    myField = myResult->GetInput()->GetField(myMeshName,(VISU::TEntity)myEntity,myFieldName);
     if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
     SetScalarMode(myScalarMode);
     if(myInput->GetInput() == NULL) throw std::runtime_error("Can't build build vtk representation !!!");
@@ -726,14 +708,14 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
       myTitle = aComment.simplifyWhiteSpace();
       if (myAddToStudy) {
        myName = GenerateName();
-       aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                        VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp);
+       aComment.sprintf("myComment=TIMESTAMP;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                        VISU::TTIMESTAMP,myResult->GetName(),myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp);
        string aResultEntry = myResult->GetEntry();
        string aRefFatherEntry = myResult->GetRefFatherEntry();
        string anEntry = FindEntryWithComment(myStudy,aResultEntry.c_str(),aComment.latin1());
        if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
-       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d;myComponentId=%d",
-                        GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp,myScalarMode);
+       aComment.sprintf("myComment=%s;myResultName=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d;myComponentId=%d",
+                        GetComment(),myResult->GetName(),myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp,myScalarMode);
        CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),
                         anIOR,myName.c_str(),"",aComment.latin1(),true);
       }
@@ -767,10 +749,7 @@ VISU::ScalarMap_i::DataType* VISU::ScalarMap_i::DoHook(int theRestoring){
 
 
 VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
-  //Update();
-  VISU_Actor* aActor = VISU::Prs3d_i::CreateActor(theIO);
-  if ( !aActor ) return NULL;
-
+  Update();
   VISU_LookupTable* aActorLookupTbl = VISU_LookupTable::New();
   if(GetScaling() == VISU::LOGARITHMIC) 
     aActorLookupTbl->SetLog(true);
@@ -787,6 +766,8 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject
     myMapper->SetScalarRange(myScalarRange);
   aActorLookupTbl->Delete();
 
+  VISU_Actor* aActor = VISU::Prs3d_i::CreateActor(theIO);
+  if ( !aActor ) return NULL;
 
   VISU_ScalarBarActor* aBar = VISU_ScalarBarActor::New();
   VISU_LookupTable* aBarLookupTbl = VISU_LookupTable::New();
@@ -823,19 +804,13 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject
   return aActor;
 }
 
+
 //==============================================================================
 int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
                                      const char* theFieldName, double theIteration){
-  try{
-    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
-    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-    return aField.myNbComp > 1;
-  }catch(std::runtime_error& exc){
-    MESSAGE("Follow exception was accured :\n"<<exc.what());
-  }catch(...){
-    MESSAGE("Unknown exception was accured!");
-  }
-  return 0;
+  if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
+  const VISU::TField* aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+  return aField->myNbComp > 1;
 }
 
 int VISU::DeformedShape_i::myNbPresent = 0;
@@ -1185,7 +1160,7 @@ void VISU::CutPlanes_i::SetPlane(int theId){
   vtkPlane *aPlane = vtkPlane::New();
   float aOrig[3];
   Mul(aOrig,myDir,myBoundPrj[0] + theId*myDBPrj);
-  if(0 && MYDEBUG) MESSAGE("aOrig["<<theId<<"]: "<<aOrig[0]<<"; "<<aOrig[1]<<"; "<<aOrig[2]);
+  if(MYDEBUG) MESSAGE("aOrig["<<theId<<"]: "<<aOrig[0]<<"; "<<aOrig[1]<<"; "<<aOrig[2]);
   aPlane->SetOrigin(aOrig);
   if(theId == 0) aPlane->SetNormal(myInvDir);
   else  aPlane->SetNormal(myDir);
index 842ec89eb22140b6845e0a673c1b922b62294cca..189ec3abd4ae1423f4eb2fc087d6f3f210667c53 100644 (file)
@@ -246,7 +246,6 @@ namespace VISU{
                          const char* theFieldName, double theIteration);
     InputType* GetInput() { return myInput;}
 
-    virtual void Update();
     const VISU::TField*  GetField() const { return myField;}
     const string&  GetFieldName() const { return myFieldName;}
     int GetScalarMode() const { return myScalarMode;}
index dc9f250565e591624090def695edb558e4f479aa..b5f2d3b8795d0c9501333ceedf6fbfa42da8b97f 100644 (file)
@@ -89,12 +89,6 @@ void CreateReference(SALOMEDS::Study_ptr theStudyDocument,
   aStudyBuilder->Addreference(newObj,aRefSObj);
 }
 
-string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){
-  SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
-  CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
-  return aDataType.in();
-}
-
 //==============================================================================
 
 const string VISU::Result_i::myComment = "RESULT";
@@ -102,149 +96,133 @@ const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
 
 VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
   myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
-  myInput = NULL;
 }
 
-VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) 
-     throw (std::runtime_error&)
-{
+VISU::Storable* VISU::Result_i::Build() {
   if(MYDEBUG) MESSAGE("Result_i::Build");
-  mySComponent = FindOrCreateVisuComponent(myStudyDocument);
-  CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
-  string aRefFatherEntry = GetRefFatherEntry();
-  QString aComment;
-  aComment.sprintf("myComment=%s;myType=%d;myFileName=%s",
-                  GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1());
-  string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
-                                        anIOR,myName.c_str(),"",aComment.latin1(),true);
-  mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
-  if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
-  if(theSObject != NULL){
-    CORBA::String_var aString = theSObject->GetID();
-    CreateReference(myStudyDocument,aResultEntry,aString.in());
-  }
-  const TMeshMap& aMeshMap = myInput->GetMeshMap();
-  if(!aMeshMap.empty()) {//apo
-    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
-    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
-      const string& aMeshName = aMeshMapIter->first;
-      const VISU::TMesh& aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
-      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
-      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
-                      aMeshName.c_str(),aMesh.myDim);
-      string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
-                                          "",aMeshName.c_str(),"",aComment.latin1(),true);
-      if(aMeshOnEntityMap.empty()) continue;
-      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
-      string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "","Families","",aComment.latin1(),true);
-      //Import entities and according families
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      typedef map<VISU::TEntity,string> TEntity2Entry;
-      TEntity2Entry aEntity2Entry;
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                        VISU::TENTITY,aMeshName.c_str(),anEntity);
-       string anEntityName;
-       switch(anEntity){
-       case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
-       case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
-       case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
-       case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
-       default:
-         throw std::runtime_error("Build >> Value of entity is incorrect!");
-       }
-       aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
-                                                  "",anEntityName.c_str(),"",aComment.latin1(),true);
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
-       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-         const string& aFamilyName = aFamilyMapIter->first;
-         aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                          VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
-         CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
-                          "",aFamilyName.c_str(),"",aComment.latin1(),true);
-       }
-      }
-      //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
-      if(aGroupMap.size() > 0){
-       aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
-       string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
-                                              "","Groups","",aComment.latin1(),true);
-       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-         const string& aGroupName = aGroupMapIter->first;
-         aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                          VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
-         string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "",aGroupName.c_str(),"",aComment.latin1(),true);
-         const VISU::TGroup& aGroup = aGroupMapIter->second;
-         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
-         VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
-         for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-           const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-           const string& aFamilyName = aFamilyAndEntity.first;
-           const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-           aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                            VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
-           string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
-           CreateReference(myStudyDocument,aGroupEntry,anEntry);
+  try{
+    mySComponent = FindOrCreateVisuComponent(myStudyDocument);
+    CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
+    string aRefFatherEntry = GetRefFatherEntry();
+    QString aComment;
+    aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
+                    GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
+    string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
+                                          anIOR,myName.c_str(),"",aComment.latin1(),true);
+    mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
+    if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for hte Result !!!");
+    const TMeshMap& aMeshMap = *(myInput->GetMeshMap());
+    if( &aMeshMap != NULL) {//apo
+      TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+      for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+       const string& aMeshName = aMeshMapIter->first;
+       const VISU::TMesh& aMesh = aMeshMapIter->second;
+       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+       aComment.sprintf("myComment=MESH;myResultName=%s;myName=%s;myDim=%d",
+                        myName.c_str(),aMeshName.c_str(),aMesh.myDim);
+       string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
+                                            "",aMeshName.c_str(),"",aComment.latin1(),true);
+       if(aMeshOnEntityMap.empty()) continue;
+       aComment.sprintf("myComment=FAMILIES;myResultName=%s;myMeshName=%s",myName.c_str(),aMeshName.c_str());
+       string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                                 "","Families","",aComment.latin1(),true);
+       //Import entities and according families
+       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+       typedef map<VISU::TEntity,string> TEntity2Entry;
+       TEntity2Entry aEntity2Entry;
+       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+         const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+         aComment.sprintf("myComment=ENTITY;myType=%d;myResultName=%s;myMeshName=%s;myId=%d",
+                          VISU::TENTITY,myName.c_str(),aMeshName.c_str(),anEntity);
+         string anEntityName;
+         switch(anEntity){
+         case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
+         case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
+         case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
+         case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
+         default:
+           throw std::runtime_error("Build >> Value of entity is incorrect!");
+         }
+         aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
+                                                    "",anEntityName.c_str(),"",aComment.latin1(),true);
+         const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+         const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+         VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+         for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+           const string& aFamilyName = aFamilyMapIter->first;
+           aComment.sprintf("myComment=FAMILY;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s",
+                            VISU::TFAMILY,myName.c_str(),aMeshName.c_str(),anEntity,aFamilyName.c_str());
+           CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
+                            "",aFamilyName.c_str(),"",aComment.latin1(),true);
          }
        }
-      }
-      //Import fields
-      string aFieldsEntry;
-      bool isFieldEntryCreated = 0;
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
-       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-         if(!isFieldEntryCreated){
-           aComment.sprintf("myComment=FIELDS;myMeshName=%s",aMeshName.c_str());
-           aFieldsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
-                                           "","Fields","",aComment.latin1(),true);
-           isFieldEntryCreated = true;
+       //Importing groups
+       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+       if(aGroupMap.size() > 0){
+         aComment.sprintf("myComment=GROUPS;myResultName=%s;myMeshName=%s",myName.c_str(),aMeshName.c_str());
+         string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                                "","Groups","",aComment.latin1(),true);
+         VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+         for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+           const string& aGroupName = aGroupMapIter->first;
+           aComment.sprintf("myComment=GROUP;myType=%d;myResultName=%s;myMeshName=%s;myName=%s",
+                            VISU::TGROUP,myName.c_str(),aMeshName.c_str(),aGroupName.c_str());
+           string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
+                                                 "",aGroupName.c_str(),"",aComment.latin1(),true);
+           const VISU::TGroup& aGroup = aGroupMapIter->second;
+           const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+           VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
+           for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+             const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+             const string& aFamilyName = aFamilyAndEntity.first;
+             const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+             aComment.sprintf("myComment=FAMILY;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s",
+                              VISU::TFAMILY,myName.c_str(),aMeshName.c_str(),anEntity,aFamilyName.c_str());
+             string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
+             CreateReference(myStudyDocument,aGroupEntry,anEntry);
+           }
          }
-         const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField& aField = aFieldMapIter->second;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
-                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
-         string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
-                                               "",aFieldName.c_str(),"",aComment.latin1(),true);
-         CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
-         for(; aValFieldIter != aValField.end(); aValFieldIter++){
-           int aTimeStamp = aValFieldIter->first;
-           const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
-           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
-           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
-           CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
-                            "",aTimeStampId.c_str(),"",aComment.latin1(),true);
+       }
+       //Import fields
+       string aFieldsEntry;
+       bool isFieldEntryCreated = 0;
+       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+         const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+         const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+         const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+         VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+         for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+           if(!isFieldEntryCreated){
+             aComment.sprintf("myComment=FIELDS;myResultName=%s;myMeshName=%s",myName.c_str(),aMeshName.c_str());
+             aFieldsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                             "","Fields","",aComment.latin1(),true);
+             isFieldEntryCreated = true;
+           }
+           const string& aFieldName = aFieldMapIter->first;
+           const VISU::TField& aField = aFieldMapIter->second;
+           const VISU::TField::TValField& aValField = aField.myValField;
+           aComment.sprintf("myComment=FIELD;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+                            VISU::TFIELD,myName.c_str(),aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
+           string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
+                                                 "",aFieldName.c_str(),"",aComment.latin1(),true);
+           CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
+           VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+           for(; aValFieldIter != aValField.end(); aValFieldIter++){
+             int aTimeStamp = aValFieldIter->first;
+             const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
+             aComment.sprintf("myComment=TIMESTAMP;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                              VISU::TTIMESTAMP,myName.c_str(),aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
+             string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
+             CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
+                              "",aTimeStampId.c_str(),"",aComment.latin1(),true);
+           }
          }
        }
       }
     }
-  }
-  return this;
-}
-
-VISU::Storable* VISU::Result_i::Create(const char* theFileName){
-  try{
-    mySourceId = eFile;
-    myInput = CreateConvertor(theFileName);
-    if(myInput == NULL) return NULL;
-    myFileInfo.setFile(theFileName);
-    myName = ::GenerateName(myFileInfo.fileName().latin1());
-    return Build();
+    return this;
   }catch(std::runtime_error& exc){
     MESSAGE("Follow exception was accured :\n"<<exc.what());
   }catch(...){
@@ -253,22 +231,46 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){
   return NULL;
 }
 
-VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
-  if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from theMedSObject");
-  try{
-    mySourceId = eComponent;
-    myInput = CreateMEDConvertor(theMedSObject);
-    if(myInput == NULL) return NULL;
-    string aCompDataType = GetComponentDataType(theMedSObject);
-    myFileInfo.setFile(aCompDataType.c_str());
-    myName = ::GenerateName("aResult");
-    return Build(theMedSObject);
-  }catch(std::runtime_error& exc){
-    MESSAGE("Follow exception was accured :\n"<<exc.what());
-  }catch(...){
-    MESSAGE("Unknown exception was accured!");
-  }
-  return NULL;
+VISU::Storable* VISU::Result_i::Create(const char* theFileName){
+  myIsRestored = 0;
+  myInput = CreateConvertor(theFileName);
+  if(myInput == NULL) return NULL;
+  myFileInfo.setFile(theFileName);
+  myName = ::GenerateName(myFileInfo.fileName().latin1());
+  return Build();
+}
+
+VISU::Storable* VISU::Result_i::Create(SALOME_MED::MESH_ptr theMesh){
+  if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from Mesh");
+  VISU_MedMeshConvertor* aInput = new VISU_MedMeshConvertor();
+  aInput->SetMedMesh(theMesh);
+  myInput = aInput;
+  //if(myInput->GetOutput() == NULL) return NULL;
+  TMeshMap::const_iterator aMeshMapIter = myInput->GetMeshMap()->begin();
+  myName = ::GenerateName((aMeshMapIter->first).c_str());
+  return Build();
+}
+
+VISU::Storable* VISU::Result_i::Create(SALOME_MED::SUPPORT_ptr theSupport){
+  if(MYDEBUG)  MESSAGE("Result_i::Create Mesh from MED::SUPPORT");
+  VISU_CorbaMedSupportConvertor* aInput = new VISU_CorbaMedSupportConvertor();
+  aInput->SetSupport(theSupport);
+  myInput = aInput;
+  //if(myInput->GetOutput() == NULL) return NULL;
+  TMeshMap::const_iterator aMeshMapIter = myInput->GetMeshMap()->begin();
+  myName = ::GenerateName((aMeshMapIter->first).c_str());
+  return Build();
+}
+
+VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
+  if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from Field");
+  VISU_CorbaMedConvertor* aInput = new VISU_CorbaMedConvertor();
+  aInput->SetMedField(theField);
+  myInput = aInput;
+  //if(myInput->GetOutput() == NULL) return NULL;
+  TMeshMap::const_iterator aMeshMapIter = myInput->GetMeshMap()->begin();
+  myName = ::GenerateName((aMeshMapIter->first).c_str());
+  return Build();
 }
 
 VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, 
@@ -277,55 +279,31 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
 {
   if(MYDEBUG)  MESSAGE("Result_i::Restore - "<<thePrefix);
   try{
+    myIsRestored = 1;
     mySObject = SALOMEDS::SObject::_duplicate(theSObject);
     myStudyDocument = mySObject->GetStudy();
     mySComponent = mySObject->GetFatherComponent();
     myName = VISU::Storable::FindValue(theMap,"myName");
-    SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
-    if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
-      mySourceId = eRestoredComponent;
-      if(MYDEBUG)  MESSAGE("Result_i::GetInput - There is some reference.");
-      SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
-      CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
-      myFileInfo.setFile(aDataType.in());
-      if(MYDEBUG)  MESSAGE("Result_i::GetInput - aDataType = "<<aDataType);
-      Engines::Component_var aEngComp = Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
-      if (CORBA::is_nil(aEngComp)) 
-       throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
-      SALOMEDS::StudyBuilder_var  aStudyBuilder = myStudyDocument->NewBuilder();
-      SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
-      aStudyBuilder->LoadWith(aCompRefSObj,aDriver);
-      if(strcmp(aDataType,"Med") == 0){
-       myInput = CreateMEDConvertor(aTargetRefSObj);
-      }else
-       throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
-    }else{
-      mySourceId = eRestoredFile;
-      myFileInfo.setFile(thePrefix.c_str());
-      string aStudyPrefix(SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
-      string aTmpDir(SALOMEDS_Tool::GetDirFromPath(myStudyDocument->URL()));
-      if(!myFileInfo.isFile()){
-       string aFileName = thePrefix + aStudyPrefix + "_" + myName;  
-       myFileInfo.setFile(aFileName.c_str());
-      }
-      if(MYDEBUG)  
-       MESSAGE("Result_i::Restore - aFileName = "<<myFileInfo.filePath()<<"; "<<myFileInfo.isFile());
-      myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
-      QString aComment;
-      aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
-                      GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
-      SALOMEDS::GenericAttribute_var anAttr;
-      if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
-       throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
-      SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
-      aCmnt->SetValue(aComment.latin1());
-      // remove temporary file, if it's not multifile mode
-      if (false || !IsMultifile()) {
-       SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
-       aSeq->length(1);
-       aSeq[0]=(aStudyPrefix + myName).c_str();
-       SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
-      }
+    string aFileName(thePrefix);
+    string aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL());
+    aFileName += aStudyPrefix + "_" + myName;
+    if(MYDEBUG)  MESSAGE("Result_i::Restore - aFileName = "<<aFileName);
+    myFileInfo.setFile(aFileName.c_str());
+    myInput = CreateMedConvertor(aFileName);
+    QString aComment;
+    aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
+                    GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
+    SALOMEDS::GenericAttribute_var anAttr;
+    if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
+       throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
+    SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+    aCmnt->SetValue(aComment.latin1());
+    // remove temporary file, if it's not multifile mode
+    if (false || !IsMultifile()) {
+      SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+      aSeq->length(1);
+      aSeq[0]=(aStudyPrefix + myName).c_str();
+      SALOMEDS_Tool::RemoveTemporaryFiles(thePrefix.c_str(), aSeq.in(), true);
     }
     return this;
   }catch(std::runtime_error& exc){
@@ -336,10 +314,6 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
   return NULL;
 }
 
-VISU::Result_i::InputType* VISU::Result_i::GetInput() { 
-  return myInput;
-}
-
 void VISU::Result_i::ToStream(ostrstream& theStr){
   if(MYDEBUG) MESSAGE(GetComment());
   Storable::DataToStream(theStr,"myName",myName.c_str());
index 441e82606c1debd69f8aa14d03de9f161cc732eb..4b5a30b1789b1997d3ed1902d47c4ac2e65179f4 100644 (file)
@@ -28,28 +28,28 @@ namespace VISU{
 
     typedef VISU_Convertor InputType;
     typedef vtkUnstructuredGridReader OutputType;
-    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
   private:
-    TSourceId mySourceId;
     InputType *myInput;
     string myName;
     QFileInfo myFileInfo;
+    int myIsRestored;
   protected:
-    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = NULL) 
-      throw (std::runtime_error&);
+    virtual Storable* Build();
   public:
     virtual Storable* Create(const char* theFileName);
-    virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
+    virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
+    virtual Storable* Create(SALOME_MED::MESH_ptr theMesh);
+    virtual Storable* Create(SALOME_MED::SUPPORT_ptr theSupport);
     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
                              const string& thePrefix, const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
     virtual void ToStream(ostrstream& theStr);
     virtual const char* GetComment() const;
     static const string myComment;
-    InputType* GetInput();
-    const string& GetName() const { return myName;}
+    InputType* GetInput() { return myInput;}
+    const char* GetName() const { return myName.c_str();}
     const QFileInfo& GetFileInfo() const { return myFileInfo;}
-    Result_i::TSourceId GetSourceId() const { return mySourceId;}
+    int IsRestored() const { return myIsRestored;}
   private:
     SALOMEDS::SObject_var mySObject;
     SALOMEDS::Study_var myStudyDocument;
index ba5dda37ea392f8b3694d63bd2892dc1f9b6b36a..1aba7769853f9f8acfc4b4e79796a825a25071fc 100644 (file)
@@ -886,8 +886,6 @@ int getLine(ifstream& theStmIn, QString& theString){
 
 void ImportTables(const char* theFileName, TTableCont& theTableCont){
   ifstream aStmIn;
-  QFileInfo aFileInfo(theFileName);
-  if(!aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size()) return;
   aStmIn.open(theFileName);
   QString aTmp;
   do{
index f475f1a574fdbee9726d586ea2fa02294eeb88a9..2f481591b55937cacd8835f62cb67f5efcdeb686 100644 (file)
@@ -385,6 +385,7 @@ void VISU_TimeAnimation::run() {
        aName.replace(aPos, 1, "_");
       aFile += aName;
       aFile += ".jpeg";
+      //cout<<"### save:"<<aFile<<endl;
       px.save(aFile, "JPEG");
     }
     qApp->unlock();
index f7d2de23da26d4f4dfda7d7023b92511741b34bf..82df8ba5a0379bd1a32cd58060f742c654d3e109 100644 (file)
@@ -767,7 +767,7 @@ namespace VISU{
          string aComm(aString);
          if(MYDEBUG)  MESSAGE("View3D_i::SaveViewPoint - aComm = "<<aComm);
          if(aComm.compare(View3D_i::myComment) >= 0){
-           aCmnt->SetValue(ToString().c_str());
+           aCmnt->SetValue(ToString());
            return 1;
          }
        }
@@ -781,7 +781,7 @@ namespace VISU{
     SALOMEDS::SComponent_var aSComponent = 
       FindOrCreateVisuComponent(myStudy->getStudyDocument());
     CORBA::String_var aSComponentEntry = aSComponent->GetID(), anIOR(GetID());
-    string anEntry = CreateAttributes(myStudy->getStudyDocument(),aSComponentEntry,"","",newName.latin1(),"",ToString().c_str());
+    string anEntry = CreateAttributes(myStudy->getStudyDocument(),aSComponentEntry,"","",newName.latin1(),"",ToString());
     return 1;
   }
 
@@ -1108,23 +1108,14 @@ namespace VISU{
          vtkTransformPolyDataFilter *aTransformFilter = vtkTransformPolyDataFilter::New();
          aTransformFilter->SetInput ( mapper->GetInput() );
          aTransformFilter->SetTransform (aTransform);
-
          //create new mapper
-         vtkMapper* aIMapper = pSA->GetInitialMapper();
-         if ((aIMapper != NULL) && aIMapper->IsA("vtkDataSetMapper")) {
-           vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
-           aMapper->SetInput (aTransformFilter->GetOutput());
-           aMapper->ShallowCopy ( actor->GetMapper());
-           actor->SetMapper (aMapper);
-           aMapper->Delete();
-         } else {
-           vtkPolyDataMapper *aMapper = vtkPolyDataMapper::New();
-           aMapper->SetInput (aTransformFilter->GetOutput());
-           aMapper->ShallowCopy ( actor->GetMapper());
-           actor->SetMapper (aMapper);
-           aMapper->Delete();
-         }
+         vtkPolyDataMapper *aMapper = vtkPolyDataMapper::New();
+         aMapper->SetInput (aTransformFilter->GetOutput());
+         aMapper->ShallowCopy ( actor->GetMapper());
+         //set new mapper
+         actor->SetMapper (aMapper);
          aTransformFilter->Delete();
+         aMapper->Delete();
          changed = true;
        }
       }