#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_VolumeTool.hxx"
#include "SMESHDS_GroupBase.hxx"
+#include "SMESHDS_GroupOnFilter.hxx"
#include "SMESHDS_Mesh.hxx"
-#include "SMESH_OctreeNode.hxx"
#include "SMESH_MeshAlgos.hxx"
+#include "SMESH_OctreeNode.hxx"
#include <Basics_Utils.hxx>
bool GroupColor::IsSatisfy( long theId )
{
- return (myIDs.find( theId ) != myIDs.end());
+ return myIDs.count( theId );
}
void GroupColor::SetType( SMDSAbs_ElementType theType )
void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
{
myIDs.clear();
-
+
const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
if ( !aMesh )
return;
int nbGrp = aMesh->GetNbGroups();
if ( !nbGrp )
return;
-
+
// iterates on groups and find necessary elements ids
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
- for (; GrIt != aGroups.end(); GrIt++) {
+ for (; GrIt != aGroups.end(); GrIt++)
+ {
SMESHDS_GroupBase* aGrp = (*GrIt);
if ( !aGrp )
continue;
// check type and color of group
- if ( !isEqual( myColor, aGrp->GetColor() ) )
- continue;
- if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
+ if ( !isEqual( myColor, aGrp->GetColor() ))
continue;
+ // IPAL52867 (prevent infinite recursion via GroupOnFilter)
+ if ( SMESHDS_GroupOnFilter * gof = dynamic_cast< SMESHDS_GroupOnFilter* >( aGrp ))
+ if ( gof->GetPredicate().get() == this )
+ continue;
+
SMDSAbs_ElementType aGrpElType = (SMDSAbs_ElementType)aGrp->GetType();
if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) {
// add elements IDS into control
BelongToGeom_i::~BelongToGeom_i()
{
- delete myShapeName;
- delete myShapeID;
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
}
void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
void BelongToGeom_i::SetShapeName( const char* theName )
{
- delete myShapeName;
- myShapeName = strdup( theName );
+ CORBA::string_free( myShapeName );
+ myShapeName = CORBA::string_dup( theName );
myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
}
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
{
- delete myShapeName;
- delete myShapeID;
- myShapeName = strdup( theName );
- myShapeID = strdup( theID );
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
+ myShapeName = CORBA::string_dup( theName );
+ myShapeID = CORBA::string_dup( theID );
bool hasName = ( theName && theName[0] );
bool hasID = ( theID && theID[0] );
BelongToSurface_i::~BelongToSurface_i()
{
- delete myShapeName;
- delete myShapeID;
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
}
void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
{
- delete myShapeName;
- myShapeName = strdup( theName );
+ CORBA::string_free( myShapeName );
+ myShapeName = CORBA::string_dup( theName );
myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
}
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
{
- delete myShapeName;
- delete myShapeID;
- myShapeName = strdup( theName );
- myShapeID = strdup( theID );
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
+ myShapeName = CORBA::string_dup( theName );
+ myShapeID = CORBA::string_dup( theID );
bool hasName = ( theName && theName[0] );
bool hasID = ( theID && theID[0] );
LyingOnGeom_i::~LyingOnGeom_i()
{
- delete myShapeName;
- delete myShapeID;
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
}
void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
void LyingOnGeom_i::SetShapeName( const char* theName )
{
- delete myShapeName;
- myShapeName = strdup( theName );
+ CORBA::string_free( myShapeName );
+ myShapeName = CORBA::string_dup( theName );
myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
}
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
{
- delete myShapeName;
- delete myShapeID;
- myShapeName = strdup( theName );
- myShapeID = strdup( theID );
+ CORBA::string_free( myShapeName );
+ CORBA::string_free( myShapeID );
+ myShapeName = CORBA::string_dup( theName );
+ myShapeID = CORBA::string_dup( theID );
bool hasName = ( theName && theName[0] );
- bool hasID = ( theID && theID[0] );
+ bool hasID = ( theID && theID[0] );
TopoDS_Shape S;
if ( hasName && hasID )
//=======================================================================
FilterLibrary_i::FilterLibrary_i( const char* theFileName )
{
- myFileName = strdup( theFileName );
+ myFileName = CORBA::string_dup( theFileName );
SMESH::FilterManager_i* aFilterMgr = new SMESH::FilterManager_i();
myFilterMgr = aFilterMgr->_this();
FilterLibrary_i::~FilterLibrary_i()
{
- delete myFileName;
+ CORBA::string_free( myFileName );
//TPythonDump()<<this<<".UnRegister()";
}
{
char a[ 255 ];
sprintf( a, "%d", val );
- aCriterion.ThresholdStr = strdup( a );
+ aCriterion.ThresholdStr = CORBA::string_dup( a );
}
else
aCriterion.ThresholdStr = str.GetString();
//=======================================================================
void FilterLibrary_i::SetFileName( const char* theFileName )
{
- delete myFileName;
- myFileName = strdup( theFileName );
+ CORBA::string_free( myFileName );
+ myFileName = CORBA::string_dup( theFileName );
TPythonDump()<<this<<".SetFileName('"<<theFileName<<"')";
}
#
class Pattern(SMESH._objref_SMESH_Pattern):
+ def LoadFromFile(self, patternTextOrFile ):
+ text = patternTextOrFile
+ if os.path.exists( text ):
+ text = open( patternTextOrFile ).read()
+ pass
+ return SMESH._objref_SMESH_Pattern.LoadFromFile( self, text )
+
def ApplyToMeshFaces(self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse):
decrFun = lambda i: i-1
theNodeIndexOnKeyPoint1,Parameters,hasVars = ParseParameters(theNodeIndexOnKeyPoint1, decrFun)
theMesh.SetParameters(Parameters)
return SMESH._objref_SMESH_Pattern.ApplyToHexahedrons( self, theMesh, theVolumesIDs, theNode000Index, theNode001Index )
+ def MakeMesh(self, mesh, CreatePolygons=False, CreatePolyhedra=False):
+ if isinstance( mesh, Mesh ):
+ mesh = mesh.GetMesh()
+ return SMESH._objref_SMESH_Pattern.MakeMesh( self, mesh, CreatePolygons, CreatePolyhedra )
+
# Registering the new proxy for Pattern
omniORB.registerObjref(SMESH._objref_SMESH_Pattern._NP_RepositoryId, Pattern)