]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Merge multi-study removal branch
authorrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 12:12:57 +0000 (15:12 +0300)
committerrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 12:15:08 +0000 (15:15 +0300)
55 files changed:
CMakeLists.txt
SalomeMEDConfig.cmake.in
adm_local/unix/config_files/med_check_sizeof_medint.m4
doc/dev/sphinx/_static/medcalc.css
doc/dev/sphinx/conf.py.in
doc/dev/sphinx/medcalc-userguide-api.rst
doc/tut/medcoupling/pyfunctions/functions.py
doc/tut/medcoupling/testpil.py
doc/tut/medloader/manage.py
idl/MEDDataManager.idl
idl/MEDEventListener.idl
src/MEDCalc/cmp/CMakeLists.txt
src/MEDCalc/cmp/MED.hxx
src/MEDCalc/cmp/MEDCALC.hxx
src/MEDCalc/cmp/MEDCalculator_i.hxx
src/MEDCalc/cmp/MEDCommandsHistoryManager_i.hxx
src/MEDCalc/cmp/MEDDataManager_i.cxx
src/MEDCalc/cmp/MEDDataManager_i.hxx
src/MEDCalc/cmp/MEDPresentation.cxx
src/MEDCalc/cmp/MEDPresentationContour.cxx
src/MEDCalc/cmp/MEDPresentationManager_i.hxx
src/MEDCalc/cmp/MEDPresentationScalarMap.cxx
src/MEDCalc/cmp/test_medcalc_components.py
src/MEDCalc/gui/MEDModule.cxx
src/MEDCalc/gui/MEDModule.hxx
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/PresentationController.hxx
src/MEDCalc/gui/ProcessingController.cxx
src/MEDCalc/gui/ProcessingController.hxx
src/MEDCalc/gui/WorkspaceController.cxx
src/MEDCalc/gui/XmedConsoleDriver.cxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx
src/MEDCalc/tui/CMakeLists.txt
src/MEDCalc/tui/__init__.py
src/MEDCalc/tui/medconsole.py
src/MEDCalc/tui/medevents.py
src/MEDCalc/tui/medimages.py
src/MEDCalc/tui/medio.py
src/MEDCalc/tui/medpresentation.py
src/MEDCalc/tui/medprocessing.py [new file with mode: 0644]
src/MEDCalculator/MEDCalculatorBrowserField.cxx
src/MEDCalculator/MEDCalculatorBrowserMesh.cxx
src/MEDCalculator/MEDCalculatorBrowserStep.cxx
src/MEDCalculator/MEDCalculatorDBField.cxx
src/MEDCalculator/MEDCalculatorDBSliceField.cxx
src/MEDCalculator/MEDCalculatorDBSliceField.hxx
src/MEDCalculator/Swig/MEDCalculator.i
src/MEDCalculator/Swig/SPythonParser.cxx
src/MEDCouplingCorba/Client/DataArrayIntClient.hxx
src/MEDCouplingCorba/Client/MEDCouplingMeshClient.cxx
src/MEDCouplingCorba/DataArrayIntServant.hxx
src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.hxx
src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i
src/MEDCouplingCorba_Swig/MEDCouplingCorba.i
src/MEDGUI/MEDGUIFileContentDial.h

index 06efdca3162359c5d98cf4284c4ae4b822275842..1fe7e3232b8883dff0e6e007255fa59fa845d1aa 100644 (file)
@@ -33,7 +33,7 @@ ENDIF(WIN32)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@ -248,7 +248,7 @@ IF(SALOME_USE_MPI)
 ENDIF()
 
 LIST(APPEND _${PROJECT_NAME}_exposed_targets
-    medcouplingcorba medcouplingclient medcalculator MEDFactoryEngine)
+    medcouplingcorba medcouplingclient medcalculator MEDEngineCommon MEDFactoryEngine MEDEngine)
 IF(SALOME_MED_ENABLE_PYTHON)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets medcalculatorspython)
 ENDIF()
index c1adbf8744fcb7fdeb272a01da4d64212872c036..201fd67888cee929a8ed8e63edbd90fdebfbfe28 100644 (file)
@@ -133,6 +133,8 @@ SET(MED_medcouplingcorba medcouplingcorba)
 SET(MED_medcouplingclient medcouplingclient)
 SET(MED_medcalculator medcalculator)
 SET(MED_medcalculatorspython medcalculatorspython)
+SET(MED_MEDEngineCommon MEDEngineCommon)
 SET(MED_MEDFactoryEngine MEDFactoryEngine)
+SET(MED_MEDEngine MEDEngine)
 SET(MED_MEDCALCGUI_dialogs MEDCALCGUI_dialogs)
 SET(MED_MEDCALCGUI MEDCALCGUI)
index d49d3f804f4f215cf605401cf5de94c007684967..24d3dd6ff9812b2448fc2b559e9dce2e3c649e5c 100644 (file)
@@ -30,7 +30,7 @@ AC_DEFUN([MED_CHECK_SIZEOF_MEDINT], [
      test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
      DEFINED_F77INT64=""
   else
-     AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
+     AC_MSG_ERROR([Size of Fortran type integer is neither four nor eight bytes])
   fi
   AC_SUBST(DEFINED_F77INT64)
 ])
