]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix of issue 0017328: EDF 593 VISU : min and max scalar map of results given at gauss... V5_1_main_20090721
authorouv <ouv@opencascade.com>
Mon, 20 Jul 2009 09:13:10 +0000 (09:13 +0000)
committerouv <ouv@opencascade.com>
Mon, 20 Jul 2009 09:13:10 +0000 (09:13 +0000)
25 files changed:
doc/salome/gui/VISU/images/scalarbarproperties.png
doc/salome/gui/VISU/input/scalar_map.doc
idl/VISU_Gen.idl
resources/SalomeApp.xml
src/CONVERTOR/VISU_ConvertorDef.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MeshValue.cxx
src/CONVERTOR/VISU_Structures.hxx
src/CONVERTOR/VISU_Structures_impl.cxx
src/CONVERTOR/VISU_Structures_impl.hxx
src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx
src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx
src/PIPELINE/VISU_Extractor.cxx
src/PIPELINE/VISU_Extractor.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx
src/VISUGUI/VisuGUI_Prs3dDlg.cxx
src/VISUGUI/VisuGUI_Prs3dDlg.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh

index 318497db8ae0e169a667995dd014ec206cbee0ce..9da29706fa427b59c945aeeee153a80298848178 100644 (file)
Binary files a/doc/salome/gui/VISU/images/scalarbarproperties.png and b/doc/salome/gui/VISU/images/scalarbarproperties.png differ
index 749ff40ce9cab101d87497ba5900baeab867ac30..775471e817af93e7de542d7bca7a305eacc9687e 100644 (file)
@@ -64,6 +64,11 @@ fields containing vector values, in other cases it will be
 inactive).</li>
 <li><b>Logarithmic scaling</b> check box: You can apply logarithmic
 scaling to the color scale of the presentation.</li>
+<li><b>Gauss Metric</b> field: This field allows to choose what kind
+of value will be extracted from gauss points data. (Note: This field
+is shown only for two types of presentantation - <b>Scalar Map</b>
+and <b>Deformed Shape and Scalar Map</b>, and it is active only when
+the result is based on multiple gauss points).</li>
 <li><b>Use field range:</b> if this check box is selected, all cells
 of the field presentation will be colored according the values applied
 to these cells.</li>
index 7ff5beb88abcb401b88dd34a08c5797abebede0b..2e98fc191536ae708655be10d601dfa4ad1389e7 100644 (file)
@@ -56,6 +56,16 @@ module VISU {
                LOGARITHMIC /*!< Logarithmic type of scaling. */
              };
 
+  /*!
+   * This enumeration contains a set of elements defining
+   * what kind of value will be extracted from gauss points data.
+   */
+  enum GaussMetric {
+    AVERAGE, /*!< Average value (default). */
+    MINIMUM, /*!< Minimum value. */
+    MAXIMUM  /*!< Maximum value. */
+  };
+
   /*!
    * This enumeration contains a set of elements defining the
    * type of the %entity (topological units) constituting a mesh.
@@ -759,6 +769,17 @@ module VISU {
      */
     void SetBarVisible(in boolean theVisible);
 
+    /*!
+     * Sets the gauss metric for the presentation.
+     * \param theGaussMetric The value of this parameter is taken from the <VAR>GaussMetric</VAR> enumeration.
+     */
+    void SetGaussMetric(in GaussMetric theGaussMetric);
+
+    /*!
+     * Gets the gauss metric of the presentation.
+     */
+    GaussMetric GetGaussMetric();
+
   };
 
   //-------------------------------------------------------
index 612d301fd65e1102909d1cf7e361139aec37cd7e..48c8051b1b3e757213e6b7b88b9eab1207ec9176 100644 (file)
@@ -92,6 +92,7 @@
     <parameter name="scalar_bar_vertical_label_size" value="0"/>
     <parameter name="scalar_bar_vertical_bar_height" value="0"/>
     <parameter name="scalar_bar_vertical_bar_width" value="0"/>
+    <parameter name="scalar_gauss_metric"        value="0" />
     <parameter name="scalar_range_max"           value="0"/>
     <parameter name="scalar_range_min"           value="0"/>
     <parameter name="scalar_range_type"          value="0"/>
index a500b34d2e75174bfa9c5cb88819b13ae7f1506e..cf416a9224d6dd778976f85f1389bee8eeea91fb 100644 (file)
@@ -49,6 +49,11 @@ namespace VISU
                  ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
 
 
+  //---------------------------------------------------------------
+  //! Enumeration used to extract different kinds of values from the data on gauss points
+  enum TGaussMetric { AVERAGE_METRIC = 0, MINIMUM_METRIC, MAXIMUM_METRIC };
+
+
   //---------------------------------------------------------------
   struct TMesh;
   typedef MED::SharedPtr<TMesh> PMesh;
index 2c7fdf284b4faf453ed2bc79b6a229f842c1bc22..4beb4133fc5c2979e1d9c5f21b29f2d5922a1198 100644 (file)
@@ -1594,16 +1594,22 @@ void
 BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
                     const VISU::PMEDMeshOnEntity theMeshOnEntity,
                     const MED::TGeom2Gauss& theGeom2Gauss,
