From: ouv Date: Mon, 20 Jul 2009 09:13:10 +0000 (+0000) Subject: Fix of issue 0017328: EDF 593 VISU : min and max scalar map of results given at gauss... X-Git-Tag: V5_1_main_20090721 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=45f3a53e410f578994f269a1b424e23e46518010;p=modules%2Fvisu.git Fix of issue 0017328: EDF 593 VISU : min and max scalar map of results given at gauss points --- diff --git a/doc/salome/gui/VISU/images/scalarbarproperties.png b/doc/salome/gui/VISU/images/scalarbarproperties.png index 318497db..9da29706 100644 Binary files a/doc/salome/gui/VISU/images/scalarbarproperties.png and b/doc/salome/gui/VISU/images/scalarbarproperties.png differ diff --git a/doc/salome/gui/VISU/input/scalar_map.doc b/doc/salome/gui/VISU/input/scalar_map.doc index 749ff40c..775471e8 100644 --- a/doc/salome/gui/VISU/input/scalar_map.doc +++ b/doc/salome/gui/VISU/input/scalar_map.doc @@ -64,6 +64,11 @@ fields containing vector values, in other cases it will be inactive).
  • Logarithmic scaling check box: You can apply logarithmic scaling to the color scale of the presentation.
  • +
  • Gauss Metric 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 - Scalar Map +and Deformed Shape and Scalar Map, and it is active only when +the result is based on multiple gauss points).
  • Use field range: if this check box is selected, all cells of the field presentation will be colored according the values applied to these cells.
  • diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 7ff5beb8..2e98fc19 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -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 GaussMetric enumeration. + */ + void SetGaussMetric(in GaussMetric theGaussMetric); + + /*! + * Gets the gauss metric of the presentation. + */ + GaussMetric GetGaussMetric(); + }; //------------------------------------------------------- diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 612d301f..48c8051b 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -92,6 +92,7 @@ + diff --git a/src/CONVERTOR/VISU_ConvertorDef.hxx b/src/CONVERTOR/VISU_ConvertorDef.hxx index a500b34d..cf416a92 100644 --- a/src/CONVERTOR/VISU_ConvertorDef.hxx +++ b/src/CONVERTOR/VISU_ConvertorDef.hxx @@ -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 PMesh; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 2c7fdf28..4beb4133 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -1594,16 +1594,22 @@ void BuildTimeStampMinMax(MED::SharedPtr 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 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 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 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 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 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 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(CastToFloatTimeStampValue(aTimeStampValue), aMeshOnEntity, aGeom2Gauss, - aMinMaxArr, - anAverageMinMaxArr, - aGroup2MinMaxArr, - aGroup2AverageMinMaxArr, + aMetric2Comp2MinMax, + aMetric2Comp2AverageMinMax, + aMetric2Comp2Group2MinMax, + aMetric2Comp2Group2AverageMinMax, aNbComp, aNbComp2); else BuildTimeStampMinMax(CastToIntTimeStampValue(aTimeStampValue), aMeshOnEntity, aGeom2Gauss, - aMinMaxArr, - anAverageMinMaxArr, - aGroup2MinMaxArr, - aGroup2AverageMinMaxArr, + aMetric2Comp2MinMax, + aMetric2Comp2AverageMinMax, + aMetric2Comp2Group2MinMax, + aMetric2Comp2Group2AverageMinMax, aNbComp, aNbComp2); diff --git a/src/CONVERTOR/VISU_MeshValue.cxx b/src/CONVERTOR/VISU_MeshValue.cxx index a4cee766..b26b95ff 100644 --- a/src/CONVERTOR/VISU_MeshValue.cxx +++ b/src/CONVERTOR/VISU_MeshValue.cxx @@ -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 TTDataArrayHolder2; PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray)); TTimeStampOnProfileInitArray(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(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(aGaussMaxDataArrayHolder).Execute(theField, theValForTime, VISU::MAXIMUM_METRIC); + aGaussMaxDataArray->Delete(); + } } aSelectedDataArray->Delete(); diff --git a/src/CONVERTOR/VISU_Structures.hxx b/src/CONVERTOR/VISU_Structures.hxx index 4e877ccd..d9f08fb0 100644 --- a/src/CONVERTOR/VISU_Structures.hxx +++ b/src/CONVERTOR/VISU_Structures.hxx @@ -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; }; diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index cdb78dbd..3931c1e9 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -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() diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx index eebf3dd1..baec9a32 100644 --- a/src/CONVERTOR/VISU_Structures_impl.hxx +++ b/src/CONVERTOR/VISU_Structures_impl.hxx @@ -786,10 +786,12 @@ namespace VISU //--------------------------------------------------------------- - typedef TVector TMinMaxArr; + typedef TVector TComp2MinMax; + typedef TVector TMetric2Comp2MinMax; - typedef std::map TGroup2MinMax; - typedef TVector TGroup2MinMaxArr; + typedef std::map TGroup2MinMax; + typedef TVector TComp2Group2MinMax; + typedef TVector 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 diff --git a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx index 2da76c09..3297e520 100644 --- a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx +++ b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx @@ -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(); +} diff --git a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx index 05eedb53..f211f24b 100644 --- a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx +++ b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx @@ -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); diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index 0a53d675..575f787d 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -26,6 +26,7 @@ #include "VISU_Extractor.hxx" #include "VISU_PipeLineUtils.hxx" #include "VISU_ConvertorUtils.hxx" +#include "VISU_MeshValue.hxx" #include @@ -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 void @@ -119,13 +141,22 @@ Component2Scalars(vtkDataArray *theInputDataArray, template 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; diff --git a/src/PIPELINE/VISU_Extractor.hxx b/src/PIPELINE/VISU_Extractor.hxx index 53f038bd..5d6b8874 100644 --- a/src/PIPELINE/VISU_Extractor.hxx +++ b/src/PIPELINE/VISU_Extractor.hxx @@ -28,6 +28,7 @@ #define VISU_Extractor_HeaderFile #include "VISUPipeline.hxx" +#include "VISU_ConvertorDef.hxx" #include @@ -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 diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index 9786e6e0..35a0a1d2 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -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(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 diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 5db2f3b5..e504112b 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -86,6 +86,14 @@ public: void GetSourceRange(vtkFloatingPointType theRange[2]); + virtual + void + SetGaussMetric(VISU::TGaussMetric theGaussMetric); + + virtual + VISU::TGaussMetric + GetGaussMetric(); + //---------------------------------------------------------------------------- virtual vtkPointSet* diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 1c75f4a1..6e63b378 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -189,6 +189,26 @@ number of time stamps or number of components is not the same! VISU_FONT_TIMES Times + + VISU_GAUSS_METRIC + Gauss Metric + + + VISU_GAUSS_METRIC_AVERAGE + Average + + + VISU_GAUSS_METRIC_MAXIMUM + Maximum + + + VISU_GAUSS_METRIC_MINIMUM + Minimum + + + VISU_GAUSS_METRIC_TOOLTIP + Select the data to display on the cell + VISU_HEIGHT Height: diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 11011105..befa55e7 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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 ); diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx index b5415a4c..4d65681c 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx @@ -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), diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx index 8372ddb2..58bbb712 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -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 ); } diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.h b/src/VISUGUI/VisuGUI_Prs3dDlg.h index 734203e6..be4b12d7 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.h +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.h @@ -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, diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 40558464..551e2b06 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -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); diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index d782714e..14e0e6f3 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -441,6 +441,24 @@ namespace VISU theStr<GetGaussMetric()){ + case AVERAGE: + aParam = "VISU.AVERAGE"; + break; + case MINIMUM: + aParam = "VISU.MINIMUM"; + break; + case MAXIMUM: + aParam = "VISU.MAXIMUM"; + break; + } + theStr<IsRangeFixed()) + theStr<GetMin()<<", "<GetMax()<<")"<(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 + (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(myColoredPrs3d)) + VISU::GaussMetric aGaussMetric = VISU::AVERAGE; + if(VISU::ScalarMap_i* aPrs3d = dynamic_cast(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(myColoredPrs3d)) + VISU::GaussMetric aGaussMetric = VISU::AVERAGE; + if(VISU::ScalarMap_i* aPrs3d = dynamic_cast(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; } } diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 0b640af6..aba260e0 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -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