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>
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.
*/
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();
+
};
//-------------------------------------------------------
<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"/>
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;
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++){
// 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;
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();
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;
+ }
}
}
}
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()");
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);
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);
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]);
}
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();
*/
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
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;
};
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 );
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 );
}
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;
+ }
}
}
TMinMax
TFieldImpl
- ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames)
+ ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
{
TMinMax aMinMax;
bool anIsMinMaxInitialized = false;
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 );
}
if( !anIsMinMaxInitialized )
- aMinMax = myMinMaxArr[theCompID];
+ aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
return aMinMax;
}
TMinMax
TFieldImpl
- ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames)
+ ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
{
TMinMax aMinMax;
bool anIsMinMaxInitialized = false;
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 );
}
if( !anIsMinMaxInitialized )
- aMinMax = myAverageMinMaxArr[theCompID];
+ aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
return aMinMax;
}
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()
//---------------------------------------------------------------
- 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
//! 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;
};
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
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();
+}
void
GetSourceRange(vtkFloatingPointType theRange[2]);
+ virtual
+ void
+ SetGaussMetric(VISU::TGaussMetric theGaussMetric);
+
+ virtual
+ VISU::TGaussMetric
+ GetGaussMetric();
+
virtual
void
SetScalars(vtkDataSet *theScalars);
#include "VISU_Extractor.hxx"
#include "VISU_PipeLineUtils.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "VISU_MeshValue.hxx"
#include <sstream>
//----------------------------------------------------------------------------
VISU_Extractor
::VISU_Extractor():
- myScalarMode(1)
+ myScalarMode(1),
+ myGaussMetric(VISU::AVERAGE_METRIC)
{
}
}
+//----------------------------------------------------------------------------
+void
+VISU_Extractor
+::SetGaussMetric(VISU::TGaussMetric theGaussMetric)
+{
+ if(myGaussMetric != theGaussMetric){
+ myGaussMetric = theGaussMetric;
+ Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+VISU::TGaussMetric
+VISU_Extractor
+::GetGaussMetric()
+{
+ return myGaussMetric;
+}
+
+
//----------------------------------------------------------------------------
template<typename TValueType>
void
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);
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();
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;
#define VISU_Extractor_HeaderFile
#include "VISUPipeline.hxx"
+#include "VISU_ConvertorDef.hxx"
#include <vtkDataSetAlgorithm.h>
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&);
RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
int myScalarMode;
+ VISU::TGaussMetric myGaussMetric;
};
#endif
#include "VISU_ScalarMapPL.hxx"
#include "VISU_DataSetMapperHolder.hxx"
#include "VISU_ElnoAssembleFilter.hxx"
+#include "VISU_Extractor.hxx"
#include "VISU_FieldTransform.hxx"
#include "VISU_AppendFilter.hxx"
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);
{
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+ if(VISU_ScalarMapPL* aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine))
+ SetGaussMetric(aPipeLine->GetGaussMetric());
}
}
+//----------------------------------------------------------------------------
+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
void
GetSourceRange(vtkFloatingPointType theRange[2]);
+ virtual
+ void
+ SetGaussMetric(VISU::TGaussMetric theGaussMetric);
+
+ virtual
+ VISU::TGaussMetric
+ GetGaussMetric();
+
//----------------------------------------------------------------------------
virtual
vtkPointSet*
<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>
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" ) );
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 );
* Constructor
*/
VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule)
- : VisuGUI_ScalarBarBaseDlg(theModule),
+ : VisuGUI_ScalarBarBaseDlg(theModule, true),
myIsAnimation(false),
myUpdateScalars(true),
myIsScalarFieldValid(true),
#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"
/*!
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();
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 );
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);
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 ) ) );
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() );
else
myScalarMapPL->SetScaling(VISU::LINEAR);
+ if( myGaussMetric->isVisible() )
+ myScalarMapPL->SetGaussMetric((VISU::TGaussMetric)myGaussMetric->currentIndex());
+
if ( RBFrange->isChecked() ) {
myScalarMapPL->SetSourceRange();
} else {
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()) {
}
+//----------------------------------------------------------------------------
+/*!
+ 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
}
//----------------------------------------------------------------------------
-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 );
}
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 );
QLabel* myModeLbl;
QComboBox* myModeCombo;
+ QLabel* myGaussMetricLabel;
+ QComboBox* myGaussMetric;
QPushButton* myTextBtn;
QPushButton* myBarBtn;
VisuGUI_TextPrefDlg* myTextDlg;
void onImposedRange( bool );
void XYChanged( double );
void changeScalarMode( int );
+ void changeGaussMetric( int );
void onTextPref();
void onBarPref();
void onPreviewCheck(bool thePreview);
std::string myTitle;
bool myBusy;
+ bool myIsDisplayGaussMetric;
};
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,
Constructor
*/
VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule)
- : VisuGUI_ScalarBarBaseDlg(theModule)
+ : VisuGUI_ScalarBarBaseDlg(theModule, true)
{
setWindowTitle(tr("DLG_PROP_TITLE"));
setSizeGripEnabled(TRUE);
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;
}
ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
SetScaling(anOrigin->GetScaling());
+ SetGaussMetric(anOrigin->GetGaussMetric());
SetBarVisible(anOrigin->IsBarVisible());
Update();
}
else
SetScaling(VISU::LINEAR);
+ int aGaussMetric = aResourceMgr->integerValue("VISU", "scalar_gauss_metric", 0);
+ SetGaussMetric((VISU::GaussMetric)aGaussMetric);
+
myShowBar = true;
return this;
}
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();
Storable::DataToStream( theStr, "myScaling", GetScaling() );
Storable::DataToStream( theStr, "myShowBar", (IsBarVisible()? 1:0) );
+ Storable::DataToStream( theStr, "myGaussMetric", int(GetGaussMetric()) );
}
(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
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 ) {
} 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;
}
}
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 ) {
} 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;
}
}
void
SetScaling(VISU::Scaling theScaling);
+ //----------------------------------------------------------------------------
+ virtual
+ VISU::GaussMetric
+ GetGaussMetric();
+
+ virtual
+ void
+ SetGaussMetric(VISU::GaussMetric theGaussMetric);
+
//----------------------------------------------------------------------------
//! Sets initial source geometry
virtual