-                    VISU::TMinMaxArr& theMinMaxArr,
-                     VISU::TMinMaxArr& theAverageMinMaxArr,
-                    VISU::TGroup2MinMaxArr& theGroup2MinMaxArr,
-                    VISU::TGroup2MinMaxArr& theGroup2AverageMinMaxArr,
+                    VISU::TMetric2Comp2MinMax& theMetric2Comp2MinMax,
+                     VISU::TMetric2Comp2MinMax& theMetric2Comp2AverageMinMax,
+                    VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2MinMax,
+                    VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2AverageMinMax,
                     TInt theNbComp,
                     TInt theNbComp2)
 {
   const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
   VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
 
+  VISU::TVector<double> aBaseAverageValues;
+  aBaseAverageValues.resize(3);
+  aBaseAverageValues[VISU::AVERAGE_METRIC] = 0.0;
+  aBaseAverageValues[VISU::MINIMUM_METRIC] = VTK_LARGE_FLOAT;
+  aBaseAverageValues[VISU::MAXIMUM_METRIC] = -VTK_LARGE_FLOAT;
+
   const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
   typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
   for(; anIter != aGeom2Value.end(); anIter++){
@@ -1629,19 +1635,131 @@ BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
     // To calculate min/max per components
     for(TInt iElem = 0; iElem < aNbElem; iElem++){
       typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-      for(TInt iComp = 0; iComp < theNbComp; iComp++){
-       const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
-       VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
-       vtkFloatingPointType& aMin = aMinMax.first;
-       vtkFloatingPointType& aMax = aMinMax.second;
-        VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[iComp+1];
-        vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
-       vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
-        vtkFloatingPointType anAverageValue = 0.0;
-
-       VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[iComp+1];
-       VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[iComp+1];
-       std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
+
+      for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
+       VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
+       VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
+       VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
+       VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
+
+       for(TInt iComp = 0; iComp < theNbComp; iComp++){
+         const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+
+         VISU::TMinMax& aMinMax = aComp2MinMax[iComp+1];
+         vtkFloatingPointType& aMin = aMinMax.first;
+         vtkFloatingPointType& aMax = aMinMax.second;
+         VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp+1];
+         vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
+         vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
+         vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
+
+         VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[iComp+1];
+         VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[iComp+1];
+         std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
+
+         // get names of groups, to which the element belongs
+         VISU::TNames aGroupNames;
+         VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
+         if(anIter != anElemID2FamilyID.end()){
+           int aFamilyId = anIter->second;
+           if(aFamilyId != 0){
+             VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
+             if(aFamilyIter != aFamilyIDMap.end()){
+               VISU::PMEDFamily aFamily = aFamilyIter->second;
+               aGroupNames = aFamily->myGroupNames;
+               VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
+               for(; aGroupIter != aGroupNames.end(); aGroupIter++)
+                 aGroup2AverageValue[*aGroupIter] = aBaseAverageValues[aGaussMetric];
+             }
+           }
+         }
+
+         for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+           const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
+           aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
+           aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);          
+           if(isAverageByGaussPoints){
+             switch(aGaussMetric) {
+               case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
+               case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
+               case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
+             }
+           }
+           else {
+             anAverageMin = aMin;
+             anAverageMax = aMax;
+           }
+
+           // additional calculation for each group, to which the element belongs
+           VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
+           for(; aGroupIter != aGroupNames.end(); aGroupIter++){
+             VISU::TName aGroupName = *aGroupIter;
+             bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
+             VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
+             vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
+             vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
+             aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
+             aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;          
+
+             if(isAverageByGaussPoints){
+               switch(aGaussMetric) {
+                 case VISU::AVERAGE_METRIC: aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal; break;
+                 case VISU::MINIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::min(aGroup2AverageValue[aGroupName], aVal); break;
+                 case VISU::MAXIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::max(aGroup2AverageValue[aGroupName], aVal); break;
+               }
+             }
+             else {
+               VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
+               vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
+               vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
+               aGroupAverageMin = aGroupMin;
+               aGroupAverageMax = aGroupMax;
+             }
+           }
+         }
+         if(isAverageByGaussPoints){
+           if(aGaussMetric == VISU::AVERAGE_METRIC)
+             anAverageValue /= aNbGauss;
+           anAverageMin = std::min(anAverageMin,anAverageValue);
+           anAverageMax = std::max(anAverageMax,anAverageValue);
+
+           VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
+           for(; aGroupIter != aGroupNames.end(); aGroupIter++){
+             VISU::TName aGroupName = *aGroupIter;
+             vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName];
+             if(aGaussMetric == VISU::AVERAGE_METRIC)
+               aGroupAverageValue /= aNbGauss;
+             bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
+             VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
+             vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
+             vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
+             aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
+             aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
+           }
+         }
+       }
+      }
+    }
+
+    // To calculate min/max per vector modulus
+    for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
+      VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
+      VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
+      VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
+      VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
+
+      VISU::TMinMax& aMinMax = aComp2MinMax[0];
+      vtkFloatingPointType& aMin = aMinMax.first;
+      vtkFloatingPointType& aMax = aMinMax.second;
+      VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[0];
+      vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
+      vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
+
+      VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[0];
+      VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[0];
+
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+       typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
 
        // get names of groups, to which the element belongs
        VISU::TNames aGroupNames;
@@ -1653,24 +1771,20 @@ BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
            if(aFamilyIter != aFamilyIDMap.end()){
              VISU::PMEDFamily aFamily = aFamilyIter->second;
              aGroupNames = aFamily->myGroupNames;
-             VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
-             for(; aGroupIter != aGroupNames.end(); aGroupIter++)
-               aGroup2AverageValue[*aGroupIter] = 0.0;
            }
          }
        }
 
-        for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-         const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
-          aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
-          aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);          
-          if(isAverageByGaussPoints){
-            anAverageValue += aVal;
-          }
-          else {
-            anAverageMin = aMin;
-            anAverageMax = aMax;
-          }
+       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+         const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+         vtkFloatingPointType aValue = 0.0;
+         for(TInt iComp = 0; iComp < theNbComp2; iComp++){
+           vtkFloatingPointType aVal = aMValueSlice[iComp];
+           aValue += aVal*aVal;
+         }
+         aValue = sqrt(aValue);
+         aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
+         aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
 
          // additional calculation for each group, to which the element belongs
          VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
@@ -1680,134 +1794,58 @@ BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
            VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
            vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
            vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
-           aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
-           aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;          
-
-           if(isAverageByGaussPoints){
-             aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal;
-           }
-           else {
-             VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
-             vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
-             vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
-             aGroupAverageMin = aGroupMin;
-             aGroupAverageMax = aGroupMax;
-           }
+           aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
+           aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
          }
        }
