// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// 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
+// 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
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
-//
-// 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
-//
+//
+// 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
+//
TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE )
{
TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE )
{
TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
- const TopoDS_Shape& theShape,
- const SMDS_MeshElement* theElem,
- TopAbs_ShapeEnum theFindShapeEnum,
- TopAbs_ShapeEnum theAvoidShapeEnum )
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum )
{
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
return true;
{
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
return true;
TopTools_IndexedMapOfShape aSubShapes;
TopExp::MapShapes( theShape, aSubShapes );
TopTools_IndexedMapOfShape aSubShapes;
TopExp::MapShapes( theShape, aSubShapes );
- {
- const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
-
- if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
- if( aSubMesh->Contains( theElem ) )
- return true;
-
- SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
- while ( aNodeIt->more() )
- {
- const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
- SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
- while ( anElemIt->more() )
- {
- const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
- if (anElement == theElem)
- return true;
- }
- }
+ {
+ const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
+
+ if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
+ if( aSubMesh->Contains( theElem ) )
+ return true;
+
+ SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
+ while ( aNodeIt->more() )
+ {
+ const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
+ SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+ while ( anElemIt->more() )
+ {
+ const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+ if (anElement == theElem)
+ return true;
+ }
MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
{
SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theMesh);
return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
}
MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
{
SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theMesh);
return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
}
toArray( const TColStd_ListOfReal& aList )
{
SMESH::double_array_var anArray = new SMESH::double_array;
toArray( const TColStd_ListOfReal& aList )
{
SMESH::double_array_var anArray = new SMESH::double_array;
{
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
{
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
{
SALOMEDS::Study::ListOfSObject_var aList =
aStudy->FindObjectByName( theName, "GEOM" );
{
SALOMEDS::Study::ListOfSObject_var aList =
aStudy->FindObjectByName( theName, "GEOM" );
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
if ( !aGeomObj->_is_nil() )
{
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
if ( !aGeomObj->_is_nil() )
{
+/*
+ Class : Volume3D_i
+ Description : Functor for calculating volume of 3D element
+*/
+Volume3D_i::Volume3D_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::Volume() );
+ myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Volume3D_i::GetFunctorType()
+{
+ return SMESH::FT_Volume3D;
+}
+
INFOS("Length2D_i::GetValues");
SMESH::Controls::Length2D::TValues aValues;
myLength2DPtr->GetValues( aValues );
INFOS("Length2D_i::GetValues");
SMESH::Controls::Length2D::TValues aValues;
myLength2DPtr->GetValues( aValues );
long i = 0, iEnd = aValues.size();
SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd);
long i = 0, iEnd = aValues.size();
SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd);
{
const SMESH::Controls::Length2D::Value& aVal = *anIter;
SMESH::Length2D::Value &aValue = aResult[ i ];
{
const SMESH::Controls::Length2D::Value& aVal = *anIter;
SMESH::Length2D::Value &aValue = aResult[ i ];
aValue.myLength = aVal.myLength;
aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ];
aValue.myLength = aVal.myLength;
aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ];
INFOS("MultiConnection2D_i::GetValues");
SMESH::Controls::MultiConnection2D::MValues aValues;
myMulticonnection2DPtr->GetValues( aValues );
INFOS("MultiConnection2D_i::GetValues");
SMESH::Controls::MultiConnection2D::MValues aValues;
myMulticonnection2DPtr->GetValues( aValues );
long i = 0, iEnd = aValues.size();
SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd);
long i = 0, iEnd = aValues.size();
SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd);
{
const SMESH::Controls::MultiConnection2D::Value& aVal = (*anIter).first;
SMESH::MultiConnection2D::Value &aValue = aResult[ i ];
{
const SMESH::Controls::MultiConnection2D::Value& aVal = (*anIter).first;
SMESH::MultiConnection2D::Value &aValue = aResult[ i ];
aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ];
aValue.myNbConnects = (*anIter).second;
aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ];
aValue.myNbConnects = (*anIter).second;
INFOS("FreeEdges_i::GetBorders");
SMESH::Controls::FreeEdges::TBorders aBorders;
myFreeEdgesPtr->GetBoreders( aBorders );
INFOS("FreeEdges_i::GetBorders");
SMESH::Controls::FreeEdges::TBorders aBorders;
myFreeEdgesPtr->GetBoreders( aBorders );
long i = 0, iEnd = aBorders.size();
SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders(iEnd);
long i = 0, iEnd = aBorders.size();
SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders(iEnd);
{
const SMESH::Controls::FreeEdges::Border& aBord = *anIter;
SMESH::FreeEdges::Border &aBorder = aResult[ i ];
{
const SMESH::Controls::FreeEdges::Border& aBord = *anIter;
SMESH::FreeEdges::Border &aBorder = aResult[ i ];
aBorder.myElemId = aBord.myElemId;
aBorder.myPnt1 = aBord.myPntId[ 0 ];
aBorder.myPnt2 = aBord.myPntId[ 1 ];
aBorder.myElemId = aBord.myElemId;
aBorder.myPnt1 = aBord.myPntId[ 0 ];
aBorder.myPnt2 = aBord.myPntId[ 1 ];
+Volume3D_ptr FilterManager_i::CreateVolume3D()
+{
+ SMESH::Volume3D_i* aServant = new SMESH::Volume3D_i();
+ SMESH::Volume3D_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateVolume3D()";
+ return anObj._retn();
+}
+
+
// name : Filter_i::SetMesh
// Purpose : Set mesh
//=======================================================================
// name : Filter_i::SetMesh
// Purpose : Set mesh
//=======================================================================
- const SMDS_Mesh* theMesh,
- Controls::Filter::TIdSequence& theSequence )
+ const SMDS_Mesh* theMesh,
+ Controls::Filter::TIdSequence& theSequence )
- SMESH_Mesh_ptr theMesh,
- Controls::Filter::TIdSequence& theSequence )
+ SMESH_Mesh_ptr theMesh,
+ Controls::Filter::TIdSequence& theSequence )
{
if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
}
{
if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
}
SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
FilterManager_ptr aFilterMgr = aFilter->_this();
SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
FilterManager_ptr aFilterMgr = aFilter->_this();
TPythonDump()<<"aCriteria.append(SMESH.Filter.Criterion("<<
aCriterion<<","<<aCompare<<","<<aThreshold<<",'"<<aThresholdStr<<"',"<<
aUnary<<","<<aBinary<<","<<aTolerance<<","<<aTypeOfElem<<","<<aPrecision<<"))";
TPythonDump()<<"aCriteria.append(SMESH.Filter.Criterion("<<
aCriterion<<","<<aCompare<<","<<aThreshold<<",'"<<aThresholdStr<<"',"<<
aUnary<<","<<aBinary<<","<<aTolerance<<","<<aTypeOfElem<<","<<aPrecision<<"))";
SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
switch ( aCriterion )
{
// Functors
SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
switch ( aCriterion )
{
// Functors
case SMESH::FT_MultiConnection:
aFunctor = aFilterMgr->CreateMultiConnection();
break;
case SMESH::FT_MultiConnection2D:
case SMESH::FT_MultiConnection:
aFunctor = aFilterMgr->CreateMultiConnection();
break;
case SMESH::FT_MultiConnection2D:
case FT_Taper : return "Taper";
case FT_Skew : return "Skew";
case FT_Area : return "Area";
case FT_Taper : return "Taper";
case FT_Skew : return "Skew";
case FT_Area : return "Area";
case FT_BelongToGeom : return "Belong to Geom";
case FT_BelongToPlane : return "Belong to Plane";
case FT_BelongToCylinder: return "Belong to Cylinder";
case FT_BelongToGeom : return "Belong to Geom";
case FT_BelongToPlane : return "Belong to Plane";
case FT_BelongToCylinder: return "Belong to Cylinder";
else if ( theStr.equals( "Taper" ) ) return FT_Taper;
else if ( theStr.equals( "Skew" ) ) return FT_Skew;
else if ( theStr.equals( "Area" ) ) return FT_Area;
else if ( theStr.equals( "Taper" ) ) return FT_Taper;
else if ( theStr.equals( "Skew" ) ) return FT_Skew;
else if ( theStr.equals( "Area" ) ) return FT_Area;
else if ( theStr.equals( "Belong to Geom" ) ) return FT_BelongToGeom;
else if ( theStr.equals( "Belong to Plane" ) ) return FT_BelongToPlane;
else if ( theStr.equals( "Belong to Cylinder" ) ) return FT_BelongToCylinder;
else if ( theStr.equals( "Belong to Geom" ) ) return FT_BelongToGeom;
else if ( theStr.equals( "Belong to Plane" ) ) return FT_BelongToPlane;
else if ( theStr.equals( "Belong to Cylinder" ) ) return FT_BelongToCylinder;
const char* aSectionName = getSectionName( theType );
if ( strcmp( aSectionName, "" ) == 0 )
return LDOM_Node();
const char* aSectionName = getSectionName( theType );
if ( strcmp( aSectionName, "" ) == 0 )
return LDOM_Node();
LDOM_NodeList aSections = theDoc.getElementsByTagName( "section" );
LDOM_Node aNode;
for ( int i = 0, n = aSections.getLength(); i < n; i++ )
LDOM_NodeList aSections = theDoc.getElementsByTagName( "section" );
LDOM_Node aNode;
for ( int i = 0, n = aSections.getLength(); i < n; i++ )
aCriterionItem.setAttribute( ATTR_THRESHOLD , toString( aCriteria[ i ].Threshold ) );
aCriterionItem.setAttribute( ATTR_UNARY , toString( aCriteria[ i ].UnaryOp ) );
aCriterionItem.setAttribute( ATTR_BINARY , toString( aCriteria[ i ].BinaryOp ) );
aCriterionItem.setAttribute( ATTR_THRESHOLD , toString( aCriteria[ i ].Threshold ) );
aCriterionItem.setAttribute( ATTR_UNARY , toString( aCriteria[ i ].UnaryOp ) );
aCriterionItem.setAttribute( ATTR_BINARY , toString( aCriteria[ i ].BinaryOp ) );
aCriterionItem.setAttribute( ATTR_THRESHOLD_STR, (const char*)aCriteria[ i ].ThresholdStr );
aCriterionItem.setAttribute( ATTR_TOLERANCE , toString( aCriteria[ i ].Tolerance ) );
aCriterionItem.setAttribute( ATTR_ELEMENT_TYPE ,
aCriterionItem.setAttribute( ATTR_THRESHOLD_STR, (const char*)aCriteria[ i ].ThresholdStr );
aCriterionItem.setAttribute( ATTR_TOLERANCE , toString( aCriteria[ i ].Tolerance ) );
aCriterionItem.setAttribute( ATTR_ELEMENT_TYPE ,
for ( LDOM_Node aCritNode = aFilter.getFirstChild();
!aCritNode.isNull() ; aCritNode = aCritNode.getNextSibling() )
{
for ( LDOM_Node aCritNode = aFilter.getFirstChild();
!aCritNode.isNull() ; aCritNode = aCritNode.getNextSibling() )
{
const char* aUnaryStr = aCrit->getAttribute( ATTR_UNARY ).GetString();
const char* aBinaryStr = aCrit->getAttribute( ATTR_BINARY ).GetString();
const char* anElemTypeStr = aCrit->getAttribute( ATTR_ELEMENT_TYPE ).GetString();
const char* aUnaryStr = aCrit->getAttribute( ATTR_UNARY ).GetString();
const char* aBinaryStr = aCrit->getAttribute( ATTR_BINARY ).GetString();
const char* anElemTypeStr = aCrit->getAttribute( ATTR_ELEMENT_TYPE ).GetString();
SMESH::Filter::Criterion aCriterion = createCriterion();
aCriterion.Type = toFunctorType( aTypeStr );
aCriterion.Compare = toFunctorType( aCompareStr );
aCriterion.UnaryOp = toFunctorType( aUnaryStr );
aCriterion.BinaryOp = toFunctorType( aBinaryStr );
SMESH::Filter::Criterion aCriterion = createCriterion();
aCriterion.Type = toFunctorType( aTypeStr );
aCriterion.Compare = toFunctorType( aCompareStr );
aCriterion.UnaryOp = toFunctorType( aUnaryStr );
aCriterion.BinaryOp = toFunctorType( aBinaryStr );
aCriterion.TypeOfElement = toElementType( anElemTypeStr );
LDOMString str = aCrit->getAttribute( ATTR_THRESHOLD );
aCriterion.TypeOfElement = toElementType( anElemTypeStr );
LDOMString str = aCrit->getAttribute( ATTR_THRESHOLD );
SMESH::Filter::Criteria_var aCriteriaVar = new SMESH::Filter::Criteria;
aCriteriaVar->length( aCriteria.size() );
SMESH::Filter::Criteria_var aCriteriaVar = new SMESH::Filter::Criteria;
aCriteriaVar->length( aCriteria.size() );
for( ; anIter != aCriteria.end(); ++anIter )
aCriteriaVar[ i++ ] = *anIter;
aRes = myFilterMgr->CreateFilter();
aRes->SetCriteria( aCriteriaVar.inout() );
for( ; anIter != aCriteria.end(); ++anIter )
aCriteriaVar[ i++ ] = *anIter;
aRes = myFilterMgr->CreateFilter();
aRes->SetCriteria( aCriteriaVar.inout() );
LDOM_Element aFilterItem = createFilterItem( theFilterName, aFilter, myDoc );
if ( aFilterItem.isNull() )
return false;
LDOM_Element aFilterItem = createFilterItem( theFilterName, aFilter, myDoc );
if ( aFilterItem.isNull() )
return false;
// Purpose : Replace existing filter with entry filter.
// IMPORTANT : If filter does not exist it is not created
//=======================================================================
CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
// Purpose : Replace existing filter with entry filter.
// IMPORTANT : If filter does not exist it is not created
//=======================================================================
CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,