return 0; // nothing to compute
}
+//================================================================================
+/*!
+ * \brief Returns a current algorithm
+ */
+//================================================================================
+
+SMESH_Algo* SMESH_subMesh::GetAlgo() const
+{
+ return _father->GetGen()->GetAlgo(*_father, _subShape);
+}
+
//================================================================================
/*!
* \brief Allow algo->Compute() if a subshape of lower dim is meshed but
SMESH_Hypothesis::Hypothesis_Status aux_ret, ret = SMESH_Hypothesis::HYP_OK;
SMESHDS_Mesh* meshDS =_father->GetMeshDS();
- SMESH_Gen* gen =_father->GetGen();
+ //SMESH_Gen* gen =_father->GetGen();
SMESH_Algo* algo = 0;
if (_subShape.ShapeType() == TopAbs_VERTEX )
if ( event != REMOVE_FATHER_ALGO )
{
_algoState = NO_ALGO;
- algo = gen->GetAlgo(*_father, _subShape);
+ algo = GetAlgo();
if ( algo ) {
_algoState = MISSING_HYP;
if ( event == REMOVE_FATHER_HYP ||
case ADD_HYP:
break;
case ADD_ALGO: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if (algo->CheckHypothesis((*_father),_subShape, aux_ret))
SetAlgoState(HYP_OK);
case ADD_FATHER_HYP:
break;
case ADD_FATHER_ALGO: { // Algo just added in father
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo == anHyp ) {
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret))
case REMOVE_FATHER_HYP:
break;
case REMOVE_FATHER_ALGO: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo)
{
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
switch (event)
{
case ADD_HYP: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, ret ))
SetAlgoState(HYP_OK);
break;
}
case ADD_ALGO: { //already existing algo : on father ?
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))// ignore hyp status
SetAlgoState(HYP_OK);
case REMOVE_HYP:
break;
case REMOVE_ALGO: { // perhaps a father algo applies ?
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo == NULL) // no more algo applying on subShape...
{
SetAlgoState(NO_ALGO);
}
case MODIF_HYP: // assigned hypothesis value may become good
case ADD_FATHER_HYP: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
SetAlgoState(HYP_OK);
break;
}
case ADD_FATHER_ALGO: { // new father algo
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT( algo );
if ( algo == anHyp ) {
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
case REMOVE_FATHER_HYP: // nothing to do
break;
case REMOVE_FATHER_ALGO: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo == NULL) // no more applying algo on father
{
SetAlgoState(NO_ALGO);
switch (event)
{
case ADD_HYP: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if (!algo->CheckHypothesis((*_father),_subShape, ret ))
{
break;
}
case ADD_ALGO: { //already existing algo : on father ?
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
// check if algo changes
SMESH_HypoFilter f;
break;
}
case REMOVE_HYP: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
SetAlgoState(HYP_OK);
break;
}
case REMOVE_ALGO: { // perhaps a father algo applies ?
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo == NULL) // no more algo applying on subShape...
{
SetAlgoState(NO_ALGO);
}
case MODIF_HYP: // hypothesis value may become bad
case ADD_FATHER_HYP: { // new father hypothesis ?
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
{
break;
}
case ADD_FATHER_ALGO: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if ( algo == anHyp ) { // a new algo on father
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
// check if algo changes
break;
}
case REMOVE_FATHER_HYP: {
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
// is there the same local hyp or maybe a new father algo applied?
if (!algo->NeedDescretBoundary())
needFullClean = true;
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo == NULL) // no more applying algo on father
{
SetAlgoState(NO_ALGO);
switch (event)
{
case MODIF_ALGO_STATE:
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo && !algo->NeedDescretBoundary())
CleanDependsOn(); // clean sub-meshes with event CLEAN
if ( _algoState == HYP_OK )
{
case MODIF_ALGO_STATE:
_computeState = NOT_READY;
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo)
{
if (!algo->NeedDescretBoundary())
break;
case COMPUTE:
{
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
ASSERT(algo);
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
if (!ret)
if ( !_computeError || ( !ret && _computeError->IsOK() ) ) // algo can set _computeError of submesh
_computeError = algo->GetComputeError();
}
+ catch ( ::SMESH_ComputeError& comperr ) {
+ cout << " SMESH_ComputeError caught" << endl;
+ if ( !_computeError ) _computeError = SMESH_ComputeError::New();
+ *_computeError = comperr;
+ }
catch ( std::bad_alloc& exc ) {
MESSAGE("std::bad_alloc thrown inside algo->Compute()");
if ( _computeError ) {
CleanDependants();
RemoveSubMeshElementsAndNodes();
_computeState = NOT_READY;
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo)
{
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
// happen after retrieval from a file
ComputeStateEngine( CHECK_COMPUTE_STATE );
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
- algo = gen->GetAlgo(*_father, _subShape);
+ algo = GetAlgo();
if (algo) algo->SubmeshRestored( this );
break;
case MESH_ENTITY_REMOVED:
{
case MODIF_ALGO_STATE:
ComputeStateEngine( CLEAN );
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo && !algo->NeedDescretBoundary())
CleanDependsOn(); // clean sub-meshes with event CLEAN
break;
case SUBMESH_RESTORED:
ComputeStateEngine( CHECK_COMPUTE_STATE );
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
- algo = gen->GetAlgo(*_father, _subShape);
+ algo = GetAlgo();
if (algo) algo->SubmeshRestored( this );
break;
case MESH_ENTITY_REMOVED:
case MODIF_ALGO_STATE:
if ( !IsEmpty() )
ComputeStateEngine( CLEAN );
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if (algo && !algo->NeedDescretBoundary())
CleanDependsOn(); // clean sub-meshes with event CLEAN
if (_algoState == HYP_OK)
#ifdef WITH_SMESH_CANCEL_COMPUTE
case COMPUTE_CANCELED:
{
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
algo->CancelCompute();
}
break;
return ret;
}
- SMESH_Gen *gen = _father->GetGen();
+ //SMESH_Gen *gen = _father->GetGen();
SMESH_Algo *algo = 0;
SMESH_Hypothesis::Hypothesis_Status hyp_status;
- algo = gen->GetAlgo((*_father), _subShape);
+ algo = GetAlgo();
if(algo && !aResMap.count(this) )
{
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);