myNbComp = theNbComp;
myCompNames.resize(theNbComp);
myUnitNames.resize(theNbComp);
- myMinMaxArr.resize(theNbComp);
- for(vtkIdType iComp = 0; iComp < theNbComp; iComp++){
+ myMinMaxArr.resize(theNbComp + 1);
+ for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
TMinMax& aMinMax = myMinMaxArr[iComp];
aMinMax.first = VTK_LARGE_FLOAT;
aMinMax.second = -VTK_LARGE_FLOAT;
endl);
TInt aNbComp = myField->myNbComp;
+ int aNbComp2 = aNbComp;
+ if(aNbComp == 2 || aNbComp == 4)
+ aNbComp2 = 2;
+ else if(aNbComp > 4)
+ aNbComp2 = 3;
+
TValField& aValField = myField->myValField;
TMinMaxArr& aMinMaxArr = myField->myMinMaxArr;
for(TInt iTimeStamp = 1; iTimeStamp <= myNbTimeStamps; iTimeStamp++){
MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
+
+ // To calculate min/max per components
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
for(TInt iComp = 0; iComp < aNbComp; iComp++){
const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
- TMinMax& aMinMax = aMinMaxArr[iComp];
+ TMinMax& aMinMax = aMinMaxArr[iComp+1];
float& aMin = aMinMax.first;
float& aMax = aMinMax.second;
for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
}
}
}
+
+ // To calculate min/max per vector modulus
+ TMinMax& aMinMax = aMinMaxArr[0];
+ float& aMin = aMinMax.first;
+ float& aMax = aMinMax.second;
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+ float aValue = 0.0;
+ for(TInt iComp = 0; iComp < aNbComp2; iComp++){
+ float aVal = aMValueSlice[iComp];
+ aValue += aVal*aVal;
+ }
+ aValue = sqrt(aValue);
+ aMin = min(aMin,aValue);
+ aMax = max(aMax,aValue);
+ }
+ }
}
}
}
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ for(TInt iComp = 0; iComp <= aNbComp; iComp++){
VISU::TMinMax aMinMax = myField->GetMinMax(iComp);
INITMSG(MYTHREADDEBUG,"- "<<this<<"; "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
}