]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Add field interpolation to GUI
authorCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Oct 2014 10:04:06 +0000 (12:04 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Oct 2014 10:04:06 +0000 (12:04 +0200)
22 files changed:
idl/MEDDataManager.idl
src/MEDOP/cmp/CMakeLists.txt
src/MEDOP/cmp/MEDDataManager_i.cxx
src/MEDOP/cmp/MEDDataManager_i.hxx
src/MEDOP/gui/DatasourceController.cxx
src/MEDOP/gui/DatasourceController.hxx
src/MEDOP/gui/MED_images.ts
src/MEDOP/gui/MED_msg_en.ts
src/MEDOP/gui/MED_msg_fr.ts
src/MEDOP/gui/XmedConsoleDriver.cxx
src/MEDOP/gui/dialogs/CMakeLists.txt
src/MEDOP/gui/dialogs/DlgChangeUnderlyingMesh.ui
src/MEDOP/gui/dialogs/DlgInterpolateField.cxx [new file with mode: 0644]
src/MEDOP/gui/dialogs/DlgInterpolateField.hxx [new file with mode: 0644]
src/MEDOP/gui/dialogs/DlgInterpolateField.ui [new file with mode: 0644]
src/MEDOP/gui/dialogs/GenericDialog.ui
src/MEDOP/res/CMakeLists.txt
src/MEDOP/res/datasource_interpolateField.png [new file with mode: 0644]
src/MEDOP/res/testfiles/smooth_surface.med [new file with mode: 0644]
src/MEDOP/res/testfiles/smooth_surface_and_field.med [new file with mode: 0644]
src/MEDOP/tui/xmedpy/driver_pvis.py
src/MEDOP/tui/xmedpy/fieldtools.py

index ce12020183c42c7354c25da547ed31a1f8f3381f..51be0e61f92a7a762af3cb2b8d59ab586d179c1a 100644 (file)
@@ -50,7 +50,7 @@ module MEDOP
    * point that aggregate a list of fields that relie on the same mesh
    * with the same type (the fields in a timeseries differ by their
    * time step).
-   * 
+   *
    * Then you could have a field with no fieldseries associated but
    * directly associated to a mesh. That is typically the case of
    * fields created by MED operations: if you operate tow fields
@@ -101,9 +101,18 @@ module MEDOP
   typedef sequence<FieldHandler> FieldHandlerList;
   typedef sequence<long> FieldIdList;
 
+  struct InterpolationParameters {
+    double precision;
+    double defaultValue;
+    boolean reverse;
+    string method;
+    string nature;
+    string intersectionType;
+  };
+
   interface MEDDataManager: SALOME::GenericObj
   {
-    
+
     //==========================================================
     // Datasource management
     //==========================================================
@@ -112,7 +121,7 @@ module MEDOP
     //==========================================================
     // Mesh data management
     //==========================================================
-    
+
     MeshHandler     getMesh(in long meshId) raises (SALOME::SALOME_Exception);
     MeshHandlerList getMeshList(in long datasourceId);
 
@@ -136,16 +145,19 @@ module MEDOP
 
 
     void updateFieldMetadata(in long   fieldHandlerId,
-                            in string fieldname,
-                            in long   iteration,
-                            in long   order,
-                            in string source);
+                             in string fieldname,
+                             in long   iteration,
+                             in long   order,
+                             in string source);
 
     //void saveFields(in FieldHandlerList fieldHandlerList, in string filepath);
 
     void changeUnderlyingMesh(in long fieldHandlerId, in long meshHandlerId)
       raises (SALOME::SALOME_Exception);
-    
+
+    FieldHandler interpolateField(in long fieldHandlerId, in long meshHandlerId, in InterpolationParameters params)
+      raises (SALOME::SALOME_Exception);
+
     //==========================================================
     // General purpose data management
     //==========================================================
index 2849b66eb9332c12141b8c4c77dc496a3e151e6b..f55ccecbd7cfc397376fa1530bd667f20f961cb5 100644 (file)
@@ -47,9 +47,10 @@ SET(COMMON_LIBS
   ${KERNEL_SalomeKernelHelpers}
   ${KERNEL_SalomeLifeCycleCORBA}
   ${KERNEL_SALOMELocalTrace}
-  ${KERNEL_SALOMEBasics} 
+  ${KERNEL_SALOMEBasics}
   ${KERNEL_SalomeGenericObj}
   medcoupling
+  medcouplingremapper
   interpkernel
   ${MEDFILE_C_LIBRARIES}
   ${HDF5_LIBRARIES}
@@ -57,7 +58,7 @@ SET(COMMON_LIBS
   ${PLATFORM_LIBRARIES}
 )
 
-# This undefines the macros MIN and MAX which are specified in the windows headers 
+# This undefines the macros MIN and MAX which are specified in the windows headers
 IF(WIN32)
   SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOMINMAX")
 ENDIF(WIN32)
index efd9b7af671521c433fc0f4b7199659a9cf5f74e..66115b4226cf8a8ffd68e3c269546b044db52647 100644 (file)
@@ -79,7 +79,7 @@ std::string MEDDataManager_i::source_to_file(const char * source)
  */
 MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath) {
 
-  // We first check that this datasource is not already registered  
+  // We first check that this datasource is not already registered
   long sourceid = getDatasourceId(filepath);
   if ( sourceid != LONG_UNDEFINED ) {
     // The file is already registered under the identifier sourceid
@@ -121,7 +121,7 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath)
     for (int iField = 0; iField < nbOfFields; iField++) {
       const char * fieldName = fieldNames[iField].c_str();
       LOG("-- name of field " << iField << " = " << fieldName);
-      
+
       // A field name could identify several MEDCoupling fields, that
       // differ by their spatial discretization on the mesh (values on
       // cells, values on nodes, ...). This spatial discretization is
@@ -186,13 +186,13 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath)
       }
     }
   }