-        if(isAverageByGaussPoints){
-          anAverageValue /= aNbGauss;
-          anAverageMin = std::min(anAverageMin,anAverageValue);
-          anAverageMax = std::max(anAverageMax,anAverageValue);
+       if(isAverageByGaussPoints){
+         typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+         vtkFloatingPointType aValue = 0.0;
+         for(TInt iComp = 0; iComp < theNbComp2; iComp++){
+           const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
+           vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
+           for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+             const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
+             switch(aGaussMetric) {
+               case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
+               case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
+               case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
+             }
+           }
+           if(aGaussMetric == VISU::AVERAGE_METRIC)
+             anAverageValue /= aNbGauss;
+           aValue += anAverageValue*anAverageValue;
+         }
+         aValue = sqrt(aValue);
+         anAverageMin = std::min(anAverageMin,aValue);
+         anAverageMax = std::max(anAverageMax,aValue);
 
+         // additional calculation for each group, to which the element belongs
          VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
          for(; aGroupIter != aGroupNames.end(); aGroupIter++){
            VISU::TName aGroupName = *aGroupIter;
-           vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName] / aNbGauss;
            bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
            VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
            vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
            vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
-           aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
-           aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
-         }
-        }
-      }
-    }
-                 
-    // To calculate min/max per vector modulus
-    VISU::TMinMax& aMinMax = theMinMaxArr[0];
-    vtkFloatingPointType& aMin = aMinMax.first;
-    vtkFloatingPointType& aMax = aMinMax.second;
-    VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[0];
-    vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
-    vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
-
-    VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[0];
-    VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[0];
-
-    for(TInt iElem = 0; iElem < aNbElem; iElem++){
-      typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-
-      // get names of groups, to which the element belongs
-      VISU::TNames aGroupNames;
-      VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
-      if(anIter != anElemID2FamilyID.end()){
-       int aFamilyId = anIter->second;
-       if(aFamilyId != 0){
-         VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
-         if(aFamilyIter != aFamilyIDMap.end()){
-           VISU::PMEDFamily aFamily = aFamilyIter->second;
-           aGroupNames = aFamily->myGroupNames;
+           aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
+           aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
          }
        }
-      }
+       else {
+         anAverageMin = aMin;
+         anAverageMax = aMax;
 
-      for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-        const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-        vtkFloatingPointType aValue = 0.0;
-        for(TInt iComp = 0; iComp < theNbComp2; iComp++){
-          vtkFloatingPointType aVal = aMValueSlice[iComp];
-          aValue += aVal*aVal;
-        }
-        aValue = sqrt(aValue);
-        aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
-        aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
-
-       // additional calculation for each group, to which the element belongs
-       VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
-       for(; aGroupIter != aGroupNames.end(); aGroupIter++){
-         VISU::TName aGroupName = *aGroupIter;
-         bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
-         VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
-         vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
-         vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
-         aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
-         aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
-       }
-      }
-      if(isAverageByGaussPoints){
-        typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-        vtkFloatingPointType aValue = 0.0;
-        for(TInt iComp = 0; iComp < theNbComp2; iComp++){
-          const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
-          vtkFloatingPointType anAverageValue = 0.0;
-          for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-            const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
-            anAverageValue += aVal;
-          }
-          anAverageValue /= aNbGauss;
-          aValue += anAverageValue*anAverageValue;
-        }
-        aValue = sqrt(aValue);
-        anAverageMin = std::min(anAverageMin,aValue);
-        anAverageMax = std::max(anAverageMax,aValue);
-
-       // additional calculation for each group, to which the element belongs
-       VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
-       for(; aGroupIter != aGroupNames.end(); aGroupIter++){
-         VISU::TName aGroupName = *aGroupIter;
-         bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
-         VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
-         vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
-         vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
-         aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
-         aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
-       }
-      }
-      else {
-        anAverageMin = aMin;
-        anAverageMax = aMax;
-
-       // additional calculation for each group, to which the element belongs
-       VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
-       for(; aGroupIter != aGroupNames.end(); aGroupIter++){
-         VISU::TName aGroupName = *aGroupIter;
-         VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
-         vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
-         vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
-         aGroupAverageMin = aGroup2MinMax[aGroupName].first;
-         aGroupAverageMax = aGroup2MinMax[aGroupName].second;
+         // additional calculation for each group, to which the element belongs
+         VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
+         for(; aGroupIter != aGroupNames.end(); aGroupIter++){
+           VISU::TName aGroupName = *aGroupIter;
+           VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
+           vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
+           vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
+           aGroupAverageMin = aGroup2MinMax[aGroupName].first;
+           aGroupAverageMax = aGroup2MinMax[aGroupName].second;
+         }
        }
       }
     }
@@ -1893,10 +1931,10 @@ VISU_MedConvertor
          else if(aNbComp > 4)
            aNbComp2 = 3;
 
-         VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
-          VISU::TMinMaxArr& anAverageMinMaxArr = aField->myAverageMinMaxArr;
-          VISU::TGroup2MinMaxArr& aGroup2MinMaxArr = aField->myGroup2MinMaxArr;
-          VISU::TGroup2MinMaxArr& aGroup2AverageMinMaxArr = aField->myGroup2AverageMinMaxArr;
+         VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax;
+          VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax;
+          VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax;
+          VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax;
          TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
          for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
            VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
@@ -1925,20 +1963,20 @@ VISU_MedConvertor
                 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
                                                                aMeshOnEntity,
                                                                 aGeom2Gauss,
-                                                                aMinMaxArr,
-                                                                anAverageMinMaxArr,
-                                                               aGroup2MinMaxArr,
-                                                               aGroup2AverageMinMaxArr,
+                                                                aMetric2Comp2MinMax,
+                                                                aMetric2Comp2AverageMinMax,
+                                                               aMetric2Comp2Group2MinMax,
+                                                               aMetric2Comp2Group2AverageMinMax,
                                                                 aNbComp,
                                                                 aNbComp2);
               else
                 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
                                                              aMeshOnEntity,
                                                               aGeom2Gauss,
-                                                              aMinMaxArr,
-                                                              anAverageMinMaxArr,
-                                                             aGroup2MinMaxArr,
-                                                             aGroup2AverageMinMaxArr,
+                                                              aMetric2Comp2MinMax,
+                                                              aMetric2Comp2AverageMinMax,
+                                                             aMetric2Comp2Group2MinMax,
+                                                             aMetric2Comp2Group2AverageMinMax,
                                                               aNbComp,
                                                               aNbComp2);
 
index a4cee7660ce2e7ef75357a254719dc6f480a0731..b26b95ff6f27a5fc82efa631ea9ded8750a3f326 100644 (file)
@@ -230,7 +230,8 @@ namespace VISU
     
     void
     Execute(const PFieldImpl& theField,
-           const PValForTimeImpl& theValForTime)
+           const PValForTimeImpl& theValForTime,
+           const TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC)
     {
       vtkIdType aNbComp = theField->myNbComp;
       vtkIdType aSize = std::max(vtkIdType(3), aNbComp);
@@ -257,9 +258,19 @@ namespace VISU
            const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
            aDataValues[iComp] = TVTKBasicType();
            for(vtkIdType iGauss = 0; iGauss < aNbGauss; iGauss++){
-             aDataValues[iComp] += aValueSlice[iGauss];
+             TVTKBasicType aValue = aValueSlice[iGauss];
+             if( iGauss == 0 && theGaussMetric != VISU::AVERAGE_METRIC ) {
+               aDataValues[iComp] = aValue;
+               continue;
+             }
+             switch( theGaussMetric ) {
+               case VISU::AVERAGE_METRIC: aDataValues[iComp] += aValue; break;
+               case VISU::MINIMUM_METRIC: aDataValues[iComp] = std::min( aValue, aDataValues[iComp] ); break;
+               case VISU::MAXIMUM_METRIC: aDataValues[iComp] = std::max( aValue, aDataValues[iComp] ); break;
+             }    
            }
-           aDataValues[iComp] /= aNbGauss;
+           if( theGaussMetric ==  VISU::AVERAGE_METRIC )
+             aDataValues[iComp] /= aNbGauss;
          }
          this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
        }
@@ -345,6 +356,28 @@ namespace VISU
       typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
       PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
       TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+
