From: apo Date: Mon, 21 Nov 2005 07:24:11 +0000 (+0000) Subject: Initial patch for Bug GVIEW10573 X-Git-Tag: BR-D5-38-2003_D2005-24-11~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c0e71e6ad7ef7623e049b54d24465b7f59944b7e;p=modules%2Fvisu.git Initial patch for Bug GVIEW10573 time to load sandia file too long --- diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 4af7323b..ea3debee 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -274,6 +274,26 @@ public: VISU_Convertor* Build() = 0; + //! This method perform first parsing of MED file to get known what MED mesh entities are pressent in it + virtual + VISU_Convertor* + BuildEntities() = 0; + + //! This method perform first parsing of MED file to get known what MED fields are pressent in it + virtual + VISU_Convertor* + BuildFields() = 0; + + //! This min /max calculation over existing MED fields + virtual + VISU_Convertor* + BuildMinMax() = 0; + + //! This method perform first parsing of MED file to get known what MED groups are pressent in it + virtual + VISU_Convertor* + BuildGroups() = 0; + //! This method allow to get known what MED entities are present is the MED file virtual const VISU::TMeshMap& diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index ac737d37..622caf4e 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -30,7 +30,7 @@ #include #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 2; #else static int MYDEBUG = 0; #endif @@ -49,20 +49,30 @@ namespace VISU aWriter->Delete(); } + TTimerLog ::TTimerLog(const std::string& theName): myTimerLog(vtkTimerLog::New()), + myPrefixPrinter(MYDEBUG == 1), myName(theName) { myCPUTime = myTimerLog->GetCPUTime(); + BEGMSG(MYDEBUG > 1,"{\n"); } TTimerLog ::~TTimerLog() { myCPUTime = myTimerLog->GetCPUTime() - myCPUTime; - INITMSG(MYDEBUG,"~TTimerLog for "< 1){ + BEGMSG(MYDEBUG,"} = "<Delete(); + myTimerLog = NULL; } } diff --git a/src/CONVERTOR/VISU_ConvertorUtils.hxx b/src/CONVERTOR/VISU_ConvertorUtils.hxx index 124eb8d7..ae2f0881 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.hxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.hxx @@ -36,6 +36,11 @@ class vtkUnstructuredGrid; class vtkTimerLog; +namespace MED +{ + class PrefixPrinter; +} + namespace VISU{ void @@ -43,9 +48,10 @@ namespace VISU{ class TTimerLog { - vtkTimerLog* myTimerLog; double myCPUTime; std::string myName; + vtkTimerLog* myTimerLog; + MED::PrefixPrinter myPrefixPrinter; public: TTimerLog(const std::string& theName); ~TTimerLog(); diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index d8c2c0ef..e7e13a26 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -1765,6 +1765,43 @@ VISU_Convertor_impl {} +//--------------------------------------------------------------- +VISU_Convertor* +VISU_Convertor_impl +::Build() +{ + return this; +} + +VISU_Convertor* +VISU_Convertor_impl +::BuildEntities() +{ + return this; +} + +VISU_Convertor* +VISU_Convertor_impl +::BuildFields() +{ + return this; +} + +VISU_Convertor* +VISU_Convertor_impl +::BuildMinMax() +{ + return this; +} + +VISU_Convertor* +VISU_Convertor_impl +::BuildGroups() +{ + return this; +} + + //--------------------------------------------------------------- VISU::PNamedIDMapper VISU_Convertor_impl diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 45d6531e..5e910090 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -770,10 +770,27 @@ public: //! Just to define default behaviour virtual VISU_Convertor* - Build() - { - return this; - } + Build(); + + //! Just to define default behaviour + virtual + VISU_Convertor* + BuildEntities(); + + //! Just to define default behaviour + virtual + VISU_Convertor* + BuildFields(); + + //! Just to define default behaviour + virtual + VISU_Convertor* + BuildMinMax(); + + //! Just to define default behaviour + virtual + VISU_Convertor* + BuildGroups(); //! Implemention of the VISU_Convertor::GetSize virtual diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx index e4b2825f..57cf9ee7 100644 --- a/src/CONVERTOR/VISU_IDMapper.hxx +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -51,6 +51,8 @@ namespace VISU //! Just to provide possibility of dynamic navigation through the class hierarchy virtual ~TBaseStructure() {} + + std::string myEntry; //!< To simplify publication of the object tree }; typedef SharedPtr PBaseStructure; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 8961e2b6..c35eef81 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -47,18 +47,14 @@ using MED::TFloat; using MED::EBooleen; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; static int MYVALUEDEBUG = 0; -static int MYMEMORYDEBUG = 0; -static int MYTHREADDEBUG = 0; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; #define _DEXCEPT_ #else static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; -static int MYMEMORYDEBUG = 0; -static int MYTHREADDEBUG = 0; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; #endif @@ -363,7 +359,6 @@ namespace PMEDProfile aProfile = theValForTime.myProfile; TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); @@ -505,17 +500,15 @@ namespace //--------------------------------------------------------------- - typedef std::map TFamilyCounterMap; - void BuildMeshOnEntityMap(PMEDMesh theMesh, - TFamilyCounterMap& theFamilyID2CellsSize, const MED::TEntityInfo& theEntityInfo, const MED::PNodeInfo& theNodeInfo, const MED::PWrapper& theMEDWrapper) { TTimerLog aTimerLog("BuildMeshOnEntityMap"); INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<myMeshInfo; const std::string& aMeshName = theMesh->myName; TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; @@ -529,7 +522,8 @@ namespace aMeshOnEntity->myEntity = aVEntity; aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; - + TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + INITMSG(MYDEBUG, "- aMEntity = "< PFieldMinMax; - - - //--------------------------------------------------------------- - void - GetFieldMinMax(PFieldMinMax theFieldMinMax) - { - theFieldMinMax->Calculate(); - } - - - //--------------------------------------------------------------- - struct TCalculateMinMax - { - VISU::PMEDMesh myMesh; - MED::TEntityInfo myEntityInfo; - MED::TMKey2Profile myMKey2Profile; - MED::TKey2Gauss myKey2Gauss; - MED::PWrapper myMEDWrapper; - - TCalculateMinMax(const VISU::PMEDMesh& theMesh, - const MED::TEntityInfo& theEntityInfo, - const MED::TMKey2Profile& theMKey2Profile, - const MED::TKey2Gauss& theKey2Gauss, - const MED::PWrapper& theMEDWrapper): - myMesh(theMesh), - myEntityInfo(theEntityInfo), - myMKey2Profile(theMKey2Profile), - myKey2Gauss(theKey2Gauss), - myMEDWrapper(theMEDWrapper) - { - INITMSG(MYMEMORYDEBUG,"TCalculateMinMax() - "<GetNbFields(); - MED::PMeshInfo aMeshInfo = myMesh->myMeshInfo; - const std::string& aMeshName = myMesh->myName; - INITMSG(MYDEBUG,"MinMaxCalculation: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); - TInt aNbComp = aFieldInfo->GetNbComp(); - std::string aFieldName = aFieldInfo->GetName(); - - MED::TGeom2Size aGeom2Size; - MED::EEntiteMaillage aMEntity; - TInt aNbTimeStamps = myMEDWrapper->GetNbTimeStamps(aFieldInfo, - myEntityInfo, - aMEntity, - aGeom2Size); - if(aNbTimeStamps < 1) - continue; - - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = myMesh->myMeshOnEntityMap[aVEntity]; - TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - PMEDField aField = aFieldMap[aFieldName]; - - PFieldMinMax aFieldMinMax(new TFieldMinMax(aField, - aFieldInfo, - aNbTimeStamps, - aMEntity, - aGeom2Size, - myMKey2Profile, - myKey2Gauss, - myMEDWrapper)); - - boost::thread aThread(boost::bind(&GetFieldMinMax,aFieldMinMax)); - } - } - }; - typedef SharedPtr PCalculateMinMax; - - - //--------------------------------------------------------------- - void - CalculateMinMax(PCalculateMinMax theCalculateMinMax) - { - theCalculateMinMax->Calculate(); - } - - //--------------------------------------------------------------- void BuildFieldMap(PMEDMesh theMesh, const MED::TEntityInfo& theEntityInfo, - const MED::TMKey2Profile& theMKey2Profile, - const MED::TKey2Gauss& theKey2Gauss, MED::PWrapper theMEDWrapper) { TTimerLog aTimerLog("BuildFieldMap"); @@ -865,7 +636,7 @@ namespace const std::string& aMeshName = theMesh->myName; INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); TInt aNbComp = aFieldInfo->GetNbComp(); std::string aFieldName = aFieldInfo->GetName(); @@ -902,36 +673,23 @@ namespace } for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){ - TTimerLog aTimerLog("BuildFieldMap - GetPTimeStampInfo"); + TTimerLog aTimerLog("GetPTimeStampInfo"); MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo, aMEntity, aGeom2Size, iTimeStamp); TFloat aDt = aTimeStampInfo->GetDt(); std::string anUnitDt = aTimeStampInfo->GetUnitDt(); - { - TTimerLog aTimerLog("BuildFieldMap - GetPTimeStampVal"); - 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 = '"<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 = '"<myMeshInfo; MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet); MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin(); @@ -957,6 +715,7 @@ namespace TEntity aVEntity = MEDEntityToVTK(aMEntity); PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; + const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; if(aFamilyTSizeSet.empty()) @@ -985,8 +744,8 @@ namespace aFamily->myNbCells = aSize; aFamily->myCellsSize = 0; - TFamilyCounterMap::const_iterator anIter = theFamilyID2CellsSize.find(anId); - if(anIter != theFamilyID2CellsSize.end()) + TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId); + if(anIter != aFamilyID2CellsSize.end()) aFamily->myCellsSize = anIter->second; INITMSG(MY_FAMILY_DEBUG, @@ -1018,6 +777,7 @@ namespace { TTimerLog aTimerLog("BuildGroupMap"); INITMSG(MYDEBUG,"BuildGroupMap\n"); + TGroupMap& aGroupMap = theMesh->myGroupMap; MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet); MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); @@ -1172,43 +932,37 @@ VISU_MedConvertor //--------------------------------------------------------------- VISU_Convertor* VISU_MedConvertor -::Build() +::BuildEntities() { - TTimerLog aTimerLog("Build"); + TTimerLog aTimerLog("BuildEntities"); MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); - MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed); - MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed); - TInt aNbMeshes = aMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; - MSG(MYDEBUG,"VISU_MedConvertor::Build()"); - INITMSG(MYDEBUG,"GetNbMeshes() = "<GetPMeshInfo(iMesh); + std::string aMeshName = aMeshInfo->GetName(); + TInt aDim = aMeshInfo->GetDim(); MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); - MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); - - MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = - MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo); - - // creating TMesh structure and TMeshOnEntityMap - TInt aDim = aMeshInfo->GetDim(); - std::string aMeshName = aMeshInfo->GetName(); + MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); + // creating TMesh structure and TMeshOnEntityMap PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh()); aMesh->myDim = aDim; aMesh->myName = aMeshName; aMesh->myNbPoints = aNodeInfo->GetNbElem(); aMesh->myMeshInfo = aMeshInfo; - aMesh->myEntityInfo = aEntityInfo; + aMesh->myEntityInfo = anEntityInfo; aMesh->myNamedPointCoords(new TMEDNamedPointCoords()); INITMSG(MYDEBUG,"aMeshName = '"<GetNbMeshes(); + TMeshMap& aMeshMap = myMeshMap; + + INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<GetPMeshInfo(iMesh); + std::string aMeshName = aMeshInfo->GetName(); + + TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + if(anIter == aMeshMap.end()) + continue; + PMEDMesh aMesh = anIter->second; + + INITMSG(MYDEBUG,"aMeshName = '"<GetEntityInfo(aMeshInfo); + BuildFieldMap(aMesh, - aEntityInfo, - aMKey2Profile, - aKey2Gauss, + anEntityInfo, aMed); +#ifndef _DEXCEPT_ + }catch(std::exception& exc){ + MSG(MYDEBUG,"Follow exception was occured in:\n"<GetNbMeshes(); + TMeshMap& aMeshMap = myMeshMap; + + INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<GetPMeshInfo(iMesh); + std::string aMeshName = aMeshInfo->GetName(); + + TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + if(anIter == aMeshMap.end()) + continue; + PMEDMesh aMesh = anIter->second; + +#ifndef _DEXCEPT_ + try{ +#endif + TInt aNbFields = aMed->GetNbFields(); + + INITMSG(MYDEBUG, + "- aMeshName = '"<GetEntityInfo(aMeshInfo); + + for(TInt iField = 1; iField <= aNbFields; iField++){ + TTimerLog aTimerLog("BuildMinMax - GetPFieldInfo()"); + MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField); + std::string aFieldName = aFieldInfo->GetName(); + INITMSG(MYDEBUG,"- aFieldName = '"<GetNbTimeStamps(aFieldInfo, + anEntityInfo, + aMEntity, + aGeom2Size); + if(aNbTimeStamps < 1) + continue; + + TEntity aVEntity = MEDEntityToVTK(aMEntity); + PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; + TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + PMEDField aField = aFieldMap[aFieldName]; + + TInt aNbComp = aField->myNbComp; + int aNbComp2 = aNbComp; + if(aNbComp == 2 || aNbComp == 4) + aNbComp2 = 2; + else if(aNbComp > 4) + aNbComp2 = 3; + + TMinMaxArr& aMinMaxArr = aField->myMinMaxArr; + for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){ + TTimerLog aTimerLog("BuildMinMax - GetPTimeStampInfo()"); + INITMSG(MYDEBUG,"- iTimeStamp = "<GetPTimeStampInfo(aFieldInfo, + aMEntity, + aGeom2Size, + iTimeStamp); + + MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, + aMKey2Profile, + aKey2Gauss); + + const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal; + + const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value; + MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin(); + for(; anIter != aGeom2Value.end(); anIter++){ + const MED::TMeshValue& aMMeshValue = anIter->second; + MED::EGeometrieElement aMGeom = anIter->first; + + TInt aNbElem = aMMeshValue.myNbElem; + TInt aNbGauss = aMMeshValue.myNbGauss; + + INITMSG(MYDEBUG, + "- aMGeom = "<GetNbMeshes(); + TMeshMap& aMeshMap = myMeshMap; + + INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<GetPMeshInfo(iMesh); + std::string aMeshName = aMeshInfo->GetName(); + + TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + if(anIter == aMeshMap.end()) + continue; + PMEDMesh aMesh = anIter->second; + + INITMSG(MYDEBUG,"aMeshName = '"<GetEntityInfo(aMeshInfo); + + MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = + MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo); + +#ifndef _DEXCEPT_ + try{ +#endif MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo); BuildFamilyMap(aMesh, - aFamilyID2CellsSize, - aEntityInfo, + anEntityInfo, anEntity2TGeom2ElemInfo, aFamilyInfoSet, aMed); BuildGroupMap(aMesh, aFamilyInfoSet); -#endif - PCalculateMinMax aCalculateMinMax(new TCalculateMinMax(aMesh, - aEntityInfo, - aMKey2Profile, - aKey2Gauss, - aMed)); - - boost::thread aThread(boost::bind(&CalculateMinMax,aCalculateMinMax)); #ifndef _DEXCEPT_ }catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<myEntity; @@ -1304,6 +1318,8 @@ VISU_MedConvertor VISU::PFamilyImpl theFamily) { TTimerLog aTimerLog("LoadFamilyOnEntity"); + INITMSG(MYDEBUG,"LoadFamilyOnEntity"<myEntity; @@ -1326,6 +1342,8 @@ VISU_MedConvertor const VISU::TFamilySet& theFamilySet) { TTimerLog aTimerLog("LoadMeshOnGroup"); + INITMSG(MYDEBUG,"LoadMeshOnGroup"<myEntity; @@ -1376,6 +1396,8 @@ VISU_MedConvertor VISU::PValForTimeImpl theValForTime) { TTimerLog aTimerLog("LoadValForTimeOnGaussPts"); + INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<myEntity; @@ -2084,6 +2106,14 @@ LoadValForTime(const MED::PWrapper& theMed, aMKey2Profile, aKey2Gauss); + InitGaussProfile(theMed, + aMeshInfo, + aTimeStampVal, + theMeshOnEntity, + aMEntity, + aGeom2Size, + theValForTime); + LoadProfile(theMed, theMesh, aTimeStampVal, @@ -2100,7 +2130,6 @@ LoadValForTime(const MED::PWrapper& theMed, PMEDProfile aProfile = theValForTime->myProfile; TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); TInt aNbComp = theField->myNbComp; INITMSGA(MYDEBUG,0, @@ -2169,7 +2198,6 @@ VISU_MedConvertor VISU::PMEDField theField, VISU::PMEDValForTime theValForTime) { - TTimerLog aTimerLog("LoadValForTimeOnMesh"); PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter; return LoadValForTime(theMed, theMesh, @@ -2190,7 +2218,6 @@ VISU_MedConvertor VISU::PMEDField theField, VISU::PMEDValForTime theValForTime) { - TTimerLog aTimerLog("LoadValForTimeOnGaussPts"); PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter; return LoadValForTime(theMed, theMesh, diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 61bb67e1..43416b95 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -130,8 +130,11 @@ namespace VISU //--------------------------------------------------------------- + typedef std::map TFamilyID2CellsSize; + struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl { + TFamilyID2CellsSize myFamilyID2CellsSize; MED::TGeom2Size myGeom2Size; }; typedef SharedPtr PMEDMeshOnEntity; @@ -172,7 +175,19 @@ public: virtual VISU_Convertor* - Build(); + BuildEntities(); + + virtual + VISU_Convertor* + BuildFields(); + + virtual + VISU_Convertor* + BuildMinMax(); + + virtual + VISU_Convertor* + BuildGroups(); protected: QFileInfo myFileInfo; diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index bad03e4f..0131825a 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -19,6 +19,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl LIB = libVISUEngineImpl.la LIB_SRC = \ + VISU_Result_i.cc \ VISUConfig.cc \ VISU_PrsObject_i.cc \ VISU_Prs3d_i.cc \ @@ -35,7 +36,6 @@ LIB_SRC = \ VISU_Mesh_i.cc \ VISU_Table_i.cc \ VISU_Gen_i.cc \ - VISU_Result_i.cc \ VISU_ViewManager_i.cc \ VISU_View_i.cc \ VISU_TimeAnimation.cxx \ diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 2ecd1f0f..2b9ea7f9 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -35,6 +35,14 @@ #include "SALOMEDS_Tool.hxx" #include "HDFascii.hxx" +#include "SUIT_Session.h" +#include "SALOME_Event.hxx" +#include "SalomeApp_Study.h" +#include "SalomeApp_Application.h" + +#include +#include + // QT Includes #include #include @@ -145,8 +153,8 @@ void VISU::Result_i::RemoveFromStudy() int -VISU::Result_i:: -IsPossible() +VISU::Result_i +::IsPossible() { try{ float aSize = myInput->GetSize(); @@ -162,9 +170,10 @@ IsPossible() } +//--------------------------------------------------------------- CORBA::Boolean -VISU::Result_i:: -BuildAll() +VISU::Result_i +::BuildAll() { if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<NewBuilder(); - aStudyBuilder->NewCommand(); // There is a transaction - if(MYDEBUG) MESSAGE("Result_i::Build"); - try{ - const TMeshMap& aMeshMap = myInput->GetMeshMap(); - if(aMeshMap.empty()) - throw std::runtime_error("Build - There is no any mesh information in the file !!!"); + QString aComment; + myInput->BuildEntities(); + string aRefFatherEntry = GetRefFatherEntry(); + const TMeshMap& aMeshMap = myInput->GetMeshMap(); + TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); + for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ mySComponent = FindOrCreateVisuComponent(myStudyDocument); - CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID()); - string aRefFatherEntry = GetRefFatherEntry(); - QString aComment; + CORBA::String_var aSComponentEntry = mySComponent->GetID(); + CORBA::String_var anIOR(GetID()); aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s", GetComment(), VISU::TRESULT, @@ -276,7 +284,6 @@ Build(SALOMEDS::SObject_ptr theSObject) aComment.latin1(), true); 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)){ CORBA::String_var aString = theSObject->GetID(); CreateReference(myStudyDocument,aResultEntry,aString.in()); @@ -284,151 +291,370 @@ Build(SALOMEDS::SObject_ptr theSObject) TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ const string& aMeshName = aMeshMapIter->first; - const VISU::PMesh aMesh = aMeshMapIter->second; - const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; - VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter; + const PMesh& aMesh = aMeshMapIter->second; + const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + if(aMeshOnEntityMap.empty()) + continue; + aComment.sprintf("myComment=MESH;myName=%s;myDim=%d", - aMeshName.c_str(),aMesh->myDim); - string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(), - "",aMeshName.c_str(),"",aComment.latin1(),true); - if(aMeshOnEntityMap.empty()) continue; - aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str()); - string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(), - "","Families","",aComment.latin1(),true); - //Import entities and according families - aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - typedef std::map TComment2EntryMap; - TComment2EntryMap aComment2EntryMap; - typedef std::map TEntity2EntryMap; - TEntity2EntryMap aEntity2EntryMap; + aMeshName.c_str(), + aMesh->myDim); + aMesh->myEntry = + CreateAttributes(myStudyDocument, + aResultEntry.c_str(), + aRefFatherEntry.c_str(), + "", + aMeshName.c_str(), + "", + aComment.latin1(), + true); + + aComment.sprintf("myComment=FAMILIES;myMeshName=%s", + aMeshName.c_str()); + string aSubMeshesEntry = + CreateAttributes(myStudyDocument, + aMesh->myEntry.c_str(), + aRefFatherEntry.c_str(), + "", + "Families", + "", + aComment.latin1(), + true); + //Import entities + TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ - const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; + const TEntity& anEntity = aMeshOnEntityMapIter->first; + const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; + + string anEntityName; + switch(anEntity){ + case NODE_ENTITY: + anEntityName = "onNodes"; + break; + case EDGE_ENTITY: + anEntityName = "onEdges"; + break; + case FACE_ENTITY: + anEntityName = "onFaces"; + break; + case CELL_ENTITY: + anEntityName = "onCells"; + break; + default: + continue; + } + aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", VISU::TENTITY, aMeshName.c_str(), anEntity); - string anEntityName; - switch(anEntity){ - case VISU::NODE_ENTITY : anEntityName = "onNodes"; break; - case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break; - case VISU::FACE_ENTITY : anEntityName = "onFaces"; break; - case VISU::CELL_ENTITY : anEntityName = "onCells"; break; - default: - throw std::runtime_error("Build >> Value of entity is incorrect!"); + + aMeshOnEntity->myEntry = + CreateAttributes(myStudyDocument, + aSubMeshesEntry.c_str(), + aRefFatherEntry.c_str(), + "", + anEntityName.c_str(), + "", + aComment.latin1(), + true); + } + } + } +} + + +//--------------------------------------------------------------- +namespace +{ + struct TMemManager + { + VISU::Result_i* myResult; + TMemManager(VISU::Result_i* theResult): + myResult(theResult) + { + myResult->Register(); + } + + ~TMemManager() + { + myResult->Destroy(); + } + }; + + struct TUpdateObjBrowser: public SALOME_Event + { + int myStudyId; + + TUpdateObjBrowser(const int theStudyId): + myStudyId(theStudyId) + {} + + virtual + void + Execute() + { + SUIT_Session* aSession = SUIT_Session::session(); + QPtrList anApplications = aSession->applications(); + QPtrListIterator anIter (anApplications); + while (SUIT_Application* aSApp = anIter.current()) { + if(SalomeApp_Application* anApp = dynamic_cast(aSApp)){ + if (SalomeApp_Study* aStudy = dynamic_cast(anApp->activeStudy())) { + if (_PTR(Study) aCStudy = aStudy->studyDS()) { + if (myStudyId == aCStudy->StudyId()) { + MESSAGE("Result_i::updateObjectBrowser"); + anApp->updateObjectBrowser(); + break; + } + } + } } - aEntity2EntryMap[anEntity] = CreateAttributes - (myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(), - "", anEntityName.c_str(), "", aComment.latin1(), true); - const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; - const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; - VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); - for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ - const string& aFamilyName = aFamilyMapIter->first; - aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", - VISU::TFAMILY, - aMeshName.c_str(), - anEntity, - aFamilyName.c_str()); - aComment2EntryMap[aComment.latin1()] = + ++anIter; + } + } + }; +} + +void +VISU::Result_i +::BuildGroups() +{ + TMemManager aMemManager(this); + + QString aComment; + myInput->BuildGroups(); + string aRefFatherEntry = GetRefFatherEntry(); + const TMeshMap& aMeshMap = myInput->GetMeshMap(); + TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); + for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ + const string& aMeshName = aMeshMapIter->first; + const PMesh& aMesh = aMeshMapIter->second; + + const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + if(aMeshOnEntityMap.empty()) + 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; + aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", + TFAMILY, + aMeshName.c_str(), + anEntity, + aFamilyName.c_str()); + aFamily->myEntry = + CreateAttributes(myStudyDocument, + aMeshOnEntity->myEntry.c_str(), + aRefFatherEntry.c_str(), + "", + aFamilyName.c_str(), + "", + aComment.latin1(), + true); + } + } + //Importing groups + const TGroupMap& aGroupMap = aMesh->myGroupMap; + if(!aGroupMap.empty()){ + aComment.sprintf("myComment=GROUPS;myMeshName=%s", + aMeshName.c_str()); + string aGroupsEntry = + CreateAttributes(myStudyDocument, + aMesh->myEntry.c_str(), + aRefFatherEntry.c_str(), + "", + "Groups", + "", + aComment.latin1(), + true); + TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); + for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ + const string& aGroupName = aGroupMapIter->first; + const PGroup& aGroup = aGroupMapIter->second; + aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", + TGROUP,aMeshName.c_str(),aGroupName.c_str()); + aGroup->myEntry = + CreateAttributes(myStudyDocument, + aGroupsEntry.c_str(), + aRefFatherEntry.c_str(), + "", + aGroupName.c_str(), + "", + aComment.latin1(), + true); + const TFamilySet& aFamilySet = aGroup->myFamilySet; + TFamilySet::const_iterator aFamilyIter = aFamilySet.begin(); + for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){ + const PFamily& aFamily = *aFamilyIter; + CreateReference(myStudyDocument, + aGroup->myEntry, + aFamily->myEntry); + } + } + } + } + + ProcessVoidEvent(new TUpdateObjBrowser(myStudyDocument->StudyId())); +} + + +//--------------------------------------------------------------- +void +VISU::Result_i +::BuildFields() +{ + TMemManager aMemManager(this); + + QString aComment; + myInput->BuildFields(); + string aRefFatherEntry = GetRefFatherEntry(); + const TMeshMap& aMeshMap = myInput->GetMeshMap(); + TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); + for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ + const string& aMeshName = aMeshMapIter->first; + const PMesh& aMesh = aMeshMapIter->second; + + const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + if(aMeshOnEntityMap.empty()) + continue; + + //Import fields + string aFieldsEntry; + bool anIsFieldsEntryCreated = false; + + TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); + 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(!anIsFieldsEntryCreated){ + aComment.sprintf("myComment=FIELDS;myMeshName=%s", + aMeshName.c_str()); + aFieldsEntry = CreateAttributes(myStudyDocument, - aEntity2EntryMap[anEntity].c_str(), + aMesh->myEntry.c_str(), aRefFatherEntry.c_str(), "", - aFamilyName.c_str(), + "Fields", "", aComment.latin1(), true); + anIsFieldsEntryCreated = true; } - } - //Importing groups - const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap; - if(aGroupMap.size() > 0){ - aComment.sprintf("myComment=GROUPS;myMeshName=%s", - aMeshName.c_str()); - string aGroupsEntry = + const string& aFieldName = aFieldMapIter->first; + const PField& aField = aFieldMapIter->second; + const TValField& aValField = aField->myValField; + QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]); + aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d", + VISU::TFIELD, + aMeshName.c_str(), + anEntity, + aFieldName.c_str(), + aValField.size(), + aField->myNbComp); + aField->myEntry = CreateAttributes(myStudyDocument, - aMeshEntry.c_str(), + aFieldsEntry.c_str(), aRefFatherEntry.c_str(), "", - "Groups", + aFieldNameWithUnit.latin1(), "", aComment.latin1(), true); - VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); - for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ - const string& aGroupName = aGroupMapIter->first; - aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", - VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str()); - string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(), - "",aGroupName.c_str(),"",aComment.latin1(),true); - const VISU::PGroup aGroup = aGroupMapIter->second; - const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet; - VISU::TFamilySet::const_iterator aFamilyIter = aFamilySet.begin(); - for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){ - const VISU::PFamily& aFamily = *aFamilyIter; - const string& aFamilyName = aFamily->myName; - const VISU::TEntity& anEntity = aFamily->myEntity; - aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", - VISU::TFAMILY, - aMeshName.c_str(), - anEntity, - aFamilyName.c_str()); - TComment2EntryMap::const_iterator anIter = aComment2EntryMap.find(aComment.latin1()); - if(anIter != aComment2EntryMap.end()){ - const std::string& anEntry = anIter->second; - CreateReference(myStudyDocument,aGroupEntry,anEntry); - } - } - } - } - //Import fields - string aFieldsEntry; - bool isFieldEntryCreated = 0; - aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ - const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; - const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; - const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ - if(!isFieldEntryCreated){ - aComment.sprintf("myComment=FIELDS;myMeshName=%s", - aMeshName.c_str()); - aFieldsEntry = - CreateAttributes(myStudyDocument, - aMeshEntry.c_str(), - aRefFatherEntry.c_str(), - "", - "Fields", - "", - aComment.latin1(), - true); - isFieldEntryCreated = true; - } - const string& aFieldName = aFieldMapIter->first; - const VISU::PField aField = aFieldMapIter->second; - const VISU::TValField& aValField = aField->myValField; - QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]); - aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d", - VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField->myNbComp); - string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(), - "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true); - CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]); - VISU::TValField::const_iterator aValFieldIter = aValField.begin(); - for(; aValFieldIter != aValField.end(); aValFieldIter++){ - int aTimeStamp = aValFieldIter->first; - const VISU::PValForTime aValForTime = aValFieldIter->second; - aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", - VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField->myNbComp); - string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime); - CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(), - "",aTimeStampId.c_str(),"",aComment.latin1(),true); - } + CreateReference(myStudyDocument, + 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.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", + VISU::TTIMESTAMP, + aMeshName.c_str(), + anEntity, + aFieldName.c_str(), + aTimeStamp, + aField->myNbComp); + string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime); + aValForTime->myEntry = + CreateAttributes(myStudyDocument, + aField->myEntry.c_str(), + aRefFatherEntry.c_str(), + "", + aTimeStampId.c_str(), + "", + aComment.latin1(), + true); } } } - bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false); - if(isBuildAll) BuildAll(); + } + + ProcessVoidEvent(new TUpdateObjBrowser(myStudyDocument->StudyId())); +} + + +//--------------------------------------------------------------- +void +VISU::Result_i +::BuildMinMax() +{ + TMemManager aMemManager(this); + + myInput->BuildMinMax(); +} + + +//--------------------------------------------------------------- +VISU::Storable* +VISU::Result_i +::Build(SALOMEDS::SObject_ptr theSObject) +{ + bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false); + if(isBuildAll) + return BuildAll(theSObject); + else{ + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction + + BuildEntities(theSObject); + + boost::thread(boost::bind(&Result_i::BuildFields,this)); + + boost::thread(boost::bind(&Result_i::BuildGroups,this)); + + boost::thread(boost::bind(&Result_i::BuildMinMax,this)); + + aStudyBuilder->CommitCommand(); + + return this; + } +} + + +//--------------------------------------------------------------- +VISU::Storable* +VISU::Result_i +::BuildAll(SALOMEDS::SObject_ptr theSObject) +{ + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction + + if(MYDEBUG) MESSAGE("Result_i::Build"); + try{ + BuildEntities(theSObject); + BuildFields(); + BuildGroups(); + BuildAll(); }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<CommitCommand(); + return this; } +//--------------------------------------------------------------- VISU::Storable* VISU::Result_i:: Create(const char* theFileName) @@ -473,6 +702,7 @@ Create(const char* theFileName) } +//--------------------------------------------------------------- VISU::Storable* VISU::Result_i:: Create(SALOMEDS::SObject_ptr theMedSObject) @@ -499,6 +729,8 @@ Create(SALOMEDS::SObject_ptr theMedSObject) return NULL; } + +//--------------------------------------------------------------- VISU::Storable* VISU::Result_i:: Create(SALOME_MED::FIELD_ptr theField) @@ -529,6 +761,7 @@ Create(SALOME_MED::FIELD_ptr theField) } +//--------------------------------------------------------------- VISU::Storable* VISU::Result_i:: Restore(SALOMEDS::SObject_ptr theSObject, @@ -637,21 +870,32 @@ Restore(SALOMEDS::SObject_ptr theSObject, return NULL; } -VISU::Result_i::TInput* VISU::Result_i::GetInput() { +//--------------------------------------------------------------- +VISU::Result_i::TInput* +VISU::Result_i +::GetInput() +{ return myInput; } -void VISU::Result_i::ToStream(std::ostringstream& theStr){ +//--------------------------------------------------------------- +void +VISU::Result_i +::ToStream(std::ostringstream& theStr) +{ if(MYDEBUG) MESSAGE(GetComment()); Storable::DataToStream(theStr,"myName",myName.c_str()); Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str()); Storable::DataToStream(theStr,"myCreationId",myCreationId); } + +//--------------------------------------------------------------- VISU::Storable* -VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, - const string& thePrefix, - const Storable::TRestoringMap& theMap) +VISU::Result_i +::Restore(SALOMEDS::SObject_ptr theSObject, + const string& thePrefix, + const Storable::TRestoringMap& theMap) { SALOMEDS::Study_var aStudy = theSObject->GetStudy(); @@ -667,25 +911,56 @@ VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, return pResult->Restore(theSObject,theMap,thePrefix); } -string VISU::Result_i::GetRefFatherEntry() { + +//--------------------------------------------------------------- +string +VISU::Result_i +::GetRefFatherEntry() +{ //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry(); return ""; } -string VISU::Result_i::GetEntry(){ +string +VISU::Result_i +::GetEntry() +{ CORBA::String_var anEntry = mySObject->GetID(); return string(anEntry); } -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 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) { return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str()); } -VISU::Result_i::~Result_i() + +//--------------------------------------------------------------- +VISU::Result_i +::~Result_i() { MESSAGE("Result_i::~Result_i() - this = "<