-  
+
   return new MEDOP::DatasourceHandler(*datasourceHandler);
 }
 
 long MEDDataManager_i::getDatasourceId(const char *filepath) {
   std::string uri(file_to_source(filepath));
-  DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin();  
+  DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin();
   while ( it != _datasourceHandlerMap.end() ) {
     if ( strcmp(it->second->uri,uri.c_str()) == 0 ) {
       return it->first;
@@ -268,7 +268,7 @@ MEDOP::FieldseriesHandlerList * MEDDataManager_i::getFieldseriesListOnMesh(CORBA
 
 /*!
  * A fieldseries is a timeseries of fields. Then the list of fields is
- * the different time iterations defined for the specified field id.  
+ * the different time iterations defined for the specified field id.
  */
 MEDOP::FieldHandlerList * MEDDataManager_i::getFieldListInFieldseries(CORBA::Long fieldseriesId) {
 
@@ -359,32 +359,32 @@ void MEDDataManager_i::saveFields(const char * filepath,
   if ( fieldIdList.length() == 0 ) {
     throw KERNEL::createSalomeException("No fields to save");
   }
-  
+
   // Consider the first field to initiate the med file
   CORBA::Long fieldHandlerId = fieldIdList[0];
   MEDOP::FieldHandler * fieldHandler = getFieldHandler(fieldHandlerId);
-  MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);  
+  MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);
 
   try {
     bool writeFromScratch = true;
     MEDLoader::WriteField(filepath, fieldDouble, writeFromScratch);
-    
+
     writeFromScratch = false;
     for(CORBA::ULong i=1; i<fieldIdList.length(); i++) {
       fieldHandlerId = fieldIdList[i];
       fieldHandler = getFieldHandler(fieldHandlerId);
-      fieldDouble = getFieldDouble(fieldHandler);  
+      fieldDouble = getFieldDouble(fieldHandler);
       MEDLoader::WriteField(filepath, fieldDouble, writeFromScratch);
     }
   }
   catch (INTERP_KERNEL::Exception &ex) {
-    std::string message = 
+    std::string message =
       std::string("Error when saving file ") +
       std::string(filepath) + std::string(" : ") + ex.what();
     throw KERNEL::createSalomeException(message.c_str());
   }
   catch (const std::exception& ex) {
-    std::string message = 
+    std::string message =
       std::string("Error when saving file ") +
       std::string(filepath) + std::string(" : ") + ex.what();
     throw KERNEL::createSalomeException(message.c_str());
@@ -414,21 +414,21 @@ void MEDDataManager_i::savePersistentFields(const char * filepath) {
       listId.push_back(mapIt->first);
     }
   }
-  
+
   MEDOP::FieldIdList fieldIdList;
   fieldIdList.length(listId.size());
   for (int i=0; i<listId.size(); i++) {
     fieldIdList[i] = CORBA::Long(listId[i]);
   }
-  
+
   try {
     this->saveFields(filepath, fieldIdList);
-  } 
+  }
   catch (const SALOME::SALOME_Exception & ex) {
     throw ex;
   }
   catch (const std::exception& ex) {
-    std::string message = 
+    std::string message =
       std::string("Error when saving file ") +
       std::string(filepath) + std::string(" : ") + ex.what();
     throw KERNEL::createSalomeException(message.c_str());
@@ -501,16 +501,16 @@ MEDCouplingUMesh * MEDDataManager_i::getUMesh(long meshHandlerId) {
     myMesh = _meshMap[meshHandlerId];
   } else {
     // The mesh is not loaded yet ==> load it and register it in the map
-    LOG("getUMesh: the mesh must be loaded. meshid="<<meshHandlerId);    
+    LOG("getUMesh: the mesh must be loaded. meshid="<<meshHandlerId);
     if ( _meshHandlerMap[meshHandlerId] == NULL ) {
-      std::string message = 
+      std::string message =
   std::string("No mesh for id=") + ToString(meshHandlerId);
       LOG("getUMesh: "<<message);
       throw KERNEL::createSalomeException(message.c_str());
     }
 
     long sourceid = _meshHandlerMap[meshHandlerId]->sourceid;
-    std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));  
+    std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));
     const char * meshName = _meshHandlerMap[meshHandlerId]->name;
     int meshDimRelToMax = 0;
     myMesh = MEDLoader::ReadUMeshFromFile(filepath,meshName,meshDimRelToMax);
@@ -525,7 +525,7 @@ MEDCouplingUMesh * MEDDataManager_i::getUMesh(long meshHandlerId) {
  */
 long MEDDataManager_i::getUMeshId(const MEDCouplingMesh * mesh) {
   bool found = false;
-  MeshMapIterator it = _meshMap.begin();  
+  MeshMapIterator it = _meshMap.begin();
   while ( it != _meshMap.end() ) {
     found = (it->second == mesh);
     if (found) {
@@ -625,7 +625,7 @@ MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldD
   // variables are updated by this function call. This is the mean to
   // retrieve the iteration and order of the field.
   double timestamp = fieldDouble->getTime(iteration, order);
-  
+
   // For the fields that are created in memory (by operations for
   // example), the convention for the source attribute is to specify
   // the fielddouble name, because this name describes the operation
@@ -659,13 +659,13 @@ MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldD
   else {
     fieldHandler->meshid = meshHandlerId;
   }
-  
+
   _fieldHandlerMap[fieldHandler->id] = fieldHandler;
   _fieldDoubleMap[fieldHandler->id] = fieldDouble;
   // >>> WARNING: CORBA structure assignement specification ==> return
   // >>> a deep copy to avoid the destruction of the fieldHandler
   // >>> registered in the map (assignement acts as a destructor for
-  // >>> CORBA struct).   
+  // >>> CORBA struct).
   return new MEDOP::FieldHandler(*fieldHandler);
 }
 
@@ -700,7 +700,7 @@ void MEDDataManager_i::updateFieldMetadata(CORBA::Long  fieldHandlerId,
  * new mesh is not identical to the old one.
  */
 void MEDDataManager_i::changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId) {
-  
+
   MEDOP::FieldHandler * fieldHandler = getFieldHandler(fieldHandlerId);
   MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);
   MEDCouplingMesh * newMesh = getUMesh(meshHandlerId);
@@ -724,6 +724,92 @@ void MEDDataManager_i::changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::L
   // synchronized
 }
 
+INTERP_KERNEL::IntersectionType MEDDataManager_i::_getIntersectionType(const char* intersType) {
+  std::string type(intersType);
+  if (type == "Triangulation") {
+    return INTERP_KERNEL::Triangulation;
+  }
+  else if (type == "Convex") {
+    return INTERP_KERNEL::Convex;
+  }
+  else if (type == "Geometric2D") {
+    return INTERP_KERNEL::Geometric2D;
+  }
+  else if (type == "PointLocator") {
+    return INTERP_KERNEL::PointLocator;
+  }
+  else if (type == "Barycentric") {
+    return INTERP_KERNEL::Barycentric;
+  }
+  else if (type == "BarycentricGeo2D") {
+    return INTERP_KERNEL::BarycentricGeo2D;
+  }
+
+  std::string message("Error when trying to interpolate field: ");
+  message.append("Unrecognized intersection type: ");
+  message.append(type);
+  throw KERNEL::createSalomeException(message.c_str());
+}
+
+ParaMEDMEM::NatureOfField MEDDataManager_i::_getNatureOfField(const char* fieldNature) {
+  std::string nature(fieldNature);
+  if (nature == "NoNature") {
+    return NoNature;
+  }
+  else if (nature == "ConservativeVolumic") {
+    return ConservativeVolumic;
+  }
+  else if (nature == "Integral") {
+    return Integral;
+  }
+  else if (nature == "IntegralGlobConstraint") {
+    return IntegralGlobConstraint;
+  }
+  else if (nature == "RevIntegral") {
+    return RevIntegral;
+  }
+
+  std::string message("Error when trying to interpolate field: ");
+  message.append("Unrecognized field nature: ");
+  message.append(nature);
+  throw KERNEL::createSalomeException(message.c_str());
+}
+
+MEDOP::FieldHandler* MEDDataManager_i::interpolateField(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId, const MEDOP::InterpolationParameters& params) {
+  MEDOP::FieldHandler* fieldHandler = getFieldHandler(fieldHandlerId);
+  MEDCouplingFieldDouble* sourceField = getFieldDouble(fieldHandler);
+  MEDCouplingMesh* sourceMesh = getUMesh(fieldHandler->meshid);
+  MEDCouplingMesh* targetMesh = getUMesh(meshHandlerId);
+
+  double precision = params.precision;
+  INTERP_KERNEL::IntersectionType interpType = this->_getIntersectionType(params.intersectionType);
+  std::string method(params.method);
+  double defaultValue = params.defaultValue;
+  bool reverse = params.reverse;
+  ParaMEDMEM::NatureOfField nature = this->_getNatureOfField(params.nature);
+
+  // 1. Build remapper between sourceMesh and targetMesh (compute interpolation matrix)
+  MEDCouplingRemapper remapper;
+  remapper.setPrecision(precision);
+  remapper.setIntersectionType(interpType);
+  remapper.prepare(sourceMesh, targetMesh, method.c_str());
+
+  // 2. Apply interpolation to the field
+  sourceField->setNature(nature);
+  MEDCouplingFieldDouble* targetField = NULL;
+  if (reverse) {
+    targetField = remapper.reverseTransferField(sourceField, defaultValue);
+  } else {
+    targetField = remapper.transferField(sourceField, defaultValue);
+  }
+  targetField->setMesh(targetMesh);
+  targetField->setName(targetMesh->getName() + "_field");
+
+  // 3. Create and register field handler
+  MEDOP::FieldHandler* fieldResultHandler = this->addField(targetField, this->getUMeshId(targetField->getMesh()));
+  return fieldResultHandler;
+}
+
 
 
 /*!
@@ -731,7 +817,7 @@ void MEDDataManager_i::changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::L
  * the server side (data in the SALOME container).
  */
 void MEDDataManager_i::serverlog() {
-  
+
   LOG("==== Field Handler Map ====================================================");
   LOG("Size = "<<_fieldHandlerMap.size());
   FieldHandlerMapIterator fhmIt;
index 8a04315adab52eb402407deb7a7cd8c2ed0d33c1..96820420cb7035b597c5ebaf1e035bee438a5fa1 100644 (file)
@@ -26,6 +26,7 @@
 #include CORBA_SERVER_HEADER(MEDDataManager)
 #include "SALOME_GenericObj_i.hh"
 
+#include "MEDCouplingRemapper.hxx"
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 using namespace ParaMEDMEM;
@@ -61,7 +62,7 @@ class MEDOP_EXPORT MEDDataManager_i: public POA_MEDOP::MEDDataManager,
 {
 public:
 
-  // 
+  //
   // ===========================================================
   // Functions specified in the IDL interface
   // ===========================================================
@@ -73,7 +74,7 @@ public:
   // -----------------------------------------------------------
   // Mesh management
   MEDOP::MeshHandlerList * getMeshList(CORBA::Long datasourceId);
-  MEDOP::MeshHandler * getMesh(CORBA::Long meshId); 
+  MEDOP::MeshHandler * getMesh(CORBA::Long meshId);
 
   // -----------------------------------------------------------
   // Field management
@@ -97,13 +98,14 @@ public:
          const char * source);
 
   void changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId);
+  MEDOP::FieldHandler* interpolateField(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId, const MEDOP::InterpolationParameters& params);
 
   void   setEventListenerIOR(const char * ior);
   char * getEventListenerIOR();
 
   void serverlog();
 
-  // 
+  //
   // ===========================================================
   // Other public functions (non available via CORBA)
   // ===========================================================
@@ -155,6 +157,10 @@ private:
 
   MEDCouplingUMesh * getUMesh(long meshHandlerId);
   long getUMeshId(const MEDCouplingMesh * mesh);
+
+  INTERP_KERNEL::IntersectionType _getIntersectionType(const char* intersType);
+  ParaMEDMEM::NatureOfField _getNatureOfField(const char* fieldNature);
+
 };
 
 #endif // _MED_DATAMANAGER_I_HXX_
index 414431bf44ef674ef469042e7c83ef5210427cb7..ca0d90b6da46dc9c394882b0b2f8215065d289f6 100644 (file)
@@ -44,11 +44,15 @@ DatasourceController::DatasourceController(StandardApp_Module * salomeModule) {
   STDLOG("Creating a DatasourceController");
   _salomeModule = salomeModule;
   _studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp());
-  _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
 
+  _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
   connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
           this, SLOT(OnChangeUnderlyingMeshInputValidated()));
 
+  _dlgInterpolateField = new DlgInterpolateField(_studyEditor);
+  connect(_dlgInterpolateField,SIGNAL(inputValidated()),
+          this, SLOT(OnInterpolateFieldInputValidated()));
+
 }
 
 DatasourceController::~DatasourceController() {
@@ -106,6 +110,11 @@ void DatasourceController::createActions() {
   actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon);
   _salomeModule->addActionInPopupMenu(actionId);
 
+  label = tr("LAB_INTERPOLATE_FIELD");
+  icon  = tr("ICO_DATASOURCE_INTERPOLATE_FIELD");
+  actionId = _salomeModule->createStandardAction(label,this,SLOT(OnInterpolateField()),icon);
+  _salomeModule->addActionInPopupMenu(actionId);
+
 }
 
 /**
@@ -348,6 +357,13 @@ void DatasourceController::OnUseInWorkspace() {
     MEDOP::FieldHandler * fieldHandler =
       MEDOPFactoryClient::getDataManager()->getFieldHandler(fieldId);
 
+    if (! fieldHandler) {
+      QMessageBox::warning(_salomeModule->getApp()->desktop(),
+         tr("Operation not allowed"),
+         tr("No field is defined"));
+      return;
+    }
+
     QString alias(fieldHandler->fieldname);
     DlgAlias dialog;
     dialog.setAlias(alias);
@@ -406,7 +422,6 @@ void DatasourceController::OnUseInWorkspace() {
   }
 }
 
-
 void DatasourceController::OnChangeUnderlyingMesh() {
   // We need a studyEditor updated on the active study
   _studyEditor->updateActiveStudy();
@@ -456,6 +471,79 @@ void DatasourceController::OnChangeUnderlyingMeshInputValidated() {
 
   // Tag the item to prevent double import
   //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+}
+
+void DatasourceController::OnInterpolateField() {
+  // We need a studyEditor updated on the active study
+  _studyEditor->updateActiveStudy();
+
+  // Get the selected objects in the study (SObject). In case of a
+  // multiple selection, we consider only the first item. At least one
+  // item must be selected.
+  SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
+  if ( listOfSObject->size() > 0 ) {
+    SALOMEDS::SObject_var soField = listOfSObject->at(0);
+    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    // _GBO_ : the dialog should not be modal, so that we can choose a
+    // mesh in the browser. Then we have to emit a signal from the
+    // dialog.accept, connected to a slot of the DatasourceControler
+    _dlgInterpolateField->setFieldId(fieldId);
+    Qt::WindowFlags flags = _dlgInterpolateField->windowFlags();
+    _dlgInterpolateField->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
+    _dlgInterpolateField->open();
+  }
+}
+
+void DatasourceController::OnInterpolateFieldInputValidated() {
+  MEDOP::InterpolationParameters params;
+  params.precision = _dlgInterpolateField->getPrecision();
+  STDLOG("precision = " << params.precision);
+  params.defaultValue = _dlgInterpolateField->getDefaultValue();
+  STDLOG("defaultValue = " << params.defaultValue);
+  params.reverse = _dlgInterpolateField->getReverse();
+  STDLOG("reverse = " << params.reverse);
+  params.intersectionType = _dlgInterpolateField->getIntersectionType().c_str();
+  STDLOG("intersectionType = " << params.intersectionType);
+  params.method = _dlgInterpolateField->getMethod().c_str();
+  STDLOG("method = " << params.method);
+  params.nature = _dlgInterpolateField->getFieldNature().c_str();
+  STDLOG("nature = " << params.nature);
+
+  int meshId = _dlgInterpolateField->getMeshId();
+  STDLOG("meshId = " << ToString(meshId));
+  int fieldId = _dlgInterpolateField->getFieldId();
+  MEDOP::FieldHandler* fieldHandler = MEDOPFactoryClient::getDataManager()->getFieldHandler(fieldId);
+
+  // We don't modify the original field but create first a duplicate
+  // MEDOP::FieldHandler* duplicate = MEDOPFactoryClient::getCalculator()->dup(*fieldHandler);
+  //MEDOPFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
+  MEDOP::FieldHandler* result = NULL;
+  try {
+    result = MEDOPFactoryClient::getDataManager()->interpolateField(fieldId, meshId, params);
+  }
+  catch(...) {
+    STDLOG("Unable to process field interpolation; please check interpolation parameters");
+    QMessageBox::critical(_salomeModule->getApp()->desktop(),
+                          tr("Operation failed"),
+                          tr("Unable to process field interpolation; please check interpolation parameters"));
+    return;
+  }
 
+  // Request once more the duplicate to update the meta-data on this
+  // client side
+  // duplicate = MEDOPFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
+
+  // >>>
+  // WARN: the following is a temporary code for test purpose
+  // Automatically add in ws
+  DatasourceEvent * event = new DatasourceEvent();
+  event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
+  XmedDataObject * dataObject = new XmedDataObject();
+  dataObject->setFieldHandler(*result);
+  event->objectdata = dataObject;
+  emit datasourceSignal(event);
+  // Note that this signal is processed by the WorkspaceController
 
+  // // Tag the item to prevent double import
+  // //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
 }
index 42c5b4eea2263e331e399190d60f9302e1b32fe9..f64ee4fcf0844d72647c496b7ade0c4eca6585a0 100644 (file)
@@ -17,7 +17,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-// Author : Guillaume Boulant (EDF) 
+// Author : Guillaume Boulant (EDF)
 
 #ifndef DATASOURCE_CONTROLLER_H
 #define DATASOURCE_CONTROLLER_H
@@ -31,6 +31,7 @@
 
 #include "XmedDataModel.hxx"
 #include "DlgChangeUnderlyingMesh.hxx"
+#include "DlgInterpolateField.hxx"
 #include "MEDOPGUI.hxx"
 //
 // The DatasourceController defines data structures and classes to
@@ -48,7 +49,7 @@
 // transmit an object AND an alias.
 typedef struct {
   enum EventType {
-    // 
+    //
     EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
     EVENT_USE_OBJECT,    // Import in the workspace AND define a proxy
                          // variable in the tui console to use it
@@ -77,6 +78,7 @@ public:
 public slots:
   // Callback connected to dialog box validation signals
   void OnChangeUnderlyingMeshInputValidated();
+  void OnInterpolateFieldInputValidated();
 
 signals:
   void datasourceSignal(const DatasourceEvent * event);
@@ -88,6 +90,7 @@ protected slots:
   void OnVisualize();
   void OnUseInWorkspace();
   void OnChangeUnderlyingMesh();
+  void OnInterpolateField();
 
 
 private:
@@ -95,6 +98,7 @@ private:
   SALOME_AppStudyEditor * _studyEditor;
 
   DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
+  DlgInterpolateField * _dlgInterpolateField;
 
 };
 
index 3b312eda6a91268c6e6bd6651917a46be2dfbeb4..62a6afbc578ea027e4926a9b0857305602e12328 100644 (file)
       <source>ICO_DATASOURCE_CHANGE_MESH</source>
       <translation>datasource_changeUnderlyingMesh.png</translation>
     </message>
+    <message>
+      <source>ICO_DATASOURCE_INTERPOLATE_FIELD</source>
+      <translation>datasource_interpolateField.png</translation>
+    </message>
     <message>
       <source>ICO_DATASOURCE_EXPAND_FIELD</source>
       <translation>datasource_expandfield.png</translation>
index 40c9b696124a372f4b358bf151f84f3ff0af8e8e..4008c8a7bce672bd4ab010ff80a470494400f095 100644 (file)
       <source>LAB_CHANGE_MESH</source>
       <translation>Change underlying mesh</translation>
     </message>
+    <message>
+      <location filename="MEDOP/gui/DatasourceController.cxx" line="113"/>
+      <source>LAB_INTERPOLATE_FIELD</source>
+      <translation>Interpolate field</translation>
+    </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="157"/>
       <source>IMPORT_MED_FIELDS</source>
       <translation>You must select a mesh in the explorer and clic the button Mesh</translation>
     </message>
   </context>
+  <context>
+    <name>DlgInterpolateField</name>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="391"/>
+      <source>SELECT_MESH</source>
+      <translation>You must select a mesh in the explorer and clic the button Mesh</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="406"/>
+      <source>TARGET_MESH_GT</source>
+      <translation>Target mesh -&gt;</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="423"/>
+      <source>MSG_EXPLORER</source>
+      <translation>(Explorer provides a view on MED data sources (mesh and fields) referenced in data space)</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="450"/>
+      <source>LABEL_PRECISION</source>
+      <translation>Interpolator precision</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="493"/>
+      <source>LABEL_INTERSECTION_TYPE</source>
+      <translation>Intersection type</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="520"/>
+      <source>LABEL_METHOD</source>
+      <translation>Interpolation method</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="547"/>
+      <source>LABEL_DEFAULT_VALUE</source>
+      <translation>Default value of resulting field</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="581"/>
+      <source>LABEL_REVERSE</source>
+      <translation>Reverse interpolation ?</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="612"/>
+      <source>LABEL_NATURE</source>
+      <translation>Field nature</translation>
+    </message>
+  </context>
   <context>
     <name>DlgImageToMed</name>
     <message>
index 9ba8ffcb76bab017c2d89bce838db45ffa955795..2254d05497fc8aac912d1dfbde46146a22f62448 100644 (file)
       <source>LAB_CHANGE_MESH</source>
       <translation>Changer le maillage sous-jacent</translation>
     </message>
+    <message>
+      <location filename="MEDOP/gui/DatasourceController.cxx" line="113"/>
+      <source>LAB_INTERPOLATE_FIELD</source>
+      <translation>Interpoler le champ</translation>
+    </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="157"/>
       <source>IMPORT_MED_FIELDS</source>
       <translation>Vous devez sélectionner un maillage dans l'explorateur et cliquer sur le bouton Maillage</translation>
     </message>
   </context>
+  <context>
+    <name>DlgInterpolateField</name>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="391"/>
+      <source>SELECT_MESH</source>
+      <translation>Vous devez sélectionner un maillage dans l'explorateur et cliquer sur le bouton Maillage</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="406"/>
+      <source>TARGET_MESH_GT</source>
+      <translation>Maillage cible -&gt;</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="423"/>
+      <source>MSG_EXPLORER</source>
+      <translation>(L'explorateur fournit une vue des données MED (maillage et champs) référencées dans l'espace des données)</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="450"/>
+      <source>LABEL_PRECISION</source>
+      <translation>Précision de l'interpolateur</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="493"/>
+      <source>LABEL_INTERSECTION_TYPE</source>
+      <translation>Type d'intersection</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="520"/>
+      <source>LABEL_METHOD</source>
+      <translation>Méthode d'interpolation</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="547"/>
+      <source>LABEL_DEFAULT_VALUE</source>
+      <translation>Valeur par défaut du champ résultant</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="581"/>
+      <source>LABEL_REVERSE</source>
+      <translation>Interpolation inverse ?</translation>
+    </message>
+    <message>
+      <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="612"/>
+      <source>LABEL_NATURE</source>
+      <translation>Nature du champ</translation>
+    </message>
+  </context>
   <context>
     <name>DlgImageToMed</name>
     <message>
index 99c0d7f30be5de164d5b54daf194d6ece497ce99..ab3217b3ffb7a205b93692f80fbbb38fcf82c108 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Guillaume Boulant (EDF) 
+// Author : Guillaume Boulant (EDF)
 
 #include "XmedConsoleDriver.hxx"
 #include "Utils_SALOME_Exception.hxx"
@@ -39,7 +39,7 @@ XmedConsoleDriver::XmedConsoleDriver(SalomeApp_Application * application) {
  * instructions are sent once.
  */
 void XmedConsoleDriver::setup() {
-  
+
   if ( !_importXmedDone ) {
     QStringList commands;
     // First import xmed to initialize the main objects, in particular
@@ -52,6 +52,11 @@ void XmedConsoleDriver::setup() {
     // A last one to clear the console screen
     //commands+="wipe";
 
+    // start PVServer and show render view
+    commands+="import pvsimple as pvs";
+    commands+="";
+    //commands+="pvs.ShowParaviewView()";
+
     this->exec(commands);
     _importXmedDone = true;
   }
index 7b550727b950b1354a08eac5be28640d7514c647..cad22cc20320887f9f7a42fa93a25c81f8b9be7a 100644 (file)
@@ -26,6 +26,7 @@ SET(MEDOPGUI_dialogs_FORMS
   DlgAlias.ui
   DlgUseInWorkspace.ui
   DlgChangeUnderlyingMesh.ui
+  DlgInterpolateField.ui
   DlgImageToMed.ui
 )
 QT4_WRAP_UI(MEDOPGUI_dialogs_FORMS_HEADERS ${MEDOPGUI_dialogs_FORMS})
@@ -35,6 +36,7 @@ SET(MEDOPGUI_dialogs_FILES
   DlgAlias.hxx
   DlgUseInWorkspace.hxx
   DlgChangeUnderlyingMesh.hxx
+  DlgInterpolateField.hxx
   DlgImageToMed.hxx
 )
 QT4_WRAP_CPP(MEDOPGUI_dialogs_HEADERS_MOC ${MEDOPGUI_dialogs_FILES})
@@ -55,12 +57,13 @@ SET(MEDOPGUI_dialogs_SOURCES
   DlgAlias.cxx
   DlgUseInWorkspace.cxx
   DlgChangeUnderlyingMesh.cxx
+  DlgInterpolateField.cxx
   DlgImageToMed.cxx
 )
 
 ADD_LIBRARY(MEDOPGUI_dialogs SHARED ${MEDOPGUI_dialogs_SOURCES} ${MEDOPGUI_dialogs_HEADERS_MOC} ${MEDOPGUI_dialogs_FORMS_HEADERS})
-TARGET_LINK_LIBRARIES(MEDOPGUI_dialogs ${CAS_KERNEL} ${QT_LIBRARIES} ${KERNEL_SalomeIDLKernel} 
-    ${GUI_SalomeGuiHelpers} ${OMNIORB_LIBRARIES} ${GUI_qtx} ${GUI_suit} ${PLATFORM_LIBRARIES} 
+TARGET_LINK_LIBRARIES(MEDOPGUI_dialogs ${CAS_KERNEL} ${QT_LIBRARIES} ${KERNEL_SalomeIDLKernel}
+    ${GUI_SalomeGuiHelpers} ${OMNIORB_LIBRARIES} ${GUI_qtx} ${GUI_suit} ${PLATFORM_LIBRARIES}
     ${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeKernelHelpers} ${GUI_SalomeGuiHelpers})
 INSTALL(TARGETS MEDOPGUI_dialogs DESTINATION ${SALOME_INSTALL_LIBS})
 
@@ -76,4 +79,3 @@ INSTALL(TARGETS dlgTester DESTINATION ${SALOME_INSTALL_BINS})
 
 FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
 INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
-
index cad5ce3cb3b9572d62ccf771df30f0aac52f8de9..f4bf310c5b1da09edd8c1e9c4d19598edde58249 100644 (file)
@@ -6,10 +6,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>479</width>
-    <height>429</height>
+    <width>420</width>
+    <height>350</height>
    </rect>
   </property>
+  <property name="minimumSize">
+   <size>
+    <width>420</width>
+    <height>350</height>
+   </size>
+  </property>
   <property name="windowTitle">
    <string>FORM</string>
   </property>
diff --git a/src/MEDOP/gui/dialogs/DlgInterpolateField.cxx b/src/MEDOP/gui/dialogs/DlgInterpolateField.cxx
new file mode 100644 (file)
index 0000000..1d49c90
--- /dev/null
@@ -0,0 +1,104 @@
+#include "DlgInterpolateField.hxx"
+#include "DatasourceConstants.hxx"
+
+#include <QString>
+#include <QMessageBox>
+#include <QDoubleValidator>
+
+DlgInterpolateField::DlgInterpolateField(SALOME_AppStudyEditor * studyEditor,
+             QDialog * parent)
+  : GenericDialog(parent)
+{
+  ui.setupUi(this->getPanel());
+  _meshId=-1;
+  _studyEditor = studyEditor;
+
+  QDoubleValidator* precisionValidator = new QDoubleValidator(1e-15, 1e-1, 1, this);
+  precisionValidator->setNotation(QDoubleValidator::ScientificNotation);
+  this->ui.lineEditPrecision->setValidator(precisionValidator);
+  this->ui.lineEditPrecision->setText("1e-12");
+
+  QDoubleValidator* defaultValueValidator = new QDoubleValidator(this);
+  this->ui.lineEditDefaultValue->setValidator(defaultValueValidator);
+  this->ui.lineEditDefaultValue->setText("0");
+
+  QStringList intersectionTypes;
+  intersectionTypes << "Triangulation" << "Convex" << "Geometric2D" << "PointLocator" << "Barycentric" << "BarycentricGeo2D";
+  this->ui.comboBoxIntersType->addItems(intersectionTypes);
+
+  QStringList methods;
+  methods << "P0P0" << "P0P1" << "P1P0" << "P1P1" << "P2P0";
+  this->ui.comboBoxMethod->addItems(methods);
+
+  QStringList natures;
+  natures << "NoNature" << "ConservativeVolumic" << "Integral" << "IntegralGlobConstraint" << "RevIntegral";
+  this->ui.comboBoxNature->addItems(natures);
+
+  connect(this->ui.btnSelectMesh, SIGNAL(clicked()), this, SLOT(OnSelectMesh()));
+  this->setWindowTitle("Field interpolation");
+  this->getPanel()->adjustSize();
+  this->adjustSize();
+}
+
+/** This reset the dialog for a new selection */
+void DlgInterpolateField::setFieldId(int fieldId) {
+  _fieldId = fieldId;
+  _meshId=-1;
+  this->ui.txtMesh->setText(QString(""));
+}
+int DlgInterpolateField::getFieldId() {
+  return _fieldId;
+}
+
+int DlgInterpolateField::getMeshId() {
+  return _meshId;
+}
+
+double DlgInterpolateField::getPrecision() {
+  return this->ui.lineEditPrecision->text().toDouble();
+}
+
+double DlgInterpolateField::getDefaultValue() {
+  return this->ui.lineEditDefaultValue->text().toDouble();
+}
+
+bool DlgInterpolateField::getReverse() {
+  return this->ui.checkBoxReverse->isChecked();
+}
+
+std::string DlgInterpolateField::getIntersectionType() {
+  return this->ui.comboBoxIntersType->currentText().toStdString();
+}
+
+std::string DlgInterpolateField::getMethod() {
+  return this->ui.comboBoxMethod->currentText().toStdString();
+}
+
+std::string DlgInterpolateField::getFieldNature() {
+  return this->ui.comboBoxNature->currentText().toStdString();
+}
+
+void DlgInterpolateField::accept() {
+  if ( _meshId == -1 ) {
+    QMessageBox::warning(this,
+       tr("Data verification"),
+       tr("You must select a mesh in the explorer and clic the button Mesh"));
+  }
+  else {
+    GenericDialog::accept();
+    emit inputValidated();
+  }
+}
+
+void DlgInterpolateField::OnSelectMesh() {
+  SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
+  if ( listOfSObject->size() > 0 ) {
+    SALOMEDS::SObject_var soMesh = listOfSObject->at(0);
+    // _GBO_ TODO: we should test here if it is a mesh (attribute in
+    // the sobject)
+    _meshId = _studyEditor->getParameterInt(soMesh,OBJECT_ID);
+    const char * meshname = _studyEditor->getName(soMesh);
+    this->ui.txtMesh->setText(QString(meshname));
+  }
+
+}
diff --git a/src/MEDOP/gui/dialogs/DlgInterpolateField.hxx b/src/MEDOP/gui/dialogs/DlgInterpolateField.hxx
new file mode 100644 (file)
index 0000000..b422099
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef _DlgInterpolateField_HXX
+#define _DlgInterpolateField_HXX
+
+#include <QtGui>
+#include "ui_DlgInterpolateField.h"
+#include "GenericDialog.hxx"
+
+#include <SALOME_AppStudyEditor.hxx>
+#include "MEDOPGUIdialogs.hxx"
+
+class MEDOPGUI_DIALOGS_EXPORT DlgInterpolateField : public GenericDialog
+{
+  Q_OBJECT
+
+public:
+  DlgInterpolateField(SALOME_AppStudyEditor * studyEditor, QDialog *parent = 0);
+
+  void setFieldId(int fieldId);
+  int getFieldId();
+  int getMeshId();
+
+  double getPrecision();
+  double getDefaultValue();
+  bool getReverse();
+  std::string getIntersectionType();
+  std::string getMethod();
+  std::string getFieldNature();
+
+signals:
+  void inputValidated();
+
+protected slots:
+  void OnSelectMesh();
+
+ private:
+  void accept();
+  int _meshId;
+
+  SALOME_AppStudyEditor * _studyEditor;
+  int _fieldId;
+
+  Ui_DlgInterpolateField ui; // instance of the class defined in ui_dlgInterpolateField.hxx
+};
+
+
+#endif // _DlgInterpolateField_HXX
diff --git a/src/MEDOP/gui/dialogs/DlgInterpolateField.ui b/src/MEDOP/gui/dialogs/DlgInterpolateField.ui
new file mode 100644 (file)
index 0000000..ea069b5
--- /dev/null
@@ -0,0 +1,655 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgInterpolateField</class>
+ <widget class="QWidget" name="DlgInterpolateField">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>550</width>
+    <height>450</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>550</width>
+    <height>450</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>FORM</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QLabel" name="lblHelp">
+         <property name="palette">
+          <palette>
+           <active>
+            <colorrole role="WindowText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Button">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Light">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Midlight">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Dark">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Mid">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>170</red>
+               <green>170</green>
+               <blue>170</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Text">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="BrightText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="ButtonText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Base">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Window">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="AlternateBase">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </active>
+           <inactive>
+            <colorrole role="WindowText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Button">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Light">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Midlight">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Dark">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Mid">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>170</red>
+               <green>170</green>
+               <blue>170</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Text">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="BrightText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="ButtonText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Base">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Window">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="AlternateBase">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </inactive>
+           <disabled>
+            <colorrole role="WindowText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Button">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Light">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Midlight">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Dark">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Mid">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>170</red>
+               <green>170</green>
+               <blue>170</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Text">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="BrightText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="ButtonText">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>127</red>
+               <green>127</green>
+               <blue>127</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Base">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Window">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="Shadow">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>0</red>
+               <green>0</green>
+               <blue>0</blue>
+              </color>
+             </brush>
+            </colorrole>
+            <colorrole role="AlternateBase">
+             <brush brushstyle="SolidPattern">
+              <color alpha="255">
+               <red>255</red>
+               <green>255</green>
+               <blue>255</blue>
+              </color>
+             </brush>
+            </colorrole>
+           </disabled>
+          </palette>
+         </property>
+         <property name="font">
+          <font>
+           <family>Sans Serif</family>
+           <italic>true</italic>
+          </font>
+         </property>
+         <property name="text">
+          <string>SELECT_MESH</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="spacing">
+          <number>7</number>
+         </property>
+         <item>
+          <widget class="QPushButton" name="btnSelectMesh">
+           <property name="text">
+            <string>TARGET_MESH_GT</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="txtMesh"/>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QLabel" name="lblInfo">
+         <property name="font">
+          <font>
+           <italic>true</italic>
+          </font>
+         </property>
+         <property name="text">
+          <string>MSG_EXPLORER</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_7">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>LABEL_PRECISION</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="lineEditPrecision">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>225</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_4">
+       <item>
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>LABEL_INTERSECTION_TYPE</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="comboBoxIntersType"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <item>
+        <widget class="QLabel" name="label_3">
+         <property name="text">
+          <string>LABEL_METHOD</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="comboBoxMethod"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_3">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_6">
+       <item>
+        <widget class="QLabel" name="label_4">
+         <property name="text">
+          <string>LABEL_DEFAULT_VALUE</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="lineEditDefaultValue">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_4">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_7">
+       <item>
+        <widget class="QLabel" name="label_5">
+         <property name="text">
+          <string>LABEL_REVERSE</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QCheckBox" name="checkBoxReverse">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_8">
+       <item>
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>LABEL_NATURE</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="comboBoxNature"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_6">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index c18fc4a69f6cff0ccfef91bb0c00a79e25cdc337..058f5bed76d183d58c6ba24b1757560b8153a2c0 100644 (file)
@@ -1,49 +1,62 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>GenericDialog</class>
- <widget class="QDialog" name="GenericDialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="GenericDialog">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>260</width>
+    <height>164</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
    <string>DIALOG</string>
   </property>
-  <layout class="QHBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
+  <layout class="QHBoxLayout">
+   <property name="spacing">
     <number>6</number>
    </property>
+   <property name="margin">
+    <number>9</number>
+   </property>
    <item>
-    <layout class="QVBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
+    <layout class="QVBoxLayout">
+     <property name="spacing">
       <number>6</number>
      </property>
+     <property name="margin">
+      <number>0</number>
+     </property>
      <item>
-      <widget class="QFrame" name="centralPanel" >
-       <property name="frameShape" >
+      <widget class="QFrame" name="centralPanel">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="frameShape">
         <enum>QFrame::StyledPanel</enum>
        </property>
-       <property name="frameShadow" >
+       <property name="frameShadow">
         <enum>QFrame::Raised</enum>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QDialogButtonBox" name="buttonBox" >
-       <property name="orientation" >
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="standardButtons" >
-        <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
        </property>
       </widget>
      </item>
    <receiver>GenericDialog</receiver>
    <slot>accept()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>248</x>
      <y>254</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>157</x>
      <y>274</y>
     </hint>
    <receiver>GenericDialog</receiver>
    <slot>reject()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>316</x>
      <y>260</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>286</x>
      <y>274</y>
     </hint>
index 2ce2792ea0677b5eead7cd09b800257ca3f3a7ab..60a339ea8821f614cb28eae5d34b3c3726d73ef6 100644 (file)
@@ -22,6 +22,7 @@ ADD_SUBDIRECTORY(testfiles)
 SET(MED_RESOURCES_FILES
   datasource_add.png
   datasource_changeUnderlyingMesh.png
+  datasource_interpolateField.png
   datasource_expandfield.png
   datasource_field.png
   datasource_mesh.png
@@ -37,4 +38,3 @@ SET(MED_RESOURCES_FILES
   workspace_save.png
   )
 INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
-
diff --git a/src/MEDOP/res/datasource_interpolateField.png b/src/MEDOP/res/datasource_interpolateField.png
new file mode 100644 (file)
index 0000000..97b7c97
Binary files /dev/null and b/src/MEDOP/res/datasource_interpolateField.png differ
diff --git a/src/MEDOP/res/testfiles/smooth_surface.med b/src/MEDOP/res/testfiles/smooth_surface.med
new file mode 100644 (file)
index 0000000..56d7e4d
Binary files /dev/null and b/src/MEDOP/res/testfiles/smooth_surface.med differ
diff --git a/src/MEDOP/res/testfiles/smooth_surface_and_field.med b/src/MEDOP/res/testfiles/smooth_surface_and_field.med
new file mode 100644 (file)
index 0000000..226ce3b
Binary files /dev/null and b/src/MEDOP/res/testfiles/smooth_surface_and_field.med differ
index 51f40e9b6dc67d997985cb10d1e320a7036c704d..e7ed30e0eca3aa937f0389b7c97220d121964066 100644 (file)
@@ -17,7 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author : Guillaume Boulant (EDF) 
+# Author : Guillaume Boulant (EDF)
 
 import MEDCoupling
 __mapTypeOfField2ParavisLabel={
@@ -39,7 +39,7 @@ def pvis_typeOfFieldLabel(typeOfField):
     try:
         return __mapTypeOfField2ParavisLabel[typeOfField]
     except IndexError, e:
-        return "UNCKNOWN"
+        return "UNKNOWN"
 
 def pvis_scalarmap(filename,meshname,fieldname,typeOfField,iteration=-1):
     """
@@ -47,22 +47,44 @@ def pvis_scalarmap(filename,meshname,fieldname,typeOfField,iteration=-1):
     load from a med file using the PARAVIS module.
     """
     import pvsimple
-    
+
     reader = pvsimple.MEDReader( FileName=filename )
-    # For fiels defined on cells, it seems to be required to specify
-    # the type of fields
+
+    representation = pvsimple.Show()
     if typeOfField == MEDCoupling.ON_CELLS:
-        reader.Groups = ["GROUP/%s/%s/No_Group"%(meshname,pvis_typeOfFieldLabel(typeOfField))]
+        representation.ColorArrayName = ("CELLS", fieldname)
+        data = reader.CellData
+    else:
+        representation.ColorArrayName = ("POINTS", fieldname)
+        data = reader.PointData
+
+    # :TODO: Determine nb components
+    nb_cmp = 1
+    mode = "Magnitude" # "Component" if nb_cmp > 1
 
-    representation = pvsimple.GetDisplayProperties(reader)
-    representation.ColorArrayName = fieldname
+    # Get data range (mini/maxi)
+    for n in range(data.GetNumberOfArrays()):
+        if data.GetArray(n).GetName() == fieldname:
+            mini,maxi = data.GetArray(n).GetRange()
 
-    lookupTable = pvsimple.GetLookupTableForArray(
-        fieldname, 1, NanColor=[0.25, 0.0, 0.0],
-        RGBPoints=[25.0, 0.23, 0.30, 0.754, 245.0, 0.71, 0.016, 0.15],
-        VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 )
-    representation.LookupTable = lookupTable
+    stepvalue = (maxi-mini)/100. # 100 steps
 
+    # Build Lookup table
+    RGBPoints = [mini, 0.0, 0.0, 1.0, maxi, 1.0, 0.0, 0.0]
+    nb = int((maxi-mini)/stepvalue)-1
+    Table = pvsimple.GetLookupTableForArray("", nb_cmp, VectorMode=mode, ColorSpace='HSV')
+    Table.Discretize = 1
+    Table.NumberOfTableValues = nb
+    Table.RGBPoints = RGBPoints
+
+    representation.Representation = 'Surface'
+    representation.LookupTable = Table
+
+    # Build scalar bar
+    scalarbar = pvsimple.CreateScalarBar(LabelFormat = '%.1f',Title= "",LabelFontSize=12,Enabled=1,LookupTable=Table,TitleFontSize=12,LabelColor=[0.0, 0.0, 0.0],TitleColor=[0.0, 0.0, 0.0],)
+    pvsimple.SetActiveSource(reader)
+    pvsimple.GetRenderView().Representations.append(scalarbar)
+    pvsimple.SetActiveSource(reader)
     pvsimple.Render()
 
     return True
@@ -78,7 +100,7 @@ def TEST_scalarmap():
                    properties.testFieldName,
                    properties.testTypeOfField,
                    properties.testFieldIt)
-    
+
 if __name__ == "__main__":
     TEST_scalarmap()
 
index 532e22a2efeb4f20d6d3569603922e0638f84ba5..6fa6c32d82cc84169fac45f6a71e39bac3e65cd7 100644 (file)
@@ -17,7 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author : Guillaume Boulant (EDF) 
+# Author : Guillaume Boulant (EDF)
 
 #
 # ===================================================================
@@ -29,7 +29,7 @@
 
 import xmed
 from xmed.fieldproxy import FieldProxy, newFieldProxy
-    
+
 # ===================================================================
 # Operations on fields
 
@@ -87,7 +87,7 @@ def status(local=True,remote=False):
 
         if len(fieldHandlerList) > 0:
             status+="(use 'f=get(id)' to get a field in the current context)"
-    
+
     return status
 
 # For simpler typing, one can create a python command for status
@@ -104,7 +104,7 @@ class ListFields(object):
         # remote metadata on the engine (MEDCouplingFieldDouble) are
         # displayed by the stat command. Otherwise, only the local
         # metadata are displayed.
-        
+
     def __repr__(self):
         return status(self.__local, self.__remote)
 
@@ -121,13 +121,13 @@ def load(medFileName=filepath):
     """
     This function indicates that we want to use the fields from the
     specified med file. The fields meta-data are loaded in the engine
-    part of the module. To get a fieldproxy on a field, call the get 
+    part of the module. To get a fieldproxy on a field, call the get
     function with the id of the required field. To display the whole
     list of fields loaded in the engine, type 'ls' (la verbose).
     """
     xmed.dataManager.addDatasource(filepath)
     print status(local=False,remote=True)
-    
+
 def get(fieldHandlerId):
     """
     This return a field proxy on the field identified by the specified
@@ -163,22 +163,31 @@ VIEWER_VISU    = "VISU"
 VIEWER_PARAVIS = "PARAVIS"
 VIEWER_DEFAULT = VIEWER_PARAVIS
 
-VIEWER_TMP_FILE = "/tmp/medop_viewer.med"
+import tempfile
 
 def view_using_paravis(aFieldProxy):
+    temp = tempfile.NamedTemporaryFile(prefix="medop_viewer", suffix='.med', delete=False)
+
     # __GBO__ TO BE IMPROVED: we used a tmp file in this first step of
     # development, but we should used at last a MEDCoupling corba
     # object (see how to use the stuff in PARAVIS/src/Plugins)
-    xmed.dataManager.saveFields(VIEWER_TMP_FILE, [aFieldProxy.id])
-    
+    xmed.dataManager.saveFields(temp.name, [aFieldProxy.id])
+
     from xmed.driver_pvis import pvis_scalarmap
-    pvis_scalarmap(VIEWER_TMP_FILE,
+    pvis_scalarmap(temp.name,
                    aFieldProxy.meshname,
                    aFieldProxy.fieldname,
                    aFieldProxy.type,
                    aFieldProxy.iteration)
+    temp.close()
+#
 
 def view_using_visu(aFieldProxy):
+    # No more used
+    raise Exception("view_using_visu: No more used")
+
+    VIEWER_TMP_FILE = "/tmp/medop_viewer.med"
+
     # __GBO__ TO BE IMPROVED: we used a tmp file in this first step of
     # development, but we should used at last a MEDCoupling corba
     # object (see how to use the stuff in PARAVIS/src/Plugins)
@@ -200,7 +209,7 @@ def view_using_visu(aFieldProxy):
                             iteration)
     if result is False:
         xmed.err("the field can't be displayed")
-    
+
 def view(aFieldProxy, using=VIEWER_DEFAULT):
     """
     This displays a 3D view of the field using VISU or PARAVIS,
@@ -213,4 +222,4 @@ def view(aFieldProxy, using=VIEWER_DEFAULT):
         view_using_paravis(aFieldProxy)
     else:
         view_using_visu(aFieldProxy)
-    
+