+      if ( theValForTime->GetMaxNbGauss() > 1 ) { // at least one of geometry contains multiple gauss points
+       TVTKDataArray *aGaussMinDataArray = TVTKDataArray::New();
+       aGaussMinDataArray->SetNumberOfComponents( aNbComp );
+       aGaussMinDataArray->SetNumberOfTuples( aNbTuples );
+       aGaussMinDataArray->SetName( "VISU_FIELD_GAUSS_MIN" );
+       aDataSetAttributes->AddArray( aGaussMinDataArray );
+
+       PDataArrayHolder aGaussMinDataArrayHolder(new TTDataArrayHolder(aGaussMinDataArray));
+       TTimeStampOnProfileInitArray<EDataType>(aGaussMinDataArrayHolder).Execute(theField, theValForTime, VISU::MINIMUM_METRIC);
+       aGaussMinDataArray->Delete();
+
+       TVTKDataArray *aGaussMaxDataArray = TVTKDataArray::New();
+       aGaussMaxDataArray->SetNumberOfComponents( aNbComp );
+       aGaussMaxDataArray->SetNumberOfTuples( aNbTuples );
+       aGaussMaxDataArray->SetName( "VISU_FIELD_GAUSS_MAX" );
+       aDataSetAttributes->AddArray( aGaussMaxDataArray );
+
+       PDataArrayHolder aGaussMaxDataArrayHolder(new TTDataArrayHolder(aGaussMaxDataArray));
+       TTimeStampOnProfileInitArray<EDataType>(aGaussMaxDataArrayHolder).Execute(theField, theValForTime, VISU::MAXIMUM_METRIC);
+       aGaussMaxDataArray->Delete();
+      }
     }
 
     aSelectedDataArray->Delete();
index 4e877ccd0e128e868d8a9bce1ab70788c30d4ef2..d9f08fb073fd2c874ff70b84b904781d64501b36 100644 (file)
@@ -231,12 +231,16 @@ namespace VISU
     */
     virtual
     TMinMax 
-    GetMinMax(vtkIdType theCompID, const TNames& theGroupNames) = 0;
+    GetMinMax(vtkIdType theCompID,
+              const TNames& theGroupNames,
+              TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) = 0;
     
     //! Calculate average min/max values for each of the MED FIELD components among all its timestamps
     virtual
     TMinMax 
-    GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames) = 0;
+    GetAverageMinMax(vtkIdType theCompID,
+                     const TNames& theGroupNames,
+                     TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) = 0;
 
     bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
 
@@ -265,6 +269,11 @@ namespace VISU
 
     PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
     PGaussMesh myGaussMesh;
+
+    //! Get maximum number of Gauss Points among all geometrical types (provided for convenience)
+    virtual
+    int
+    GetMaxNbGauss() const = 0;
   };
  
 
index cdb78dbdb6a77c0bcb3a071958aff12e88c187a7..3931c1e953868f169a088c547d59740f11e3c4b6 100644 (file)
@@ -705,6 +705,8 @@ namespace VISU
       aFilter->SetScalars( aDataSet );
       aFilter->SetVectors( aDataSet );
       aFilter->AddField( "VISU_FIELD", aDataSet );
+      aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
+      aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
       aFilter->AddField( "ELNO_FIELD", aDataSet );
       aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
@@ -811,6 +813,8 @@ namespace VISU
       aFilter->SetScalars( aDataSet );
       aFilter->SetVectors( aDataSet );
       aFilter->AddField( "VISU_FIELD", aDataSet );
+      aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
+      aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
       aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
     }
@@ -1369,17 +1373,29 @@ namespace VISU
     myDataType = theDataType;
     myCompNames.resize(theNbComp);
     myUnitNames.resize(theNbComp);
-    myMinMaxArr.resize(theNbComp + 1);
-    myAverageMinMaxArr.resize(theNbComp + 1);
-    myGroup2MinMaxArr.resize(theNbComp + 1);
-    myGroup2AverageMinMaxArr.resize(theNbComp + 1);
-    for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
-      TMinMax& aMinMax = myMinMaxArr[iComp];
-      aMinMax.first = VTK_LARGE_FLOAT;
-      aMinMax.second = -VTK_LARGE_FLOAT;
-      TMinMax& anAverageMinMax = myAverageMinMaxArr[iComp];
-      anAverageMinMax.first = VTK_LARGE_FLOAT;
-      anAverageMinMax.second = -VTK_LARGE_FLOAT;
+
+    myMetric2Comp2MinMax.resize(3);
+    myMetric2Comp2AverageMinMax.resize(3);
+    myMetric2Comp2Group2MinMax.resize(3);
+    myMetric2Comp2Group2AverageMinMax.resize(3);
+    for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
+      TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
+      TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
+      TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
+      TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
+
+      aComp2MinMax.resize(theNbComp + 1);
+      aComp2AverageMinMax.resize(theNbComp + 1);
+      aComp2Group2MinMax.resize(theNbComp + 1);
+      aComp2Group2AverageMinMax.resize(theNbComp + 1);
+      for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
+       TMinMax& aMinMax = aComp2MinMax[iComp];
+       aMinMax.first = VTK_LARGE_FLOAT;
+       aMinMax.second = -VTK_LARGE_FLOAT;
+       TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
+       anAverageMinMax.first = VTK_LARGE_FLOAT;
+       anAverageMinMax.second = -VTK_LARGE_FLOAT;
+      }
     }
   }
 
@@ -1392,7 +1408,7 @@ namespace VISU
 
   TMinMax 
   TFieldImpl
-  ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames)
+  ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
   {
     TMinMax aMinMax;
     bool anIsMinMaxInitialized = false;
@@ -1400,7 +1416,7 @@ namespace VISU
       aMinMax.first = VTK_LARGE_FLOAT;
       aMinMax.second = -VTK_LARGE_FLOAT;
 
-      const TGroup2MinMax& aGroup2MinMax = myGroup2MinMaxArr[theCompID];
+      const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
       TNames::const_iterator aNameIter = theGroupNames.begin();
       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
        TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
@@ -1414,7 +1430,7 @@ namespace VISU
     }
 
     if( !anIsMinMaxInitialized )
-      aMinMax = myMinMaxArr[theCompID];
+      aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
 
     return aMinMax;
   }
@@ -1422,7 +1438,7 @@ namespace VISU
 
   TMinMax 
   TFieldImpl
-  ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames)
+  ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
   {
     TMinMax aMinMax;
     bool anIsMinMaxInitialized = false;
@@ -1430,7 +1446,7 @@ namespace VISU
       aMinMax.first = VTK_LARGE_FLOAT;
       aMinMax.second = -VTK_LARGE_FLOAT;
 
-      const TGroup2MinMax& aGroup2MinMax = myGroup2AverageMinMaxArr[theCompID];
+      const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
       TNames::const_iterator aNameIter = theGroupNames.begin();
       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
        TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
@@ -1444,7 +1460,7 @@ namespace VISU
     }
 
     if( !anIsMinMaxInitialized )
-      aMinMax = myAverageMinMaxArr[theCompID];
+      aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
 
     return aMinMax;
   }
@@ -1546,6 +1562,18 @@ namespace VISU
     return anIter->second;
   }
   
+  int
+  TValForTimeImpl
+  ::GetMaxNbGauss() const
+  {
+    int aNbGauss = 1;
+    TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
+    for(; anIter != myGeom2NbGauss.end(); anIter++){
+      aNbGauss = std::max(aNbGauss, anIter->second);
+    }
+    return aNbGauss;
+  }
+  
   unsigned long int
   TValForTimeImpl
   ::GetMemorySize()
