mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-28 13:20:32 +05:00
0022301: [CEA] Problems with study dump in SMESH
Merge from V7_main 2013-08-22
This commit is contained in:
parent
1779fc70bb
commit
993a87b969
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,8 @@
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
||||
|
||||
#define USE_STRING_FAMILY
|
||||
|
||||
// ===========================================================================================
|
||||
/*!
|
||||
* This file was created in order to respond to requirement of bug PAL10494:
|
||||
@ -129,6 +131,7 @@ public:
|
||||
const _AString & GetMethod();
|
||||
const _AString & GetArg( int index );
|
||||
int GetNbArgs() { FindAllArgs(); return myArgs.Length(); }
|
||||
bool IsMethodCall();
|
||||
bool MethodStartsFrom(const _AString& beg)
|
||||
{ GetMethod(); return ( myMeth.Location( beg, 1, myMeth.Length() ) == 1 ); }
|
||||
void SetResultValue( const _AString& theResult )
|
||||
@ -144,6 +147,7 @@ public:
|
||||
static _AString GetWord( const _AString & theSring, int & theStartPos,
|
||||
const bool theForward, const bool dotIsWord = false);
|
||||
static bool IsStudyEntry( const _AString& str );
|
||||
static bool IsID( const _AString& str );
|
||||
static std::list< _pyID > GetStudyEntries( const _AString& str );
|
||||
void AddDependantCmd( Handle(_pyCommand) cmd, bool prepend = false)
|
||||
{ if (prepend) myDependentCmds.push_front( cmd ); else myDependentCmds.push_back( cmd ); }
|
||||
@ -166,6 +170,7 @@ protected:
|
||||
_pyID myID;
|
||||
Handle(_pyCommand) myCreationCmd;
|
||||
std::list< Handle(_pyCommand) > myProcessedCmds;
|
||||
std::list< Handle(_pyCommand) > myArgCmds; // where this obj is used as an argument
|
||||
bool myIsPublished;
|
||||
|
||||
void setID(const _pyID& theID);
|
||||
@ -182,10 +187,11 @@ public:
|
||||
void AddProcessedCmd( const Handle(_pyCommand) & cmd )
|
||||
{ if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
|
||||
std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }
|
||||
void AddArgCmd( const Handle(_pyCommand) & cmd ) { myArgCmds.push_back( cmd ); }
|
||||
virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); }
|
||||
virtual void Flush() = 0;
|
||||
virtual const char* AccessorMethod() const;
|
||||
virtual bool CanClear() { return !myIsPublished; }
|
||||
virtual bool CanClear();
|
||||
virtual void ClearCommands();
|
||||
virtual void Free() {}
|
||||
|
||||
@ -212,6 +218,26 @@ struct ExportedMeshData
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
/*!
|
||||
* \brief A container of strings groupped by prefix. It is used for a faster search of
|
||||
* objects requiring to KeepAgrCmds() in commands. A speed up is gained because
|
||||
* only a common prefix (e.g. "aArea") of many object IDs is searched in a command
|
||||
* and not every object ID
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------
|
||||
class _pyStringFamily
|
||||
{
|
||||
_AString _prefix;
|
||||
std::list< _pyStringFamily > _subFams;
|
||||
std::list< _AString > _strings;
|
||||
int isIn( const char* str );
|
||||
public:
|
||||
bool Add( const char* str );
|
||||
bool IsIn( const _AString& str, _AString& subStr );
|
||||
void Print( int level = 0 );
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
/*!
|
||||
* \brief Class corresponding to SMESH_Gen. It holds info on existing
|
||||
@ -228,16 +254,18 @@ public:
|
||||
const bool theToKeepAllCommands);
|
||||
Handle(_pyCommand) AddCommand( const _AString& theCommand );
|
||||
void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
|
||||
void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
||||
void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
|
||||
void SetCommandAfter ( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
||||
void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
|
||||
Handle(_pyCommand)& GetLastCommand();
|
||||
std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
|
||||
void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const;
|
||||
|
||||
_pyID GenerateNewID( const _pyID& theID );
|
||||
void AddObject( Handle(_pyObject)& theObj );
|
||||
void CheckObjectIsReCreated( Handle(_pyObject)& theObj );
|
||||
void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
|
||||
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
||||
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
|
||||
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
||||
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
|
||||
Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
|
||||
Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
|
||||
const Handle(_pyHypothesis)& theHypothesis);
|
||||
@ -250,6 +278,11 @@ public:
|
||||
bool IsGeomObject(const _pyID& theObjID) const;
|
||||
bool IsNotPublished(const _pyID& theObjID) const;
|
||||
void ObjectCreationRemoved(const _pyID& theObjID);
|
||||
#ifdef USE_STRING_FAMILY
|
||||
void KeepAgrCmds(const _pyID& theObjID) { myKeepAgrCmdsIDs.Add( theObjID.ToCString() ); }
|
||||
#else
|
||||
void KeepAgrCmds(const _pyID& theObjID) { myKeepAgrCmdsIDs.push_back( theObjID ); }
|
||||
#endif
|
||||
bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
|
||||
void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
|
||||
{ myFile2ExportedMesh[ file ] = mesh; }
|
||||
@ -267,24 +300,30 @@ private:
|
||||
void setNeighbourCommand( Handle(_pyCommand)& theCmd,
|
||||
Handle(_pyCommand)& theOtherCmd,
|
||||
const bool theIsAfter );
|
||||
|
||||
//void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
|
||||
|
||||
private:
|
||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
||||
std::map< _pyID, Handle(_pyObject) > myObjects;
|
||||
std::list< Handle(_pyHypothesis) > myHypos;
|
||||
std::list< Handle(_pyCommand) > myCommands;
|
||||
int myNbCommands;
|
||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
||||
std::map< _pyID, Handle(_pyObject) > myObjects;
|
||||
std::map< _pyID, Handle(_pyHypothesis) > myHypos;
|
||||
#ifdef USE_STRING_FAMILY
|
||||
_pyStringFamily myKeepAgrCmdsIDs;
|
||||
#else
|
||||
std::list< _pyID > myKeepAgrCmdsIDs;
|
||||
#endif
|
||||
std::list< Handle(_pyCommand) > myCommands;
|
||||
int myNbCommands;
|
||||
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
||||
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
||||
std::set< TCollection_AsciiString >& myRemovedObjIDs;
|
||||
Handle(_pyCommand) myLastCommand;
|
||||
int myNbFilters;
|
||||
bool myToKeepAllCommands;
|
||||
SALOMEDS::Study_var myStudy;
|
||||
int myGeomIDNb, myGeomIDIndex;
|
||||
std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
|
||||
Handle( _pyHypothesisReader ) myHypReader;
|
||||
Handle(_pyCommand) myLastCommand;
|
||||
int myNbFilters;
|
||||
bool myToKeepAllCommands;
|
||||
SALOMEDS::Study_var myStudy;
|
||||
int myGeomIDNb, myGeomIDIndex;
|
||||
std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
|
||||
Handle( _pyHypothesisReader ) myHypReader;
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pyGen)
|
||||
};
|
||||
@ -298,7 +337,7 @@ private:
|
||||
class _pyMesh: public _pyObject
|
||||
{
|
||||
std::list< Handle(_pyHypothesis) > myHypos;
|
||||
std::list< Handle(_pyCommand) > myAddHypCmds;
|
||||
std::list< Handle(_pyCommand) > myAddHypCmds, myNotConvertedAddHypCmds;
|
||||
std::list< Handle(_pySubMesh) > mySubmeshes;
|
||||
std::list< Handle(_pyGroup) > myGroups;
|
||||
std::list< Handle(_pyMeshEditor)> myEditors;
|
||||
@ -363,7 +402,7 @@ protected:
|
||||
_pyID myGeom, myMesh;
|
||||
struct CreationMethod {
|
||||
_AString myMethod; // method of algo or mesh creating a hyp
|
||||
// myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myAlgoMethod
|
||||
// myArgNb(i)-th arg of myArgMethods(i) of hyp becomes an i-th arg of myMethod
|
||||
std::vector<_AString> myArgMethods;
|
||||
std::vector<int> myArgNb; // arg nb countered from 1
|
||||
std::vector<_AString> myArgs; // creation arguments
|
||||
@ -372,6 +411,7 @@ protected:
|
||||
// a hypothesis can be created by different algos by different methods
|
||||
typedef std::map<_AString, CreationMethod > TType2CrMethod;
|
||||
TType2CrMethod myAlgoType2CreationMethod;
|
||||
std::set< _AString > myAccumulativeMethods;
|
||||
CreationMethod* myCurCrMethod; // used for adding to myAlgoType2CreationMethod
|
||||
std::list<Handle(_pyCommand)> myArgCommands;
|
||||
std::list<Handle(_pyCommand)> myUnusedCommands;
|
||||
@ -392,6 +432,8 @@ public:
|
||||
void AddArgMethod(const _AString& method, const int argNb = 1)
|
||||
{ myCurCrMethod->myArgMethods.push_back( method );
|
||||
myCurCrMethod->myArgNb.push_back( argNb ); }
|
||||
void AddAccumulativeMethod( const _AString& method)
|
||||
{ myAccumulativeMethods.insert( method ); }
|
||||
//const TColStd_SequenceOfAsciiString& GetArgs() const { return myArgs; }
|
||||
const std::list<Handle(_pyCommand)>& GetArgCommands() const { return myArgCommands; }
|
||||
void ClearAllCommands();
|
||||
@ -525,9 +567,10 @@ DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
|
||||
// -------------------------------------------------------------------------------------
|
||||
class _pySelfEraser: public _pyObject
|
||||
{
|
||||
bool myIgnoreOwnCalls; // not to erase only if this obj is used as argument
|
||||
public:
|
||||
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
|
||||
:_pyObject(theCreationCmd) { myIsPublished = true; }
|
||||
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd);
|
||||
void IgnoreOwnCalls() { myIgnoreOwnCalls = true; }
|
||||
virtual void Flush();
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pySelfEraser)
|
||||
@ -544,12 +587,13 @@ class _pySubMesh: public _pyObject
|
||||
Handle(_pyObject) myCreator;
|
||||
Handle(_pyMesh) myMesh;
|
||||
public:
|
||||
_pySubMesh(const Handle(_pyCommand)& theCreationCmd);
|
||||
_pySubMesh(const Handle(_pyCommand)& theCreationCmd, bool toKeepAgrCmds=true);
|
||||
virtual void Process( const Handle(_pyCommand)& theCommand);
|
||||
virtual void Flush();
|
||||
virtual Handle(_pyMesh) GetMesh() { return myMesh; }
|
||||
virtual void Free() { myCreator.Nullify(); myMesh.Nullify(); }
|
||||
void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
|
||||
static bool CanBeArgOfMethod(const _AString& theMethodName);
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pySubMesh)
|
||||
};
|
||||
@ -561,14 +605,14 @@ public:
|
||||
class _pyFilter: public _pyObject
|
||||
{
|
||||
_pyID myNewID, myMesh;
|
||||
std::list< Handle(_pyObject) > myUsers;
|
||||
//std::list< Handle(_pyObject) > myUsers;
|
||||
public:
|
||||
_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
|
||||
void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
|
||||
//void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
|
||||
virtual void Process( const Handle(_pyCommand)& theCommand);
|
||||
virtual void Flush();
|
||||
virtual bool CanClear();
|
||||
virtual void Free() { myUsers.clear(); }
|
||||
//virtual bool CanClear();
|
||||
//virtual void Free() { myUsers.clear(); }
|
||||
const _pyID& GetNewID() const { return myNewID; }
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pyFilter)
|
||||
@ -580,7 +624,7 @@ DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
|
||||
* \brief To convert creation of a group by filter
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------
|
||||
class _pyGroup: public _pySubMesh
|
||||
class _pyGroup: public _pySubMesh // use myMesh of _pySubMesh
|
||||
{
|
||||
Handle(_pyFilter) myFilter;
|
||||
bool myCanClearCreationCmd;
|
||||
@ -589,6 +633,8 @@ public:
|
||||
virtual void Process( const Handle(_pyCommand)& theCommand);
|
||||
virtual void Flush();
|
||||
virtual void Free() { myFilter.Nullify(); }
|
||||
virtual bool CanClear();
|
||||
void RemovedWithContents();
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pyGroup)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user