mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 09:50:36 +05:00
0021347: [CEA 497] Visualisation into SMESH and VISU of hexagonal prism cells (MED_OCTA12)
0021380: EDF 1937 SMESH: Take into account QUAD9 and HEXA27 + prepare to 0021439: Dump of study gives bad geom group and stops with NameError exception
This commit is contained in:
parent
faf45035fc
commit
5638e6783f
@ -35,7 +35,7 @@
|
|||||||
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
|
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
|
||||||
|
|
||||||
#include "SMESH_Gen_i.hxx"
|
#include "SMESH_Gen_i.hxx"
|
||||||
/* SALOME headers that include CORBA headers that include windows.h
|
/* SALOME headers that include CORBA headers that include windows.h
|
||||||
* that defines GetObject symbol as GetObjectA should stand before SALOME headers
|
* that defines GetObject symbol as GetObjectA should stand before SALOME headers
|
||||||
* that declare methods named GetObject - to apply the same rules of GetObject renaming
|
* that declare methods named GetObject - to apply the same rules of GetObject renaming
|
||||||
* and thus to avoid mess with GetObject symbol on Windows */
|
* and thus to avoid mess with GetObject symbol on Windows */
|
||||||
@ -134,7 +134,7 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
|||||||
// split theScript into separate commands
|
// split theScript into separate commands
|
||||||
|
|
||||||
SMESH_NoteBook * aNoteBook = new SMESH_NoteBook();
|
SMESH_NoteBook * aNoteBook = new SMESH_NoteBook();
|
||||||
|
|
||||||
int from = 1, end = theScript.Length(), to;
|
int from = 1, end = theScript.Length(), to;
|
||||||
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
||||||
{
|
{
|
||||||
@ -143,13 +143,13 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
|||||||
aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
|
aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
|
||||||
from = to + 1;
|
from = to + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
aNoteBook->ReplaceVariables();
|
aNoteBook->ReplaceVariables();
|
||||||
|
|
||||||
TCollection_AsciiString aNoteScript = aNoteBook->GetResultScript();
|
TCollection_AsciiString aNoteScript = aNoteBook->GetResultScript();
|
||||||
delete aNoteBook;
|
delete aNoteBook;
|
||||||
aNoteBook = 0;
|
aNoteBook = 0;
|
||||||
|
|
||||||
// split theScript into separate commands
|
// split theScript into separate commands
|
||||||
from = 1, end = aNoteScript.Length();
|
from = 1, end = aNoteScript.Length();
|
||||||
while ( from < end && ( to = aNoteScript.Location( "\n", from, end )))
|
while ( from < end && ( to = aNoteScript.Location( "\n", from, end )))
|
||||||
@ -175,7 +175,7 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
|||||||
if ( (*cmd)->SetDependentCmdsAfter() )
|
if ( (*cmd)->SetDependentCmdsAfter() )
|
||||||
orderChanges = true;
|
orderChanges = true;
|
||||||
} while ( orderChanges );
|
} while ( orderChanges );
|
||||||
|
|
||||||
// concat commands back into a script
|
// concat commands back into a script
|
||||||
TCollection_AsciiString aScript;
|
TCollection_AsciiString aScript;
|
||||||
for ( cmd = theGen->GetCommands().begin(); cmd != theGen->GetCommands().end(); ++cmd )
|
for ( cmd = theGen->GetCommands().begin(); cmd != theGen->GetCommands().end(); ++cmd )
|
||||||
@ -258,20 +258,22 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
||||||
if ( id_mesh != myMeshes.end() )
|
if ( id_mesh != myMeshes.end() )
|
||||||
{
|
{
|
||||||
|
id_mesh->second->AddProcessedCmd( aCommand );
|
||||||
|
|
||||||
// check for mesh editor object
|
// check for mesh editor object
|
||||||
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
|
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
|
||||||
_pyID editorID = aCommand->GetResultValue();
|
_pyID editorID = aCommand->GetResultValue();
|
||||||
Handle(_pyMeshEditor) editor = new _pyMeshEditor( aCommand );
|
Handle(_pyMeshEditor) editor = new _pyMeshEditor( aCommand );
|
||||||
myMeshEditors.insert( make_pair( editorID, editor ));
|
myMeshEditors.insert( make_pair( editorID, editor ));
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
// check for SubMesh objects
|
// check for SubMesh objects
|
||||||
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
|
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
|
||||||
_pyID subMeshID = aCommand->GetResultValue();
|
_pyID subMeshID = aCommand->GetResultValue();
|
||||||
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
|
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
|
||||||
myObjects.insert( make_pair( subMeshID, subMesh ));
|
myObjects.insert( make_pair( subMeshID, subMesh ));
|
||||||
}
|
}
|
||||||
|
|
||||||
id_mesh->second->Process( aCommand );
|
id_mesh->second->Process( aCommand );
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
@ -281,12 +283,15 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
if ( id_editor != myMeshEditors.end() )
|
if ( id_editor != myMeshEditors.end() )
|
||||||
{
|
{
|
||||||
id_editor->second->Process( aCommand );
|
id_editor->second->Process( aCommand );
|
||||||
|
id_editor->second->AddProcessedCmd( aCommand );
|
||||||
TCollection_AsciiString processedCommand = aCommand->GetString();
|
TCollection_AsciiString processedCommand = aCommand->GetString();
|
||||||
|
|
||||||
// some commands of SMESH_MeshEditor create meshes
|
// some commands of SMESH_MeshEditor create meshes
|
||||||
if ( aCommand->GetMethod().Search("MakeMesh") != -1 ) {
|
if ( aCommand->GetMethod().Search("MakeMesh") != -1 ) {
|
||||||
Handle(_pyMesh) mesh = new _pyMesh( aCommand, aCommand->GetResultValue() );
|
_pyID meshID = aCommand->GetResultValue();
|
||||||
|
Handle(_pyMesh) mesh = new _pyMesh( aCommand, meshID );
|
||||||
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
|
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
|
||||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
myMeshes.insert( make_pair( meshID, mesh ));
|
||||||
}
|
}
|
||||||
if ( aCommand->GetMethod() == "MakeBoundaryMesh") {
|
if ( aCommand->GetMethod() == "MakeBoundaryMesh") {
|
||||||
_pyID meshID = aCommand->GetResultValue(0);
|
_pyID meshID = aCommand->GetResultValue(0);
|
||||||
@ -304,6 +309,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
for ( ; hyp != myHypos.end(); ++hyp )
|
for ( ; hyp != myHypos.end(); ++hyp )
|
||||||
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
|
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
|
||||||
(*hyp)->Process( aCommand );
|
(*hyp)->Process( aCommand );
|
||||||
|
(*hyp)->AddProcessedCmd( aCommand );
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +331,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID );
|
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID );
|
||||||
if ( id_obj != myObjects.end() ) {
|
if ( id_obj != myObjects.end() ) {
|
||||||
id_obj->second->Process( aCommand );
|
id_obj->second->Process( aCommand );
|
||||||
|
id_obj->second->AddProcessedCmd( aCommand );
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +396,8 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
// set SMESH.GeometryType instead of a numerical Threshold
|
// set SMESH.GeometryType instead of a numerical Threshold
|
||||||
const char* types[SMESH::Geom_POLYHEDRA+1] = {
|
const char* types[SMESH::Geom_POLYHEDRA+1] = {
|
||||||
"Geom_POINT", "Geom_EDGE", "Geom_TRIANGLE", "Geom_QUADRANGLE", "Geom_POLYGON",
|
"Geom_POINT", "Geom_EDGE", "Geom_TRIANGLE", "Geom_QUADRANGLE", "Geom_POLYGON",
|
||||||
"Geom_TETRA", "Geom_PYRAMID", "Geom_HEXA", "Geom_PENTA", "Geom_POLYHEDRA"
|
"Geom_TETRA", "Geom_PYRAMID", "Geom_HEXA", "Geom_PENTA", "Geom_HEXAGONAL_PRISM",
|
||||||
|
"Geom_POLYHEDRA"
|
||||||
};
|
};
|
||||||
int iGeom = Threshold.IntegerValue();
|
int iGeom = Threshold.IntegerValue();
|
||||||
if ( -1 < iGeom && iGeom < SMESH::Geom_POLYHEDRA+1 )
|
if ( -1 < iGeom && iGeom < SMESH::Geom_POLYHEDRA+1 )
|
||||||
@ -824,7 +832,19 @@ Handle(_pyObject) _pyGen::FindObject( const _pyID& theObjID ) const
|
|||||||
std::map< _pyID, Handle(_pyObject) >::const_iterator id_obj = myObjects.find( theObjID );
|
std::map< _pyID, Handle(_pyObject) >::const_iterator id_obj = myObjects.find( theObjID );
|
||||||
return ( id_obj == myObjects.end() ) ? Handle(_pyObject)() : id_obj->second;
|
return ( id_obj == myObjects.end() ) ? Handle(_pyObject)() : id_obj->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns true if an object is removed from study
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
bool _pyGen::IsDead(const _pyID& theObjID) const
|
||||||
|
{
|
||||||
|
const bool hasStudyName = myObjectNames.IsBound( theObjID );
|
||||||
|
return !hasStudyName;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Find out type of geom group
|
* \brief Find out type of geom group
|
||||||
@ -1190,7 +1210,7 @@ void _pyMesh::Flush()
|
|||||||
// try to convert
|
// try to convert
|
||||||
if ( algo->Addition2Creation( addCmd, this->GetID() )) // OK
|
if ( algo->Addition2Creation( addCmd, this->GetID() )) // OK
|
||||||
{
|
{
|
||||||
// wrapped algo is created atfer mesh creation
|
// wrapped algo is created after mesh creation
|
||||||
GetCreationCmd()->AddDependantCmd( addCmd );
|
GetCreationCmd()->AddDependantCmd( addCmd );
|
||||||
|
|
||||||
if ( isLocalAlgo ) {
|
if ( isLocalAlgo ) {
|
||||||
@ -1683,6 +1703,24 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
return algo->IsValid() ? algo : hyp;
|
return algo->IsValid() ? algo : hyp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns true if addition of this hypothesis to a given mesh can be
|
||||||
|
* wrapped into hypothesis creation
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
bool _pyHypothesis::IsWrappable(const _pyID& theMesh) const
|
||||||
|
{
|
||||||
|
if ( !myIsWrapped && myMesh == theMesh && !IsRemovedFromStudy() )
|
||||||
|
{
|
||||||
|
Handle(_pyObject) pyMesh = theGen->FindObject( myMesh );
|
||||||
|
if ( !pyMesh.IsNull() && !pyMesh->IsRemovedFromStudy() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert the command adding a hypothesis to mesh into a smesh command
|
* \brief Convert the command adding a hypothesis to mesh into a smesh command
|
||||||
@ -1889,7 +1927,7 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
|
|
||||||
if( theCommand->GetMethod() == "SetLength" )
|
if( theCommand->GetMethod() == "SetLength" )
|
||||||
{
|
{
|
||||||
// NOW it becomes OBSOLETE
|
// NOW it is OBSOLETE
|
||||||
// ex: hyp.SetLength(start, 1)
|
// ex: hyp.SetLength(start, 1)
|
||||||
// hyp.SetLength(end, 0)
|
// hyp.SetLength(end, 0)
|
||||||
ASSERT(( theCommand->GetArg( 2 ).IsIntegerValue() ));
|
ASSERT(( theCommand->GetArg( 2 ).IsIntegerValue() ));
|
||||||
@ -2726,6 +2764,19 @@ bool _pyCommand::AddAccessorMethod( _pyID theObjectID, const char* theAcsMethod
|
|||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Creates pyObject
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
_pyObject::_pyObject(const Handle(_pyCommand)& theCreationCmd)
|
||||||
|
: myCreationCmd(theCreationCmd), myNbCalls(0), myIsRemoved(false)
|
||||||
|
{
|
||||||
|
if ( !theCreationCmd.IsNull() && !theCreationCmd->IsEmpty() )
|
||||||
|
myIsRemoved = theGen->IsDead( theCreationCmd->GetResultValue() );
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return method name giving access to an interaface object wrapped by python class
|
* \brief Return method name giving access to an interaface object wrapped by python class
|
||||||
|
@ -154,15 +154,19 @@ class _pyObject: public Standard_Transient
|
|||||||
{
|
{
|
||||||
Handle(_pyCommand) myCreationCmd;
|
Handle(_pyCommand) myCreationCmd;
|
||||||
int myNbCalls;
|
int myNbCalls;
|
||||||
|
bool myIsRemoved, myIsProtected;
|
||||||
|
std::list< Handle(_pyCommand) > myProcessedCmds;
|
||||||
public:
|
public:
|
||||||
_pyObject(const Handle(_pyCommand)& theCreationCmd)
|
_pyObject(const Handle(_pyCommand)& theCreationCmd);
|
||||||
: myCreationCmd(theCreationCmd), myNbCalls(0) {}
|
|
||||||
const _pyID& GetID() { return myCreationCmd->GetResultValue(); }
|
const _pyID& GetID() { return myCreationCmd->GetResultValue(); }
|
||||||
static _pyID FatherID(const _pyID & childID);
|
static _pyID FatherID(const _pyID & childID);
|
||||||
const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
|
const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
|
||||||
int GetNbCalls() const { return myNbCalls; }
|
int GetNbCalls() const { return myNbCalls; }
|
||||||
|
bool IsRemovedFromStudy() const { return myIsRemoved; }
|
||||||
void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
|
void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
|
||||||
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
|
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
|
||||||
|
void AddProcessedCmd( const Handle(_pyCommand) & cmd )
|
||||||
|
{ if ( !cmd.IsNull() ) myProcessedCmds.push_back( cmd ); }
|
||||||
virtual void Process(const Handle(_pyCommand) & theCommand) { myNbCalls++; }
|
virtual void Process(const Handle(_pyCommand) & theCommand) { myNbCalls++; }
|
||||||
virtual void Flush() = 0;
|
virtual void Flush() = 0;
|
||||||
virtual const char* AccessorMethod() const;
|
virtual const char* AccessorMethod() const;
|
||||||
@ -200,6 +204,7 @@ public:
|
|||||||
_pyID GenerateNewID( const _pyID& theID );
|
_pyID GenerateNewID( const _pyID& theID );
|
||||||
void AddObject( Handle(_pyObject)& theObj );
|
void AddObject( Handle(_pyObject)& theObj );
|
||||||
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
||||||
|
bool IsDead(const _pyID& theObjID) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setNeighbourCommand( Handle(_pyCommand)& theCmd,
|
void setNeighbourCommand( Handle(_pyCommand)& theCmd,
|
||||||
@ -319,7 +324,7 @@ public:
|
|||||||
{ return myType2CreationMethod.find( algoType ) != myType2CreationMethod.end(); }
|
{ return myType2CreationMethod.find( algoType ) != myType2CreationMethod.end(); }
|
||||||
const TCollection_AsciiString& GetCreationMethod(const TCollection_AsciiString& algoType) const
|
const TCollection_AsciiString& GetCreationMethod(const TCollection_AsciiString& algoType) const
|
||||||
{ return myType2CreationMethod.find( algoType )->second; }
|
{ return myType2CreationMethod.find( algoType )->second; }
|
||||||
virtual bool IsWrappable(const _pyID& theMesh) { return !myIsWrapped && myMesh == theMesh; }
|
virtual bool IsWrappable(const _pyID& theMesh) const;
|
||||||
virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
|
virtual bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd,
|
||||||
const _pyID& theMesh);
|
const _pyID& theMesh);
|
||||||
static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
|
static Handle(_pyHypothesis) NewHypothesis( const Handle(_pyCommand)& theCreationCmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user