// _compatibleHypothesis.push_back("hypothese_2D_bidon");
_type = ALGO_2D;
gen->_map2D_Algo[hypId] = this;
- myCreateQuadratic = false;
}
//=============================================================================
SMESH_2D_Algo::~SMESH_2D_Algo()
{
- myCreateQuadratic = false;
}
//=============================================================================
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
- if(myCreateQuadratic)
+ if(_quadraticMesh)
nb = nb/2;
- //SCRUTE(nb);
- nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?)
+ nbPoints += nb + 1; // internal points plus 1 vertex of 2 (last point ?)
}
- //SCRUTE(nbPoints);
return nbPoints;
}
int NumberOfWires(const TopoDS_Shape& S);
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
-protected:
- bool myCreateQuadratic;
};
#endif
gen->_mapAlgo[hypId] = this;
_onlyUnaryInput = _requireDescretBoundary = true;
+ _quadraticMesh = false;
}
//=============================================================================
*/
//=============================================================================
-const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
- SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+const list <const SMESHDS_Hypothesis *> &
+SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary)
{
_usedHypList.clear();
- if ( !_compatibleHypothesis.empty() )
+ SMESH_HypoFilter filter;
+ if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
{
- SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
- for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
- filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
-
aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
- if ( _usedHypList.size() > 1 )
+ if ( ignoreAuxiliary && _usedHypList.size() > 1 )
_usedHypList.clear(); //only one compatible hypothesis allowed
}
return _usedHypList;
*/
//=============================================================================
-const list<const SMESHDS_Hypothesis *> & SMESH_Algo::GetAppliedHypothesis(
- SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+const list<const SMESHDS_Hypothesis *> &
+SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary)
{
_appliedHypList.clear();
- if ( !_compatibleHypothesis.empty() )
- {
- SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
- for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
- filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
-
+ SMESH_HypoFilter filter;
+ if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
aMesh.GetHypotheses( aShape, filter, _appliedHypList, false );
- }
+
return _appliedHypList;
}
return Ne * Nf < 0.;
}
+
+/*!
+ * \brief Make filter recognize only compatible hypotheses
+ * \param theFilter - the filter to initialize
+ * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
+ */
+bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
+ 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;
+ }
+ return false;
+}
+
class SMESH_Gen;
class SMESH_Mesh;
+class SMESH_HypoFilter;
class TopoDS_Face;
class SMESHDS_Mesh;
class SMDS_MeshNode;
virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = 0;
virtual const std::list <const SMESHDS_Hypothesis *> &
- GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
+ GetUsedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary=true);
const list <const SMESHDS_Hypothesis *> &
- GetAppliedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
+ GetAppliedHypothesis(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool ignoreAuxiliary=true);
static double EdgeLength(const TopoDS_Edge & E);
+
+ /*!
+ * \brief Make filter recognize only compatible hypotheses
+ * \param theFilter - the filter to initialize
+ * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
+ * \retval bool - true if the algo has compatible hypotheses
+ */
+ bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
+ const bool ignoreAuxiliary) const;
+
/*!
* \brief Find out elements orientation on a geometrical face
* \param theFace - The face correctly oriented in the shape being meshed
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
std::list<const SMESHDS_Hypothesis *> _usedHypList;
+ // quadratic mesh creation required
+ bool _quadraticMesh;
};
#endif
if ( algoList.empty() )
return NULL;
- if (algoList.size() > 1 ) { // check if there is one algo several times
- list <const SMESHDS_Hypothesis * >::iterator algo = algoList.begin();
- for ( ; algo != algoList.end(); ++algo )
- if ( (*algo) != algoList.front() &&
- (*algo)->GetName() != algoList.front()->GetName() )
- return NULL;
- }
+ // Now it is checked in SMESH_Mesh::GetHypotheses()
+// if (algoList.size() > 1 ) { // check if there is one algo several times
+// list <const SMESHDS_Hypothesis * >::iterator algo = algoList.begin();
+// for ( ; algo != algoList.end(); ++algo )
+// if ( (*algo) != algoList.front() &&
+// (*algo)->GetName() != algoList.front()->GetName() )
+// return NULL;
+// }
return const_cast<SMESH_Algo*> ( static_cast<const SMESH_Algo* >( algoList.front() ));
}
return SMESH_subMesh::IsApplicableHypotesis( aHyp, (TopAbs_ShapeEnum)_shapeType );
};
+//=======================================================================
+//function : IsAuxiliaryPredicate::IsOk
+//purpose :
+//=======================================================================
+
+bool SMESH_HypoFilter::IsAuxiliaryPredicate::IsOk(const SMESH_Hypothesis* aHyp,
+ const TopoDS_Shape& /*aShape*/) const
+{
+ return aHyp->IsAuxiliary();
+};
+
//=======================================================================
//function : ApplicablePredicate::ApplicablePredicate
//purpose :
return new TypePredicate( MORE, SMESHDS_Hypothesis::PARAM_ALGO );
}
+//=======================================================================
+//function : IsAuxiliary
+//purpose :
+//=======================================================================
+
+SMESH_HypoPredicate* SMESH_HypoFilter::IsAuxiliary()
+{
+ return new IsAuxiliaryPredicate();
+}
+
+
//=======================================================================
//function : IsGlobal
//purpose :
// Create predicates
static SMESH_HypoPredicate* IsAlgo();
+ static SMESH_HypoPredicate* IsAuxiliary();
static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
const TopoDS_Shape& aShape) const;
};
+ struct IsAuxiliaryPredicate : public SMESH_HypoPredicate {
+ bool IsOk(const SMESH_Hypothesis* aHyp,
+ const TopoDS_Shape& aShape) const;
+ };
+
};
int SMESH_Hypothesis::GetDim() const
{
- int dim = -1;
+ int dim = 0;
switch (_type)
{
case ALGO_1D: dim = 1; break;
case ALGO_2D: dim = 2; break;
case ALGO_3D: dim = 3; break;
- case PARAM_ALGO: dim = _param_algo_dim; break;
+ case PARAM_ALGO:
+ dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
}
return dim;
}
itm++)
{
SMESH_Mesh* mesh = (*itm).second;
- const list<SMESH_subMesh*>& subMeshes =
- mesh->GetSubMeshUsingHypothesis(this);
+ mesh->NotifySubMeshesHypothesisModification( this );
+// const list<SMESH_subMesh*>& subMeshes =
+// mesh->GetSubMeshUsingHypothesis(this);
- //for all subMeshes using hypothesis
+// //for all subMeshes using hypothesis
- list<SMESH_subMesh*>::const_iterator its;
- for (its = subMeshes.begin(); its != subMeshes.end(); its++)
- (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
+// list<SMESH_subMesh*>::const_iterator its;
+// for (its = subMeshes.begin(); its != subMeshes.end(); its++)
+// (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
}
}
SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_Hypothesis();
- int GetDim() const;
+ virtual int GetDim() const;
int GetStudyId() const;
- void NotifySubMeshesHypothesisModification();
- int GetShapeType() const;
- const char* GetLibName() const;
+ virtual void NotifySubMeshesHypothesisModification();
+ virtual int GetShapeType() const;
+ virtual const char* GetLibName() const;
void SetLibName(const char* theLibName);
+ /*!
+ * \brief Return true if me is an auxiliary hypothesis
+ * \retval bool - auxiliary or not
+ *
+ * An auxiliary hypothesis is optional, i.e. an algorithm
+ * can work without it and another hypothesis of the same
+ * dimention can be assigned to the shape
+ */
+ virtual bool IsAuxiliary() const
+ { return GetType() == PARAM_ALGO && _param_algo_dim <= 0; }
+
protected:
SMESH_Gen* _gen;
int _studyId;
//purpose :
//=======================================================================
-bool SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
- const SMESH_HypoFilter& aFilter,
- list <const SMESHDS_Hypothesis * >& aHypList,
- const bool andAncestors) const
+//================================================================================
+/*!
+ * \brief Return hypothesis assigned to the shape
+ * \param aSubShape - the shape to check
+ * \param aFilter - the hypothesis filter
+ * \param aHypList - the list of the found hypotheses
+ * \param andAncestors - flag to check hypos assigned to ancestors of the shape
+ * \retval int - number of unique hypos in aHypList
+ */
+//================================================================================
+
+int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
+ const SMESH_HypoFilter& aFilter,
+ list <const SMESHDS_Hypothesis * >& aHypList,
+ const bool andAncestors) const
{
- int nbHyp = 0;
+ set<string> hypTypes; // to exclude same type hypos from the result list
+ int nbHyps = 0;
+
+ // fill in hypTypes
+ list<const SMESHDS_Hypothesis*>::const_iterator hyp;
+ for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ )
+ if ( hypTypes.insert( (*hyp)->GetName() ).second )
+ nbHyps++;
+
+ // get hypos from aSubShape
{
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
- list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
- for ( ; hyp != hypList.end(); hyp++ )
- if ( aFilter.IsOk (static_cast<const SMESH_Hypothesis*>( *hyp ), aSubShape)) {
+ for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
+ if ( aFilter.IsOk (static_cast<const SMESH_Hypothesis*>( *hyp ), aSubShape) &&
+ hypTypes.insert( (*hyp)->GetName() ).second )
+ {
aHypList.push_back( *hyp );
- nbHyp++;
+ nbHyps++;
}
}
- // get hypos from shape of one type only: if any hypo is found on edge, do
- // not look up on faces
- if ( !nbHyp && andAncestors )
+
+ // get hypos from ancestors of aSubShape
+ if ( andAncestors )
{
TopTools_MapOfShape map;
TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape ));
- int shapeType = it.More() ? it.Value().ShapeType() : TopAbs_SHAPE;
for (; it.More(); it.Next() )
{
- if ( nbHyp && shapeType != it.Value().ShapeType() )
- break;
- shapeType = it.Value().ShapeType();
- if ( !map.Add( it.Value() ))
+ if ( !map.Add( it.Value() ))
continue;
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
- list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
- for ( ; hyp != hypList.end(); hyp++ )
- if (aFilter.IsOk( static_cast<const SMESH_Hypothesis*>( *hyp ), it.Value() )) {
- aHypList.push_back( *hyp );
- nbHyp++;
- }
+ for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
+ if (aFilter.IsOk( static_cast<const SMESH_Hypothesis*>( *hyp ), it.Value() ) &&
+ hypTypes.insert( (*hyp)->GetName() ).second ) {
+ aHypList.push_back( *hyp );
+ nbHyps++;
+ }
}
}
- return nbHyp;
+ return !aHypList.empty();
}
//=============================================================================
//=======================================================================
bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
- const TopoDS_Shape & aSubShape)
+ const SMESH_subMesh* aSubMesh)
{
SMESH_Hypothesis* hyp = static_cast<SMESH_Hypothesis*>(anHyp);
- // check if anHyp is applicable to aSubShape
- SMESH_subMesh * subMesh = GetSubMeshContaining( aSubShape );
- if ( !subMesh || !subMesh->IsApplicableHypotesis( hyp ))
+
+ // check if anHyp can be used to mesh aSubMesh
+ if ( !aSubMesh || !aSubMesh->IsApplicableHypotesis( hyp ))
return false;
- SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape);
+ const TopoDS_Shape & aSubShape = const_cast<SMESH_subMesh*>( aSubMesh )->GetSubShape();
+
+ SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape );
// algorithm
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO)
if (algo)
{
// look trough hypotheses used by algo
- const list <const SMESHDS_Hypothesis * >&usedHyps =
- algo->GetUsedHypothesis(*this, aSubShape);
- return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
+ SMESH_HypoFilter hypoKind;
+ if ( algo->InitCompatibleHypoFilter( hypoKind, !hyp->IsAuxiliary() )) {
+ list <const SMESHDS_Hypothesis * > usedHyps;
+ if ( GetHypotheses( aSubShape, hypoKind, usedHyps, true ))
+ return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
+ }
}
// look through all assigned hypotheses
- SMESH_HypoFilter filter( SMESH_HypoFilter::Is( hyp ));
- return GetHypothesis( aSubShape, filter, true );
+ //SMESH_HypoFilter filter( SMESH_HypoFilter::Is( hyp ));
+ return false; //GetHypothesis( aSubShape, filter, true );
}
-
//=============================================================================
/*!
*
//=============================================================================
const list < SMESH_subMesh * >&
- SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
-throw(SALOME_Exception)
+SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
+ throw(SALOME_Exception)
+{
+ Unexpect aCatch(SalomeException);
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
+ map < int, SMESH_subMesh * >::iterator itsm;
+ _subMeshesUsingHypothesisList.clear();
+ for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
+ {
+ SMESH_subMesh *aSubMesh = (*itsm).second;
+ if ( IsUsedHypothesis ( anHyp, aSubMesh ))
+ _subMeshesUsingHypothesisList.push_back(aSubMesh);
+ }
+ return _subMeshesUsingHypothesisList;
+}
+
+//=======================================================================
+//function : NotifySubMeshesHypothesisModification
+//purpose : Say all submeshes using theChangedHyp that it has been modified
+//=======================================================================
+
+void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp)
{
Unexpect aCatch(SalomeException);
- if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
- map < int, SMESH_subMesh * >::iterator itsm;
- _subMeshesUsingHypothesisList.clear();
- for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
- {
- SMESH_subMesh *aSubMesh = (*itsm).second;
- if ( IsUsedHypothesis ( anHyp, aSubMesh->GetSubShape() ))
- _subMeshesUsingHypothesisList.push_back(aSubMesh);
- }
- return _subMeshesUsingHypothesisList;
+
+ const SMESH_Hypothesis* hyp = static_cast<const SMESH_Hypothesis*>(theChangedHyp);
+
+ const SMESH_Algo *foundAlgo = 0;
+ SMESH_HypoFilter algoKind( SMESH_HypoFilter::IsAlgo() );
+ SMESH_HypoFilter compatibleHypoKind;
+ list <const SMESHDS_Hypothesis * > usedHyps;
+
+
+ map < int, SMESH_subMesh * >::iterator itsm;
+ for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
+ {
+ SMESH_subMesh *aSubMesh = (*itsm).second;
+ if ( aSubMesh->IsApplicableHypotesis( hyp ))
+ {
+ const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
+
+ if ( !foundAlgo ) // init filter for algo search
+ algoKind.And( algoKind.IsApplicableTo( aSubShape ));
+
+ const SMESH_Algo *algo = static_cast<const SMESH_Algo*>
+ ( GetHypothesis( aSubShape, algoKind, true ));
+
+ if ( algo )
+ {
+ bool sameAlgo = ( algo == foundAlgo );
+ if ( !sameAlgo && foundAlgo )
+ sameAlgo = ( strcmp( algo->GetName(), foundAlgo->GetName() ) == 0);
+
+ if ( !sameAlgo ) { // init filter for used hypos search
+ if ( !algo->InitCompatibleHypoFilter( compatibleHypoKind, !hyp->IsAuxiliary() ))
+ continue; // algo does not use any hypothesis
+ foundAlgo = algo;
+ }
+
+ // check if hyp is used by algo
+ usedHyps.clear();
+ if ( GetHypotheses( aSubShape, compatibleHypoKind, usedHyps, true ) &&
+ find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
+ {
+ aSubMesh->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
+
+ if ( algo->GetDim() == 1 && IsPropagationHypothesis( aSubShape ))
+ CleanMeshOnPropagationChain( aSubShape );
+ }
+ }
+ }
+ }
}
//=============================================================================
const SMESH_HypoFilter& aFilter,
const bool andAncestors) const;
- bool GetHypotheses(const TopoDS_Shape & aSubShape,
- const SMESH_HypoFilter& aFilter,
- list <const SMESHDS_Hypothesis * >& aHypList,
- const bool andAncestors) const;
+ int GetHypotheses(const TopoDS_Shape & aSubShape,
+ const SMESH_HypoFilter& aFilter,
+ list <const SMESHDS_Hypothesis * >& aHypList,
+ const bool andAncestors) const;
const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
SMESH_subMesh *GetSubMeshContaining(const int aShapeID)
throw(SALOME_Exception);
+ void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp);
+ // Say all submeshes that theChangedHyp has been modified
+
const list < SMESH_subMesh * >&
GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception);
- bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
- const TopoDS_Shape & aSubShape);
+ bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
+ const SMESH_subMesh * aSubMesh);
// Return True if anHyp is used to mesh aSubShape
bool IsNotConformAllowed() const;
*/
//=============================================================================
-const TopoDS_Shape & SMESH_subMesh::GetSubShape()
+const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
{
//MESSAGE("SMESH_subMesh::GetSubShape");
return _subShape;
if ( ! CanAddHypothesis( anHyp ))
return SMESH_Hypothesis::HYP_BAD_DIM;
- if ( GetSimilarAttached( _subShape, anHyp ) )
+ if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
if ( !_meshDS->AddHypothesis(_subShape, anHyp))
// Serve Propagation of 1D hypothesis
if (event == ADD_HYP) {
bool isPropagationOk = true;
- string hypName = anHyp->GetName();
+ bool isPropagationHyp = ( strcmp( "Propagation", anHyp->GetName() ) == 0 );
- if (hypName == "Propagation") {
+ if ( isPropagationHyp ) {
TopExp_Explorer exp (_subShape, TopAbs_EDGE);
TopTools_MapOfShape aMap;
for (; exp.More(); exp.Next()) {
} else {
}
- if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) {
+ if ( isPropagationOk ) {
+ if ( isPropagationHyp )
+ return ret; // nothing more to do for "Propagation" hypothesis
+ }
+ else if ( ret < SMESH_Hypothesis::HYP_CONCURENT) {
ret = SMESH_Hypothesis::HYP_CONCURENT;
}
} // Serve Propagation of 1D hypothesis
{
bool isPropagationOk = true;
SMESH_HypoFilter propagFilter( SMESH_HypoFilter::HasName( "Propagation" ));
- if ( propagFilter.IsOk( anHyp, _subShape ))
+ bool isPropagationHyp = propagFilter.IsOk( anHyp, _subShape );
+
+ if ( isPropagationHyp )
{
TopExp_Explorer exp (_subShape, TopAbs_EDGE);
TopTools_MapOfShape aMap;
isPropagationOk = _father->RebuildPropagationChains();
}
- if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) {
+ if ( isPropagationOk ) {
+ if ( isPropagationHyp )
+ return ret; // nothing more to do for "Propagation" hypothesis
+ }
+ else if ( ret < SMESH_Hypothesis::HYP_CONCURENT) {
ret = SMESH_Hypothesis::HYP_CONCURENT;
}
} // Serve Propagation of 1D hypothesis
SetAlgoState(HYP_OK);
if (SMESH_Hypothesis::IsStatusFatal( ret ))
_meshDS->RemoveHypothesis(_subShape, anHyp);
- else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
+ else if (!_father->IsUsedHypothesis( anHyp, this ))
{
_meshDS->RemoveHypothesis(_subShape, anHyp);
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
// ret should be fatal: anHyp was not added
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
- else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
+ else if (!_father->IsUsedHypothesis( anHyp, this ))
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
if (SMESH_Hypothesis::IsStatusFatal( ret ))
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
{
- if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp
+ if (_father->IsUsedHypothesis( anHyp, this )) // new Hyp
modifiedHyp = true;
}
else
if ( mainShape.IsSame( _subShape ))
return _subShape;
+ const bool ignoreAuxiliaryHyps = false;
list<const SMESHDS_Hypothesis*> aUsedHyp =
- theAlgo->GetUsedHypothesis( *_father, _subShape ); // copy
+ theAlgo->GetUsedHypothesis( *_father, _subShape, ignoreAuxiliaryHyps ); // copy
// put in a compound all shapes with the same hypothesis assigned
// and a good ComputState
if (subMesh->GetComputeState() == READY_TO_COMPUTE &&
anAlgo == theAlgo &&
- anAlgo->GetUsedHypothesis( *_father, S ) == aUsedHyp)
+ anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp)
{
aBuilder.Add( aCompound, S );
}
//=======================================================================
//function : GetSimilarAttached
-//purpose : return nb of hypotheses attached to theShape.
+//purpose : return a hypothesis attached to theShape.
// If theHyp is provided, similar but not same hypotheses
-// are countered; else only applicable ones having theHypType
-// are countered
+// is returned; else only applicable ones having theHypType
+// is returned
//=======================================================================
const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached(const TopoDS_Shape& theShape,
const SMESH_Hypothesis * theHyp,
const int theHypType)
{
- SMESH_HypoFilter filter;
- filter.Init( SMESH_HypoFilter::HasType( theHyp ? theHyp->GetType() : theHypType ));
+ SMESH_HypoFilter hypoKind;
+ hypoKind.Init( hypoKind.HasType( theHyp ? theHyp->GetType() : theHypType ));
if ( theHyp ) {
- filter.And( SMESH_HypoFilter::HasDim( theHyp->GetDim() ));
- filter.AndNot( SMESH_HypoFilter::Is( theHyp ));
+ hypoKind.And ( hypoKind.HasDim( theHyp->GetDim() ));
+ hypoKind.AndNot( hypoKind.Is( theHyp ));
+ if ( theHyp->IsAuxiliary() )
+ hypoKind.And( hypoKind.HasName( theHyp->GetName() ));
+ else
+ hypoKind.AndNot( hypoKind.IsAuxiliary());
+ }
+ else {
+ hypoKind.And( hypoKind.IsApplicableTo( theShape ));
}
- else
- filter.And( SMESH_HypoFilter::IsApplicableTo( theShape ));
- return _father->GetHypothesis( theShape, filter, false );
+ return _father->GetHypothesis( theShape, hypoKind, false );
}
//=======================================================================
const map < int, SMESH_subMesh * >&DependsOn();
//const map < int, SMESH_subMesh * >&Dependants();
- const TopoDS_Shape & GetSubShape();
+ const TopoDS_Shape & GetSubShape() const;
// bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
SMESH_Hypothesis::Hypothesis_Status
SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
- int GetAlgoState() { return _algoState; }
+ int GetAlgoState() const { return _algoState; }
+ int GetComputeState() const { return _computeState; };
void DumpAlgoState(bool isMain);
bool ComputeStateEngine(int event);
- int GetComputeState()
- {
- return _computeState;
- };
-
bool IsConform(const SMESH_Algo* theAlgo);
// check if a conform mesh will be produced by the Algo