mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 10:10:33 +05:00
PythonDump for SMESH Controls / Filter
This commit is contained in:
parent
108ee5d360
commit
83630f8314
@ -33,6 +33,8 @@
|
||||
|
||||
module SMESH
|
||||
{
|
||||
interface Predicate;
|
||||
|
||||
/*!
|
||||
* SMESH_Group: base interface of group object
|
||||
*/
|
||||
@ -98,11 +100,13 @@ module SMESH
|
||||
* Adds elements to the group
|
||||
*/
|
||||
long Add( in long_array elem_ids );
|
||||
long AddByPredicate( in Predicate thePredicate );
|
||||
|
||||
/*!
|
||||
* Removes elements from the group
|
||||
*/
|
||||
long Remove( in long_array elem_ids );
|
||||
long RemoveByPredicate( in Predicate thePredicate );
|
||||
|
||||
};
|
||||
/*!
|
||||
|
@ -81,7 +81,7 @@ namespace{
|
||||
return aDist;
|
||||
}
|
||||
|
||||
int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
|
||||
int getNbMultiConnection( const SMDS_Mesh* theMesh, const int theId )
|
||||
{
|
||||
if ( theMesh == 0 )
|
||||
return 0;
|
||||
@ -137,7 +137,7 @@ NumericalFunctor::NumericalFunctor():
|
||||
myPrecision = -1;
|
||||
}
|
||||
|
||||
void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
|
||||
void NumericalFunctor::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1030,7 +1030,6 @@ double MultiConnection2D::GetValue( long theElementId )
|
||||
int aResult = 0;
|
||||
|
||||
if (GetPoints(theElementId,P)){
|
||||
double aVal;
|
||||
const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
|
||||
SMDSAbs_ElementType aType = anFaceElem->GetType();
|
||||
|
||||
@ -1112,7 +1111,6 @@ void MultiConnection2D::GetValues(MValues& theValues){
|
||||
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
|
||||
for(; anIter->more(); ){
|
||||
const SMDS_MeshFace* anElem = anIter->next();
|
||||
long anElemId = anElem->GetID();
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
long aNodeId[3];
|
||||
|
||||
@ -1172,7 +1170,7 @@ BadOrientedVolume::BadOrientedVolume()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void BadOrientedVolume::SetMesh( SMDS_Mesh* theMesh )
|
||||
void BadOrientedVolume::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1203,7 +1201,7 @@ FreeBorders::FreeBorders()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void FreeBorders::SetMesh( SMDS_Mesh* theMesh )
|
||||
void FreeBorders::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1228,7 +1226,7 @@ FreeEdges::FreeEdges()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void FreeEdges::SetMesh( SMDS_Mesh* theMesh )
|
||||
void FreeEdges::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1375,7 +1373,7 @@ RangeOfIds::RangeOfIds()
|
||||
// name : SetMesh
|
||||
// Purpose : Set mesh
|
||||
//=======================================================================
|
||||
void RangeOfIds::SetMesh( SMDS_Mesh* theMesh )
|
||||
void RangeOfIds::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1577,7 +1575,7 @@ Comparator::Comparator():
|
||||
Comparator::~Comparator()
|
||||
{}
|
||||
|
||||
void Comparator::SetMesh( SMDS_Mesh* theMesh )
|
||||
void Comparator::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myFunctor )
|
||||
myFunctor->SetMesh( theMesh );
|
||||
@ -1662,7 +1660,7 @@ bool LogicalNOT::IsSatisfy( long theId )
|
||||
return myPredicate && !myPredicate->IsSatisfy( theId );
|
||||
}
|
||||
|
||||
void LogicalNOT::SetMesh( SMDS_Mesh* theMesh )
|
||||
void LogicalNOT::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myPredicate )
|
||||
myPredicate->SetMesh( theMesh );
|
||||
@ -1689,7 +1687,7 @@ LogicalBinary::LogicalBinary()
|
||||
LogicalBinary::~LogicalBinary()
|
||||
{}
|
||||
|
||||
void LogicalBinary::SetMesh( SMDS_Mesh* theMesh )
|
||||
void LogicalBinary::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myPredicate1 )
|
||||
myPredicate1->SetMesh( theMesh );
|
||||
@ -1763,11 +1761,10 @@ void Filter::SetPredicate( PredicatePtr thePredicate )
|
||||
myPredicate = thePredicate;
|
||||
}
|
||||
|
||||
|
||||
template<class TElement, class TIterator, class TPredicate>
|
||||
void FillSequence(const TIterator& theIterator,
|
||||
TPredicate& thePredicate,
|
||||
Filter::TIdSequence& theSequence)
|
||||
inline void FillSequence(const TIterator& theIterator,
|
||||
TPredicate& thePredicate,
|
||||
Filter::TIdSequence& theSequence)
|
||||
{
|
||||
if ( theIterator ) {
|
||||
while( theIterator->more() ) {
|
||||
@ -1779,40 +1776,46 @@ void FillSequence(const TIterator& theIterator,
|
||||
}
|
||||
}
|
||||
|
||||
Filter::TIdSequence
|
||||
Filter::GetElementsId( SMDS_Mesh* theMesh )
|
||||
void
|
||||
Filter::
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
PredicatePtr thePredicate,
|
||||
TIdSequence& theSequence )
|
||||
{
|
||||
TIdSequence aSequence;
|
||||
if ( !theMesh || !myPredicate ) return aSequence;
|
||||
theSequence.clear();
|
||||
|
||||
myPredicate->SetMesh( theMesh );
|
||||
if ( !theMesh || !thePredicate )
|
||||
return;
|
||||
|
||||
SMDSAbs_ElementType aType = myPredicate->GetType();
|
||||
thePredicate->SetMesh( theMesh );
|
||||
|
||||
SMDSAbs_ElementType aType = thePredicate->GetType();
|
||||
switch(aType){
|
||||
case SMDSAbs_Node:{
|
||||
FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),myPredicate,aSequence);
|
||||
case SMDSAbs_Node:
|
||||
FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Edge:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Face:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Volume:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_All:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Edge:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Face:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Volume:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_All:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return aSequence;
|
||||
}
|
||||
|
||||
void
|
||||
Filter::GetElementsId( const SMDS_Mesh* theMesh,
|
||||
Filter::TIdSequence& theSequence )
|
||||
{
|
||||
GetElementsId(theMesh,myPredicate,theSequence);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1876,7 +1879,7 @@ ManifoldPart::~ManifoldPart()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void ManifoldPart::SetMesh( SMDS_Mesh* theMesh )
|
||||
void ManifoldPart::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
process();
|
||||
@ -2205,7 +2208,7 @@ ElementsOnSurface::~ElementsOnSurface()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void ElementsOnSurface::SetMesh( SMDS_Mesh* theMesh )
|
||||
void ElementsOnSurface::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myMesh == theMesh )
|
||||
return;
|
||||
|
@ -97,14 +97,14 @@ namespace SMESH{
|
||||
{
|
||||
public:
|
||||
~Functor(){}
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
};
|
||||
|
||||
class NumericalFunctor: public virtual Functor{
|
||||
public:
|
||||
NumericalFunctor();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual double GetValue( long theElementId );
|
||||
virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
@ -117,7 +117,7 @@ namespace SMESH{
|
||||
static bool GetPoints(const SMDS_MeshElement* theElem,
|
||||
TSequenceOfXYZ& theRes);
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
long myPrecision;
|
||||
};
|
||||
|
||||
@ -295,12 +295,12 @@ namespace SMESH{
|
||||
class FreeBorders: public virtual Predicate{
|
||||
public:
|
||||
FreeBorders();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
@ -311,12 +311,12 @@ namespace SMESH{
|
||||
class BadOrientedVolume: public virtual Predicate{
|
||||
public:
|
||||
BadOrientedVolume();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
@ -327,7 +327,7 @@ namespace SMESH{
|
||||
class FreeEdges: public virtual Predicate{
|
||||
public:
|
||||
FreeEdges();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
|
||||
@ -342,7 +342,7 @@ namespace SMESH{
|
||||
void GetBoreders(TBorders& theBorders);
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
|
||||
|
||||
@ -359,7 +359,7 @@ namespace SMESH{
|
||||
{
|
||||
public:
|
||||
RangeOfIds();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theNodeId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
virtual void SetType( SMDSAbs_ElementType theType );
|
||||
@ -369,7 +369,7 @@ namespace SMESH{
|
||||
bool SetRangeStr( const TCollection_AsciiString& );
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
|
||||
TColStd_SequenceOfInteger myMin;
|
||||
TColStd_SequenceOfInteger myMax;
|
||||
@ -389,7 +389,7 @@ namespace SMESH{
|
||||
public:
|
||||
Comparator();
|
||||
virtual ~Comparator();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetMargin(double theValue);
|
||||
virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
|
||||
virtual bool IsSatisfy( long theElementId ) = 0;
|
||||
@ -449,7 +449,7 @@ namespace SMESH{
|
||||
LogicalNOT();
|
||||
virtual ~LogicalNOT();
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetPredicate(PredicatePtr thePred);
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
@ -467,7 +467,7 @@ namespace SMESH{
|
||||
public:
|
||||
LogicalBinary();
|
||||
virtual ~LogicalBinary();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetPredicate1(PredicatePtr thePred);
|
||||
virtual void SetPredicate2(PredicatePtr thePred);
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
@ -532,7 +532,7 @@ namespace SMESH{
|
||||
|
||||
ManifoldPart();
|
||||
~ManifoldPart();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
// inoke when all parameters already set
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
@ -560,7 +560,7 @@ namespace SMESH{
|
||||
TVectorOfFacePtr& theFaces ) const;
|
||||
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
TColStd_MapOfInteger myMapIds;
|
||||
TColStd_MapOfInteger myMapBadGeomIds;
|
||||
TVectorOfFacePtr myAllFacePtr;
|
||||
@ -582,7 +582,7 @@ namespace SMESH{
|
||||
public:
|
||||
ElementsOnSurface();
|
||||
~ElementsOnSurface();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
@ -597,7 +597,7 @@ namespace SMESH{
|
||||
bool isOnSurface( const SMDS_MeshNode* theNode ) const;
|
||||
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
TColStd_MapOfInteger myIds;
|
||||
SMDSAbs_ElementType myType;
|
||||
Handle(Geom_Surface) mySurf;
|
||||
@ -615,9 +615,20 @@ namespace SMESH{
|
||||
Filter();
|
||||
virtual ~Filter();
|
||||
virtual void SetPredicate(PredicatePtr thePred);
|
||||
|
||||
typedef std::vector<long> TIdSequence;
|
||||
virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
|
||||
|
||||
|
||||
virtual
|
||||
void
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
TIdSequence& theSequence );
|
||||
|
||||
static
|
||||
void
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
PredicatePtr thePredicate,
|
||||
TIdSequence& theSequence );
|
||||
|
||||
protected:
|
||||
PredicatePtr myPredicate;
|
||||
};
|
||||
|
@ -876,13 +876,14 @@ bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
|
||||
/// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
|
||||
/// TopoDS_Shape is unknown
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
|
||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
|
||||
{
|
||||
if (myShape.IsNull()) MESSAGE("myShape is NULL");
|
||||
|
||||
int Index = ShapeToIndex(S);
|
||||
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
|
||||
return myShapeIndexToSubMesh[Index];
|
||||
TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);
|
||||
if (anIter != myShapeIndexToSubMesh.end())
|
||||
return anIter->second;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -1033,7 +1034,7 @@ TopoDS_Shape SMESHDS_Mesh::IndexToShape(int ShapeIndex)
|
||||
//function : ShapeToIndex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
|
||||
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
|
||||
{
|
||||
if (myShape.IsNull())
|
||||
MESSAGE("myShape is NULL");
|
||||
|
@ -204,7 +204,7 @@ public:
|
||||
const TopoDS_Shape & S);
|
||||
TopoDS_Shape ShapeToMesh() const;
|
||||
bool HasMeshElements(const TopoDS_Shape & S);
|
||||
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
|
||||
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
|
||||
SMESHDS_SubMesh * MeshElements(const int Index);
|
||||
std::list<int> SubMeshIndices();
|
||||
const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
|
||||
@ -214,7 +214,7 @@ public:
|
||||
const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
|
||||
SMESHDS_Script * GetScript();
|
||||
void ClearScript();
|
||||
int ShapeToIndex(const TopoDS_Shape & aShape);
|
||||
int ShapeToIndex(const TopoDS_Shape & aShape) const;
|
||||
TopoDS_Shape IndexToShape(int ShapeIndex);
|
||||
|
||||
SMESHDS_SubMesh * NewSubMesh(int Index);
|
||||
@ -246,9 +246,15 @@ private:
|
||||
|
||||
int myMeshID;
|
||||
TopoDS_Shape myShape;
|
||||
|
||||
typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
|
||||
TShapeIndexToSubMesh myShapeIndexToSubMesh;
|
||||
|
||||
TopTools_IndexedMapOfShape myIndexToShape;
|
||||
std::map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
|
||||
std::set<SMESHDS_GroupBase*> myGroups;
|
||||
|
||||
typedef std::set<SMESHDS_GroupBase*> TGroups;
|
||||
TGroups myGroups;
|
||||
|
||||
SMESHDS_Script* myScript;
|
||||
};
|
||||
|
||||
|
@ -56,7 +56,7 @@ LIB= libSMESHEngine.la
|
||||
LIB_SRC = \
|
||||
SMESH_Gen_i.cxx \
|
||||
SMESH_Gen_i_1.cxx \
|
||||
SMESH_Gen_i_DumpPython.cxx \
|
||||
SMESH_DumpPython.cxx \
|
||||
SMESH_Mesh_i.cxx \
|
||||
SMESH_MEDMesh_i.cxx \
|
||||
SMESH_MEDFamily_i.cxx \
|
||||
|
@ -4,10 +4,184 @@
|
||||
// Module : SMESH
|
||||
// $Header : $
|
||||
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_Filter_i.hxx"
|
||||
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString, const char* theArg){
|
||||
theString += Standard_CString(theArg);
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString, int theArg){
|
||||
theString += TCollection_AsciiString(theArg);
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString, float theArg){
|
||||
theString += TCollection_AsciiString(theArg);
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
const SMESH::long_array& theArg)
|
||||
{
|
||||
theString<<"[ ";
|
||||
CORBA::Long i = 1, iEnd = theArg.length();
|
||||
for(; i <= iEnd; i++) {
|
||||
theString<<int(theArg[i-1]);
|
||||
if(i < iEnd)
|
||||
theString<< ", ";
|
||||
}
|
||||
theString<<" ]";
|
||||
return theString;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
CORBA::Object_ptr theArg)
|
||||
{
|
||||
CORBA::String_var aString("None");
|
||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
|
||||
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
|
||||
if(!aSObject->_is_nil()){
|
||||
aString = aSObject->GetID();
|
||||
}else if(!CORBA::is_nil(theArg)){
|
||||
aString = SMESH_Gen_i::GetORB()->object_to_string(theArg);
|
||||
}
|
||||
theString<<aString.in();
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::FilterLibrary_i* theArg)
|
||||
{
|
||||
theString += TCollection_AsciiString("aFilterLibrary_");
|
||||
theString += TCollection_AsciiString(int(theArg));
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::FilterManager_i* theArg)
|
||||
{
|
||||
theString += TCollection_AsciiString("aFilterManager_");
|
||||
theString += TCollection_AsciiString(int(theArg));
|
||||
return theString;
|
||||
}
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::Functor_i* theArg)
|
||||
{
|
||||
FunctorType aFunctorType = theArg->GetFunctorType();
|
||||
switch(aFunctorType){
|
||||
case FT_AspectRatio:
|
||||
theString += TCollection_AsciiString("anAspectRatio");
|
||||
break;
|
||||
case FT_AspectRatio3D:
|
||||
theString += TCollection_AsciiString("anAspectRatio3D");
|
||||
break;
|
||||
case FT_Warping:
|
||||
theString += TCollection_AsciiString("aWarping");
|
||||
break;
|
||||
case FT_MinimumAngle:
|
||||
theString += TCollection_AsciiString("aMinimumAngle");
|
||||
break;
|
||||
case FT_Taper:
|
||||
theString += TCollection_AsciiString("aTaper");
|
||||
break;
|
||||
case FT_Skew:
|
||||
theString += TCollection_AsciiString("aSkew");
|
||||
break;
|
||||
case FT_Area:
|
||||
theString += TCollection_AsciiString("aArea");
|
||||
break;
|
||||
case FT_FreeBorders:
|
||||
theString += TCollection_AsciiString("aFreeBorders");
|
||||
break;
|
||||
case FT_FreeEdges:
|
||||
theString += TCollection_AsciiString("aFreeEdges");
|
||||
break;
|
||||
case FT_MultiConnection:
|
||||
theString += TCollection_AsciiString("aMultiConnection");
|
||||
break;
|
||||
case FT_MultiConnection2D:
|
||||
theString += TCollection_AsciiString("aMultiConnection2D");
|
||||
break;
|
||||
case FT_Length:
|
||||
theString += TCollection_AsciiString("aLength");
|
||||
break;
|
||||
case FT_Length2D:
|
||||
theString += TCollection_AsciiString("aLength");
|
||||
break;
|
||||
case FT_BelongToGeom:
|
||||
theString += TCollection_AsciiString("aBelongToGeom");
|
||||
break;
|
||||
case FT_BelongToPlane:
|
||||
theString += TCollection_AsciiString("aBelongToPlane");
|
||||
break;
|
||||
case FT_BelongToCylinder:
|
||||
theString += TCollection_AsciiString("aBelongToCylinder");
|
||||
break;
|
||||
case FT_LyingOnGeom:
|
||||
theString += TCollection_AsciiString("aLyingOnGeom");
|
||||
break;
|
||||
case FT_RangeOfIds:
|
||||
theString += TCollection_AsciiString("aRangeOfIds");
|
||||
break;
|
||||
case FT_BadOrientedVolume:
|
||||
theString += TCollection_AsciiString("aBadOrientedVolume");
|
||||
break;
|
||||
case FT_LessThan:
|
||||
theString += TCollection_AsciiString("aLessThan");
|
||||
break;
|
||||
case FT_MoreThan:
|
||||
theString += TCollection_AsciiString("aMoreThan");
|
||||
break;
|
||||
case FT_EqualTo:
|
||||
theString += TCollection_AsciiString("anEqualTo");
|
||||
break;
|
||||
case FT_LogicalNOT:
|
||||
theString += TCollection_AsciiString("aLogicalNOT");
|
||||
break;
|
||||
case FT_LogicalAND:
|
||||
theString += TCollection_AsciiString("aLogicalAND");
|
||||
break;
|
||||
case FT_LogicalOR:
|
||||
theString += TCollection_AsciiString("aLogicalOR");
|
||||
break;
|
||||
case FT_Undefined:
|
||||
theString += TCollection_AsciiString("anUndefined");
|
||||
break;
|
||||
}
|
||||
theString += Standard_CString("_");
|
||||
theString += TCollection_AsciiString(int(theArg));
|
||||
return theString;
|
||||
}
|
||||
|
||||
TPythonDump::
|
||||
~TPythonDump()
|
||||
{
|
||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
|
||||
if(!aStudy->_is_nil()){
|
||||
aSMESHGen->AddToPythonScript(aStudy->StudyId(),myString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpPython
|
||||
//purpose :
|
@ -29,6 +29,7 @@
|
||||
#include "SMESH_Filter_i.hxx"
|
||||
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
@ -63,6 +64,18 @@
|
||||
using namespace SMESH;
|
||||
using namespace SMESH::Controls;
|
||||
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
Predicate_i*
|
||||
GetPredicate( Predicate_ptr thePredicate )
|
||||
{
|
||||
PortableServer::ServantBase_var aServant = SMESH_Gen_i::GetServant( thePredicate );
|
||||
return dynamic_cast<Predicate_i*>(aServant.in());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Class : BelongToGeom
|
||||
Description : Predicate for verifying whether entiy belong to
|
||||
@ -74,9 +87,9 @@ Controls::BelongToGeom::BelongToGeom()
|
||||
myType(SMDSAbs_All)
|
||||
{}
|
||||
|
||||
void Controls::BelongToGeom::SetMesh( SMDS_Mesh* theMesh )
|
||||
void Controls::BelongToGeom::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
|
||||
myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
|
||||
}
|
||||
|
||||
void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
|
||||
@ -84,7 +97,7 @@ void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
|
||||
myShape = theShape;
|
||||
}
|
||||
|
||||
static bool IsContains( SMESHDS_Mesh* theMeshDS,
|
||||
static bool IsContains( const SMESHDS_Mesh* theMeshDS,
|
||||
const TopoDS_Shape& theShape,
|
||||
const SMDS_MeshElement* theElem,
|
||||
TopAbs_ShapeEnum theFindShapeEnum,
|
||||
@ -166,7 +179,9 @@ TopoDS_Shape Controls::BelongToGeom::GetShape()
|
||||
return myShape;
|
||||
}
|
||||
|
||||
SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS()
|
||||
const SMESHDS_Mesh*
|
||||
Controls::BelongToGeom::
|
||||
GetMeshDS() const
|
||||
{
|
||||
return myMeshDS;
|
||||
}
|
||||
@ -182,9 +197,9 @@ Controls::LyingOnGeom::LyingOnGeom()
|
||||
myType(SMDSAbs_All)
|
||||
{}
|
||||
|
||||
void Controls::LyingOnGeom::SetMesh( SMDS_Mesh* theMesh )
|
||||
void Controls::LyingOnGeom::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
|
||||
myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
|
||||
}
|
||||
|
||||
void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape )
|
||||
@ -254,12 +269,14 @@ TopoDS_Shape Controls::LyingOnGeom::GetShape()
|
||||
return myShape;
|
||||
}
|
||||
|
||||
SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS()
|
||||
const SMESHDS_Mesh*
|
||||
Controls::LyingOnGeom::
|
||||
GetMeshDS() const
|
||||
{
|
||||
return myMeshDS;
|
||||
}
|
||||
|
||||
bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS,
|
||||
bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS,
|
||||
const TopoDS_Shape& theShape,
|
||||
const SMDS_MeshElement* theElem,
|
||||
TopAbs_ShapeEnum theFindShapeEnum,
|
||||
@ -301,14 +318,18 @@ bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS,
|
||||
AUXILIARY METHODS
|
||||
*/
|
||||
|
||||
static inline SMDS_Mesh* MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
|
||||
inline
|
||||
const SMDS_Mesh*
|
||||
MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
|
||||
{
|
||||
SMESH_Mesh_i* anImplPtr =
|
||||
dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
|
||||
return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
|
||||
}
|
||||
|
||||
static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList )
|
||||
inline
|
||||
SMESH::long_array*
|
||||
toArray( const TColStd_ListOfInteger& aList )
|
||||
{
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
anArray->length( aList.Extent() );
|
||||
@ -320,7 +341,9 @@ static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList )
|
||||
return anArray._retn();
|
||||
}
|
||||
|
||||
static inline SMESH::double_array* toArray( const TColStd_ListOfReal& aList )
|
||||
inline
|
||||
SMESH::double_array*
|
||||
toArray( const TColStd_ListOfReal& aList )
|
||||
{
|
||||
SMESH::double_array_var anArray = new SMESH::double_array;
|
||||
anArray->length( aList.Extent() );
|
||||
@ -1005,6 +1028,7 @@ Comparator_i::~Comparator_i()
|
||||
void Comparator_i::SetMargin( CORBA::Double theValue )
|
||||
{
|
||||
myComparatorPtr->SetMargin( theValue );
|
||||
TPythonDump()<<this<<".SetMargin("<<float(theValue)<<")";
|
||||
}
|
||||
|
||||
CORBA::Double Comparator_i::GetMargin()
|
||||
@ -1023,6 +1047,7 @@ void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
|
||||
{
|
||||
myComparatorPtr->SetNumFunctor( myNumericalFunctor->GetNumericalFunctor() );
|
||||
myNumericalFunctor->Register();
|
||||
TPythonDump()<<this<<".SetNumFunctor("<<myNumericalFunctor<<")";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1111,12 +1136,12 @@ LogicalNOT_i::~LogicalNOT_i()
|
||||
myPredicate->Destroy();
|
||||
}
|
||||
|
||||
void LogicalNOT_i::SetPredicate( Predicate_ptr thePred )
|
||||
void LogicalNOT_i::SetPredicate( Predicate_ptr thePredicate )
|
||||
{
|
||||
if ( myPredicate )
|
||||
myPredicate->Destroy();
|
||||
|
||||
myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePred ).in() );
|
||||
myPredicate = SMESH::GetPredicate(thePredicate);
|
||||
|
||||
if ( myPredicate ){
|
||||
myLogicalNOTPtr->SetPredicate(myPredicate->GetPredicate());
|
||||
@ -1167,7 +1192,7 @@ void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
|
||||
if ( myPredicate1 )
|
||||
myPredicate1->Destroy();
|
||||
|
||||
myPredicate1 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
|
||||
myPredicate1 = SMESH::GetPredicate(thePredicate);
|
||||
|
||||
if ( myPredicate1 ){
|
||||
myLogicalBinaryPtr->SetPredicate1(myPredicate1->GetPredicate());
|
||||
@ -1180,7 +1205,7 @@ void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
|
||||
if ( myPredicate2 )
|
||||
myPredicate2->Destroy();
|
||||
|
||||
myPredicate2 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
|
||||
myPredicate2 = SMESH::GetPredicate(thePredicate);
|
||||
|
||||
if ( myPredicate2 ){
|
||||
myLogicalBinaryPtr->SetPredicate2(myPredicate2->GetPredicate());
|
||||
@ -1297,6 +1322,7 @@ Area_ptr FilterManager_i::CreateArea()
|
||||
{
|
||||
SMESH::Area_i* aServant = new SMESH::Area_i();
|
||||
SMESH::Area_var anObj = aServant->_this();
|
||||
TPythonDump()<<aServant<<" = "<<this<<".CreateArea()";
|
||||
return anObj._retn();
|
||||
}
|
||||
|
||||
@ -1397,6 +1423,7 @@ MoreThan_ptr FilterManager_i::CreateMoreThan()
|
||||
{
|
||||
SMESH::MoreThan_i* aServant = new SMESH::MoreThan_i();
|
||||
SMESH::MoreThan_var anObj = aServant->_this();
|
||||
TPythonDump()<<aServant<<" = "<<this<<".CreateMoreThan()";
|
||||
return anObj._retn();
|
||||
}
|
||||
|
||||
@ -1469,6 +1496,7 @@ SMESH::FilterManager_ptr SMESH_Gen_i::CreateFilterManager()
|
||||
{
|
||||
SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
|
||||
SMESH::FilterManager_var anObj = aFilter->_this();
|
||||
TPythonDump()<<aFilter<<" = smesh.CreateFilterManager()";
|
||||
return anObj._retn();
|
||||
}
|
||||
|
||||
@ -1504,7 +1532,7 @@ void Filter_i::SetPredicate( Predicate_ptr thePredicate )
|
||||
if ( myPredicate )
|
||||
myPredicate->Destroy();
|
||||
|
||||
myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
|
||||
myPredicate = SMESH::GetPredicate(thePredicate);
|
||||
|
||||
if ( myPredicate )
|
||||
{
|
||||
@ -1536,10 +1564,29 @@ void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
|
||||
// name : Filter_i::GetElementsId
|
||||
// Purpose : Get ids of entities
|
||||
//=======================================================================
|
||||
void
|
||||
Filter_i::
|
||||
GetElementsId( Predicate_i* thePredicate,
|
||||
const SMDS_Mesh* theMesh,
|
||||
Controls::Filter::TIdSequence& theSequence )
|
||||
{
|
||||
Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
|
||||
}
|
||||
|
||||
void
|
||||
Filter_i::
|
||||
GetElementsId( Predicate_i* thePredicate,
|
||||
SMESH_Mesh_ptr theMesh,
|
||||
Controls::Filter::TIdSequence& theSequence )
|
||||
{
|
||||
if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
|
||||
Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
|
||||
}
|
||||
|
||||
SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh )
|
||||
{
|
||||
SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh);
|
||||
Controls::Filter::TIdSequence aSequence = myFilter.GetElementsId(aMesh);
|
||||
Controls::Filter::TIdSequence aSequence;
|
||||
GetElementsId(myPredicate,theMesh,aSequence);
|
||||
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
long i = 0, iEnd = aSequence.size();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,8 +33,14 @@
|
||||
#include "SMESHDS_Group.hxx"
|
||||
#include "SMESHDS_GroupOnGeom.hxx"
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
|
||||
#include "SMESH_Filter_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace SMESH;
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
@ -270,6 +276,86 @@ CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
|
||||
{
|
||||
// Update Python script
|
||||
TCollection_AsciiString aStr ("nbDel = ");
|
||||
SMESH_Gen_i::AddObject(aStr, _this()) += ".Remove(";
|
||||
SMESH_Gen_i::AddArray(aStr, theIDs) += ")";
|
||||
|
||||
SMESH_Gen_i::AddToCurrentPyScript(aStr);
|
||||
|
||||
// Remove elements from the group
|
||||
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
||||
if (aGroupDS) {
|
||||
int nbDel = 0;
|
||||
for (int i = 0; i < theIDs.length(); i++) {
|
||||
int anID = (int) theIDs[i];
|
||||
if (aGroupDS->Remove(anID))
|
||||
nbDel++;
|
||||
}
|
||||
return nbDel;
|
||||
}
|
||||
MESSAGE("attempt to remove elements from a vague group");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
typedef bool (SMESHDS_Group::*TFunChangeGroup)(const int);
|
||||
|
||||
CORBA::Long
|
||||
ChangeByPredicate( SMESH::Predicate_i* thePredicate,
|
||||
SMESHDS_GroupBase* theGroupBase,
|
||||
TFunChangeGroup theFun)
|
||||
{
|
||||
CORBA::Long aNb = 0;
|
||||
if(SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>(theGroupBase)){
|
||||
SMESH::Controls::Filter::TIdSequence aSequence;
|
||||
const SMDS_Mesh* aMesh = theGroupBase->GetMesh();
|
||||
SMESH::Filter_i::GetElementsId(thePredicate,aMesh,aSequence);
|
||||
|
||||
CORBA::Long i = 0, iEnd = aSequence.size();
|
||||
for(; i < iEnd; i++)
|
||||
if((aGroupDS->*theFun)(aSequence[i]))
|
||||
aNb++;
|
||||
return aNb;
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
CORBA::Long
|
||||
SMESH_Group_i::
|
||||
AddByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||
{
|
||||
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
||||
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
|
||||
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
CORBA::Long
|
||||
SMESH_Group_i::
|
||||
RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||
{
|
||||
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
||||
TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")";
|
||||
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_GroupBase_i::GetID( CORBA::Long theIndex )
|
||||
{
|
||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||
@ -300,36 +386,6 @@ SMESH::long_array* SMESH_GroupBase_i::GetListOfID()
|
||||
return aRes._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
|
||||
{
|
||||
// Update Python script
|
||||
TCollection_AsciiString aStr ("nbDel = ");
|
||||
SMESH_Gen_i::AddObject(aStr, _this()) += ".Remove(";
|
||||
SMESH_Gen_i::AddArray(aStr, theIDs) += ")";
|
||||
|
||||
SMESH_Gen_i::AddToCurrentPyScript(aStr);
|
||||
|
||||
// Remove elements from the group
|
||||
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
||||
if (aGroupDS) {
|
||||
int nbDel = 0;
|
||||
for (int i = 0; i < theIDs.length(); i++) {
|
||||
int anID = (int) theIDs[i];
|
||||
if (aGroupDS->Remove(anID))
|
||||
nbDel++;
|
||||
}
|
||||
return nbDel;
|
||||
}
|
||||
MESSAGE("attempt to remove elements from a vague group");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
|
@ -93,6 +93,9 @@ class SMESH_Group_i:
|
||||
void Clear();
|
||||
CORBA::Long Add( const SMESH::long_array& theIDs );
|
||||
CORBA::Long Remove( const SMESH::long_array& theIDs );
|
||||
|
||||
CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
|
||||
CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
|
||||
};
|
||||
|
||||
// =========================
|
||||
|
80
src/SMESH_I/SMESH_PythonDump.hxx
Normal file
80
src/SMESH_I/SMESH_PythonDump.hxx
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
#ifndef _SMESH_PYTHONDUMP_HXX_
|
||||
#define _SMESH_PYTHONDUMP_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
const char* theArg);
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
int theArg);
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
float theArg);
|
||||
|
||||
class FilterLibrary_i;
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::FilterLibrary_i* theArg);
|
||||
|
||||
class FilterManager_i;
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::FilterManager_i* theArg);
|
||||
|
||||
class Functor_i;
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
SMESH::Functor_i* theArg);
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
CORBA::Object_ptr theArg);
|
||||
|
||||
TCollection_AsciiString&
|
||||
operator<<(TCollection_AsciiString& theString,
|
||||
const SMESH::long_array& theArg);
|
||||
|
||||
class TPythonDump
|
||||
{
|
||||
TCollection_AsciiString myString;
|
||||
public:
|
||||
virtual ~TPythonDump();
|
||||
|
||||
template<class T>
|
||||
TCollection_AsciiString&
|
||||
operator<<(T theArg){
|
||||
return myString<<theArg;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user