From a0367c838a6cd30d8c0f8a81ee5ab82f43c93766 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 18 Jan 2005 05:18:51 +0000 Subject: [PATCH] Fix on [Bug PAL7023] Problem loading MED file with a large number of families (same as VISU6154) --- src/VISU_I/VISU_Result_i.cc | 35 +++++++++++------------------------ src/VISU_I/VISU_Result_i.hh | 5 +---- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 963c438d..5897b421 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -266,7 +266,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aResultEntry; mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str()); if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!"); if(!CORBA::is_nil(theSObject)){ @@ -291,7 +290,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aMeshEntry; if(aMeshOnEntityMap.empty()) continue; aComment.sprintf("myComment=FAMILIES;myMeshName=%s", @@ -305,11 +303,12 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aSubMeshesEntry; //Import entities and according families aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - typedef map TEntity2Entry; - TEntity2Entry aEntity2Entry; + typedef std::map TComment2EntryMap; + TComment2EntryMap aComment2EntryMap; + typedef std::map TEntity2EntryMap; + TEntity2EntryMap aEntity2EntryMap; for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", @@ -325,7 +324,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) default: throw std::runtime_error("Build >> Value of entity is incorrect!"); } - string aTmpEntry = + aEntity2EntryMap[anEntity] = CreateAttributes(myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(), @@ -334,8 +333,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - aEntity2Entry[anEntity] = aTmpEntry; - myComment2EntryMap[aComment.latin1()] = aTmpEntry; const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap; VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); @@ -347,16 +344,15 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) aMeshName.c_str(), anEntity, aFamilyName.c_str()); - aTmpEntry = + aComment2EntryMap[aComment.latin1()] = CreateAttributes(myStudyDocument, - aEntity2Entry[anEntity].c_str(), + aEntity2EntryMap[anEntity].c_str(), aRefFatherEntry.c_str(), "", aFamilyName.c_str(), "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aTmpEntry; } } //Importing groups @@ -373,7 +369,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aGroupsEntry; VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ const string& aGroupName = aGroupMapIter->first; @@ -390,7 +385,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aGroupEntry; const VISU::TGroup& aGroup = aGroupMapIter->second; const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet; VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin(); @@ -403,8 +397,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) aMeshName.c_str(), anEntity, aFamilyName.c_str()); - string anEntry = myComment2EntryMap[aComment.latin1()]; - CreateReference(myStudyDocument,aGroupEntry,anEntry); + CreateReference(myStudyDocument,aGroupEntry,aComment2EntryMap[aComment.latin1()]); } } } @@ -430,7 +423,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aFieldsEntry; isFieldEntryCreated = true; } const string& aFieldName = aFieldMapIter->first; @@ -453,8 +445,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aFieldEntry; - CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]); + CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]); VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin(); for(; aValFieldIter != aValField.end(); aValFieldIter++){ int aTimeStamp = aValFieldIter->first; @@ -476,7 +467,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) "", aComment.latin1(), true); - myComment2EntryMap[aComment.latin1()] = aTimeStampEntry; } } } @@ -689,12 +679,9 @@ string VISU::Result_i::GetEntry(){ const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;} const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;} const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;} -std::string VISU::Result_i::GetEntry(const std::string& theComment) const +std::string VISU::Result_i::GetEntry(const std::string& theComment) { - TComment2EntryMap::const_iterator aComment2EntryMapIter = myComment2EntryMap.find(theComment); - if(aComment2EntryMapIter == myComment2EntryMap.end()) - return ""; - return aComment2EntryMapIter->second; + return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str()); } VISU::Result_i::~Result_i() { diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 28e0a1ab..d172f3f9 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -86,16 +86,13 @@ namespace VISU{ SALOMEDS::Study_var myStudyDocument; SALOMEDS::SComponent_var mySComponent; - typedef std::map TComment2EntryMap; - TComment2EntryMap myComment2EntryMap; - public: std::string GetRefFatherEntry(); std::string GetEntry(); const SALOMEDS::SObject_var& GetSObject() const; const SALOMEDS::Study_var& GetStudyDocument() const; const SALOMEDS::SComponent_var& GetSComponent() const; - std::string GetEntry(const std::string& theComment) const; + std::string GetEntry(const std::string& theComment); }; -- 2.39.2