mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 10:10:33 +05:00
1) avoid infinit recursion in operator<<(SMESH::SMESH_IDSource_ptr theArg)
2) 0021231: EDF 1838 SMESH: Pattern mapping on a quadratic element fix python dump of functions defining pattern in a single-file mode
This commit is contained in:
parent
67ea75a7dd
commit
d4f7fd7135
@ -229,11 +229,15 @@ namespace SMESH
|
|||||||
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
|
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
|
||||||
if(!aSObject->_is_nil() || CORBA::is_nil( theArg ))
|
if(!aSObject->_is_nil() || CORBA::is_nil( theArg ))
|
||||||
return *this << aSObject;
|
return *this << aSObject;
|
||||||
SMESH::long_array_var anElementsId = theArg->GetIDs();
|
|
||||||
SMESH::SMESH_Mesh_var mesh = theArg->GetMesh();
|
SMESH::SMESH_Mesh_var mesh = theArg->GetMesh();
|
||||||
SMESH::array_of_ElementType_var types = theArg->GetTypes();
|
if ( !theArg->_is_equivalent( mesh) )
|
||||||
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
|
{
|
||||||
return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
|
SMESH::long_array_var anElementsId = theArg->GetIDs();
|
||||||
|
SMESH::array_of_ElementType_var types = theArg->GetTypes();
|
||||||
|
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
|
||||||
|
return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPythonDump&
|
TPythonDump&
|
||||||
@ -550,9 +554,6 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
|
|||||||
aScript += DumpPython_impl(aStudy, aMap, aMapNames,
|
aScript += DumpPython_impl(aStudy, aMap, aMapNames,
|
||||||
isPublished, isMultiFile, isValidScript, aSavedTrace);
|
isPublished, isMultiFile, isValidScript, aSavedTrace);
|
||||||
|
|
||||||
if( !isMultiFile ) // remove unnecessary tabulation
|
|
||||||
RemoveTabulation( aScript );
|
|
||||||
|
|
||||||
int aLen = aScript.Length();
|
int aLen = aScript.Length();
|
||||||
unsigned char* aBuffer = new unsigned char[aLen+1];
|
unsigned char* aBuffer = new unsigned char[aLen+1];
|
||||||
strcpy((char*)aBuffer, aScript.ToCString());
|
strcpy((char*)aBuffer, aScript.ToCString());
|
||||||
@ -935,6 +936,9 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
anUpdatedScript += "\n\tpass";
|
anUpdatedScript += "\n\tpass";
|
||||||
anUpdatedScript += "\n";
|
anUpdatedScript += "\n";
|
||||||
|
|
||||||
|
if( !isMultiFile ) // remove unnecessary tabulation
|
||||||
|
RemoveTabulation( anUpdatedScript );
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// put string literals describing patterns into separate functions
|
// put string literals describing patterns into separate functions
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
@ -973,7 +977,18 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
do functionName = aFunctionType + "_" + ( nb++ ) + "()";
|
do functionName = aFunctionType + "_" + ( nb++ ) + "()";
|
||||||
while ( !functionNameSet.insert( functionName.ToCString() ).second );
|
while ( !functionNameSet.insert( functionName.ToCString() ).second );
|
||||||
|
|
||||||
anUpdatedScript += helper + "\n\ndef " + functionName + aLongString; // define function
|
// define function
|
||||||
|
TCollection_AsciiString funDef = helper + "def " + functionName + aLongString;
|
||||||
|
if ( isMultiFile )
|
||||||
|
{
|
||||||
|
anUpdatedScript += helper + "\n\n" + funDef;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
funDef += "\n\n";
|
||||||
|
anUpdatedScript.Insert( 1, funDef);
|
||||||
|
where += funDef.Length();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
anUpdatedScript.InsertBefore( where, functionName ); // call function
|
anUpdatedScript.InsertBefore( where, functionName ); // call function
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user