From: apo Date: Thu, 11 Aug 2005 06:10:33 +0000 (+0000) Subject: To split the large Build method into less parts. X-Git-Tag: BR-D5-38-2003_D2005-12-09~129 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4dd68adbac8fc9ce0e37f278ced77d3914f45e96;p=modules%2Fvisu.git To split the large Build method into less parts. Second step - extraction BuildFieldMap functionality --- diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 3bf0b784..18c1ed16 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -512,6 +512,85 @@ namespace } } + + //--------------------------------------------------------------- + void + BuildFieldMap(PMEDMesh theMesh, + const MED::TEntityInfo& theEntityInfo, + const MED::TMKey2Profile& theMKey2Profile, + const MED::TKey2Gauss& theKey2Gauss, + MED::PWrapper theMEDWrapper) + { + TInt aNbFields = theMEDWrapper->GetNbFields(); + MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo; + const std::string& aMeshName = theMesh->myName; + INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); + TInt aNbComp = aFieldInfo->GetNbComp(); + std::string aFieldName = aFieldInfo->GetName(); + + MED::TGeom2Size aGeom2Size; + MED::EEntiteMaillage aMEntity; + TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo, + theEntityInfo, + aMEntity, + aGeom2Size); + if(aNbTimeStamps < 1) + continue; + + TEntity aVEntity = MEDEntityToVTK(aMEntity); + PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; + TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + PMEDField aField = aFieldMap[aFieldName](new TMEDField()); + aField->myId = iField; + aField->myNbComp = aNbComp; + aField->myEntity = aVEntity; + aField->myName = aFieldName; + aField->myMeshName = aMeshName; + aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp; + aField->myCompNames.resize(aNbComp); + aField->myUnitNames.resize(aNbComp); + + INITMSG(MYDEBUG,"myName = '"<myName<<"'"<< + "; myId = "<myId<< + "; myEntity = "<myEntity<< + "; myDataSize = "<myDataSize<< + "; myNbComp = "<myNbComp<<"\n"); + + for(TInt iComp = 0; iComp < aNbComp; iComp++){ + aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp); + aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp); + } + + for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){ + MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo, + aMEntity, + aGeom2Size, + iTimeStamp); + TFloat aDt = aTimeStampInfo->GetDt(); + std::string anUnitDt = aTimeStampInfo->GetUnitDt(); + MED::PTimeStampVal aTimeStampVal = theMEDWrapper->GetPTimeStampVal(aTimeStampInfo, + theMKey2Profile, + theKey2Gauss); + TValField& aValField = aField->myValField; + PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime()); + aValForTime->myId = iTimeStamp; + aValForTime->myFieldName = aField->myName; + aValForTime->myEntity = aField->myEntity; + aValForTime->myMeshName = aField->myMeshName; + aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss(); + aValForTime->myTime = VISU::TTime(aDt,anUnitDt); + INITMSG(MYDEBUG,"aDt = '"<myMeshOnEntityMap; - - TInt aNbFields = aMed->GetNbFields(); - BEGMSG(MYDEBUG,"TField: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); - TInt aNbComp = aFieldInfo->GetNbComp(); - const std::string& aFieldName = aFieldInfo->GetName(); - - MED::TGeom2Size aGeom2Size; - MED::EEntiteMaillage aMEntity; - TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo, - aEntityInfo, - aMEntity, - aGeom2Size); - if(aNbTimeStamps < 1) - continue; - - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; - TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - PMEDField aField = aFieldMap[aFieldName](new TMEDField()); - aField->myId = iField; - aField->myNbComp = aNbComp; - aField->myEntity = aVEntity; - aField->myName = aFieldName; - aField->myMeshName = aMeshName; - aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp; - aField->myCompNames.resize(aNbComp); - aField->myUnitNames.resize(aNbComp); - - INITMSG(MYDEBUG,"myName = '"<myName<< - "'; myId = "<myId<< - "; myEntity = "<myEntity<< - "; myDataSize = "<myDataSize<< - "; myNbComp = "<myNbComp<<"\n"); - - for(TInt iComp = 0; iComp < aNbComp; iComp++){ - aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp); - aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp); - } - - for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){ - MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, - aMEntity, - aGeom2Size, - iTimeStamp); - TFloat aDt = aTimeStampInfo->GetDt(); - const std::string& anUnitDt = aTimeStampInfo->GetUnitDt(); - MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, - aMKey2Profile, - aKey2Gauss); - TValField& aValField = aField->myValField; - PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime()); - aValForTime->myId = iTimeStamp; - aValForTime->myFieldName = aField->myName; - aValForTime->myEntity = aField->myEntity; - aValForTime->myMeshName = aField->myMeshName; - aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss(); - aValForTime->myTime = VISU::TTime(aDt,anUnitDt); - INITMSG(MYDEBUG,"aDt = '"<