index eebf3dd1cefeb5fb536710f8c3bcdd8816408a84..baec9a3214b3258ce8d390d171ca799d55b85ab3 100644 (file)
@@ -786,10 +786,12 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  typedef TVector<TMinMax> TMinMaxArr;
+  typedef            TVector<TMinMax>              TComp2MinMax;
+  typedef       TVector<TComp2MinMax>       TMetric2Comp2MinMax;
 
-  typedef std::map<TName,TMinMax> TGroup2MinMax;
-  typedef TVector<TGroup2MinMax> TGroup2MinMaxArr;
+  typedef     std::map<TName,TMinMax>             TGroup2MinMax;
+  typedef      TVector<TGroup2MinMax>        TComp2Group2MinMax;
+  typedef TVector<TComp2Group2MinMax> TMetric2Comp2Group2MinMax;
 
   //! Specialize TField to provide VTK mapping for the entity
   struct VISU_CONVERTOR_EXPORT TFieldImpl: virtual TField
@@ -808,21 +810,21 @@ namespace VISU
     //! Implement the TField::GetMinMax
     virtual
     TMinMax 
-    GetMinMax(vtkIdType theCompID, const TNames& theGroupNames);
+    GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
 
     //! Implement the TField::GetAverageMinMax
     virtual
     TMinMax 
-    GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames);
+    GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
 
     vtkIdType myDataSize; //!< Keeps size of the assigned data
     vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
-    TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
-    TMinMaxArr myAverageMinMaxArr; //!< Keeps average by Gauss Points min/max values for each component of the MED FIELD
-                                   //!< If Nb of Gauss Points <=1 myAverageMinMaxArr equal myMinMaxArr
+    TMetric2Comp2MinMax myMetric2Comp2MinMax; //!< Keeps min/max values for each component of the MED FIELD
+    TMetric2Comp2MinMax myMetric2Comp2AverageMinMax; //!< Keeps average by Gauss Points min/max values for each component of the MED FIELD
+                                                     //!< If Nb of Gauss Points <=1 myAverageMinMaxArr equal myMinMaxArr
 
-    TGroup2MinMaxArr myGroup2MinMaxArr;
-    TGroup2MinMaxArr myGroup2AverageMinMaxArr;
+    TMetric2Comp2Group2MinMax myMetric2Comp2Group2MinMax;
+    TMetric2Comp2Group2MinMax myMetric2Comp2Group2AverageMinMax;
   };
 
 
@@ -892,6 +894,11 @@ namespace VISU
     int
     GetNbGauss(EGeometry theGeom) const;
 
+    //! Get maximum number of Gauss Points among all geometrical types (provided for convenience)
+    virtual
+    int
+    GetMaxNbGauss() const;
+
     //! Gets memory size used by the instance (bytes).
     virtual
     unsigned long int
