From: gdd Date: Thu, 31 Mar 2011 14:05:43 +0000 (+0000) Subject: Fix bugs with new MED (V3) X-Git-Tag: mergeto_V6_main_07Apr11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=65dcd907a3e7ff5ed83ec79aa70cfab53f1acfa9;p=modules%2Fvisu.git Fix bugs with new MED (V3) --- diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 764e4376..8ee84ca6 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -1115,7 +1115,7 @@ namespace VISU { TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder(); TInt aNbElem = theNodeInfo->GetNbElem(); - TInt aDim = theNodeInfo->GetMeshInfo()->GetDim(); + TInt aDim = theNodeInfo->GetMeshInfo()->GetSpaceDim(); aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord); TNamedPointCoords::Init(PCoordHolder(aCoordHolder)); myVersion = theVersion; @@ -1138,7 +1138,7 @@ namespace VISU { TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder(); TInt aNbElem = theGrilleInfo->GetNbNodes(); - TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim(); + TInt aDim = theGrilleInfo->GetMeshInfo()->GetSpaceDim(); MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim)); aCoordHolder->Init(aNbElem, aDim, aCoord); TNamedPointCoords::Init(PCoordHolder(aCoordHolder)); @@ -1902,7 +1902,8 @@ VISU_MedConvertor MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); - for(TInt iField = 1; iField <= aNbFields; iField++){ + for(TInt iField = 1; iField <= aNbFields; iField++) + { VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()"); MED::TErr anError = 0; @@ -1912,7 +1913,7 @@ VISU_MedConvertor std::string aFieldName = aFieldInfo->GetName(); INITMSG(MYDEBUG,"- aFieldName = '"<GetNbTimeStamps(aFieldInfo, @@ -1972,6 +1973,7 @@ VISU_MedConvertor aMetric2Comp2Group2AverageMinMax, aNbComp, aNbComp2); + else BuildTimeStampMinMax(CastToIntTimeStampValue(aTimeStampValue), aMeshOnEntity, @@ -2043,7 +2045,7 @@ VISU_MedConvertor VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo"); MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); - std::string aMeshName = aMeshInfo->GetName(); + std::string aMeshName = aMeshInfo->GetName(); VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); if(anIter == aMeshMap.end()) diff --git a/src/CONVERTOR/VISU_Vtk2MedConvertor.cxx b/src/CONVERTOR/VISU_Vtk2MedConvertor.cxx index e0ffb4f6..d1f64940 100644 --- a/src/CONVERTOR/VISU_Vtk2MedConvertor.cxx +++ b/src/CONVERTOR/VISU_Vtk2MedConvertor.cxx @@ -231,7 +231,7 @@ VISU_Vtk2MedConvertor /*! \brief Adds field names, which used as specific fields with ids or elements - (or something else). (Default: “VISU_CELLS_MAPPER”,”VISU_POINTS_MAPPER”,”VISU_FILED”) + (or something else). (Default: "VISU_CELLS_MAPPER","VISU_POINTS_MAPPER","VISU_FILED") \param theFieldName field name \sa eraseFromIgnoringFieldList() */ @@ -337,7 +337,7 @@ VISU_Vtk2MedConvertor } /*! - \brief Sets output mesh name. (“vtk2med” - default) + \brief Sets output mesh name. ("vtk2med" - default) \param theMeshName mesh name \sa getMeshName() */ @@ -349,7 +349,7 @@ VISU_Vtk2MedConvertor } /*! - \brief Gets output mesh name. (“vtk2med” - default) + \brief Gets output mesh name. ("vtk2med" - default) \return mesh name \sa setMeshName() */ diff --git a/src/VISU_I/VISU_ResultUtils.cc b/src/VISU_I/VISU_ResultUtils.cc index 86457d7c..fab0b1b8 100644 --- a/src/VISU_I/VISU_ResultUtils.cc +++ b/src/VISU_I/VISU_ResultUtils.cc @@ -360,11 +360,11 @@ namespace VISU //---------------------------------------------------------------------------- void BuildGroups(Result_i* theResult, - Result_i::PInput theInput, - CORBA::Boolean* theIsDone, - CORBA::Boolean theIsBuild, - CORBA::Boolean theIsAtOnce, - _PTR(Study) theStudy) + Result_i::PInput theInput, + CORBA::Boolean* theIsDone, + CORBA::Boolean theIsBuild, + CORBA::Boolean theIsAtOnce, + _PTR(Study) theStudy) { if(!theIsBuild || *theIsDone) return; @@ -387,73 +387,70 @@ namespace VISU const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; if(aMeshOnEntityMap.empty()) - continue; + continue; TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ - const TEntity& anEntity = aMeshOnEntityMapIter->first; - const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; - - const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; - TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); - for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ - const string& aFamilyName = aFamilyMapIter->first; - const PFamily& aFamily = aFamilyMapIter->second; + const TEntity& anEntity = aMeshOnEntityMapIter->first; + const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; + const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); + for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ + const string& aFamilyName = aFamilyMapIter->first; + const PFamily& aFamily = aFamilyMapIter->second; aComment=QString("myComment=FAMILY;myMeshName=%1;myEntityId=%2;myName=%3"); aComment=aComment.arg(aMeshName.c_str()); aComment=aComment.arg(anEntity); aComment=aComment.arg(aFamilyName.c_str()); - aFamily->myEntry = - CreateAttributes(theStudy, - aMeshOnEntity->myEntry, - NO_ICON, - NO_IOR, - aFamilyName, - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - true); - } + aFamily->myEntry = CreateAttributes(theStudy, + aMeshOnEntity->myEntry, + NO_ICON, + NO_IOR, + aFamilyName, + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + true); + } } //Importing groups const TGroupMap& aGroupMap = aMesh->myGroupMap; if(!aGroupMap.empty()){ - aComment = QString("myComment=GROUPS;myMeshName=%1").arg(aMeshName.c_str()); - - CreateAttributes(theStudy, - aMesh->myGroupsEntry, - NO_ICON, - NO_IOR, - "Groups", - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - false); - - TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); - for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ - const string& aGroupName = aGroupMapIter->first; - const PGroup& aGroup = aGroupMapIter->second; - aComment = QString("myComment=GROUP;myMeshName=%1;myName=%2").arg(aMeshName.c_str()).arg(aGroupName.c_str()); - aGroup->myEntry = - CreateAttributes(theStudy, - aMesh->myGroupsEntry, - NO_ICON, - NO_IOR, - aGroupName, - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - true); - const TFamilySet& aFamilySet = aGroup->myFamilySet; - TFamilySet::const_iterator aFamilyIter = aFamilySet.begin(); - for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){ - const PFamily& aFamily = (*aFamilyIter).second; - CreateReference(theStudy, - aGroup->myEntry, - aFamily->myEntry); - } - } + aComment = QString("myComment=GROUPS;myMeshName=%1").arg(aMeshName.c_str()); + + CreateAttributes(theStudy, + aMesh->myGroupsEntry, + NO_ICON, + NO_IOR, + "Groups", + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + false); + + TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); + for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ + const string& aGroupName = aGroupMapIter->first; + const PGroup& aGroup = aGroupMapIter->second; + aComment = QString("myComment=GROUP;myMeshName=%1;myName=%2").arg(aMeshName.c_str()).arg(aGroupName.c_str()); + aGroup->myEntry = CreateAttributes(theStudy, + aMesh->myGroupsEntry, + NO_ICON, + NO_IOR, + aGroupName, + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + true); + const TFamilySet& aFamilySet = aGroup->myFamilySet; + TFamilySet::const_iterator aFamilyIter = aFamilySet.begin(); + for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){ + const PFamily& aFamily = (*aFamilyIter).second; + CreateReference(theStudy, + aGroup->myEntry, + aFamily->myEntry); + } + } }else if(!theIsAtOnce) - RemoveSObject(theStudy, - aMesh->myGroupsEntry); + RemoveSObject(theStudy, + aMesh->myGroupsEntry); } ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone)); @@ -492,7 +489,7 @@ namespace VISU const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; if(aMeshOnEntityMap.empty()) - continue; + continue; //Import fields bool anIsFieldsEntryUpdated = false; @@ -500,84 +497,83 @@ namespace VISU for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) { - const TEntity& anEntity = aMeshOnEntityMapIter->first; - const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; - const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++) - { - if(!anIsFieldsEntryUpdated) - { - aComment = ""; - aComment.append("myComment=FIELDS;"); - aComment.append("myMeshName=");aComment.append(aMeshName.c_str()); - - CreateAttributes(theStudy, - aMesh->myFieldsEntry, - NO_ICON, - NO_IOR, - "Fields", - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - false); - - anIsFieldsEntryUpdated = true; - } - - const string& aFieldName = aFieldMapIter->first; - const PField& aField = aFieldMapIter->second; - const TValField& aValField = aField->myValField; - QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]); - aComment = QString("myComment=FIELD;myMeshName=%1;myEntityId=%2;myName=%3;myNbTimeStamps=%4;myNumComponent=%5"); + const TEntity& anEntity = aMeshOnEntityMapIter->first; + const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; + const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); + + for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++) + { + if(!anIsFieldsEntryUpdated) + { + aComment = ""; + aComment.append("myComment=FIELDS;"); + aComment.append("myMeshName=");aComment.append(aMeshName.c_str()); + + CreateAttributes(theStudy, + aMesh->myFieldsEntry, + NO_ICON, + NO_IOR, + "Fields", + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + false); + anIsFieldsEntryUpdated = true; + } + + const string& aFieldName = aFieldMapIter->first; + const PField& aField = aFieldMapIter->second; + const TValField& aValField = aField->myValField; + QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]); + aComment = QString("myComment=FIELD;myMeshName=%1;myEntityId=%2;myName=%3;myNbTimeStamps=%4;myNumComponent=%5"); aComment = aComment.arg(aMeshName.c_str()); aComment = aComment.arg(anEntity); aComment = aComment.arg(aFieldName.c_str()); aComment = aComment.arg(aValField.size()); aComment = aComment.arg(aField->myNbComp); - - aField->myEntry = CreateAttributes(theStudy, - aMesh->myFieldsEntry, - NO_ICON, - NO_IOR, - aFieldNameWithUnit.toLatin1().data(), - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - true); - - CreateReference(theStudy, - aField->myEntry, - aMeshOnEntity->myEntry); - - TValField::const_iterator aValFieldIter = aValField.begin(); - - for(; aValFieldIter != aValField.end(); aValFieldIter++) - { - int aTimeStamp = aValFieldIter->first; - const PValForTime& aValForTime = aValFieldIter->second; - aComment = QString("myComment=TIMESTAMP;myMeshName=%1;myEntityId=%2;myFieldName=%3;myTimeStampId=%4;myNumComponent=%5"); + + aField->myEntry = CreateAttributes(theStudy, + aMesh->myFieldsEntry, + NO_ICON, + NO_IOR, + aFieldNameWithUnit.toLatin1().data(), + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + true); + + CreateReference(theStudy, + aField->myEntry, + aMeshOnEntity->myEntry); + + TValField::const_iterator aValFieldIter = aValField.begin(); + + for(; aValFieldIter != aValField.end(); aValFieldIter++) + { + int aTimeStamp = aValFieldIter->first; + const PValForTime& aValForTime = aValFieldIter->second; + aComment = QString("myComment=TIMESTAMP;myMeshName=%1;myEntityId=%2;myFieldName=%3;myTimeStampId=%4;myNumComponent=%5"); aComment = aComment.arg(aMeshName.c_str()); aComment = aComment.arg(anEntity); aComment = aComment.arg(aFieldName.c_str()); aComment = aComment.arg(aTimeStamp); aComment = aComment.arg(aField->myNbComp); - - string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime); - - aValForTime->myEntry = CreateAttributes(theStudy, - aField->myEntry, - NO_ICON, - NO_IOR, - aTimeStampId, - NO_PERFSITENT_REF, - aComment.toLatin1().data(), - true); - } - } + + string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime); + + aValForTime->myEntry = CreateAttributes(theStudy, + aField->myEntry, + NO_ICON, + NO_IOR, + aTimeStampId, + NO_PERFSITENT_REF, + aComment.toLatin1().data(), + true); + } + } } if(!anIsFieldsEntryUpdated && !theIsAtOnce) - RemoveSObject(theStudy, aMesh->myFieldsEntry); + RemoveSObject(theStudy, aMesh->myFieldsEntry); } ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone)); @@ -587,9 +583,9 @@ namespace VISU //---------------------------------------------------------------------------- void BuildMinMax(Result_i* theResult, - Result_i::PInput theInput, - CORBA::Boolean* theIsDone, - CORBA::Boolean theIsBuild) + Result_i::PInput theInput, + CORBA::Boolean* theIsDone, + CORBA::Boolean theIsBuild) { if(!theIsBuild || *theIsDone) return; @@ -608,19 +604,19 @@ namespace VISU //---------------------------------------------------------------------------- void BuildFieldDataTree(Result_i* theResult, - Result_i::PInput theInput, - CORBA::Boolean* theIsFieldsDone, - CORBA::Boolean theIsBuildFields, - CORBA::Boolean* theIsMinMaxDone, - CORBA::Boolean theIsBuildMinMax, - _PTR(Study) theStudy) + Result_i::PInput theInput, + CORBA::Boolean* theIsFieldsDone, + CORBA::Boolean theIsBuildFields, + CORBA::Boolean* theIsMinMaxDone, + CORBA::Boolean theIsBuildMinMax, + _PTR(Study) theStudy) { BuildFields(theResult, - theInput, - theIsFieldsDone, - theIsBuildFields, - false, - theStudy); + theInput, + theIsFieldsDone, + theIsBuildFields, + false, + theStudy); BuildMinMax(theResult, theInput, diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index b158404c..2abbd7d4 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -505,6 +505,7 @@ VISU::Result_i false, myStudy)); } + { boost::thread aThread(boost::bind(&BuildFieldDataTree, this,