TProfileKey
GetProfileKey(const MED::PWrapper& theMEDWrapper,
const MED::PMeshInfo& theMeshInfo,
- const MED::TTimeStampVal& theTimeStampVal,
+ const MED::PTimeStampValueBase& theTimeStampValue,
const VISU::TMEDMeshOnEntity& theMeshOnEntity,
MED::EEntiteMaillage theMEntity,
const MED::TGeom2Size& theGeom2Size)
INITMSG(MYDEBUG,"GetProfileKey"<<endl);
TProfileKey aProfileKey;
- const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+ const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
void
InitProfile(const MED::PWrapper& theMEDWrapper,
const MED::PMeshInfo& theMeshInfo,
- MED::TTimeStampVal& theTimeStampVal,
+ MED::PTimeStampValueBase& theTimeStampValue,
VISU::TMEDMeshOnEntity& theMeshOnEntity,
MED::EEntiteMaillage theMEntity,
const MED::TGeom2Size& theGeom2Size,
TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
theMeshInfo,
- theTimeStampVal,
+ theTimeStampValue,
theMeshOnEntity,
theMEntity,
theGeom2Size);
//---------------------------------------------------------------
TGaussKey
- GetGaussKey(const MED::TTimeStampVal& theTimeStampVal,
+ GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
const VISU::TMEDMeshOnEntity& theMeshOnEntity,
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
PMEDProfile aProfile = theValForTime.myProfile;
TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+ const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
//---------------------------------------------------------------
void
- InitGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+ InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
VISU::TMEDMeshOnEntity& theMeshOnEntity,
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
- TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
+ TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
theMeshOnEntity,
theGeom2Size,
theValForTime);
void
InitGaussProfile(const MED::PWrapper& theMEDWrapper,
const MED::PMeshInfo& theMeshInfo,
- MED::TTimeStampVal& theTimeStampVal,
+ MED::PTimeStampValueBase& theTimeStampValue,
VISU::TMEDMeshOnEntity& theMeshOnEntity,
MED::EEntiteMaillage theMEntity,
const MED::TGeom2Size& theGeom2Size,
// The order of the function calls is important
InitProfile(theMEDWrapper,
theMeshInfo,
- theTimeStampVal,
+ theTimeStampValue,
theMeshOnEntity,
theMEntity,
theGeom2Size,
theValForTime);
- InitGaussMesh(theTimeStampVal,
+ InitGaussMesh(theTimeStampValue,
theMeshOnEntity,
theGeom2Size,
theValForTime);
}
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+ const MED::TGeom2Gauss& theGeom2Gauss,
+ TMinMaxArr& theMinMaxArr,
+ TInt theNbComp,
+ TInt theNbComp2)
+{
+
+ const typename TimeStampValueType::TGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
+ typename TimeStampValueType::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+ for(; anIter != aGeom2Value.end(); anIter++){
+ const typename TimeStampValueType::TMeshValue& aMMeshValue = anIter->second;
+ MED::EGeometrieElement aMGeom = anIter->first;
+
+ TInt aNbElem = aMMeshValue.myNbElem;
+ TInt aNbGauss = aMMeshValue.myNbGauss;
+
+ MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
+ if(aGaussIter == theGeom2Gauss.end())
+ aNbGauss = 1;
+
+ INITMSG(MYDEBUG,
+ "- aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ // To calculate min/max per components
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ typename TimeStampValueType::TMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+ for(TInt iComp = 0; iComp < theNbComp; iComp++){
+ const typename TimeStampValueType::TMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+ TMinMax& aMinMax = theMinMaxArr[iComp+1];
+ vtkFloatingPointType& aMin = aMinMax.first;
+ vtkFloatingPointType& aMax = aMinMax.second;
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
+ aMin = min(aMin,aVal);
+ aMax = max(aMax,aVal);
+ }
+ }
+ }
+
+ // To calculate min/max per vector modulus
+ TMinMax& aMinMax = theMinMaxArr[0];
+ vtkFloatingPointType& aMin = aMinMax.first;
+ vtkFloatingPointType& aMax = aMinMax.second;
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ typename TimeStampValueType::TMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const typename TimeStampValueType::TMeshValue::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 = min(aMin,aValue);
+ aMax = max(aMax,aValue);
+ }
+ }
+ }
+}
+
+
//---------------------------------------------------------------
VISU_Convertor*
VISU_MedConvertor
try{
OCC_CATCH_SIGNALS;
#else
- CASCatch_TRY{
- try{
+ CASCatch_TRY{
+ try{
#endif
#endif
- MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
- aMEntity,
- aGeom2Size,
- iTimeStamp);
-
- MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
- aMKey2Profile,
- aKey2Gauss);
-
- const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-
- const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-
- const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
- MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
- for(; anIter != aGeom2Value.end(); anIter++){
- const MED::TMeshValue& aMMeshValue = anIter->second;
- MED::EGeometrieElement aMGeom = anIter->first;
-
- TInt aNbElem = aMMeshValue.myNbElem;
- TInt aNbGauss = aMMeshValue.myNbGauss;
+ MED::PTimeStampInfo aTimeStampInfo =
+ aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aGeom2Size,
+ iTimeStamp);
- MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
- if(aGaussIter == aGeom2Gauss.end())
- aNbGauss = 1;
-
- INITMSG(MYDEBUG,
- "- aMGeom = "<<aMGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbGauss = "<<aNbGauss<<
- endl);
-
- // 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+1];
- vtkFloatingPointType& aMin = aMinMax.first;
- vtkFloatingPointType& aMax = aMinMax.second;
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
- aMin = min(aMin,aVal);
- aMax = max(aMax,aVal);
- }
- }
- }
+ MED::PTimeStampValueBase aTimeStampValue =
+ aMed->GetPTimeStampValue(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+
+ const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
+
+ if(aFieldInfo->GetType() == MED::eFLOAT64)
+ BuildTimeStampMinMax<MED::TFloatTimeStampValue>(aTimeStampValue,
+ aGeom2Gauss,
+ aMinMaxArr,
+ aNbComp,
+ aNbComp2);
+ else
+ BuildTimeStampMinMax<MED::TIntTimeStampValue>(aTimeStampValue,
+ aGeom2Gauss,
+ aMinMaxArr,
+ aNbComp,
+ aNbComp2);
- // To calculate min/max per vector modulus
- TMinMax& aMinMax = aMinMaxArr[0];
- vtkFloatingPointType& aMin = aMinMax.first;
- vtkFloatingPointType& 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];
- vtkFloatingPointType aValue = 0.0;
- for(TInt iComp = 0; iComp < aNbComp2; iComp++){
- vtkFloatingPointType aVal = aMValueSlice[iComp];
- aValue += aVal*aVal;
- }
- aValue = sqrt(aValue);
- aMin = min(aMin,aValue);
- aMax = max(aMax,aValue);
- }
- }
- }
#ifndef _DEXCEPT_
#ifdef NO_CAS_CATCH
- }catch(Standard_Failure){
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
- }catch(std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
- }catch(...){
- MSG(MYDEBUG,"Unknown exception !!!");
- }
+ }catch(Standard_Failure){
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
#else
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
void
LoadProfile(const MED::PWrapper& theMed,
VISU::PMEDMesh theMesh,
- MED::TTimeStampVal& theTimeStampVal,
+ MED::PTimeStampValueBase theTimeStampValue,
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
return;
const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+ const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
for(; anIter != aGeom2Profile.end(); anIter++){
MED::PProfileInfo aProfileInfo = anIter->second;
void
LoadGaussMesh(const MED::PWrapper& theMed,
VISU::PMEDMesh theMesh,
- MED::TTimeStampVal& theTimeStampVal,
+ MED::PTimeStampValueBase theTimeStampValue,
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
- const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+ const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
}
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+ const TGeom2SubProfile& theGeom2SubProfile,
+ VISU::PMEDValForTime theValForTime,
+ VISU::PMEDField theField)
+{
+ theField->myDataSize = 0;
+ TInt aNbComp = theField->myNbComp;
+
+ TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
+ for(; anIter != theGeom2SubProfile.end(); anIter++){
+ VISU::EGeometry aEGeom = anIter->first;
+ PMEDSubProfile aSubProfile(anIter->second);
+
+ TInt aNbElem = aSubProfile->myNbCells;
+ theField->myDataSize += aNbElem*aNbComp;
+
+ if(aSubProfile->myStatus != eRemoveAll){
+ TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
+
+ INITMSG(MYDEBUG,
+ "- aEGeom = "<<aEGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+ aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+
+ MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+ const typename TimeStampValueType::TMeshValue& aMMeshValue = theTimeStampValue->GetMeshValue(aMGeom);
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
+ typename TimeStampValueType::TMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+ ADDMSG(MYVALUEDEBUG,"{");
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
+ const typename TimeStampValueType::TMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ aVValueSlice[iComp] = aMValueSlice[iComp];
+ ADDMSG(MYVALUEDEBUG,aVValueSlice[iComp]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG,"| ");
+ }
+ ADDMSG(MYVALUEDEBUG,"} ");
+ }
+ ADDMSG(MYDEBUG,"\n");
+ }
+ }
+}
+
//---------------------------------------------------------------
int
LoadValForTime(const MED::PWrapper& theMed,
MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
- MED::PTimeStampVal aTimeStampVal =
- theMed->GetPTimeStampVal(aTimeStampInfo,
- aMKey2Profile,
- aKey2Gauss);
-
+ MED::PTimeStampValueBase aTimeStampValue =
+ theMed->GetPTimeStampValue(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+
InitGaussProfile(theMed,
aMeshInfo,
- aTimeStampVal,
+ aTimeStampValue,
theMeshOnEntity,
aMEntity,
aGeom2Size,
LoadProfile(theMed,
theMesh,
- aTimeStampVal,
+ aTimeStampValue,
theValForTime,
theMeshOnEntity);
if(theIsGauss)
LoadGaussMesh(theMed,
theMesh,
- aTimeStampVal,
+ aTimeStampValue,
theValForTime,
theMeshOnEntity);
PMEDProfile aProfile = theValForTime->myProfile;
TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- TInt aNbComp = theField->myNbComp;
-
INITMSGA(MYDEBUG,0,
"- aMeshName = '"<<aMeshName<<"'"<<
"; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
"; aMEntity = "<<aMEntity<<
- "; aNbComp = "<<aNbComp<<
+ "; aNbComp = "<<theField->myNbComp<<
endl);
- theField->myDataSize = 0;
-
- const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
- TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
- for(; anIter != aGeom2SubProfile.end(); anIter++){
- VISU::EGeometry aEGeom = anIter->first;
- PMEDSubProfile aSubProfile(anIter->second);
-
- TInt aNbElem = aSubProfile->myNbCells;
- theField->myDataSize += aNbElem*aNbComp;
-
- if(aSubProfile->myStatus != eRemoveAll){
- TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
-
- INITMSG(MYDEBUG,
- "- aEGeom = "<<aEGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbGauss = "<<aNbGauss<<
- endl);
-
- TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
- aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
-
- MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
- const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
- MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
- ADDMSG(MYVALUEDEBUG,"{");
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
- const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- aVValueSlice[iComp] = aMValueSlice[iComp];
- ADDMSG(MYVALUEDEBUG,aVValueSlice[iComp]<<" ");
- }
- ADDMSG(MYVALUEDEBUG,"| ");
- }
- ADDMSG(MYVALUEDEBUG,"} ");
- }
- ADDMSG(MYDEBUG,"\n");
- }
- }
-
+ if(aFieldInfo->GetType() == MED::eFLOAT64)
+ FillValForTime<MED::TFloatTimeStampValue>(aTimeStampValue,
+ aGeom2SubProfile,
+ theValForTime,
+ theField);
+ else
+ FillValForTime<MED::TIntTimeStampValue>(aTimeStampValue,
+ aGeom2SubProfile,
+ theValForTime,
+ theField);
theIsDone = true;
return 1;