index 2da76c099d091acea9427c1654b6d5442f1892c8..3297e52037fde6bb73265a1555be67a3c424a46b 100644 (file)
@@ -471,3 +471,24 @@ VISU_DeformedShapeAndScalarMapPL
   if (isnan(theRange[0]) || isnan(theRange[1]))
     throw std::runtime_error("NAN values in the presentation");
 }
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetGaussMetric(VISU::TGaussMetric theGaussMetric) 
+{
+  if(GetGaussMetric() == theGaussMetric)
+    return;
+
+  myScalarsExtractor->SetGaussMetric(theGaussMetric);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TGaussMetric
+VISU_DeformedShapeAndScalarMapPL
+::GetGaussMetric() 
+{
+  return myScalarsExtractor->GetGaussMetric();
+}
index 05eedb53e5806c4b6d78fd9899c44a4302a10f5c..f211f24bf1004866f7d2a0bdc29d765928f86b4e 100644 (file)
@@ -82,6 +82,14 @@ public:
   void
   GetSourceRange(vtkFloatingPointType theRange[2]);
 
+  virtual
+  void
+  SetGaussMetric(VISU::TGaussMetric theGaussMetric);
+  
+  virtual
+  VISU::TGaussMetric
+  GetGaussMetric();
+
   virtual
   void
   SetScalars(vtkDataSet *theScalars);
index 0a53d67553c7d6d77acbc89adb02ea87f42e8e16..575f787d4c33997cb086b1558fcce5bf6d5e0a76 100644 (file)
@@ -26,6 +26,7 @@
 #include "VISU_Extractor.hxx"
 #include "VISU_PipeLineUtils.hxx"
 #include "VISU_ConvertorUtils.hxx"
+#include "VISU_MeshValue.hxx"
 
 #include <sstream>
 
@@ -45,7 +46,8 @@ vtkStandardNewMacro(VISU_Extractor);
 //----------------------------------------------------------------------------
 VISU_Extractor
 ::VISU_Extractor():
-  myScalarMode(1)
+  myScalarMode(1),
+  myGaussMetric(VISU::AVERAGE_METRIC)
 {
 }
 
@@ -76,6 +78,26 @@ VISU_Extractor
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_Extractor
+::SetGaussMetric(VISU::TGaussMetric theGaussMetric)
+{
+  if(myGaussMetric != theGaussMetric){
+    myGaussMetric = theGaussMetric;
+    Modified();
+  }
+}
+
+//----------------------------------------------------------------------------
+VISU::TGaussMetric
+VISU_Extractor
+::GetGaussMetric()
+{
+  return myGaussMetric;
+}
+
+
 //----------------------------------------------------------------------------
 template<typename TValueType> 
 void
@@ -119,13 +141,22 @@ Component2Scalars(vtkDataArray *theInputDataArray,
 template<typename TDataSetAttributesType> void
 ExecuteScalars(vtkIdType theNbOfTuples, 
               vtkIdType theScalarMode, 
+              VISU::TGaussMetric theGaussMetric, 
               TDataSetAttributesType* theInputData, 
               TDataSetAttributesType* theOutputData)
 {
   if(theNbOfTuples < 1)
     return;
 
-  vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
+  vtkDataArray* aFieldArray = NULL;
+  switch( theGaussMetric ) {
+    case VISU::AVERAGE_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD"); break;
+    case VISU::MINIMUM_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MIN"); break;
+    case VISU::MAXIMUM_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MAX"); break;
+  }
+  if( !aFieldArray )
+    return;
+
   vtkIdType anInputDataType = aFieldArray->GetDataType();
   vtkDataArray *anOutputScalars = vtkDataArray::CreateDataArray(anInputDataType);
   anOutputScalars->SetNumberOfComponents(1);
@@ -179,7 +210,7 @@ VISU_Extractor
   if ( VISU::IsDataOnPoints( anInput ) ) {
     int aNbElems = anInput->GetNumberOfPoints();
     if ( anInputPointData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
-      ExecuteScalars( aNbElems, myScalarMode, anInputPointData, anOutputPointData );
+      ExecuteScalars( aNbElems, myScalarMode, myGaussMetric, anInputPointData, anOutputPointData );
   }
   
   vtkCellData *anInputCellData = anInput->GetCellData();
@@ -188,7 +219,7 @@ VISU_Extractor
   if ( VISU::IsDataOnCells( anInput ) ) {
     int aNbElems = anInput->GetNumberOfCells();
     if ( anInputCellData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
-      ExecuteScalars( aNbElems, myScalarMode, anInputCellData, anOutputCellData );
+      ExecuteScalars( aNbElems, myScalarMode, myGaussMetric, anInputCellData, anOutputCellData );
   }
 
   return 1;
index 53f038bdcaf3b5cd4c4f023122a86756a57e3585..5d6b8874faa76143e5df641ebd6e0c7bcefc74de 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_Extractor_HeaderFile
 
 #include "VISUPipeline.hxx"
+#include "VISU_ConvertorDef.hxx"
 #include <vtkDataSetAlgorithm.h>
 
 
@@ -49,6 +50,14 @@ public:
   void
   SetScalarMode(int theScalarMode = 0);
 
+  virtual
+  VISU::TGaussMetric
+  GetGaussMetric();
+
+  virtual
+  void
+  SetGaussMetric(VISU::TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
+
 protected:
   VISU_Extractor();
   VISU_Extractor(const VISU_Extractor&);
@@ -60,6 +69,7 @@ protected:
   RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
 
   int myScalarMode;
+  VISU::TGaussMetric myGaussMetric;
 };
 
 #endif
index 9786e6e02e46a2a00419d75400937ba15d78ac99..35a0a1d208ed74ef76deae94995e2688cd07b6af 100644 (file)
@@ -27,6 +27,7 @@
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_DataSetMapperHolder.hxx"
 #include "VISU_ElnoAssembleFilter.hxx"
+#include "VISU_Extractor.hxx"
 #include "VISU_FieldTransform.hxx"
 
 #include "VISU_AppendFilter.hxx"
@@ -114,6 +115,8 @@ VISU_ScalarMapPL
 
   myMergeFilter->RemoveFields();
   myMergeFilter->AddField("VISU_FIELD", aDataSet);
+  myMergeFilter->AddField("VISU_FIELD_GAUSS_MIN", aDataSet);
+  myMergeFilter->AddField("VISU_FIELD_GAUSS_MAX", aDataSet);
   myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
   myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
   myMergeFilter->AddField("ELNO_POINT_COORDS", aDataSet);
@@ -153,6 +156,9 @@ VISU_ScalarMapPL
 {
   Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
   VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+  if(VISU_ScalarMapPL* aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine))
+    SetGaussMetric(aPipeLine->GetGaussMetric());
 }
 
 
@@ -243,6 +249,27 @@ VISU_ScalarMapPL
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetGaussMetric(VISU::TGaussMetric theGaussMetric) 
+{
+  if(GetGaussMetric() == theGaussMetric)
+    return;
+
+  GetExtractorFilter()->SetGaussMetric(theGaussMetric);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TGaussMetric
+VISU_ScalarMapPL
+::GetGaussMetric() 
+{
+  return GetExtractorFilter()->GetGaussMetric();
+}
+
+
 //----------------------------------------------------------------------------
 vtkDataSet* 
 VISU_ScalarMapPL
index 5db2f3b54c1cdafedf30442b54c4335afc855e44..e504112bdf142e1797afc44d51d7758cc7c4050c 100644 (file)
@@ -86,6 +86,14 @@ public:
   void
   GetSourceRange(vtkFloatingPointType theRange[2]);
 
+  virtual
+  void
+  SetGaussMetric(VISU::TGaussMetric theGaussMetric);
+  
+  virtual
+  VISU::TGaussMetric
+  GetGaussMetric();
+
   //----------------------------------------------------------------------------
   virtual 
   vtkPointSet* 
index 1c75f4a16a62454967087ae636f07caa242986e1..6e63b37858af7e42d1c74455556c3ae08abee620 100644 (file)
@@ -189,6 +189,26 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_FONT_TIMES</source>
             <translation>Times</translation>
         </message>
+        <message>
+            <source>VISU_GAUSS_METRIC</source>
+            <translation>Gauss Metric</translation>
+        </message>
+        <message>
+            <source>VISU_GAUSS_METRIC_AVERAGE</source>
+            <translation>Average</translation>
+        </message>
+        <message>
+            <source>VISU_GAUSS_METRIC_MAXIMUM</source>
+            <translation>Maximum</translation>
+        </message>
+        <message>
+            <source>VISU_GAUSS_METRIC_MINIMUM</source>
+            <translation>Minimum</translation>
+        </message>
+        <message>
+            <source>VISU_GAUSS_METRIC_TOOLTIP</source>
+            <translation>Select the data to display on the cell</translation>
+        </message>
         <message>
             <source>VISU_HEIGHT</source>
             <translation>Height:</translation>
index 1101110500aa66b8661e9d1c4805686aa85bb1c7..befa55e7465c676ebc05d72514bb1b2b777091b0 100644 (file)
@@ -3489,6 +3489,8 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( mode, "strings", modes );
   setPreferenceProperty( mode, "indexes", indices );
 
+  addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
+
   int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
   QStringList types;
   types.append( tr( "VISU_FIELD_RANGE" ) );
@@ -3499,7 +3501,17 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( rangetype, "strings", types );
   setPreferenceProperty( rangetype, "indexes", indices );
 
-  addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
+  int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
+  QStringList metrics;
+  metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
+  metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
+  metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
+  indices.clear();
+  indices.append( 0 );
+  indices.append( 1 );
+  indices.append( 2 );
+  setPreferenceProperty( gaussMetric, "strings", metrics );
+  setPreferenceProperty( gaussMetric, "indexes", indices );
 
   int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
   setPreferenceProperty( imposedGr, "columns", 4 );
index b5415a4c88d872a19298e55204c2c1c0fb54cdd9..4d65681c26e235f3edcbd27e6816991b2674da4f 100644 (file)
@@ -68,7 +68,7 @@
  * Constructor
  */
 VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule)
-  : VisuGUI_ScalarBarBaseDlg(theModule),
+  : VisuGUI_ScalarBarBaseDlg(theModule, true),
     myIsAnimation(false),
     myUpdateScalars(true),
     myIsScalarFieldValid(true),
index 8372ddb2730f046f028cab61541e1caa44d21896..58bbb712b12c7ba02a42d63a0bff4f48faf55127 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "VISUConfig.hh"
 #include "VISU_Convertor.hxx"
+#include "VISU_MeshValue.hxx"
+#include "VISU_Structures_impl.hxx"
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_ScalarBarActor.hxx"
 #include "VISU_ScalarMapAct.h"
@@ -528,11 +530,12 @@ void VisuGUI_BarPrefDlg::keyPressEvent( QKeyEvent* e )
 /*!
   Constructor
 */
-VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplayGaussMetric, bool thePreview )
   : QWidget( parent ), 
     myPreviewActor( 0 ),
     myScalarMap( 0 ),
-    myScalarMapPL( 0 )
+    myScalarMapPL( 0 ),
+    myIsDisplayGaussMetric( theIsDisplayGaussMetric )
 {
   QVBoxLayout* aMainLayout = new QVBoxLayout( this );
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
@@ -575,6 +578,18 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), aGB);
   CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
+  myGaussMetricLabel = new QLabel( tr("VISU_GAUSS_METRIC"), aGB );
+  myGaussMetric = new QComboBox( aGB );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_AVERAGE") );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_MINIMUM") );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_MAXIMUM") );
+  myGaussMetric->setToolTip( tr("VISU_GAUSS_METRIC_TOOLTIP") );
+
+  if( !myIsDisplayGaussMetric ) {
+    myGaussMetricLabel->hide();
+    myGaussMetric->hide();
+  }
+
   RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), aGB);
   RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), aGB);
   RangeGroup->addButton( RBFrange, 0 );
