SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen)
{
+ _compatibleAllHypFilter = _compatibleNoAuxHypFilter = NULL;
_onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
_quadraticMesh = _supportSubmeshes = false;
_error = COMPERR_OK;
SMESH_Algo::~SMESH_Algo()
{
+ delete _compatibleNoAuxHypFilter;
+ // delete _compatibleAllHypFilter; -- _compatibleNoAuxHypFilter does it!!!
}
//=============================================================================
{
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
me->_usedHypList.clear();
- SMESH_HypoFilter filter;
- if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
+ if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
{
- aMesh.GetHypotheses( aShape, filter, me->_usedHypList, true );
+ aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true );
if ( ignoreAuxiliary && _usedHypList.size() > 1 )
me->_usedHypList.clear(); //only one compatible hypothesis allowed
}
{
SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
me->_appliedHypList.clear();
- SMESH_HypoFilter filter;
- if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
- aMesh.GetHypotheses( aShape, filter, me->_appliedHypList, false );
+ if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
+ aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false );
return _appliedHypList;
}
bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theMesh,
const TopoDS_Edge& theEdge,
const bool ignoreMediumNodes,
- map< double, const SMDS_MeshNode* > & theNodes)
+ map< double, const SMDS_MeshNode* > & theNodes,
+ const SMDSAbs_ElementType typeToCheck)
{
theNodes.clear();
while ( nIt->more() )
{
const SMDS_MeshNode* node = nIt->next();
- if ( ignoreMediumNodes ) {
- SMDS_ElemIteratorPtr elemIt = node->GetInverseElementIterator();
- if ( elemIt->more() && elemIt->next()->IsMediumNode( node ))
- continue;
- }
+ if ( ignoreMediumNodes && SMESH_MesherHelper::IsMedium( node, typeToCheck ))
+ continue;
const SMDS_PositionPtr& pos = node->GetPosition();
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
return false;
//================================================================================
/*!
- * \brief Make filter recognize only compatible hypotheses
- * \param theFilter - the filter to initialize
- * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
+ * \brief Returns the filter recognizing only compatible hypotheses
+ * \param ignoreAuxiliary - make filter ignore auxiliary hypotheses
+ * \retval SMESH_HypoFilter* - the filter that can be NULL
*/
//================================================================================
-bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
- const bool ignoreAuxiliary) const
+const SMESH_HypoFilter*
+SMESH_Algo::GetCompatibleHypoFilter(const bool ignoreAuxiliary) const
{
if ( !_compatibleHypothesis.empty() )
{
- theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
- for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
- theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
-
- if ( ignoreAuxiliary )
- theFilter.AndNot( theFilter.IsAuxiliary() );
-
- return true;
+ if ( !_compatibleAllHypFilter )
+ {
+ SMESH_HypoFilter* filter = new SMESH_HypoFilter();
+ filter->Init( filter->HasName( _compatibleHypothesis[0] ));
+ for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
+ filter->Or( filter->HasName( _compatibleHypothesis[ i ] ));
+
+ SMESH_HypoFilter* filterNoAux = new SMESH_HypoFilter( filter );
+ filterNoAux->AndNot( filterNoAux->IsAuxiliary() );
+
+ // _compatibleNoAuxHypFilter will detele _compatibleAllHypFilter!!!
+ SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
+ me->_compatibleAllHypFilter = filter;
+ me->_compatibleNoAuxHypFilter = filterNoAux;
+ }
+ return ignoreAuxiliary ? _compatibleNoAuxHypFilter : _compatibleAllHypFilter;
}
- return false;
+ return 0;
}
//================================================================================
Standard_Real tol = BRep_Tool::Tolerance( V );
Standard_Real angTol = 2e-3;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
return BRepLProp::Continuity(C1, C2, u1, u2, tol, angTol);
}
catch (Standard_Failure) {
* \param V - the vertex
* \param meshDS - mesh
* \retval const SMDS_MeshNode* - found node or NULL
+ * \sa SMESH_MesherHelper::GetSubShapeByNode( const SMDS_MeshNode*, SMESHDS_Mesh* )
*/
//================================================================================