From: apo Date: Fri, 22 Jul 2005 16:14:12 +0000 (+0000) Subject: To store MED::ProfileInfo inside of corresponding VISU CONVERTER class - TMEDSubProfile X-Git-Tag: BR-D5-38-2003_D2005-12-09~150 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14b606cf03ec8222ab9d99314b631a53793a315e;p=modules%2Fvisu.git To store MED::ProfileInfo inside of corresponding VISU CONVERTER class - TMEDSubProfile --- diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 9a06c6b8..4bb1a353 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -43,8 +43,12 @@ using namespace VISU; #ifdef _DEBUG_ static int MYDEBUG = 1; +static int MY_FAMILY_DEBUG = 0; +static int MY_GROUP_DEBUG = 0; #else static int MYDEBUG = 0; +static int MY_FAMILY_DEBUG = 0; +static int MY_GROUP_DEBUG = 0; #endif @@ -143,8 +147,6 @@ namespace{ const MED::TGeom2Size& theGeom2Size, const MED::TGeom2Profile& theGeom2Profile) { - INITMSG(MYDEBUG,"CrSubProfile()"<second; + aSubProfile->myNbCells = aProfileInfo->myElemNum.size(); aSubProfile->myName = aProfileInfo->GetName(); + aSubProfile->myProfileInfo = aProfileInfo; + aSubProfile->myStatus = eAddPart; } } aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; - INITMSGA(MYDEBUG,0, - "- aVGeom = "<myGeom2SubProfile; @@ -247,6 +253,7 @@ namespace{ const MED::TGeom2Size& theGeom2Size, VISU::TMEDValForTime& theValForTime) { + int MYDEBUG = true; INITMSG(MYDEBUG,"GetGaussKey"<second; + INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<myGeom2GaussSubMesh; @@ -416,12 +424,6 @@ VISU_MedConvertor TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo); - TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo); - - TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup); - - TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup); - // creating TMesh structure and TMeshOnEntityMap typedef map TFamilyCounterMap; TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap; @@ -569,8 +571,91 @@ VISU_MedConvertor } } + TInt aNbFields = aMed->GetNbFields(); + BEGMSG(MYDEBUG,"TField: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); + TInt aNbComp = aFieldInfo->GetNbComp(); + const string& aFieldName = aFieldInfo->GetName(); + + MED::TGeom2Size aGeom2Size; + 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++){ + PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, + aMEntity, + aGeom2Size, + iTimeStamp); + TFloat aDt = aTimeStampInfo->GetDt(); + const string& anUnitDt = aTimeStampInfo->GetUnitDt(); + 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 = '"<myGaussMap; + const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); + TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin(); + for(; anIter != aGeom2Gauss.end(); anIter++){ + EGeometrieElement aMGeom = anIter->first; + PGaussInfo aGaussInfo = anIter->second; + PMEDGauss aMEDGauss(new TMEDGauss()); + aMEDGauss->myGaussInfo = aGaussInfo; + aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss(); + aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss; + } + } + } + + continue; + + TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo); + TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup); TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin(); - BEGMSG(MYDEBUG,"TFamilyByEntity:\n"); + BEGMSG(MY_FAMILY_DEBUG,"TFamilyByEntity:\n"); for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){ const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first; const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second; @@ -582,7 +667,7 @@ VISU_MedConvertor if(aFamilyGroup.empty()) continue; - INITMSG(MYDEBUG,"aMEntity = "<myNbCells = aFamilyNbCellsCounterMap[aFamily->myId]; aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId]; - INITMSG(MYDEBUG,"aFamilyName = '"<myName<< + INITMSG(MY_FAMILY_DEBUG,"aFamilyName = '"<myName<< "'; myId = "<myId<<"; "<< "; aNbAttr = "<GetNbAttr()<< "; aNbGroup = "<GetNbGroup()<< @@ -611,14 +696,14 @@ VISU_MedConvertor for(TInt i = 0; i < aNbGroup; i++){ const string& aGroupName = aFamilyInfo->GetGroupName(i); aBindGroups.insert(aGroupName); - INITMSG(MYDEBUG,"aGroupName = '"<myGroupMap; + TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup); TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){ const string& aGroupName = aGroupInfoIter->first; @@ -627,7 +712,7 @@ VISU_MedConvertor aGroup->myName = aGroupName; aGroup->myMeshName = aMesh->myName; - INITMSG(MYDEBUG,"aGroup->myName = '"<myName<<"'\n"); + INITMSG(MY_GROUP_DEBUG,"aGroup->myName = '"<myName<<"'\n"); TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin(); for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){ @@ -656,97 +741,25 @@ VISU_MedConvertor exit_lable: if(aFamily && aVEntity >= 0){ aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity)); - INITMSG(MYDEBUG,"aFamilyName = '"<myName<<"'; aVEntity = "<myName<<"'"<< + "; aVEntity = "<myNbCells += aFamily->myNbCells; aGroup->myCellsSize += aFamily->myCellsSize; } } if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){ - BEGMSG(MYDEBUG,"myNbCells = "<myNbCells<< - "; myCellsSize = "<myCellsSize<<"\n"); + BEGMSG(MY_GROUP_DEBUG, + "myNbCells = "<myNbCells<< + "; myCellsSize = "<myCellsSize<< + "\n"); aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup)); } } - TInt aNbFields = aMed->GetNbFields(); - BEGMSG(MYDEBUG,"TField: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); - TInt aNbComp = aFieldInfo->GetNbComp(); - const string& aFieldName = aFieldInfo->GetName(); - - MED::TGeom2Size aGeom2Size; - 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++){ - PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, - aMEntity, - aGeom2Size, - iTimeStamp); - TFloat aDt = aTimeStampInfo->GetDt(); - const string& anUnitDt = aTimeStampInfo->GetUnitDt(); - 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 = "<myGaussMap; - const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); - TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin(); - for(; anIter != aGeom2Gauss.end(); anIter++){ - EGeometrieElement aMGeom = anIter->first; - PGaussInfo aGaussInfo = anIter->second; - PMEDGauss aMEDGauss(new TMEDGauss()); - aMEDGauss->myGaussInfo = aGaussInfo; - aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss(); - aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss; - } - } - } } catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<second; - aSubProfile->mySubMeshID = aProfileInfo->myElemNum; + + MED::TElemNum& anElemNum = aProfileInfo->myElemNum; + if(!anElemNum.empty()){ + TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; + TInt aSize = anElemNum.size(); + aSubMeshID.resize(aSize); + for(TInt anId = 0; anId < aSize; anId++) + aSubMeshID[anId] = anElemNum[anId] - 1; + } INITMSG(MYDEBUG, "- aVGeom = "<mySubProfile; - TElemNum anElemNum = aSubProfile->mySubMeshID; - MED::TGaussCoord aGaussCoord; - MED::GetGaussCoord3D(aGaussInfo, - aCellInfo, - aNodeInfo, - aGaussCoord, - anElemNum); - TPoints& aPoints = aGaussSubMesh->myPoints; + PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile; + const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; + + if(!aSubMeshID.empty()){ + MED::PProfileInfo aProfileInfo = aSubProfile->myProfileInfo; + const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; + MED::GetGaussCoord3D(aGaussInfo, + aCellInfo, + aNodeInfo, + aGaussCoord, + anElemNum); + }else + MED::GetGaussCoord3D(aGaussInfo, + aCellInfo, + aNodeInfo, + aGaussCoord); + + TInt aSize = aGaussCoord.size(); + if(aSize){ + TPoints& aPoints = aGaussSubMesh->myPoints; + } INITMSG(MYDEBUG, "- aVGeom = "< PMEDSubProfile;