-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
return TopoDS_Shape();
}
-static std::string getShapeNameByID (const char* theID)
-{
- if ( theID && strlen( theID ) > 0 ) {
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
- if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
- if ( !aSObj->_is_nil() ) {
- CORBA::String_var name = aSObj->GetName();
- return name.in();
- }
- }
- }
- return "";
-}
+// static std::string getShapeNameByID (const char* theID)
+// {
+// if ( theID && strlen( theID ) > 0 ) {
+// SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+// SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+// if ( !aStudy->_is_nil() ) {
+// SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
+// if ( !aSObj->_is_nil() ) {
+// CORBA::String_var name = aSObj->GetName();
+// return name.in();
+// }
+// }
+// }
+// return "";
+// }
/*
FUNCTORS
/*
Class : Functor_i
- Description : An abstact class for all functors
+ Description : An abstract class for all functors
*/
Functor_i::Functor_i():
SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
SMESH::Length2D::Values* Length2D_i::GetValues()
{
- INFOS("Length2D_i::GetValues");
SMESH::Controls::Length2D::TValues aValues;
(dynamic_cast<SMESH::Controls::Length2D*>(myFunctorPtr.get()))->GetValues( aValues );
aValue.myPnt2 = aVal.myPntId[ 1 ];
}
- INFOS("Length2D_i::GetValuess~");
return aResult._retn();
}
+/*
+ Class : Deflection2D_i
+ Description : Functor for calculating distance between a face and geometry
+*/
+Deflection2D_i::Deflection2D_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::Deflection2D() );
+ myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Deflection2D_i::GetFunctorType()
+{
+ return SMESH::FT_Deflection2D;
+}
+
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
return SMESH::FT_BallDiameter;
}
+/*
+ Class : NodeConnectivityNumber_i
+ Description : Functor returning diameter of a ball element
+*/
+NodeConnectivityNumber_i::NodeConnectivityNumber_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::NodeConnectivityNumber() );
+ myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType NodeConnectivityNumber_i::GetFunctorType()
+{
+ return SMESH::FT_NodeConnectivityNumber;
+}
+
/*
Class : MultiConnection2D_i
Description : Functor for calculating number of faces conneted to the edge
SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
{
- INFOS("MultiConnection2D_i::GetValues");
SMESH::Controls::MultiConnection2D::MValues aValues;
(dynamic_cast<SMESH::Controls::MultiConnection2D*>(myFunctorPtr.get()))->GetValues( aValues );
aValue.myNbConnects = (*anIter).second;
}
- INFOS("Multiconnection2D_i::GetValuess~");
return aResult._retn();
}
CORBA::Object_var obj = SMESH_Gen_i::GetORB()->string_to_object( myID.c_str() );
SetGroup( SMESH::SMESH_GroupBase::_narrow( obj ));
}
- else if ( strncmp( ":0", myID.c_str(), 2 ) == 0 ) // transient mode + GUI
+ else if ( strncmp( "0:", myID.c_str(), 2 ) == 0 ) // transient mode + GUI
{
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
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 )
SMESH::FreeEdges::Borders* FreeEdges_i::GetBorders()
{
- INFOS("FreeEdges_i::GetBorders");
SMESH::Controls::FreeEdges::TBorders aBorders;
myFreeEdgesPtr->GetBoreders( aBorders );
aBorder.myPnt1 = aBord.myPntId[ 0 ];
aBorder.myPnt2 = aBord.myPntId[ 1 ];
}
-
- INFOS("FreeEdges_i::GetBorders~");
return aResult._retn();
}
/*
Class : GroupColor_i
- Description : Functor for check color of group to whic mesh element belongs to
+ Description : Functor for check color of group to which mesh element belongs to
*/
GroupColor_i::GroupColor_i()
{
{
case SMESH::ConnectedElements::POINT: // read 3 node coordinates ///////////////////
{
- vector< double > xyz;
+ std::vector< double > xyz;
char* endptr;
do
{
Class : LogicalNOT_i
Description : Logical NOT predicate
*/
-LogicalNOT_i::LogicalNOT_i()
-: myPredicate( NULL ),
- myLogicalNOTPtr( new Controls::LogicalNOT() )
+LogicalNOT_i::LogicalNOT_i():
+ myLogicalNOTPtr( new Controls::LogicalNOT() ),
+ myPredicate( NULL )
{
myFunctorPtr = myPredicatePtr = myLogicalNOTPtr;
}
return anObj._retn();
}
+Deflection2D_ptr FilterManager_i::CreateDeflection2D()
+{
+ SMESH::Deflection2D_i* aServant = new SMESH::Deflection2D_i();
+ SMESH::Deflection2D_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateLength2D()";
+ return anObj._retn();
+}
+
MultiConnection_ptr FilterManager_i::CreateMultiConnection()
{
SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
return anObj._retn();
}
+NodeConnectivityNumber_ptr FilterManager_i::CreateNodeConnectivityNumber()
+{
+ SMESH::NodeConnectivityNumber_i* aServant = new SMESH::NodeConnectivityNumber_i();
+ SMESH::NodeConnectivityNumber_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateNodeConnectivityNumber()";
+ return anObj._retn();
+}
+
BelongToMeshGroup_ptr FilterManager_i::CreateBelongToMeshGroup()
{
SMESH::BelongToMeshGroup_i* aServant = new SMESH::BelongToMeshGroup_i();
case SMESH::FT_Length2D:
aFunctor = aFilterMgr->CreateLength2D();
break;
+ case SMESH::FT_Deflection2D:
+ aFunctor = aFilterMgr->CreateDeflection2D();
+ break;
case SMESH::FT_AspectRatio:
aFunctor = aFilterMgr->CreateAspectRatio();
break;
case SMESH::FT_BallDiameter:
aFunctor = aFilterMgr->CreateBallDiameter();
break;
+ case SMESH::FT_NodeConnectivityNumber:
+ aFunctor = aFilterMgr->CreateNodeConnectivityNumber();
+ break;
// Predicates
case FT_EqualFaces : return "Equal faces";
case FT_EqualVolumes : return "Equal volumes";
case FT_MultiConnection : return "Borders at multi-connections";
- case FT_MultiConnection2D :return "Borders at multi-connections 2D";
+ case FT_MultiConnection2D : return "Borders at multi-connections 2D";
case FT_Length : return "Length";
case FT_Length2D : return "Length 2D";
+ case FT_Deflection2D : return "Deflection 2D";
case FT_LessThan : return "Less than";
case FT_MoreThan : return "More than";
case FT_EqualTo : return "Equal to";
case FT_LogicalOR : return "Or";
case FT_GroupColor : return "Color of Group";
case FT_LinearOrQuadratic : return "Linear or Quadratic";
- case FT_ElemGeomType : return "Element geomtry type";
+ case FT_ElemGeomType : return "Element geometry type";
case FT_EntityType : return "Entity type";
case FT_Undefined : return "";
default : return "";
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length;
// else if ( theStr.equals( "Length2D" ) ) return FT_Length2D;
+ else if ( theStr.equals( "Deflection" ) ) return FT_Deflection2D;
else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds;
else if ( theStr.equals( "Bad Oriented Volume" ) ) return FT_BadOrientedVolume;
else if ( theStr.equals( "Volumes with bare border" ) ) return FT_BareBorderVolume;
else if ( theStr.equals( "Or" ) ) return FT_LogicalOR;
else if ( theStr.equals( "Color of Group" ) ) return FT_GroupColor;
else if ( theStr.equals( "Linear or Quadratic" ) ) return FT_LinearOrQuadratic;
- else if ( theStr.equals( "Element geomtry type" ) ) return FT_ElemGeomType;
+ else if ( theStr.equals( "Element geometry type" ) ) return FT_ElemGeomType;
else if ( theStr.equals( "Entity type" ) ) return FT_EntityType;
else if ( theStr.equals( "" ) ) return FT_Undefined;
else return FT_Undefined;
//=======================================================================
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<<"')";
}
if ( myFileName == 0 || strlen( myFileName ) == 0 )
return false;
- FILE* aOutFile = fopen( myFileName, "wt" );
- if ( !aOutFile )
- return false;
+ std::filebuf fb;
+ fb.open( myFileName, std::ios::out );
+
+ Standard_OStream os( &fb );
- LDOM_XmlWriter aWriter( aOutFile );
+ LDOM_XmlWriter aWriter;
aWriter.SetIndentation( 2 );
- aWriter << myDoc;
- fclose( aOutFile );
+ aWriter.Write( os, myDoc );
+ fb.close();
TPythonDump()<<this<<".Save()";
return true;
"FT_MultiConnection2D",
"FT_Length",
"FT_Length2D",
+ "FT_Deflection2D",
+ "FT_NodeConnectivityNumber",
"FT_BelongToMeshGroup",
"FT_BelongToGeom",
"FT_BelongToPlane",
"FT_LinearOrQuadratic",
"FT_GroupColor",
"FT_ElemGeomType",
- "FT_EntityType",
+ "FT_EntityType",
"FT_CoplanarFaces",
"FT_BallDiameter",
"FT_ConnectedElements",
#ifdef _DEBUG_
// check if functName is complete, compilation failure means that enum FunctorType changed
const int nbFunctors = sizeof(functName) / sizeof(const char*);
- int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ];
+ int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
#endif
return functName;