\ No newline at end of file
index 1d0a878f4ec40179497875b8d5270d7355dc75b3..712066dd5befcb6c451c756bef31c04b871a18d1 100644 (file)
@@ -1,3 +1,4 @@
+@import url("default.css");
 @import url("classic.css");
 
 body {
index 3e032751374187c38db687d8bbc155b0bbd3d432..575f204f8f0087cec6de46dcd546514ed12fd753 100644 (file)
@@ -47,7 +47,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = 'MED, Manipulation de champs dans SALOME'
-copyright = '2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE, G. Boulant, A. Geay'
+copyright = '2010-2017 CEA/DEN, EDF R&D, OPEN CASCADE, G. Boulant, A. Geay'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
index 96df825049f5a435ada75c46d6d57aa35c72c524..9914f26b96f9b61717ab1cb704d1daeec1595f97 100644 (file)
@@ -44,7 +44,7 @@ install only the MEDMEM library from the source files embedded in the
 SALOME MED module. Keep in mind that the MEDMEM library is designed to
 be a self-consistent library with very few third party softwares (only
 med-file, glibc and mpi typically). In particular, it is strictly
-independant from the SALOME framework even if it distributed with
+independent from the SALOME framework even if it distributed with
 SALOME for convenience reasons.
 
 Components of the MEDMEM library
@@ -292,7 +292,7 @@ does not provide such data structures.
 We suggest to work with a simple list concept to store the metadata
 for each mesh entry and each field entry. Note that a mesh entry is
 characterized by the mesh name only, while a field entry is
-charaterized by the following attributes:
+characterized by the following attributes:
 
 * :tt:`fieldName`: the name of the field
 * :tt:`meshName`: the name of the mesh that supports the field
@@ -300,7 +300,7 @@ charaterized by the following attributes:
 * :tt:`iteration`: a couple of integers :tt:`(iter,order)` that
   characterizes the step in a serie (timeseries or spectrum).
 
-By default, we suggest to work with a simple map concept (dictionnary in a
+By default, we suggest to work with a simple map concept (dictionary in a
 python context, map in a C++ context) to register the meshes and
 fields loaded from the med file for each metadata entry.
 
@@ -309,7 +309,7 @@ you may dispatch the data in a tree structure that fit your specific
 case, for performance reasons. For example, the following code
 illustrates how to dispatch the metadata in a tree data structure
 where leaves are the physical data (field objects). We first have to
-define a tree structure (basic definition in htis simple case, but it
+define a tree structure (basic definition in this simple case, but it
 works fine):
 
 .. include:: ../../tut/medloader/manage.py
index 2dec17d0937a3df7ec8a0bd27e0ba373cf8a8fb6..2ecb5c95ad68f9621ca797a8ec230fd6a6999ede 100755 (executable)
@@ -104,7 +104,7 @@ class FuncStiffExp(Function):
 
 class FuncCosinus(Function):
     def __init__(self,nbPeriods):
-        # The pulsation w must be choosen so that w*xmax=n*2pi where
+        # The pulsation w must be chosen so that w*xmax=n*2pi where
         # xmax=1 and n is an integer that corresponds to the number of
         # oscilations on the xrange [0,xmax].
         w=nbPeriods*2*pi
index 9a34bed7772776354b6e7998d92776eef5425db0..0f8ef702ef97867b69606a4291fd76390259c45d 100755 (executable)
@@ -63,7 +63,7 @@ import MEDLoader as ML
 def createMesh(meshname, sizeX, sizeY):
     """
     Creating a cartesian mesh with a grid of the size of the image.
-    sizeX and sizeY should be respectively the width and heigth of the
+    sizeX and sizeY should be respectively the width and height of the
     image.
     """
     # >>>
@@ -131,7 +131,7 @@ def image2med():
     img=Image.open("images/avatar.png")
     #img=Image.open("images/irm.png")
     imgbw=ImageOps.grayscale(img)
-    # We keep only the grayscale. Maybe, it could be usefull to get
+    # We keep only the grayscale. Maybe, it could be useful to get
     # the RGB scales each on one component of the field.
     
     width,height=imgbw.size
index 168d6b9fb67c238cff48206f5db692f69973dd35..cabbb820c3fb6ea19d67f7bab89f7107d68129e0 100644 (file)
@@ -72,7 +72,7 @@ for meshName in meshNames:
 # MEDCoupling field? Or a tree that you cross using attribute and
 # whose leaves are the MEDCoupling fields?
 # R: I think that the default structure should be a simple list that
-# store objects whith properties that corresponds to the metadata (and
+# store objects with properties that corresponds to the metadata (and
 # if loaded the MEDCouplingField or Mesh). Then for specific request,
 # a BTree could be create to organize the search (for example if we
 # request all the fields for a given iteration step, then we should
index b1e80d3db21d8985844b2ec07b385caa06e46a53..8d88928483024e6245e2679deaac865d43e89bf9 100644 (file)
@@ -84,7 +84,7 @@ module MEDCALC
   };
   typedef sequence<FieldseriesHandler> FieldseriesHandlerList;
 
-  // The FieldHandler structure is a lightweigth data structure that
+  // The FieldHandler structure is a lightweight data structure that
   // represents a single field (as understood in MEDCoupling model).
   struct FieldHandler {
     long   id;
@@ -135,7 +135,7 @@ module MEDCALC
 
     FieldHandler     getFieldHandler(in long fieldHandlerId);
     FieldHandlerList getFieldHandlerList();
-    // __GBO__ Maybe it could be usefull to define a getFieldHandlerList with a datasourceId in argument
+    // __GBO__ Maybe it could be useful to define a getFieldHandlerList with a datasourceId in argument
     string           getFieldRepresentation(in long fieldHandlerId);
 
     // Persistency management
index d53d6b1f3dbe4066ace61622b6979752ce542a98..5479729664f20447d8530a7ddadb45024e04b7f1 100644 (file)
@@ -36,6 +36,8 @@ module MEDCALC
     EVENT_ADD_PRESENTATION,
     EVENT_REMOVE_PRESENTATION,
     EVENT_MODIFY_PRESENTATION,
+    EVENT_CHANGE_UNDERLYING_MESH,
+    EVENT_INTERPOLATE_FIELD,
     EVENT_PLAY_TEST,
     EVENT_QUIT_SALOME,
     EVENT_ERROR,
index 70c383a389ad25b0856326998e1032da3315223e..04baec0b760ef5616cf6907bc60cd9b8d6bad974 100644 (file)
@@ -48,13 +48,15 @@ SET(COMMON_SOURCES
   MEDPresentationDeflectionShape.cxx  
 )
 
-SET(MEDFactoryEngine_SOURCES
+SET(MEDEngineCommon_SOURCES
   ${COMMON_SOURCES}
+)
+
+SET(MEDFactoryEngine_SOURCES
   MEDFactory_i.cxx
 )
 
 SET(MEDEngine_SOURCES
-  ${COMMON_SOURCES}
   MED.cxx
 )
 
@@ -76,15 +78,20 @@ IF(WIN32)
   SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOMINMAX")
 ENDIF(WIN32)
 
+ADD_LIBRARY(MEDEngineCommon SHARED ${MEDEngineCommon_SOURCES})
+SET_TARGET_PROPERTIES(MEDEngineCommon PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}")
+TARGET_LINK_LIBRARIES(MEDEngineCommon ${COMMON_LIBS})
+
 ADD_LIBRARY(MEDFactoryEngine SHARED ${MEDFactoryEngine_SOURCES})
 SET_TARGET_PROPERTIES(MEDFactoryEngine PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}")
-TARGET_LINK_LIBRARIES(MEDFactoryEngine ${COMMON_LIBS})
+TARGET_LINK_LIBRARIES(MEDFactoryEngine ${COMMON_LIBS} MEDEngineCommon)
 
 ADD_LIBRARY(MEDEngine SHARED ${MEDEngine_SOURCES})
 SET_TARGET_PROPERTIES(MEDEngine PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}")
-TARGET_LINK_LIBRARIES(MEDEngine ${COMMON_LIBS})
+TARGET_LINK_LIBRARIES(MEDEngine ${COMMON_LIBS} MEDEngineCommon)
 
 #INSTALL(TARGETS MEDFactoryEngine DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(TARGETS MEDEngineCommon EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 INSTALL(TARGETS MEDFactoryEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 INSTALL(TARGETS MEDEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
index c8e9d213e333c0fd6021dc7c7e475369fc577f16..a3436164bc8f571a56b6bdfacc826627bd7971b3 100644 (file)
 #ifndef _MED_HXX_
 #define _MED_HXX_
 
-#ifdef WIN32
-# if defined MEDENGINE_EXPORTS || defined MEDEngine_EXPORTS
-#  define MEDENGINE_EXPORT __declspec( dllexport )
-# else
-#  define MEDENGINE_EXPORT __declspec( dllimport )
-# endif
-#else
-# define MEDENGINE_EXPORT
-#endif
-
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(MED_Gen)
 #include CORBA_SERVER_HEADER(MEDDataManager)
@@ -39,7 +29,9 @@
 #include <map>
 #include <string>
 
-class MEDENGINE_EXPORT MED :
+#include "MEDCALC.hxx"
+
+class MEDCALC_EXPORT MED :
   public POA_MED_ORB::MED_Gen,
   public Engines_Component_i
 {
@@ -92,7 +84,7 @@ public:
 };
 
 extern "C"
-MEDENGINE_EXPORT
+MEDCALC_EXPORT
 PortableServer::ObjectId* MEDEngine_factory( CORBA::ORB_ptr orb,
                                              PortableServer::POA_ptr poa,
                                              PortableServer::ObjectId* contId,
index 3d716f0154bcbad5035f38a8761714723699be91..dca83c706311729370fae91246c4cff49f5d2afe 100644 (file)
@@ -21,7 +21,7 @@
 #define __MEDCALC_HXX__
 
 #ifdef WIN32
-# if defined MEDFactoryEngine_EXPORTS || defined MEDEngine_EXPORTS
+# if defined MEDFactoryEngine_EXPORTS || defined MEDEngine_EXPORTS || defined MEDEngineCommon_EXPORTS
 #    define MEDCALC_EXPORT __declspec( dllexport )
 #  else
 #    define MEDCALC_EXPORT __declspec( dllimport )
index 1b43d1ab621514a3d4941dd0bed7ed5986b5a30c..b0e9be8ef00c88c1c121ac49d214733c3baff207 100644 (file)
@@ -56,7 +56,7 @@ public:
   // Other public functions (non available via CORBA)
   // ===========================================================
   //
-  static MEDCalculator_i * getInstance();
+  MEDCALC_EXPORT static MEDCalculator_i * getInstance();
 
 private:
   MEDCalculator_i();
index 279355317ea0aed993e56ce03acbfba8542a075a..d607881262e2424f3ef41d16781e99455c5859e6 100644 (file)
@@ -31,7 +31,7 @@ class MEDCommandsHistoryManager_i
     public SALOME::GenericObj_i
 {
  public:
-  static MEDCommandsHistoryManager_i* getInstance();
+  MEDCALC_EXPORT static MEDCommandsHistoryManager_i* getInstance();
 
   MEDCALC_EXPORT void addCommand(const char* command);
   MEDCALC_EXPORT MEDCALC::CommandsList* getCommandsHistory();
index 6a703eabb8e7aa9f80e54ad51e44ef388862b1aa..b3ef305456c7eea54dcafc6cf574d4c4abdae4b9 100644 (file)
@@ -452,7 +452,7 @@ void MEDDataManager_i::saveFields(const char * filepath,
  * function savePersistentFields is called.
  */
 void MEDDataManager_i::markAsPersistent(CORBA::Long fieldHandlerId, bool persistent) {
-  LOG("mark as persistant : id="<<fieldHandlerId);
+  LOG("mark as persistent : id="<<fieldHandlerId);
   _fieldPersistencyMap[fieldHandlerId] = persistent;
 }
 
@@ -641,7 +641,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa
   LOG("getFieldDouble: field "<<fieldHandler->fieldname<<" loaded from file "<<filepath);
   TypeOfField type = (TypeOfField)fieldHandler->type;
   int meshDimRelToMax = 0;
-  MEDCouplingFieldDouble * myField = ReadField(type,
+  MCAuto<MEDCouplingFieldDouble> myField = ReadField(type,
                 filepath,
                 meshName,
                 meshDimRelToMax,
@@ -649,7 +649,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa
                 fieldHandler->iteration,
                 fieldHandler->order);
   myField->setMesh(myMesh);
-  _fieldDoubleMap[fieldHandler->id] = myField;
+  _fieldDoubleMap[fieldHandler->id] = myField.retn();
   return myField;
 }
 
index f6a5611b03b50a1f9cb3a270a0da74779c49c4e9..147ead2ea1d58d694b75ba01751d388e1e11894a 100644 (file)
@@ -115,10 +115,10 @@ public:
   // ===========================================================
   //
   static long LONG_UNDEFINED;
-  static MEDDataManager_i * getInstance();
-  MEDCouplingFieldDouble *  getFieldDouble(const MEDCALC::FieldHandler * fieldHandler);
-  MEDCALC::FieldHandler *     addField(MEDCouplingFieldDouble * fieldDouble,
-                                       long meshHandlerId=LONG_UNDEFINED);
+  MEDCALC_EXPORT static MEDDataManager_i * getInstance();
+  MEDCALC_EXPORT MEDCouplingFieldDouble *  getFieldDouble(const MEDCALC::FieldHandler * fieldHandler);
+  MEDCALC_EXPORT MEDCALC::FieldHandler *     addField(MEDCouplingFieldDouble * fieldDouble,
+                                                      long meshHandlerId=LONG_UNDEFINED);
 
 private:
   MEDDataManager_i();
index 84b74bc672eea5cb9fd6fd16fb92bf5e11cec4ba..5c2ac3b9caa28864e0ab6e52e7ee867121add6fd 100644 (file)
@@ -91,7 +91,7 @@ MEDPresentation::initFieldMeshInfos()
   _fieldName = fieldHandler->fieldname;
   _mcFieldType = (MEDCoupling::TypeOfField) fieldHandler->type;
   _pvFieldType = getPVFieldTypeString(_mcFieldType);
-  _colorByType = _pvFieldType;  // by default the same; overriden in DeflectionShape, VectorField, PointSprite and Contour
+  _colorByType = _pvFieldType;  // by default the same; overridden in DeflectionShape, VectorField, PointSprite and Contour
   _meshName = meshHandler->name;
 }
 
index 5a25cef588e767135542626893aba67c3184e48d..35a4264902df0a031f6aac7f06bc36c916796e57 100644 (file)
@@ -94,6 +94,10 @@ MEDPresentationContour::internalGeneratePipeline()
   oss << _objVar << ".ContourBy = ['POINTS', '" << _fieldName << "'];";
   pushAndExecPyLine(oss.str()); oss.str("");
 
+  // Colorize contour
+  oss << _objVar << ".ComputeScalars = 1;";
+  pushAndExecPyLine(oss.str()); oss.str("");
+
   // Set number of contours
   setNumberContours();
 
index cc2ae289eab3fdb3f22a466eb8a3ae0d7aacd359..e33f018c84ab7bfdd26bda643720833e2e6b1fff 100644 (file)
@@ -37,7 +37,7 @@ class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
 {
  public:
 
-  static MEDPresentationManager_i* getInstance();
+  MEDCALC_EXPORT static MEDPresentationManager_i* getInstance();
 
   MEDCALC_EXPORT MEDPresentation::TypeID makeMeshView(const MEDCALC::MeshViewParameters&, const MEDCALC::ViewModeType);
   MEDCALC_EXPORT MEDPresentation::TypeID makeScalarMap(const MEDCALC::ScalarMapParameters&, const MEDCALC::ViewModeType);
index f308b539b1711f38ddc2281bf25967176eed4615..6e759ba8965655ec948e7e15901c05d6fe08bcbf 100644 (file)
@@ -59,6 +59,7 @@ MEDPresentationScalarMap::internalGeneratePipeline()
   selectColorMap();
   rescaleTransferFunction();
   resetCameraAndRender();
+  pushAndExecPyLine(_dispVar+".SetRepresentationType('Surface')");
 }
 
 void
index 69e10785d47c28ee79827324b1571538619642b7..d2db81bce3763bcd26c2a71ecd0af332c2bd9caa 100644 (file)
@@ -20,7 +20,7 @@
 #
 
 # This file is a set of basic use case to test (from the python
-# context) the functions developped in the MEDCALC engine and the
+# context) the functions developed in the MEDCALC engine and the
 # associated MEDCALC CORBA interface (MEDDataManager and
 # MEDCalaculator).
 #
@@ -63,7 +63,7 @@ factory=salome.lcc.FindOrLoadComponent(containerType,componentName)
 # This is not the main CORBA component of the SALOME module MED
 # (i.e. the engine associated to the study), but the CORBA
 # entry point for MED fields operations (i.e. a CORBA component
-# reachable throught the LifeCycleCORBA). This entry point is used to
+# reachable throughout the LifeCycleCORBA). This entry point is used to
 # get the other SALOME CORBA components required for MED field
 # operations, in particular the dataManager and the calculator
 
index d7fe92a037602ce0072bb5dd8e332a39651b911d..ebadeaa4e3a3ba42a2324f3bb34ccd829d090c56 100644 (file)
@@ -487,3 +487,19 @@ MEDModule::requestSALOMETermination() const
 //{
 //  return _eventLoopStarted;
 //}
+
+int
+MEDModule::getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name)
+{
+  if (obj->_is_nil())
+    return -1;
+
+  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::AttributeParameter_var aParam;
+  if ( obj->FindAttribute(anAttr,"AttributeParameter") ) {
+    aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
+    if (aParam->IsSet(name, PT_INTEGER))
+      return aParam->GetInt(name);
+  }
+  return -1;
+}
index fa38c17903518259bf8ac33ced21a41f5961995f..7d7fab55ffe7a93d45f23964fd32fe0892d6541d 100644 (file)
@@ -87,7 +87,9 @@ public:
   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
   void requestSALOMETermination() const;
 
-  bool itemClickGeneric(std::string & name, std::string & type, int & presId) const;
+  bool itemClickGeneric(std::string& name, std::string& type, int& presId) const;
+
+  int getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name);
 
 signals:
   void presentationSelected(int presId, const QString& presType, const QString& presName);
index d223b066e00a853275c4d6f561359c4d52ae3d7f..6b5aa906b350c4705f9199d3f0baf505f5f8d6b3 100644 (file)
@@ -110,22 +110,6 @@ PresentationController::~PresentationController()
     delete((*it).second);
 }
 
-int
-PresentationController::getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char * name)
-{
-  if (obj->_is_nil())
-    return -1;
-
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeParameter_var aParam;
-  if ( obj->FindAttribute(anAttr,"AttributeParameter") ) {
-    aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-    if (aParam->IsSet(name, PT_INTEGER))
-      return aParam->GetInt(name);
-  }
-  return -1;
-}
-
 std::string
 PresentationController::_getIconName(const std::string& name)
 {
@@ -311,8 +295,8 @@ PresentationController::visualize(PresentationEvent::EventType eventType)
       if (soObj->_is_nil() || name == "MEDCalc")
         return;
 
-      int fieldId = getIntParamFromStudyEditor(soObj, FIELD_ID);
-      int meshId = getIntParamFromStudyEditor(soObj, MESH_ID);
+      int fieldId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_ID);
+      int meshId = _salomeModule->getIntParamFromStudyEditor(soObj, MESH_ID);
       MEDCALC::FieldHandler* fieldHandler = 0;
       MEDCALC::MeshHandler* meshHandler = 0;
 
@@ -325,9 +309,9 @@ PresentationController::visualize(PresentationEvent::EventType eventType)
         }
       else
         {
-          if (fieldId < 0)  // is it a field serie ?
+          if (fieldId < 0)  // is it a field series?
             {
-              int fieldSeriesId = getIntParamFromStudyEditor(soObj, FIELD_SERIES_ID);
+              int fieldSeriesId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_SERIES_ID);
               // If fieldId and fieldSeriesId equals -1, then it means that it is not a field
               // managed by the MED module, and we stop this function process.
               if ( fieldSeriesId < 0)
@@ -412,7 +396,7 @@ PresentationController::onDeletePresentation()
       std::string name(_studyEditor->getName(soPres));
       if (soPres->_is_nil() || name == "MEDCalc")
         return;
-      int presId = getIntParamFromStudyEditor(soPres,PRESENTATION_ID);
+      int presId = _salomeModule->getIntParamFromStudyEditor(soPres,PRESENTATION_ID);
       // If fieldId equals -1, then it means that it is not a field
       // managed by the MED module, and we stop this function process.
       if ( presId < 0 )
@@ -667,7 +651,7 @@ PresentationController::onParavisDump()
       std::string name(_studyEditor->getName(soPres));
       if (soPres->_is_nil() || name == "MEDCalc")
         return;
-      int presId = getIntParamFromStudyEditor(soPres,PRESENTATION_ID);
+      int presId = _salomeModule->getIntParamFromStudyEditor(soPres,PRESENTATION_ID);
       // If fieldId equals -1, then it means that it is not a field
       // managed by the MED module, and we stop this function process.
       if ( presId < 0 )
index 0c187e5627fbd157771d9dbf35701a1e5e1f8435..7faa1a4dc2a922910bb9325691a37d0bc94aa04e 100644 (file)
@@ -86,8 +86,6 @@ private:
   MEDWidgetHelper * findOrCreateWidgetHelper(MEDCALC::MEDPresentationManager_ptr presManager,
                                              int presId, const std::string& type, const std::string& name);
 
-  int getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char * name);
-
   QString getViewModePython() const;
   QString getColorMapPython() const;
   QString getScalarBarRangePython() const;
index 0665f3726ccb45bac1e8b534ac34097b92d8be45..ca111db6c960bbe804201bbb55c21bd6886fdd0d 100644 (file)
@@ -87,18 +87,28 @@ ProcessingController::OnChangeUnderlyingMesh()
   // item must be selected.
   SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
   if ( listOfSObject->size() > 0 ) {
-    SALOMEDS::SObject_var soField = listOfSObject->at(0);
-    std::string name(_studyEditor->getName(soField));
-    if (soField->_is_nil() || name == "MEDCalc")
+    SALOMEDS::SObject_var soObj = listOfSObject->at(0);
+    std::string name(_studyEditor->getName(soObj));
+    if (soObj->_is_nil() || name == "MEDCalc")
       return;
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeParameter_var aParam;
-    if ( soField->FindAttribute(anAttr,"AttributeParameter") ) {
-      aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-      if (! aParam->IsSet(FIELD_SERIES_ID, PT_INTEGER))
+
+    int fieldId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_ID);
+    if (fieldId < 0) { // is it a field series?
+      int fieldSeriesId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_SERIES_ID);
+      // If fieldId and fieldSeriesId equals -1, then it means that it is not a field
+      // managed by the MED module, and we stop this function process.
+      if ( fieldSeriesId < 0)
+        return;
+      MEDCALC::FieldHandlerList* fieldHandlerList = MEDFactoryClient::getDataManager()->getFieldListInFieldseries(fieldSeriesId);
+      if (fieldHandlerList->length() < 0)
+        return;
+      // For a field series, get the first real field entry:
+      MEDCALC::FieldHandler fieldHandler = (*fieldHandlerList)[0];
+      fieldId = fieldHandler.id;
+      if (fieldId < 0)
         return;
     }
-    int fieldId = aParam->GetInt(FIELD_SERIES_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
@@ -112,30 +122,16 @@ ProcessingController::OnChangeUnderlyingMesh()
 void
 ProcessingController::OnChangeUnderlyingMeshInputValidated()
 {
+  STDLOG("Change Underlying Mesh");
   int meshId = _dlgChangeUnderlyingMesh->getMeshId();
   STDLOG("meshId = " << ToString(meshId));
   int fieldId = _dlgChangeUnderlyingMesh->getFieldId();
-  MEDCALC::FieldHandler* fieldHandler =
-    MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
 
-  // We don't modify the original field but create first a duplicate
-  MEDCALC::FieldHandler* duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler);
-  MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
-
-  // Request once more the duplicate to update the meta-data on this
-  // client side
-  duplicate = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
-
-  // >>>
-  // WARN: the following is a temporary code for test purpose
-  // Automatically add in ws
   ProcessingEvent* event = new ProcessingEvent();
-  event->eventtype = ProcessingEvent::EVENT_IMPORT_OBJECT;
-  XmedDataObject* dataObject = new XmedDataObject();
-  dataObject->setFieldHandler(*duplicate);
-  event->objectdata = dataObject;
-  emit processingSignal(event);
-  // Note that this signal is processed by the WorkspaceController
+  event->eventtype = ProcessingEvent::EVENT_CHANGE_UNDERLYING_MESH;
+  event->fieldId = fieldId;
+  event->meshId = meshId;
+  emit processingSignal(event); // --> WorkspaceController::processProcessingEvent()
 
   // Tag the item to prevent double import
   //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
@@ -149,18 +145,28 @@ ProcessingController::OnInterpolateField()
   // item must be selected.
   SALOME_StudyEditor::SObjectList* listOfSObject = _studyEditor->getSelectedObjects();
   if ( listOfSObject->size() > 0 ) {
-    SALOMEDS::SObject_var soField = listOfSObject->at(0);
-    std::string name(_studyEditor->getName(soField));
-    if (soField->_is_nil() || name == "MEDCalc")
+    SALOMEDS::SObject_var soObj = listOfSObject->at(0);
+    std::string name(_studyEditor->getName(soObj));
+    if (soObj->_is_nil() || name == "MEDCalc")
       return;
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeParameter_var aParam;
-    if ( soField->FindAttribute(anAttr,"AttributeParameter") ) {
-      aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
-      if (! aParam->IsSet(FIELD_SERIES_ID, PT_INTEGER))
+
+    int fieldId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_ID);
+    if (fieldId < 0) { // is it a field series?
+      int fieldSeriesId = _salomeModule->getIntParamFromStudyEditor(soObj, FIELD_SERIES_ID);
+      // If fieldId and fieldSeriesId equals -1, then it means that it is not a field
+      // managed by the MED module, and we stop this function process.
+      if ( fieldSeriesId < 0)
+        return;
+      MEDCALC::FieldHandlerList* fieldHandlerList = MEDFactoryClient::getDataManager()->getFieldListInFieldseries(fieldSeriesId);
+      if (fieldHandlerList->length() < 0)
+        return;
+      // For a field series, get the first real field entry:
+      MEDCALC::FieldHandler fieldHandler = (*fieldHandlerList)[0];
+      fieldId = fieldHandler.id;
+      if (fieldId < 0)
         return;
     }
-    int fieldId = aParam->GetInt(FIELD_SERIES_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
@@ -174,6 +180,7 @@ ProcessingController::OnInterpolateField()
 void
 ProcessingController::OnInterpolateFieldInputValidated()
 {
+  STDLOG("Interpolate Field");
   MEDCALC::InterpolationParameters params;
   params.precision = _dlgInterpolateField->getPrecision();
   STDLOG("precision = " << params.precision);
@@ -191,37 +198,13 @@ ProcessingController::OnInterpolateFieldInputValidated()
   int meshId = _dlgInterpolateField->getMeshId();
   STDLOG("meshId = " << ToString(meshId));
   int fieldId = _dlgInterpolateField->getFieldId();
-  MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
-
-  // We don't modify the original field but create first a duplicate
-  // MEDCALC::FieldHandler* duplicate = MEDFactoryClient::getCalculator()->dup(*fieldHandler);
-  //MEDFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
-  MEDCALC::FieldHandler* result = NULL;
-  try {
-    result = MEDFactoryClient::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 = MEDFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
 
-  // >>>
-  // WARN: the following is a temporary code for test purpose
-  // Automatically add in ws
   ProcessingEvent* event = new ProcessingEvent();
-  event->eventtype = ProcessingEvent::EVENT_IMPORT_OBJECT;
-  XmedDataObject* dataObject = new XmedDataObject();
-  dataObject->setFieldHandler(*result);
-  event->objectdata = dataObject;
-  emit processingSignal(event);
-  // Note that this signal is processed by the WorkspaceController
+  event->eventtype = ProcessingEvent::EVENT_INTERPOLATE_FIELD;
+  event->fieldId = fieldId;
+  event->meshId = meshId;
+  event->interpParams = params;
+  emit processingSignal(event); // --> WorkspaceController::processProcessingEvent()
 
   // // Tag the item to prevent double import
   // //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
index 0dd9478c24408b4094a5750998d509d988829667..0683e1696b449ba7de0340c108bdf68facac3f28 100644 (file)
 typedef struct {
   enum EventType {
     EVENT_IMPORT_OBJECT,
-    EVENT_PROCESS_INTERPOLATE_FIELD,
-    EVENT_PROCESS_CHANGE_UNDERLYING_MESH
+    EVENT_INTERPOLATE_FIELD,
+    EVENT_CHANGE_UNDERLYING_MESH
   };
   int eventtype;
-  XmedDataObject* objectdata;
+  int fieldId;
+  int meshId;
+  MEDCALC::InterpolationParameters interpParams;
 } ProcessingEvent;
 
 class MEDModule;
index a2c442aa4b68e7a8644f7da7b01b325d252e8482..5560882af3630d0d3842d489850ecef198b1bc00 100644 (file)
 #include <QTimer>
 #include <QMessageBox>
 
+#include "MEDLoader.hxx"
+using namespace MEDCoupling;
+#include "MEDDataManager_i.hxx"
+
 /*!
  * This class defines a DockWidget plugged in the SALOME application,
  * and containing a tree view for rendering a hierarchical data
@@ -317,6 +321,36 @@ void WorkspaceController::processMedEvent(const MEDCALC::MedEvent* event) {
   else if ( event->type == MEDCALC::EVENT_MODIFY_PRESENTATION ) {
       emit workspaceSignal(event); // forward to PresentationController
   }
+  else if ( event->type == MEDCALC::EVENT_CHANGE_UNDERLYING_MESH
+            || event->type == MEDCALC::EVENT_INTERPOLATE_FIELD ) {
+    int fieldId = event->dataId;
+    MEDCALC::FieldHandler* fieldHandler = MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
+    XmedDataObject* dataObject = new XmedDataObject();
+    dataObject->setFieldHandler(*fieldHandler);
+    std::cout << "IMPORT object in workspace: " << dataObject->toString() << std::endl;
+    STDLOG("IMPORT object in workspace:\n"<<dataObject->toString());
+    // _GBO_ QUESTION: tag automatically the object as a peristant object ??
+    // We first add the data object to the internal data model
+    dataModel->addDataObject(dataObject);
+    // Then we request the tree view to consider this new object
+    this->getDataTreeModel()->addData(dataObject);
+
+    // Workaround to visualize the result
+    MEDCouplingFieldDouble* fieldDouble = MEDDataManager_i::getInstance()->getFieldDouble(fieldHandler);
+    std::string filename = std::tmpnam(NULL);
+    WriteField(filename.c_str(), fieldDouble, true);
+
+    QStringList commands;
+    commands += QString("source_id = medcalc.LoadDataSource('%1')").arg(filename.c_str());
+    commands += QString("source_id");
+    commands += QString("mesh_id = medcalc.GetFirstMeshFromDataSource(source_id)");
+    commands += QString("mesh_id");
+    commands += QString("field_id = medcalc.GetFirstFieldFromMesh(mesh_id)");
+    commands += QString("field_id");
+    commands += QString("presentation_id = medcalc.MakeScalarMap(accessField(field_id), viewMode=MEDCALC.VIEW_MODE_NEW_LAYOUT)");
+    commands += QString("presentation_id");
+    _consoleDriver->exec(commands);
+  }
   else if ( event->type == MEDCALC::EVENT_PLAY_TEST ) {
     emit workspaceSignal(event); // forward to TestController
   }
@@ -554,23 +588,25 @@ WorkspaceController::processProcessingEvent(const ProcessingEvent* event)
     return;
   }
 
-  // >>>
-  // __GBO__ To know what to do we should test the type, because the
-  // object could be a mesh, a timeseries or a single field. We test
-  // here the case of a single field. Moreover, there could have
-  // options such that "change the underlying mesh".
-  // <<<
+  int fieldId = event->fieldId;
+  int meshId = event->meshId;
 
-  XmedDataObject* dataObject = event->objectdata;
+  if ( event->eventtype == ProcessingEvent::EVENT_CHANGE_UNDERLYING_MESH ) {
+    QStringList commands;
+    commands += QString("result_id = medcalc.ChangeUnderlyingMesh(fieldId=%1,meshId=%2)").arg(fieldId).arg(meshId);
+    commands += QString("result_id");
+    _consoleDriver->exec(commands);
+  }
+  else if ( event->eventtype == ProcessingEvent::EVENT_INTERPOLATE_FIELD ) {
+    MEDCALC::InterpolationParameters params = event->interpParams;
+    QString method = QString(params.method);
+    QString nature = QString(params.nature);
+    QString intersectionType = QString(params.intersectionType);
 
-  if ( event->eventtype == ProcessingEvent::EVENT_IMPORT_OBJECT ) {
-    std::cout << "IMPORT object in workspace: " << dataObject->toString() << std::endl;
-    STDLOG("IMPORT object in workspace:\n"<<dataObject->toString());
-    // _GBO_ QUESTION: tag automatically the object as a peristant object ??
-    // We first add the data object to the internal data model
-    dataModel->addDataObject(dataObject);
-    // Then we request the tree view to consider this new object
-    this->getDataTreeModel()->addData(dataObject);
+    QStringList commands;
+    commands += QString("result_id = medcalc.InterpolateField(fieldId=%1,meshId=%2,precision=%3,defaultValue=%4,reverse=%5,method='%6',nature='%7',intersectionType='%8')").arg(fieldId).arg(meshId).arg(params.precision).arg(params.defaultValue).arg(params.reverse).arg(method).arg(nature).arg(intersectionType);
+    commands += QString("result_id");
+    _consoleDriver->exec(commands);
   }
 }
 
index 303e87f6c8bb68734ee34b73c62aa8eef0ff8bb0..0d4c4ae2f80b4a6e9e354210bbf4e7485e7c6abb 100644 (file)
@@ -25,6 +25,7 @@
 #include "MEDFactoryClient.hxx"
 #include CORBA_CLIENT_HEADER(MED_Gen)
 #include CORBA_CLIENT_HEADER(MEDCommandsHistoryManager)
+#include <iostream>
 
 XmedConsoleDriver::XmedConsoleDriver(MEDModule* salomeModule)
 {
index d9297d173a2eba21cfbfa2df9aade8f3f6c2a2c0..1b76e84ee39228fabc8acb97578677d2e70eadeb 100644 (file)
@@ -107,7 +107,7 @@ WidgetPresentationParameters::toggleWidget(bool show)
   else
     {
       _ui.widgetDynamic->show();
-      // It is the WidgetHelper responsability to re-show the widgets it needs
+      // It is the WidgetHelper responsibility to re-show the widgets it needs
       _ui.labelCompo->hide();
       _ui.comboBoxCompo->hide();
       _ui.labelMeshMode->hide();
index ba1b5b810a0b39cca2b5fb8905ae433d15418bbf..52e94386524dd94d4b8dbf2a3b21d7ecb26c0ac7 100644 (file)
@@ -26,6 +26,7 @@ SET(PYFILES_TO_INSTALL
   medimages.py
   medio.py
   medpresentation.py
+  medprocessing.py
   medtest.py
   )
 
index 71845ab4650937515ec93c00018c9c2a4f8b90c0..149d377625fb6206e2c8e5ff1d3ec784a9e151d6 100644 (file)
@@ -35,7 +35,10 @@ import medevents
 from fieldproxy import newFieldProxy, FieldProxy
 
 # Input/Output
-from medio import LoadDataSource, LoadImageAsDataSource, GetFirstMeshFromDataSource
+from medio import LoadDataSource
+from medio import LoadImageAsDataSource
+from medio import GetFirstMeshFromDataSource
+from medio import GetFirstFieldFromMesh
 
 # Presentations
 from medpresentation import MakeMeshView
@@ -65,6 +68,10 @@ from medpresentation import UpdateDeflectionShape
 
 from medpresentation import ComputeCellAverageSize, GetDomainCenter, GetSliceOrigins, SelectSourceField
 
+# Processing
+from medprocessing import ChangeUnderlyingMesh
+from medprocessing import InterpolateField
+
 # Console commands
 import medconsole
 
index 4daee6a3e8a76be739bd795d0dcc34592d9bf9ae..4384b080e47b487d71fdd3d73432343cdf2372bd 100644 (file)
@@ -22,13 +22,13 @@ import medcalc
 dataManager = medcalc.medcorba.factory.getDataManager()
 
 # IMPORTANT NOTE:
-# the pyConsoleGlobals variable should hold the globals() dictionnary of
+# the pyConsoleGlobals variable should hold the globals() dictionary of
 # the python console context
 pyConsoleGlobals = None
 
 #-----
 # This function is to be called from the working python console to
-# specify the globals() dictionnary (used in fieldtools for stat analysis)
+# specify the globals() dictionary (used in fieldtools for stat analysis)
 #
 # >>> medcalc.setConsoleGlobals(globals())
 #
index 2e17a37100f72789bad4db8f17573d8b4490aa74..52be16a11715b1a72967b1f347574600aa7d63df 100644 (file)
@@ -56,7 +56,7 @@ def eventListenerIsRunning():
   # Try to define the event listener
   connectEventListener()
   if __eventListener is None:
-    # it definitly does not work
+    # it definitely does not work
     medcalc.wrn("the GUI is not loaded yet and will not be notified of the modification")
     return False
 
@@ -118,14 +118,20 @@ def notifyGui_addPresentation(fieldId, presId):
 def notifyGui_removePresentation(presId):
   __notifyGui(MEDCALC.EVENT_REMOVE_PRESENTATION, presentationId=presId)
 #
+def notifyGui_modifyPresentation(presId):
+  __notifyGui(MEDCALC.EVENT_MODIFY_PRESENTATION, presentationId=presId)
+
 def notifyGui_playQtTestingScenario(filename):
   __notifyGui(MEDCALC.EVENT_PLAY_TEST, filename=filename)
 #
 def notifyGui_termination():
   __notifyGui(MEDCALC.EVENT_QUIT_SALOME)
-  
+
 def notifyGui_error(msg):
   __notifyGui(MEDCALC.EVENT_ERROR, msg=msg)
-  
-def notifyGui_modifyPresentation(presId):
-  __notifyGui(MEDCALC.EVENT_MODIFY_PRESENTATION, presentationId=presId)
+
+def notifyGui_changeUnderlyingMesh(fieldId):
+  __notifyGui(MEDCALC.EVENT_CHANGE_UNDERLYING_MESH, dataId=fieldId)
+
+def notifyGui_interpolateField(fieldId):
+  __notifyGui(MEDCALC.EVENT_INTERPOLATE_FIELD, dataId=fieldId)
index 49be53a5e7263a3d9b77090a2bf4208e6b0fff2a..88b4c6d33879709b51c0c916d84f9b66f49a8b6f 100644 (file)
@@ -34,7 +34,7 @@ class FieldBuilder:
         # Load the image file in a numpy array using PIL.
         img=Image.open(imageFilepath)
         imgbw=ImageOps.grayscale(img)
-        # WARN: We keep only the grayscale. Maybe, it could be usefull
+        # WARN: We keep only the grayscale. Maybe, it could be useful
         # to get the RGB scales each on one component of the field.
 
         # Creating a cartesian mesh with a grid of the size of the image
@@ -53,7 +53,7 @@ class FieldBuilder:
     def createMesh(self, meshname, sizeX, sizeY):
         """
         Creating a cartesian mesh with a grid of the size of the image.
-        sizeX and sizeY should be respectively the width and heigth of the
+        sizeX and sizeY should be respectively the width and height of the
         image.
         """
         # >>>
index 013842d04e4d4824fef7b203021f6d8e68d2db29..df59c1ba5bd3552d5ff14b441d20b7ee034d9cb7 100644 (file)
@@ -46,3 +46,15 @@ def GetFirstMeshFromDataSource(datasource_id):
   if not len(handlerLst):
     return -1
   return handlerLst[0].id
+#
+
+def GetFirstFieldFromMesh(mesh_id):
+  dataManager = medcalc.medcorba.factory.getDataManager()
+  series = dataManager.getFieldseriesListOnMesh(mesh_id)
+  if not len(series):
+    return -1
+  fields = dataManager.getFieldListInFieldseries(series[0].id)
+  if not len(fields):
+    return -1
+  return fields[0].id
+#
index 3ef5c42a8afe9fe4b5e8fce30ca047ea21443459..7c1d5f9b2b35c95022f0d2e1fbf6534c94e8e2a7 100644 (file)
@@ -34,7 +34,7 @@ def MakeMeshView(meshID,
     notifyGui_addPresentation(meshID, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the mesh view:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the mesh view:\n" + e.details.text)
     raise Exception(e.details.text)
 
 
@@ -52,7 +52,7 @@ def MakeScalarMap(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the scalar map:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the scalar map:\n" + e.details.text)
     raise Exception(e.details.text)
 
 def MakeContour(proxy,
@@ -67,7 +67,7 @@ def MakeContour(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the contour:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the contour:\n" + e.details.text)
     raise Exception(e.details.text)
 
 #
@@ -85,7 +85,7 @@ def MakeVectorField(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the vector field:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the vector field:\n" + e.details.text)
     raise Exception(e.details.text)
 
 def MakeSlices(proxy,
@@ -104,7 +104,7 @@ def MakeSlices(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the slices:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the slices:\n" + e.details.text)
     raise Exception(e.details.text)
 
 
@@ -121,7 +121,7 @@ def MakeDeflectionShape(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the deflection shape:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the deflection shape:\n" + e.details.text)
     raise Exception(e.details.text)
 
 
@@ -139,7 +139,7 @@ def MakePointSprite(proxy,
     notifyGui_addPresentation(proxy.id, presentation_id)
     return presentation_id
   except SALOME.SALOME_Exception as e:
-    notifyGui_error("An error occured while creating the point sprite:\n" + e.details.text)
+    notifyGui_error("An error occurred while creating the point sprite:\n" + e.details.text)
     raise Exception(e.details.text)
 
 def RemovePresentation(presentation_id):
diff --git a/src/MEDCalc/tui/medprocessing.py b/src/MEDCalc/tui/medprocessing.py
new file mode 100644 (file)
index 0000000..c95f140
--- /dev/null
@@ -0,0 +1,62 @@
+# Copyright (C) 2011-2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import medcalc
+import MEDCALC
+import SALOME
+from medcalc.medevents import notifyGui_error
+
+
+def ChangeUnderlyingMesh(fieldId, meshId):
+  try:
+    dataManager = medcalc.medcorba.factory.getDataManager()
+    fieldHandler = dataManager.getFieldHandler(fieldId)
+
+    # We don't modify the original field but create first a duplicate
+    duplicate = medcalc.medcorba.factory.getCalculator().dup(fieldHandler)
+    dataManager.changeUnderlyingMesh(duplicate.id, meshId)
+
+    from medcalc.medevents import notifyGui_changeUnderlyingMesh
+    notifyGui_changeUnderlyingMesh(duplicate.id)
+    return duplicate.id
+  except SALOME.SALOME_Exception as e:
+    notifyGui_error("An error occurred while changing underlying mesh:\n" + e.details.text)
+    raise Exception(e.details.text)
+#
+
+def InterpolateField(fieldId,
+                     meshId,
+                     precision,
+                     defaultValue,
+                     reverse,
+                     method,
+                     nature,
+                     intersectionType
+                     ):
+  params = MEDCALC.InterpolationParameters(precision, defaultValue, reverse, method, nature, intersectionType)
+  try:
+    dataManager = medcalc.medcorba.factory.getDataManager()
+    fieldHandler = dataManager.interpolateField(fieldId, meshId, params)
+    from medcalc.medevents import notifyGui_interpolateField
+    notifyGui_interpolateField(fieldHandler.id)
+    return fieldHandler.id
+  except SALOME.SALOME_Exception as e:
+    notifyGui_error("An error occurred while interpolating field:\n" + e.details.text)
+    raise Exception(e.details.text)
+#
index 6609186a4e46f5c35ded3f0b0be437bfa054976c..ff8a351d05a18d5ef12ffa4f974ab9d249c8f643 100644 (file)
@@ -60,7 +60,7 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch
   if(types.empty())
     throw INTERP_KERNEL::Exception("MEDCalculatorBrowserField::MEDCalculatorBrowserField : the file is not loadable using MED File 3 API ! Problably presence of field on edges faces...");
   _type=types[0];//To improve
-  MEDCouplingFieldDouble *tmpf=0;
+  MCAuto<MEDCouplingFieldDouble> tmpf;
   try
     {
       tmpf=ReadField(_type,fname,meshNames[0].c_str(),0,fieldName,dtits[0].first.first,dtits[0].first.second);
@@ -80,7 +80,6 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch
         c="-noname-";
       _components.push_back(c);
     }
-  tmpf->decrRef();
   _corresponding_meshes=GetMeshNamesOnField(fname,fieldName);
 }
 
index 620526650eb2bbf1ff884a9fb8576b011f88519b..fed187cbd6bb7409020e5a9daf4064e87d8a864d 100644 (file)
@@ -75,7 +75,7 @@ const std::string& MEDCalculatorBrowserMesh::getName() const
   return _name;
 }
 
-//  Return if the mesh name is equal to input or not, usefull for std::find for example
+//  Return if the mesh name is equal to input or not, useful for std::find for example
 bool MEDCalculatorBrowserMesh::operator==(const std::string& nm)
 {
   return _name==nm;
index a7ade24edb66ad2bed4ed0e9c0a48c01fabdc84a..83288e56a3b4ae17484fc61427505323a4ad3f40 100644 (file)
@@ -55,7 +55,7 @@ bool MEDCalculatorBrowserStep::operator==(bool sel)
 //  str method
 //  Construct a std::string to print this time step, using std::cout for example
 //  Put x or o for selected or not
-//  Add time step id value ( tiem value )
+//  Add time step id value ( time value )
 //  Return a std::string
 std::string MEDCalculatorBrowserStep::str()
 {
index 4c838b61c0c4ecb3b04d8cdc8bc2c806ef8fec9d..5c9a3aa252784cffa4b7dd99842c6c11d52edad8 100644 (file)
@@ -249,7 +249,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldReal::operator+(const MEDCalculatorDBF
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldReal::operator+ : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldReal::operator+ : unrecognized type of parameter received !");
     }
 }
 
@@ -299,7 +299,7 @@ bool MEDCalculatorDBFieldReal::isEqual(const MEDCalculatorDBField& other, double
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldReal::isEqual : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldReal::isEqual : unrecognized type of parameter received !");
     }
 }
 
@@ -346,7 +346,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldReal::operator-(const MEDCalculatorDBF
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldReal::operator- : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldReal::operator- : unrecognized type of parameter received !");
     }
 }
 
@@ -396,7 +396,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldReal::operator*(const MEDCalculatorDBF
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldReal::operator* : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldReal::operator* : unrecognized type of parameter received !");
     }
 }
 
@@ -446,7 +446,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldReal::operator/(const MEDCalculatorDBF
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldReal::operator/ : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldReal::operator/ : unrecognized type of parameter received !");
     }
 }
 
@@ -806,7 +806,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldCst::operator+(const MEDCalculatorDBFi
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldCst::operator+ : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldCst::operator+ : unrecognized type of parameter received !");
     }
 }
 
@@ -831,7 +831,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldCst::operator-(const MEDCalculatorDBFi
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldCst::operator- : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldCst::operator- : unrecognized type of parameter received !");
     }
 }
 
@@ -856,7 +856,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldCst::operator*(const MEDCalculatorDBFi
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldCst::operator* : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldCst::operator* : unrecognized type of parameter received !");
     }
 }
 
@@ -881,7 +881,7 @@ MEDCalculatorDBField *MEDCalculatorDBFieldCst::operator/(const MEDCalculatorDBFi
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldCst::operator/ : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldCst::operator/ : unrecognized type of parameter received !");
     }
 }
 
@@ -901,6 +901,6 @@ bool MEDCalculatorDBFieldCst::isEqual(const MEDCalculatorDBField& other, double
           return ret;
         }
       else
-        throw INTERP_KERNEL::Exception("FieldCst::isEqual : unrecognized type of parameter recieved !");
+        throw INTERP_KERNEL::Exception("FieldCst::isEqual : unrecognized type of parameter received !");
     }
 }
index 0a0327a7633caf52f0d3ec4c4231ec46b3ec8daf..e2d6e663186db78a59cc50e04d4eda11f791e961 100644 (file)
@@ -95,7 +95,10 @@ MEDCalculatorDBSliceField::~MEDCalculatorDBSliceField()
 MEDCouplingFieldDouble *MEDCalculatorDBSliceField::getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const
 {
   if(!_field)
-    _field=ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order);
+    {
+      MCAuto<MEDCouplingFieldDouble> tmp(ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order));
+      _field=tmp.retn();
+    }
   return _field;
 }
 
index 1d07d27b2a6796a5c24c076380adb5a6d2c5ee7a..a580f0c87cb3639f222059bfb5389506e25c66bb 100644 (file)
@@ -22,6 +22,7 @@
 #define __MEDCALCULATORDBSLICEFIELD_HXX__
 
 #include "MedCalculatorDefines.hxx"
+#include "MCType.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 
 #include "InterpKernelException.hxx"
index 2ed3d30b6ec0780843c978d0650145cc2fdf9742..e6445f3e1e22145e8d59bad2daac9466aa29b87d 100644 (file)
@@ -363,6 +363,9 @@ def MEDCouplingFieldDoubleIdiv(self,*args):
 def MEDCouplingFieldDoubleIpow(self,*args):
     import _MEDCalculator
     return _MEDCalculator.MEDCouplingFieldDouble____ipow___(self, self, *args)
+def MEDCouplingDataArrayBytenew(cls,*args):
+    import _MEDCalculator
+    return _MEDCalculator.DataArrayByte____new___(cls,args)
 def MEDCouplingDataArrayIntnew(cls,*args):
     import _MEDCalculator
     return _MEDCalculator.DataArrayInt____new___(cls,args)
index f686f1b1088e59376bfa6c66c7b53214cd6b86de..39858b1fc7058b3b07a6e4caac7200b9d108d7ed 100644 (file)
@@ -295,7 +295,7 @@ bool SPythonParser::isElementInParenthesisMatching(const std::string& s, std::st
       return true;
     }
   std::size_t pos5=s.find_first_not_of(NUMBERS,pos4,10);
-  if(pos5==pos4)//an another caracter found after : !
+  if(pos5==pos4)//an another character found after : !
     return false;
   std::string elt2;
   if(pos5==std::string::npos)
@@ -309,7 +309,7 @@ bool SPythonParser::isElementInParenthesisMatching(const std::string& s, std::st
   ret << elt2;
   result=ret.str();
   std::size_t pos6=s.find_first_not_of(' ',pos5);
-  if(pos6==pos5)//an another caracter found after 2nd elt !
+  if(pos6==pos5)//an another character found after 2nd elt !
     return false;
   return pos6==std::string::npos;
 }
index e20bb96fffc98b9b95a3ef59408d3e9ce253d9ab..5ec47813c86018146770ca197512f3f410bc5d6a 100644 (file)
@@ -27,6 +27,7 @@
 #endif
 #include CORBA_SERVER_HEADER(MEDCouplingCorbaServant)
 #include "MEDCouplingClient.hxx"
+#include "MCType.hxx"
 
 namespace MEDCoupling
 {
index 2f14bda1b020d6f797de4d4d14033e83735ed443..23c3ac61abfbee684cf9426b048b00de4feb221c 100644 (file)
@@ -95,7 +95,7 @@ void MEDCouplingMeshClient::fillMeshFromCorbaData(MEDCouplingMesh *meshCpp, SALO
 {
   meshPtr->Register();
   //1st call to getTinyInfo to get tiny array of key integers value
-  //to corectly resize local copy of distant instance adressed by 'meshPtr'
+  //to corectly resize local copy of distant instance addressed by 'meshPtr'
   //1st value of returned array is the type of instance. Thanks to
   //CORBA and its type-check no use of this value is necessary.
   SALOME_TYPES::ListOfDouble *tinyD;
index 0c244b53a5be8756db0d8090d1a6f1d5ccdd526f..507b75a514448a0082b796647db13748948ac461 100644 (file)
@@ -28,6 +28,7 @@
 #include CORBA_SERVER_HEADER(MEDCouplingCorbaServant)
 #include "MEDCouplingCorba.hxx"
 #include "DataArrayServant.hxx"
+#include "MCType.hxx"
 
 namespace MEDCoupling
 {
index 7a9586f59eecc03ecf13ffdaef95d0e72e1c97b8..f3ab4e70ec563e0c967d936d1e0cc33342767f18 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef __MEDCOUPLINGCORBAFIELDFACTORYCOMPONENT_HXX__
 #define __MEDCOUPLINGCORBAFIELDFACTORYCOMPONENT_HXX__
 
+#include "MCType.hxx"
+
 #include <string>
 
 namespace MEDCoupling
index afe0316febd234695442649649b77483c0596b92..3c31e7267331ce002e32ac90f9cd1ed4ddccaac2 100644 (file)
@@ -612,6 +612,9 @@ def MEDCouplingDataArrayIntImod(self,*args):
 def MEDCouplingDataArrayIntIpow(self,*args):
     import _MEDCouplingClient
     return _MEDCouplingClient.DataArrayInt____ipow___(self, self, *args)
+def MEDCouplingDataArrayBytenew(cls,*args):
+    import _MEDCouplingClient
+    return _MEDCouplingClient.DataArrayByte____new___(cls,args)
 def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
     import _MEDCouplingClient
     return _MEDCouplingClient.DataArrayDoubleTuple____iadd___(self, self, *args)
index 4cba53eefee9bc16b1baf1dec1553674e1c66f3a..e4461e1062bbb30c32cdf8d6ee89384ee1550106 100644 (file)
@@ -372,6 +372,9 @@ def MEDCouplingDataArrayIntImod(self,*args):
 def MEDCouplingDataArrayIntIpow(self,*args):
     import _MEDCouplingCorba
     return _MEDCouplingCorba.DataArrayInt____ipow___(self, self, *args)
+def MEDCouplingDataArrayBytenew(cls,*args):
+    import _MEDCouplingCorba
+    return _MEDCouplingCorba.DataArrayByte____new___(cls,args)
 def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
     import _MEDCouplingCorba
     return _MEDCouplingCorba.DataArrayDoubleTuple____iadd___(self, self, *args)
index 500fa63f599f258b00fb93807c824dc3e7bbb673..8ec0efbe4c4ce10de85de1fb46aaf227b9630cd3 100644 (file)
@@ -55,7 +55,7 @@ class MEDGUIFileContentDial : public QDialog
 public slots:
   void openFile();//  Create a new MedGUI_LiteStruct from a file and add content to QTreeWidgets
   void meshesStateChange(QTreeWidgetItem*, int);//  Change the select statement of one or more meshes, the item represents a mesh or a file
-  void fieldsStateChange(QTreeWidgetItem*, int);//  Change tje select statement of one or more fields, the item represents a mesh or a field or a step
+  void fieldsStateChange(QTreeWidgetItem*, int);//  Change the select statement of one or more fields, the item represents a mesh or a field or a step
   void fieldsStateChanges();
   void sendSelectionToDB();
   void unselectAll();//  Unselec all fields and meshes