From ecc066567bd31a19ae9d98fd029a74f63964911b Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 24 Nov 2005 07:01:05 +0000 Subject: [PATCH] To provide additional fix for Bug GVIEW10573 time to load sandia file too long To define new methods to control the Result calculations --- idl/VISU_Gen.idl | 23 ++++++++++++++++- src/CONVERTOR/VISU_Convertor.cxx | 1 - src/CONVERTOR/VISU_Convertor_impl.cxx | 7 ++++++ src/CONVERTOR/VISU_MedConvertor.cxx | 36 ++++++++++++++++++++++++++- src/CONVERTOR/VISU_MedConvertor.hxx | 5 ++++ src/ENGINE/VISU_Engine_i.cc | 5 ++++ src/ENGINE/VISU_Engine_i.hh | 1 + 7 files changed, 75 insertions(+), 3 deletions(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 77e4921e..72b6829f 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1250,14 +1250,28 @@ module VISU { * for further construction of graphical presentations. */ interface Result : RemovableObject, SALOME::GenericObj { - //interface Result : Base{ /*! Reads all data from the corresponding sources. By default the data is loaded on demand. */ boolean BuildAll(); + /*! Start to parse the source MED file and publish all its entities into the study*/ + boolean Build(in boolean theIsBuildAll, in boolean theIsAtOnce); + + /*! Allow to check is all requested MED entites already loaded or not */ + boolean IsDone(); + + /*! Allow to check is corresponding MED entites already loaded or not */ + boolean IsEntitiesDone(); + + /*! Choose to parse MED fields and perform global min / max on the MED timestamps.*/ + void SetBuildFields(in boolean theIsBuildFields, in boolean theIsCalculateMinMax); + /*! Allow to check is corresponding MED fields already loaded or not */ boolean IsFieldsDone(); + /*! Choose to parse MED groups.*/ + void SetBuildGroups(in boolean theIsBuildGroups); + /*! Allow to check is corresponding MED groups and families already loaded or not */ boolean IsGroupsDone(); @@ -1307,6 +1321,13 @@ module VISU { */ Result ImportFile(in string theFileName); + /*! + * Create result and initialize its with the file. The access to this file will be conserved outside of the application. + * \param theFileName String parameter defining the name of the file + * from which the data will be imported. + */ + Result CreateResult(in string theFileName); + /*! * Imports data from a file. The access to this file will closed. * \param theFileName String parameter defining the name of the file diff --git a/src/CONVERTOR/VISU_Convertor.cxx b/src/CONVERTOR/VISU_Convertor.cxx index 0a599cd1..f417ad07 100644 --- a/src/CONVERTOR/VISU_Convertor.cxx +++ b/src/CONVERTOR/VISU_Convertor.cxx @@ -56,7 +56,6 @@ const VISU::TMeshMap& VISU_Convertor ::GetMeshMap() { - if(!myIsDone) { myIsDone = true; Build();} return myMeshMap; } diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index e7e13a26..fd4dbd11 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -1770,6 +1770,13 @@ VISU_Convertor* VISU_Convertor_impl ::Build() { + if(!myIsDone){ + myIsDone = true; + BuildEntities(); + BuildFields(); + BuildMinMax(); + BuildGroups(); + } return this; } diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 953b0c43..5616c086 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -910,6 +910,20 @@ namespace return myElemInfo->GetElemName(theObjID); return TSubMeshImpl::GetElemName(theObjID); } + + struct TSetIsDone + { + bool& myIsDone; + TSetIsDone(bool& theIsDone): + myIsDone(theIsDone) + {} + + ~TSetIsDone() + { + myIsDone = true; + } + + }; } @@ -922,7 +936,11 @@ CreateConvertor(const string& theFileName) } VISU_MedConvertor -::VISU_MedConvertor(const string& theFileName) +::VISU_MedConvertor(const string& theFileName): + myIsEntitiesDone(false), + myIsFieldsDone(false), + myIsGroupsDone(false), + myIsMinMaxDone(false) { myFileInfo.setFile(QString(theFileName.c_str())); myName = myFileInfo.baseName().latin1(); @@ -934,6 +952,10 @@ VISU_Convertor* VISU_MedConvertor ::BuildEntities() { + if(myIsEntitiesDone) + return this; + + TSetIsDone aSetIsDone(myIsEntitiesDone); TTimerLog aTimerLog(MYDEBUG,"BuildEntities"); MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); @@ -1005,6 +1027,10 @@ VISU_Convertor* VISU_MedConvertor ::BuildFields() { + if(myIsFieldsDone) + return this; + + TSetIsDone aSetIsDone(myIsFieldsDone); TTimerLog aTimerLog(MYDEBUG,"BuildFields"); MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); @@ -1062,6 +1088,10 @@ VISU_Convertor* VISU_MedConvertor ::BuildMinMax() { + if(myIsMinMaxDone) + return this; + + TSetIsDone aSetIsDone(myIsMinMaxDone); TTimerLog aTimerLog(MYDEBUG,"BuildMinMax"); MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); @@ -1229,6 +1259,10 @@ VISU_Convertor* VISU_MedConvertor ::BuildGroups() { + if(myIsGroupsDone) + return this; + + TSetIsDone aSetIsDone(myIsGroupsDone); TTimerLog aTimerLog(MYDEBUG,"BuildGroups"); MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 43416b95..082c237d 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -170,6 +170,11 @@ class VISU_MedConvertor: public VISU_Convertor_impl VISU_MedConvertor(); VISU_MedConvertor(const VISU_MedConvertor&); + bool myIsEntitiesDone; + bool myIsFieldsDone; + bool myIsGroupsDone; + bool myIsMinMaxDone; + public: VISU_MedConvertor(const std::string& theFileName); diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index 77413b19..45dc68bc 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -162,6 +162,11 @@ namespace VISU{ } + Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){ + return myVisuGen->CreateResult(theFileName); + } + + Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){ return myVisuGen->CopyAndImportFile(theFileName); } diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index fbcc3b48..d9c665ac 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -57,6 +57,7 @@ namespace VISU{ //Create Result virtual Result_ptr ImportFile(const char* theFileName); + virtual Result_ptr CreateResult(const char* theFileName); virtual Result_ptr CopyAndImportFile(const char* theFileName); virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject); virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField); -- 2.39.2