From 88efedc470c8502d35ccbc658ff5bac9957c41a5 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 8 Dec 2006 09:04:56 +0000 Subject: [PATCH] First implementation of "MEDWrapper / Data loading customization" --- src/CONVERTOR/VISU_MedConvertor.cxx | 333 ++++++++++++++++------------ 1 file changed, 188 insertions(+), 145 deletions(-) diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index f8fa135e..de8e9b30 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -280,7 +280,7 @@ namespace 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) @@ -288,7 +288,7 @@ namespace INITMSG(MYDEBUG,"GetProfileKey"<GetGeom2Profile(); const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size; MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin(); @@ -311,7 +311,7 @@ namespace 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, @@ -324,7 +324,7 @@ namespace TProfileKey aProfileKey = GetProfileKey(theMEDWrapper, theMeshInfo, - theTimeStampVal, + theTimeStampValue, theMeshOnEntity, theMEntity, theGeom2Size); @@ -356,7 +356,7 @@ namespace //--------------------------------------------------------------- TGaussKey - GetGaussKey(const MED::TTimeStampVal& theTimeStampVal, + GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue, const VISU::TMEDMeshOnEntity& theMeshOnEntity, const MED::TGeom2Size& theGeom2Size, VISU::TMEDValForTime& theValForTime) @@ -368,7 +368,7 @@ namespace 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; @@ -431,7 +431,7 @@ namespace //--------------------------------------------------------------- void - InitGaussMesh(MED::TTimeStampVal& theTimeStampVal, + InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue, VISU::TMEDMeshOnEntity& theMeshOnEntity, const MED::TGeom2Size& theGeom2Size, VISU::TMEDValForTime& theValForTime) @@ -444,7 +444,7 @@ namespace TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap; - TGaussKey aGaussKey = GetGaussKey(theTimeStampVal, + TGaussKey aGaussKey = GetGaussKey(theTimeStampValue, theMeshOnEntity, theGeom2Size, theValForTime); @@ -485,7 +485,7 @@ namespace 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, @@ -497,13 +497,13 @@ namespace // The order of the function calls is important InitProfile(theMEDWrapper, theMeshInfo, - theTimeStampVal, + theTimeStampValue, theMeshOnEntity, theMEntity, theGeom2Size, theValForTime); - InitGaussMesh(theTimeStampVal, + InitGaussMesh(theTimeStampValue, theMeshOnEntity, theGeom2Size, theValForTime); @@ -1360,6 +1360,73 @@ VISU_MedConvertor } +//--------------------------------------------------------------- +template +void +BuildTimeStampMinMax(MED::SharedPtr 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 = "<GetMessageString()); - }catch(std::exception& exc){ - MSG(MYDEBUG,"Follow exception was occured in:\n"<GetMessageString()); + }catch(std::exception& exc){ + MSG(MYDEBUG,"Follow exception was occured in:\n"<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; @@ -2436,7 +2462,7 @@ LoadProfile(const MED::PWrapper& theMed, void LoadGaussMesh(const MED::PWrapper& theMed, VISU::PMEDMesh theMesh, - MED::TTimeStampVal& theTimeStampVal, + MED::PTimeStampValueBase theTimeStampValue, VISU::TMEDValForTime& theValForTime, VISU::TMEDMeshOnEntity& theMeshOnEntity) { @@ -2458,7 +2484,7 @@ LoadGaussMesh(const MED::PWrapper& theMed, 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(); @@ -2609,6 +2635,59 @@ LoadGaussMesh(const MED::PWrapper& theMed, } +//--------------------------------------------------------------- +template +void +FillValForTime(MED::SharedPtr 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 = "<GetPTimeStampVal(aTimeStampInfo, - aMKey2Profile, - aKey2Gauss); - + MED::PTimeStampValueBase aTimeStampValue = + theMed->GetPTimeStampValue(aTimeStampInfo, + aMKey2Profile, + aKey2Gauss); + InitGaussProfile(theMed, aMeshInfo, - aTimeStampVal, + aTimeStampValue, theMeshOnEntity, aMEntity, aGeom2Size, @@ -2663,73 +2742,37 @@ LoadValForTime(const MED::PWrapper& theMed, 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 = '"<GetType() == MED::eFLOAT64) + FillValForTime(aTimeStampValue, + aGeom2SubProfile, + theValForTime, + theField); + else + FillValForTime(aTimeStampValue, + aGeom2SubProfile, + theValForTime, + theField); theIsDone = true; return 1; -- 2.39.2