+// MESSAGE("SMESH_Gen::GetAlgo");
+
+ const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+ int dim = GetShapeDim( aShape );
+ int shape_type = aShape.ShapeType();
+ int algo_id = -1;
+
+ algo_id = getAlgo( meshDS->GetHypothesis( aShape ), dim, shape_type );
+
+ if (algo_id < 0)
+ {
+ // try ansestors
+ TopTools_ListIteratorOfListOfShape ancIt( aMesh.GetAncestors( aShape ));
+ for (; ancIt.More(); ancIt.Next())
+ {
+ const TopoDS_Shape& ancestor = ancIt.Value();
+ algo_id = getAlgo( meshDS->GetHypothesis( ancestor ), dim, shape_type );
+ if ( algo_id >= 0 )
+ break;
+ }
+ if (algo_id < 0) return NULL;
+ }
+
+ ASSERT(_mapAlgo.find(algo_id) != _mapAlgo.end());
+
+ return _mapAlgo[algo_id];
+
+// const SMESHDS_Hypothesis *theHyp = NULL;
+// SMESH_Algo *algo = NULL;
+// const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+// int hypType;
+// int hypId;
+// int algoDim;
+
+// // try shape first, then main shape
+
+// TopoDS_Shape mainShape = meshDS->ShapeToMesh();
+// const TopoDS_Shape *shapeToTry[2] = { &aShape, &mainShape };
+
+// for (int iShape = 0; iShape < 2; iShape++)
+// {
+// TopoDS_Shape tryShape = (*shapeToTry[iShape]);
+
+// const list<const SMESHDS_Hypothesis*>& listHyp =
+// meshDS->GetHypothesis(tryShape);
+// list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
+
+// int nb_algo = 0;
+// int shapeDim = GetShapeDim(aShape);
+// int typeOfShape = aShape.ShapeType();
+
+// while (it!=listHyp.end())
+// {
+// const SMESHDS_Hypothesis *anHyp = *it;
+// hypType = anHyp->GetType();
+// //SCRUTE(hypType);
+// if (hypType > SMESHDS_Hypothesis::PARAM_ALGO)
+// {
+// switch (hypType)
+// {
+// case SMESHDS_Hypothesis::ALGO_1D:
+// algoDim = 1;
+// break;
+// case SMESHDS_Hypothesis::ALGO_2D:
+// algoDim = 2;
+// break;
+// case SMESHDS_Hypothesis::ALGO_3D:
+// algoDim = 3;
+// break;
+// default:
+// algoDim = 0;
+// break;
+// }
+// //SCRUTE(algoDim);
+// //SCRUTE(shapeDim);
+// //SCRUTE(typeOfShape);
+// if (shapeDim == algoDim) // count only algos of shape dim.
+// { // discard algos for subshapes
+// hypId = anHyp->GetID(); // (of lower dim.)
+// ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end());
+// SMESH_Algo *anAlgo = _mapAlgo[hypId];
+// //SCRUTE(anAlgo->GetShapeType());
+// //if (anAlgo->GetShapeType() == typeOfShape)
+// if ((anAlgo->GetShapeType()) & (1 << typeOfShape))
+// { // only specific TopoDS_Shape
+// nb_algo++;
+// theHyp = anHyp;
+// }
+// }
+// }
+// if (nb_algo > 1) return NULL; // more than one algo
+// it++;
+// }
+// if (nb_algo == 1) // one algo found : OK
+// break; // do not try a parent shape
+// }
+
+// if (!theHyp)
+// return NULL; // no algo found
+
+// hypType = theHyp->GetType();
+// hypId = theHyp->GetID();
+
+// ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end());
+// algo = _mapAlgo[hypId];
+// //MESSAGE("Algo found " << algo->GetName() << " Id " << hypId);
+// return algo;