@@ -602,12 +617,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   RangeGroupLayout->addWidget( myModeLbl, 0, 0, 1, 1 );
   RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 2);
   RangeGroupLayout->addWidget( CBLog, 0, 3, 1, 1);
-  RangeGroupLayout->addWidget( RBFrange, 1, 0, 1, 2);
-  RangeGroupLayout->addWidget( RBIrange, 1, 2, 1, 2);
-  RangeGroupLayout->addWidget( MinLabel, 2, 0 );
-  RangeGroupLayout->addWidget( MinEdit,  2, 1 );
-  RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
-  RangeGroupLayout->addWidget( MaxEdit,  2, 3 );
+  RangeGroupLayout->addWidget( myGaussMetricLabel, 1, 0, 1, 1);
+  RangeGroupLayout->addWidget( myGaussMetric, 1, 1, 1, 3);
+  RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2);
+  RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2);
+  RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+  RangeGroupLayout->addWidget( MinEdit,  3, 1 );
+  RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+  RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
 
   // Colors and Labels ========================================================
   QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this);
@@ -766,6 +783,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   connect( RBIrange,   SIGNAL( toggled( bool ) ), this, SLOT( onImposedRange( bool ) ) );
 
   connect( myModeCombo,    SIGNAL( activated( int ) ),       this, SLOT( changeScalarMode( int ) ) );
+  connect( myGaussMetric,  SIGNAL( activated( int ) ),       this, SLOT( changeGaussMetric( int ) ) );
   connect( OrientGroup,    SIGNAL( buttonClicked( int ) ),   this, SLOT( changeDefaults( int ) ) );
   connect( XSpin,          SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
   connect( YSpin,          SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
@@ -980,6 +998,24 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
+  // Gauss Metric option should be visible only if at least one 
+  // of mesh values on geometry is based on multiple gauss points
+  bool isEnableGaussMetric = false;
+  if( myIsDisplayGaussMetric ) {
+    const VISU::TValField& aValField = aField->myValField;
+    VISU::TValField::const_iterator anIter = aValField.find(myScalarMap->GetScalarTimeStampNumber());
+    if ( anIter != aValField.end() ) {
+      VISU::PValForTime aValForTime = anIter->second;
+      if( aValForTime && aValForTime->GetMaxNbGauss() > 1 )
+       isEnableGaussMetric = true;
+    }
+  }
+
+  myGaussMetricLabel->setEnabled(isEnableGaussMetric);
+  myGaussMetric->setEnabled(isEnableGaussMetric);
+  if( isEnableGaussMetric )
+    myGaussMetric->setCurrentIndex((int)myScalarMap->GetGaussMetric());
+
   setRange( myScalarMap->GetMin(), myScalarMap->GetMax(), myScalarMap->IsRangeFixed() );
 
   setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
@@ -1097,6 +1133,9 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   else
     myScalarMapPL->SetScaling(VISU::LINEAR);
 
+  if( myGaussMetric->isVisible() )
+    myScalarMapPL->SetGaussMetric((VISU::TGaussMetric)myGaussMetric->currentIndex());
+
   if ( RBFrange->isChecked() ) {
     myScalarMapPL->SetSourceRange();
   } else {
@@ -1229,6 +1268,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     return 0;
 
   myScalarMap->SetScalarMode(myModeCombo->currentIndex());
+  if( myGaussMetric->isVisible() )
+    myScalarMap->SetGaussMetric((VISU::GaussMetric)myGaussMetric->currentIndex());
   myScalarMap->SetPosition(XSpin->value(), YSpin->value());
   myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
   if(RBvert->isChecked()) {
@@ -1407,6 +1448,23 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
 }
 
 
+//----------------------------------------------------------------------------
+/*!
+  Called when scalar mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeGaussMetric( int theGaussMetric )
+{
+  myScalarMap->SetGaussMetric((VISU::GaussMetric)theGaussMetric);
+
+  if ( RBFrange->isChecked() ) {
+    MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
+    MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+  }
+
+  updatePreview();
+}
+
+
 //----------------------------------------------------------------------------
 /*!
   Sets default values and range mode
@@ -1684,10 +1742,10 @@ void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e )
 }
 
 //----------------------------------------------------------------------------
-VisuGUI_ScalarBarBaseDlg::VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool thePreview ) :
+VisuGUI_ScalarBarBaseDlg::VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool theIsDisplayGaussMetric, bool thePreview ) :
   VisuGUI_Prs3dDlg( theModule )
 {
-  myScalarPane = new VisuGUI_ScalarBarPane(this, thePreview);
+  myScalarPane = new VisuGUI_ScalarBarPane(this, theIsDisplayGaussMetric, thePreview);
   myScalarPane->layout()->setMargin( 5 );
 }
 
index 734203e6718078dce855526a05606d9ad6646934..be4b12d79f0360988388b942cd0eb16047f4fe70 100644 (file)
@@ -154,7 +154,7 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
   Q_OBJECT;
 
  public:
-  VisuGUI_ScalarBarPane(QWidget* parent, bool thePreview = FALSE);
+  VisuGUI_ScalarBarPane(QWidget* parent, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE);
   ~VisuGUI_ScalarBarPane();
 
   void    setRange( double imin, double imax, bool sbRange );
@@ -210,6 +210,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
 
   QLabel*         myModeLbl;
   QComboBox*      myModeCombo;
+  QLabel*         myGaussMetricLabel;
+  QComboBox*      myGaussMetric;
   QPushButton*    myTextBtn;
   QPushButton*    myBarBtn;
   VisuGUI_TextPrefDlg* myTextDlg;
@@ -228,6 +230,7 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
  void onImposedRange( bool );
   void XYChanged( double );
   void changeScalarMode( int );
+  void changeGaussMetric( int );
   void onTextPref();
   void onBarPref();
   void onPreviewCheck(bool thePreview);
@@ -245,6 +248,7 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
   std::string        myTitle;
 
   bool myBusy;
+  bool myIsDisplayGaussMetric;
 };
 
 
@@ -279,7 +283,7 @@ class VisuGUI_ScalarBarBaseDlg : public VisuGUI_Prs3dDlg
   Q_OBJECT;
 
  public:
-  VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool thePreview = FALSE );
+  VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE );
   ~VisuGUI_ScalarBarBaseDlg();
 
   virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
index 405584641da2a1e64ad086e359e3a8a33cd3b18f..551e2b06f37f24ca0e2f958190e0f0eaefff6c38 100644 (file)
@@ -69,7 +69,7 @@ using namespace std;
   Constructor
 */
 VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule)
-  : VisuGUI_ScalarBarBaseDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule, true)
 {
   setWindowTitle(tr("DLG_PROP_TITLE"));
   setSizeGripEnabled(TRUE);
index d782714ea228e6c4f880baed244ad8bad13c0b83..14e0e6f31c04a4fb70774993da769609c621649d 100644 (file)
@@ -441,6 +441,24 @@ namespace VISU
     theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
     theStr<<thePrefix<<theName<<".SetBarVisible("<<aVisible<<")"<<endl;
 
+    switch(theServant->GetGaussMetric()){
+    case AVERAGE:
+      aParam = "VISU.AVERAGE";
+      break;
+    case MINIMUM:
+      aParam = "VISU.MINIMUM";
+      break;
+    case MAXIMUM:
+      aParam = "VISU.MAXIMUM";
+      break;
+    }
+    theStr<<thePrefix<<theName<<".SetGaussMetric("<<aParam<<")"<<endl;
+
+    if(theServant->IsRangeFixed())
+      theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
+    else
+      theStr<<thePrefix<<theName<<".SetSourceRange()"<<endl;
+
     return thePrefix;
   }
 
index 9c67ac1f8456f501a2960d3badc8a9a82a7e2bb5..450c8d99f7c36b3f9f50e6b956053a8d3bd83704 100644 (file)
@@ -200,6 +200,7 @@ VISU::ScalarMap_i
     ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
  
     SetScaling(anOrigin->GetScaling());
+    SetGaussMetric(anOrigin->GetGaussMetric());
     SetBarVisible(anOrigin->IsBarVisible());
     Update();
   }
