Salome HOME
57b7d3ecf595d5b90020866d0172236e5a5a8b6e
[modules/smesh.git] / src / SMESH / SMESH_Gen.cxx
1 //  SMESH SMESH : implementaion of SMESH idl descriptions
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SMESH_Gen.cxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESH_Gen.hxx"
30 #include "SMESH_subMesh.hxx"
31 #include "SMESH_HypoFilter.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_MeshNode.hxx"
34
35 #include "utilities.h"
36 #include "OpUtil.hxx"
37 #include "Utils_ExceptHandlers.hxx"
38
39 #include <gp_Pnt.hxx>
40 #include <BRep_Tool.hxx>
41 #include <TopTools_ListOfShape.hxx>
42 #include <TopTools_ListIteratorOfListOfShape.hxx>
43
44 using namespace std;
45
46 //=============================================================================
47 /*!
48  *  default constructor:
49  */
50 //=============================================================================
51
52 SMESH_Gen::SMESH_Gen()
53 {
54         MESSAGE("SMESH_Gen::SMESH_Gen");
55         _localId = 0;
56         _hypId = 0;
57 }
58
59 //=============================================================================
60 /*!
61  *
62  */
63 //=============================================================================
64
65 SMESH_Gen::~SMESH_Gen()
66 {
67         MESSAGE("SMESH_Gen::~SMESH_Gen");
68 }
69
70 //=============================================================================
71 /*!
72  *
73  */
74 //=============================================================================
75
76 /*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
77         throw(SALOME_Exception)
78 {
79
80         MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
81         // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
82
83         StudyContextStruct *myStudyContext = GetStudyContext(studyId);
84
85         // create a new hypothesis object, store its ref. in studyContext
86
87         SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
88         int hypId = myHypothesis->GetID();
89         myStudyContext->mapHypothesis[hypId] = myHypothesis;
90         SCRUTE(studyId);
91         SCRUTE(hypId);
92
93         // store hypothesis in SMESHDS document
94
95         myStudyContext->myDocument->AddHypothesis(myHypothesis);
96         return myHypothesis;
97 }*/
98
99 //=============================================================================
100 /*!
101  *
102  */
103 //=============================================================================
104
105 SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
106   throw(SALOME_Exception)
107 {
108   Unexpect aCatch(SalomeException);
109   MESSAGE("SMESH_Gen::CreateMesh");
110
111   // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
112   StudyContextStruct *aStudyContext = GetStudyContext(theStudyId);
113
114   // create a new SMESH_mesh object
115   SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
116                                      theStudyId,
117                                      this,
118                                      theIsEmbeddedMode,
119                                      aStudyContext->myDocument);
120   aStudyContext->mapMesh[_localId] = aMesh;
121
122   return aMesh;
123 }
124
125 //=============================================================================
126 /*!
127  * Compute a mesh
128  */
129 //=============================================================================
130
131 bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
132 {
133   MESSAGE("SMESH_Gen::Compute");
134
135   bool ret = true;
136
137   SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
138
139   // -----------------------------------------------------------------
140   // apply algos that do not require descretized boundaries, starting
141   // from the most complex shapes
142   // -----------------------------------------------------------------
143
144   const bool includeSelf = true;
145   const bool complexShapeFirst = true;
146
147   SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(includeSelf,
148                                                            complexShapeFirst);
149   while ( smIt->more() )
150   {
151     SMESH_subMesh* smToCompute = smIt->next();
152
153     const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
154     if ( GetShapeDim( aSubShape ) < 1 ) break;
155
156     SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
157     if (algo && !algo->NeedDescretBoundary())
158     {
159       if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
160         smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
161
162       if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
163         ret = false;;
164     }
165     if ((algo && !aMesh.HasShapeToMesh()))
166     {
167       if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
168         smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
169       
170       if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
171         ret = false;;
172     }
173   }
174
175   // -----------------------------------------------
176   // mesh the rest subshapes starting from vertices
177   // -----------------------------------------------
178   smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst);
179   while ( smIt->more() )
180   {
181     SMESH_subMesh* smToCompute = smIt->next();
182
183     if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
184       smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
185
186     if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
187       ret = false;
188   }
189
190   MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
191   return ret;
192 }
193
194 //=======================================================================
195 //function : checkConformIgnoredAlgos
196 //purpose  :
197 //=======================================================================
198
199 static bool checkConformIgnoredAlgos(SMESH_Mesh&               aMesh,
200                                      SMESH_subMesh*            aSubMesh,
201                                      const SMESH_Algo*         aGlobIgnoAlgo,
202                                      const SMESH_Algo*         aLocIgnoAlgo,
203                                      bool &                    checkConform,
204                                      map<int, SMESH_subMesh*>& aCheckedMap,
205                                      list< SMESH_Gen::TAlgoStateError > & theErrors)
206 {
207   ASSERT( aSubMesh );
208   if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
209     return true;
210
211
212   bool ret = true;
213
214   const list<const SMESHDS_Hypothesis*>& listHyp =
215     aMesh.GetMeshDS()->GetHypothesis( aSubMesh->GetSubShape() );
216   list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
217   for ( ; it != listHyp.end(); it++)
218   {
219     const SMESHDS_Hypothesis * aHyp = *it;
220     if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
221       continue;
222
223     const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
224     ASSERT ( algo );
225
226     if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
227     {
228       INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
229             << aLocIgnoAlgo->GetName() << ">");
230     }
231     else
232     {
233       bool isGlobal = (aMesh.IsMainShape( aSubMesh->GetSubShape() ));
234       int dim = algo->GetDim();
235       int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
236
237       if ( dim < aMaxGlobIgnoDim )
238       {
239         // algo is hidden by a global algo
240         INFOS( ( isGlobal ? "Global" : "Local" )
241               << " <" << algo->GetName() << "> is hidden by global <"
242               << aGlobIgnoAlgo->GetName() << ">");
243       }
244       else if ( !algo->NeedDescretBoundary() && !isGlobal)
245       {
246         // local algo is not hidden and hides algos on sub-shapes
247         if (checkConform && !aSubMesh->IsConform( algo ))
248         {
249           ret = false;
250           checkConform = false; // no more check conformity
251           INFOS( "ERROR: Local <" << algo->GetName() <<
252                 "> would produce not conform mesh: "
253                 "<Not Conform Mesh Allowed> hypotesis is missing");
254           theErrors.push_back( SMESH_Gen::TAlgoStateError() );
255           theErrors.back().Set( SMESH_Hypothesis::HYP_NOTCONFORM, algo, false );
256         }
257
258         // sub-algos will be hidden by a local <algo>
259         const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
260         map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
261         bool checkConform2 = false;
262         for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
263         {
264           checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
265                                     algo, checkConform2, aCheckedMap, theErrors);
266           int key = (*revItSub).first;
267           SMESH_subMesh* sm = (*revItSub).second;
268           if ( aCheckedMap.find( key ) == aCheckedMap.end() )
269           {
270             aCheckedMap[ key ] = sm;
271           }
272         }
273       }
274     }
275   }
276
277   return ret;
278 }
279
280 //=======================================================================
281 //function : checkMissing
282 //purpose  : notify on missing hypothesis
283 //           Return false if algo or hipothesis is missing
284 //=======================================================================
285
286 static bool checkMissing(SMESH_Gen*                aGen,
287                          SMESH_Mesh&               aMesh,
288                          SMESH_subMesh*            aSubMesh,
289                          const int                 aTopAlgoDim,
290                          bool*                     globalChecked,
291                          const bool                checkNoAlgo,
292                          map<int, SMESH_subMesh*>& aCheckedMap,
293                          list< SMESH_Gen::TAlgoStateError > & theErrors)
294 {
295   if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
296     return true;
297
298   //MESSAGE("=====checkMissing");
299
300   int ret = true;
301   SMESH_Algo* algo = 0;
302
303   switch (aSubMesh->GetAlgoState())
304   {
305   case SMESH_subMesh::NO_ALGO: {
306     if (checkNoAlgo)
307     {
308       // should there be any algo?
309       int shapeDim = SMESH_Gen::GetShapeDim( aSubMesh->GetSubShape() );
310       if (aTopAlgoDim > shapeDim)
311       {
312         INFOS( "ERROR: " << shapeDim << "D algorithm is missing" );
313         ret = false;
314         theErrors.push_back( SMESH_Gen::TAlgoStateError() );
315         theErrors.back().Set( SMESH_Hypothesis::HYP_MISSING, shapeDim, true );
316       }
317     }
318     return ret;
319   }
320   case SMESH_subMesh::MISSING_HYP: {
321     // notify if an algo missing hyp is attached to aSubMesh
322     algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
323     ASSERT( algo );
324     bool IsGlobalHypothesis = aGen->IsGlobalHypothesis( algo, aMesh );
325     if (!IsGlobalHypothesis || !globalChecked[ algo->GetDim() ])
326     {
327       TAlgoStateErrorName errName = SMESH_Hypothesis::HYP_MISSING;
328       SMESH_Hypothesis::Hypothesis_Status status;
329       algo->CheckHypothesis( aMesh, aSubMesh->GetSubShape(), status );
330       if ( status == SMESH_Hypothesis::HYP_BAD_PARAMETER ) {
331         INFOS( "ERROR: hypothesis of " << (IsGlobalHypothesis ? "Global " : "Local ")
332                << "<" << algo->GetName() << "> has a bad parameter value");
333         errName = status;
334       } else if ( status == SMESH_Hypothesis::HYP_BAD_GEOMETRY ) {
335         INFOS( "ERROR: " << (IsGlobalHypothesis ? "Global " : "Local ")
336                << "<" << algo->GetName() << "> assigned to mismatching geometry");
337         errName = status;
338       } else {
339         INFOS( "ERROR: " << (IsGlobalHypothesis ? "Global " : "Local ")
340                << "<" << algo->GetName() << "> misses some hypothesis");
341       }
342       if (IsGlobalHypothesis)
343         globalChecked[ algo->GetDim() ] = true;
344       theErrors.push_back( SMESH_Gen::TAlgoStateError() );
345       theErrors.back().Set( errName, algo, IsGlobalHypothesis );
346     }
347     ret = false;
348     break;
349   }
350   case SMESH_subMesh::HYP_OK:
351     algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
352     ret = true;
353     break;
354   default: ASSERT(0);
355   }
356
357   // do not check under algo that hides sub-algos or
358   // re-start checking NO_ALGO state
359   ASSERT (algo);
360   bool isTopLocalAlgo =
361     ( aTopAlgoDim <= algo->GetDim() && !aGen->IsGlobalHypothesis( algo, aMesh ));
362   if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
363   {
364     bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
365     const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
366     map<int, SMESH_subMesh*>::const_iterator itsub;
367     for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
368     {
369       // sub-meshes should not be checked further more
370       int key = (*itsub).first;
371       SMESH_subMesh* sm = (*itsub).second;
372       if ( aCheckedMap.find( key ) == aCheckedMap.end() )
373         aCheckedMap[ key ] = sm;
374
375       if (isTopLocalAlgo)
376       {
377         //check algo on sub-meshes
378         int aTopAlgoDim2 = algo->GetDim();
379         if (!checkMissing (aGen, aMesh, sm, aTopAlgoDim2,
380                            globalChecked, checkNoAlgo2, aCheckedMap, theErrors))
381         {
382           ret = false;
383           if (sm->GetAlgoState() == SMESH_subMesh::NO_ALGO )
384             checkNoAlgo2 = false;
385         }
386       }
387     }
388   }
389   return ret;
390 }
391
392 //=======================================================================
393 //function : CheckAlgoState
394 //purpose  : notify on bad state of attached algos, return false
395 //           if Compute() would fail because of some algo bad state
396 //=======================================================================
397
398 bool SMESH_Gen::CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
399 {
400   list< TAlgoStateError > errors;
401   return GetAlgoState( aMesh, aShape, errors );
402 }
403
404 //=======================================================================
405 //function : GetAlgoState
406 //purpose  : notify on bad state of attached algos, return false
407 //           if Compute() would fail because of some algo bad state
408 //           theErrors list contains problems description
409 //=======================================================================
410
411 bool SMESH_Gen::GetAlgoState(SMESH_Mesh&               theMesh,
412                              const TopoDS_Shape&       theShape,
413                              list< TAlgoStateError > & theErrors)
414 {
415   //MESSAGE("SMESH_Gen::CheckAlgoState");
416
417   bool ret = true;
418   bool hasAlgo = false;
419
420   SMESH_subMesh* sm = theMesh.GetSubMesh(theShape);
421   const SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
422   TopoDS_Shape mainShape = meshDS->ShapeToMesh();
423
424   // -----------------
425   // get global algos
426   // -----------------
427
428   const SMESH_Algo* aGlobAlgoArr[] = {0,0,0,0};
429
430   const list<const SMESHDS_Hypothesis*>& listHyp = meshDS->GetHypothesis( mainShape );
431   list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
432   for ( ; it != listHyp.end(); it++)
433   {
434     const SMESHDS_Hypothesis * aHyp = *it;
435     if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
436       continue;
437
438     const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
439     ASSERT ( algo );
440
441     int dim = algo->GetDim();
442     aGlobAlgoArr[ dim ] = algo;
443
444     hasAlgo = true;
445   }
446
447   // --------------------------------------------------------
448   // info on algos that will be ignored because of ones that
449   // don't NeedDescretBoundary() attached to super-shapes,
450   // check that a conform mesh will be produced
451   // --------------------------------------------------------
452
453
454   // find a global algo possibly hiding sub-algos
455   int dim;
456   const SMESH_Algo* aGlobIgnoAlgo = 0;
457   for (dim = 3; dim > 0; dim--)
458   {
459     if (aGlobAlgoArr[ dim ] &&
460         !aGlobAlgoArr[ dim ]->NeedDescretBoundary())
461     {
462       aGlobIgnoAlgo = aGlobAlgoArr[ dim ];
463       break;
464     }
465   }
466
467   const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
468   map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
469   map<int, SMESH_subMesh*> aCheckedMap;
470   bool checkConform = ( !theMesh.IsNotConformAllowed() );
471   int aKey = 1;
472   SMESH_subMesh* smToCheck = sm;
473
474   // loop on theShape and its sub-shapes
475   while ( smToCheck )
476   {
477     if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
478       break;
479
480     if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
481       if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
482                                      0, checkConform, aCheckedMap, theErrors))
483         ret = false;
484
485     if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
486       hasAlgo = true;
487
488     // next subMesh
489     if (revItSub != smMap.rend())
490     {
491       aKey = (*revItSub).first;
492       smToCheck = (*revItSub).second;
493       revItSub++;
494     }
495     else
496     {
497       smToCheck = 0;
498     }
499
500   }
501
502   // ----------------------------------------------------------------
503   // info on missing hypothesis and find out if all needed algos are
504   // well defined
505   // ----------------------------------------------------------------
506
507   //MESSAGE( "---info on missing hypothesis and find out if all needed algos are");
508
509   // find max dim of global algo
510   int aTopAlgoDim = 0;
511   for (dim = 3; dim > 0; dim--)
512   {
513     if (aGlobAlgoArr[ dim ])
514     {
515       aTopAlgoDim = dim;
516       break;
517     }
518   }
519   aCheckedMap.clear();
520   smToCheck = sm;
521   revItSub = smMap.rbegin();
522   bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
523   bool globalChecked[] = { false, false, false, false };
524
525   // loop on theShape and its sub-shapes
526   while ( smToCheck )
527   {
528     if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
529       break;
530
531     if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
532       if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
533                          globalChecked, checkNoAlgo, aCheckedMap, theErrors))
534       {
535         ret = false;
536         if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
537           checkNoAlgo = false;
538       }
539
540     // next subMesh
541     if (revItSub != smMap.rend())
542     {
543       aKey = (*revItSub).first;
544       smToCheck = (*revItSub).second;
545       revItSub++;
546     }
547     else
548       smToCheck = 0;
549   }
550
551   if ( !hasAlgo ) {
552     ret = false;
553     INFOS( "None algorithm attached" );
554     theErrors.push_back( TAlgoStateError() );
555     theErrors.back().Set( SMESH_Hypothesis::HYP_MISSING, 1, true );
556   }
557
558   return ret;
559 }
560
561 //=======================================================================
562 //function : IsGlobalHypothesis
563 //purpose  : check if theAlgo is attached to the main shape
564 //=======================================================================
565
566 bool SMESH_Gen::IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh)
567 {
568   SMESH_HypoFilter filter( SMESH_HypoFilter::Is( theHyp ));
569   return aMesh.GetHypothesis( aMesh.GetMeshDS()->ShapeToMesh(), filter, false );
570 }
571
572 //=============================================================================
573 /*!
574  *
575  */
576 //=============================================================================
577
578 SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
579 {
580
581   SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
582   filter.And( filter.IsApplicableTo( aShape ));
583
584   list <const SMESHDS_Hypothesis * > algoList;
585   aMesh.GetHypotheses( aShape, filter, algoList, true );
586
587   if ( algoList.empty() )
588     return NULL;
589
590   return const_cast<SMESH_Algo*> ( static_cast<const SMESH_Algo* >( algoList.front() ));
591 }
592
593 //=============================================================================
594 /*!
595  *
596  */
597 //=============================================================================
598
599 StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
600 {
601         // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
602
603         if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
604         {
605                 _mapStudyContext[studyId] = new StudyContextStruct;
606                 _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
607         }
608         StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
609 //   ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
610         return myStudyContext;
611 }
612
613 //=============================================================================
614 /*!
615  *
616  */
617 //=============================================================================
618
619 void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
620 {
621 }
622
623 //=============================================================================
624 /*!
625  *
626  */
627 //=============================================================================
628
629 void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
630 {
631 }
632
633 //=============================================================================
634 /*!
635  *
636  */
637 //=============================================================================
638
639 void SMESH_Gen::Close(int studyId)
640 {
641 }
642
643 //=============================================================================
644 /*!
645  *
646  */
647 //=============================================================================
648
649 int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
650 {
651   static vector<int> dim;
652   if ( dim.empty() )
653   {
654     dim.resize( TopAbs_SHAPE, -1 );
655     dim[ TopAbs_COMPOUND ]  = 3;
656     dim[ TopAbs_COMPSOLID ] = 3;
657     dim[ TopAbs_SOLID ]     = 3;
658     dim[ TopAbs_SHELL ]     = 3;
659     dim[ TopAbs_FACE  ]     = 2;
660     dim[ TopAbs_WIRE ]      = 1;
661     dim[ TopAbs_EDGE ]      = 1;
662     dim[ TopAbs_VERTEX ]    = 0;
663   }
664   return dim[ aShapeType ];
665 }
666
667 //=============================================================================
668 /*!
669  *
670  */
671 //=============================================================================
672
673 int SMESH_Gen::GetANewId()
674 {
675         //MESSAGE("SMESH_Gen::GetANewId");
676         return _hypId++;
677 }