@@ -226,6 +227,9 @@ VISU::ScalarMap_i
   else
     SetScaling(VISU::LINEAR);
 
+  int aGaussMetric = aResourceMgr->integerValue("VISU", "scalar_gauss_metric", 0);
+  SetGaussMetric((VISU::GaussMetric)aGaussMetric);
+
   myShowBar = true;
   return this;
 }
@@ -252,6 +256,8 @@ VISU::ScalarMap_i
   QString aVal = VISU::Storable::FindValue(theMap,"myShowBar", "1");
   SetBarVisible((aVal.toInt() == 1)? true : false);
 
+  SetGaussMetric(VISU::GaussMetric(VISU::Storable::FindValue(theMap,"myGaussMetric").toInt()));
+
   // Check if the icon needs to be updated, update if necessary
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
@@ -275,6 +281,7 @@ VISU::ScalarMap_i
 
   Storable::DataToStream( theStr, "myScaling",        GetScaling() );
   Storable::DataToStream( theStr, "myShowBar",        (IsBarVisible()? 1:0) );
+  Storable::DataToStream( theStr, "myGaussMetric",    int(GetGaussMetric()) );
 }
 
 
@@ -297,6 +304,25 @@ VISU::ScalarMap_i
                   (GetSpecificPL(), &VISU_ColoredPL::SetScaling, theScaling));
 }
 
+//----------------------------------------------------------------------------
+VISU::GaussMetric 
+VISU::ScalarMap_i
+::GetGaussMetric()
+{
+  return VISU::GaussMetric(GetSpecificPL()->GetGaussMetric());
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::SetGaussMetric(VISU::GaussMetric theGaussMetric)
+{
+  VISU::TSetModified aModified(this);
+  
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, VISU::TGaussMetric>
+                  (GetSpecificPL(), &VISU_ScalarMapPL::SetGaussMetric, (VISU::TGaussMetric)theGaussMetric));
+}
+
 //----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
@@ -541,8 +567,11 @@ struct TGetComponentMin: public SALOME_Event
   Execute()
   {
     VISU::TNames aGroupNames;
-    if(VISU::ScalarMap_i* aPrs3d = dynamic_cast<VISU::ScalarMap_i*>(myColoredPrs3d))
+    VISU::GaussMetric aGaussMetric = VISU::AVERAGE;
+    if(VISU::ScalarMap_i* aPrs3d = dynamic_cast<VISU::ScalarMap_i*>(myColoredPrs3d)) {
       aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames();
+      aGaussMetric = aPrs3d->GetGaussMetric();
+    }
 
     VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController();
     if ( aMinMaxController ) {
@@ -550,9 +579,9 @@ struct TGetComponentMin: public SALOME_Event
     } else {
       VISU::TMinMax aTMinMax;
       if(myColoredPrs3d->GetScalarField()->myIsELNO)
-       aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames );
+       aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames, (VISU::TGaussMetric)aGaussMetric );
       else
-       aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames );
+       aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames, (VISU::TGaussMetric)aGaussMetric );
       myResult = aTMinMax.first;
     }
   }
@@ -587,8 +616,11 @@ struct TGetComponentMax: public SALOME_Event
   Execute()
   {
     VISU::TNames aGroupNames;
-    if(VISU::ScalarMap_i* aPrs3d = dynamic_cast<VISU::ScalarMap_i*>(myColoredPrs3d))
+    VISU::GaussMetric aGaussMetric = VISU::AVERAGE;
+    if(VISU::ScalarMap_i* aPrs3d = dynamic_cast<VISU::ScalarMap_i*>(myColoredPrs3d)) {
       aGroupNames = aPrs3d->GetSpecificPL()->GetGeometryNames();
+      aGaussMetric = aPrs3d->GetGaussMetric();
+    }
 
     VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController();
     if ( aMinMaxController ) {
@@ -596,9 +628,9 @@ struct TGetComponentMax: public SALOME_Event
     } else {
       VISU::TMinMax aTMinMax;
       if(myColoredPrs3d->GetScalarField()->myIsELNO)
-       aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames );
+       aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID, aGroupNames, (VISU::TGaussMetric)aGaussMetric );
       else
-       aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames );
+       aTMinMax = myColoredPrs3d->GetScalarField()->GetAverageMinMax( myCompID, aGroupNames, (VISU::TGaussMetric)aGaussMetric );
       myResult = aTMinMax.second;
     }
   }
index 0b640af6bcfa83c3ef4388cc3bf8492a8e27593b..aba260e0e3e164c7545909703f44a0f0c5bc423c 100644 (file)
@@ -76,6 +76,15 @@ namespace VISU
     void
     SetScaling(VISU::Scaling theScaling);
 
+    //----------------------------------------------------------------------------
+    virtual 
+    VISU::GaussMetric 
+    GetGaussMetric();
+
+    virtual
+    void
+    SetGaussMetric(VISU::GaussMetric theGaussMetric);
+
     //----------------------------------------------------------------------------
     //! Sets initial source geometry
     virtual