Salome HOME
Merge from BR_imps_2013 14/01/2014
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_NETGEN_2D_ONLY.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : NETGENPlugin_NETGEN_2D_ONLY.cxx
21 // Author    : Edward AGAPOV (OCC)
22 // Project   : SALOME
23 //
24 #include "NETGENPlugin_NETGEN_2D_ONLY.hxx"
25
26 #include "NETGENPlugin_Mesher.hxx"
27 #include "NETGENPlugin_Hypothesis_2D.hxx"
28
29 #include <SMDS_MeshElement.hxx>
30 #include <SMDS_MeshNode.hxx>
31 #include <SMESHDS_Mesh.hxx>
32 #include <SMESH_Comment.hxx>
33 #include <SMESH_Gen.hxx>
34 #include <SMESH_Mesh.hxx>
35 #include <SMESH_MesherHelper.hxx>
36 #include <SMESH_subMesh.hxx>
37 #include <StdMeshers_FaceSide.hxx>
38 #include <StdMeshers_LengthFromEdges.hxx>
39 #include <StdMeshers_MaxElementArea.hxx>
40 #include <StdMeshers_QuadranglePreference.hxx>
41 #include <StdMeshers_ViscousLayers2D.hxx>
42
43 #include <Precision.hxx>
44 #include <Standard_ErrorHandler.hxx>
45 #include <Standard_Failure.hxx>
46
47 #include <utilities.h>
48
49 #include <list>
50 #include <vector>
51 #include <limits>
52
53 /*
54   Netgen include files
55 */
56 namespace nglib {
57 #include <nglib.h>
58 }
59 #ifndef OCCGEOMETRY
60 #define OCCGEOMETRY
61 #endif
62 #include <occgeom.hpp>
63 #include <meshing.hpp>
64 //#include <meshtype.hpp>
65 namespace netgen {
66 #ifdef NETGEN_V5
67   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
68 #else
69   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
70 #endif
71   extern MeshingParameters mparam;
72 }
73
74 using namespace std;
75 using namespace netgen;
76 using namespace nglib;
77
78 //#define DUMP_SEGMENTS
79
80 //=============================================================================
81 /*!
82  *  
83  */
84 //=============================================================================
85
86 NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int hypId, int studyId,
87                                                          SMESH_Gen* gen)
88   : SMESH_2D_Algo(hypId, studyId, gen)
89 {
90   MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY");
91   _name = "NETGEN_2D_ONLY";
92   
93   _shapeType = (1 << TopAbs_FACE);// 1 bit /shape type
94
95   _compatibleHypothesis.push_back("MaxElementArea");
96   _compatibleHypothesis.push_back("LengthFromEdges");
97   _compatibleHypothesis.push_back("QuadranglePreference");
98   _compatibleHypothesis.push_back("NETGEN_Parameters_2D");
99   _compatibleHypothesis.push_back("ViscousLayers2D");
100
101   _hypMaxElementArea = 0;
102   _hypLengthFromEdges = 0;
103   _hypQuadranglePreference = 0;
104   _hypParameters = 0;
105 }
106
107 //=============================================================================
108 /*!
109  *  
110  */
111 //=============================================================================
112
113 NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY()
114 {
115   MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY");
116 }
117
118 //=============================================================================
119 /*!
120  *  
121  */
122 //=============================================================================
123
124 bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh&         aMesh,
125                                                    const TopoDS_Shape& aShape,
126                                                    Hypothesis_Status&  aStatus)
127 {
128   _hypMaxElementArea = 0;
129   _hypLengthFromEdges = 0;
130   _hypQuadranglePreference = 0;
131   _progressByTic = -1;
132
133   const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
134
135   if (hyps.empty())
136   {
137     aStatus = HYP_OK; //SMESH_Hypothesis::HYP_MISSING;
138     return true;  // (PAL13464) can work with no hypothesis, LengthFromEdges is default one
139   }
140
141   aStatus = HYP_MISSING;
142
143   list<const SMESHDS_Hypothesis*>::const_iterator ith;
144   for (ith = hyps.begin(); ith != hyps.end(); ++ith )
145   {
146     const SMESHDS_Hypothesis* hyp = (*ith);
147
148     string hypName = hyp->GetName();
149
150     if      ( hypName == "MaxElementArea")
151       _hypMaxElementArea = static_cast<const StdMeshers_MaxElementArea*> (hyp);
152     else if ( hypName == "LengthFromEdges" )
153       _hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges*> (hyp);
154     else if ( hypName == "QuadranglePreference" )
155       _hypQuadranglePreference = static_cast<const StdMeshers_QuadranglePreference*>(hyp);
156     else if ( hypName == "NETGEN_Parameters_2D" )
157       _hypParameters = static_cast<const NETGENPlugin_Hypothesis_2D*>(hyp);
158     else if ( hypName == StdMeshers_ViscousLayers2D::GetHypType() )
159       continue;
160     else {
161       aStatus = HYP_INCOMPATIBLE;
162       return false;
163     }
164   }
165
166   int nbHyps = bool(_hypMaxElementArea) + bool(_hypLengthFromEdges) + bool(_hypParameters );
167   if ( nbHyps > 1 )
168     aStatus = HYP_CONCURENT;
169   else
170     aStatus = HYP_OK;
171
172   return ( aStatus == HYP_OK );
173 }
174
175 //=============================================================================
176 /*!
177  *Here we are going to use the NETGEN mesher
178  */
179 //=============================================================================
180
181 bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
182                                           const TopoDS_Shape& aShape)
183 {
184   netgen::multithread.terminate = 0;
185   netgen::multithread.task = "Surface meshing";
186
187   SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
188   int faceID = meshDS->ShapeToIndex( aShape );
189
190   SMESH_MesherHelper helper(aMesh);
191   _quadraticMesh = helper.IsQuadraticSubMesh(aShape);
192   helper.SetElementsOnShape( true );
193   const bool ignoreMediumNodes = _quadraticMesh;
194
195   // build viscous layers if required
196   TopoDS_Face F = TopoDS::Face( aShape/*.Oriented( TopAbs_FORWARD )*/);
197   if ( F.Orientation() != TopAbs_FORWARD &&
198        F.Orientation() != TopAbs_REVERSED )
199     F.Orientation( TopAbs_FORWARD ); // avoid pb with TopAbs_INTERNAL
200   SMESH_ProxyMesh::Ptr proxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F );
201   if ( !proxyMesh )
202     return false;
203
204   // ------------------------
205   // get all edges of a face
206   // ------------------------
207   TError problem;
208   TSideVector wires =
209     StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem, proxyMesh );
210   if ( problem && !problem->IsOK() )
211     return error( problem );
212   int nbWires = wires.size();
213   if ( nbWires == 0 )
214     return error( "Problem in StdMeshers_FaceSide::GetFaceWires()");
215   if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments
216     return error(COMPERR_BAD_INPUT_MESH,
217                  SMESH_Comment("Too few segments: ")<<wires[0]->NbSegments());
218
219   // --------------------
220   // compute edge length
221   // --------------------
222
223   NETGENPlugin_Mesher aMesher( &aMesh, aShape, /*isVolume=*/false);
224   netgen::OCCGeometry occgeo;
225   aMesher.PrepareOCCgeometry( occgeo, F, aMesh );
226   occgeo.fmap.Clear(); // face can be reversed, which is wrong in this case (issue 19978)
227   occgeo.fmap.Add( F );
228
229   if ( _hypParameters )
230   {
231     aMesher.SetParameters(_hypParameters);
232   }
233   else
234   {
235     double edgeLength = 0;
236     if (_hypLengthFromEdges /*|| (!_hypLengthFromEdges && !_hypMaxElementArea)*/)
237     {
238       int nbSegments = 0;
239       for ( int iW = 0; iW < nbWires; ++iW )
240       {
241         edgeLength += wires[ iW ]->Length();
242         nbSegments += wires[ iW ]->NbSegments();
243       }
244       if ( nbSegments )
245         edgeLength /= nbSegments;
246     }
247     else if ( _hypMaxElementArea )
248     {
249       double maxArea = _hypMaxElementArea->GetMaxArea();
250       edgeLength = sqrt(2. * maxArea/sqrt(3.0));
251     }
252     else
253     {
254       // set edgeLength by a longest segment
255       double maxSeg2 = 0;
256       for ( int iW = 0; iW < nbWires; ++iW )
257       {
258         const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct();
259         gp_Pnt pPrev = SMESH_TNodeXYZ( points[0].node );
260         for ( size_t i = 1; i < points.size(); ++i )
261         {
262           gp_Pnt p = SMESH_TNodeXYZ( points[i].node );
263           maxSeg2 = Max( maxSeg2, p.SquareDistance( pPrev ));
264           pPrev = p;
265         }
266       }
267       edgeLength = sqrt( maxSeg2 ) * 1.05;
268     }
269     if ( edgeLength < DBL_MIN )
270       edgeLength = occgeo.GetBoundingBox().Diam();
271
272     netgen::mparam.maxh = edgeLength;
273     netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh );
274     netgen::mparam.quad = _hypQuadranglePreference ? 1 : 0;
275     netgen::mparam.grading = 0.4; // Moderate fineness by default
276   }
277   occgeo.face_maxh = netgen::mparam.maxh;
278
279   // -------------------------
280   // Make input netgen mesh
281   // -------------------------
282
283   // MESHCONST_ANALYSE step may lead to a failure, so we make an attempt
284   // w/o MESHCONST_ANALYSE at the second loop
285   int err = 1;
286   int iLoop = netgen::mparam.uselocalh ? 0 : 1; // uselocalh depends on 
287   for ( ; iLoop < 2; iLoop++ )
288   {
289     bool isMESHCONST_ANALYSE = false;
290     InitComputeError();
291
292     NETGENPlugin_NetgenLibWrapper ngLib;
293     netgen::Mesh * ngMesh = (netgen::Mesh*) ngLib._ngMesh;
294     ngLib._isComputeOk = false;
295
296 #ifndef NETGEN_V5
297     char *optstr = 0;
298 #endif
299     int startWith = MESHCONST_ANALYSE;
300     int endWith   = MESHCONST_ANALYSE;
301
302     if ( !_hypLengthFromEdges && !_hypMaxElementArea && iLoop == 0 )
303     {
304       isMESHCONST_ANALYSE = true;
305 #ifdef NETGEN_V5
306       err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
307 #else
308       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
309 #endif
310       ngLib._ngMesh = 0;
311       ngLib.setMesh(( nglib::Ng_Mesh*) ngMesh );
312     }
313     else
314     {
315       Box<3> bb = occgeo.GetBoundingBox();
316       bb.Increase (bb.Diam()/10);
317       ngMesh->SetLocalH (bb.PMin(), bb.PMax(), netgen::mparam.grading);
318       ngMesh->SetGlobalH (netgen::mparam.maxh);
319     }
320     //cerr << "max " << netgen::mparam.maxh << " min " << netgen::mparam.minh << endl;
321
322     vector< const SMDS_MeshNode* > nodeVec;
323     problem = aMesher.AddSegmentsToMesh( *ngMesh, occgeo, wires, helper, nodeVec );
324     if ( problem && !problem->IsOK() )
325       return error( problem );
326
327     // limit element size near existing segments
328     TopTools_IndexedMapOfShape edgeMap, faceMap;
329     TopExp::MapShapes( aMesh.GetShapeToMesh(), TopAbs_EDGE, edgeMap );
330     for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
331     {
332       const TopoDS_Shape& edge = edgeMap( iE );
333       if ( SMESH_Algo::isDegenerated( TopoDS::Edge( edge )) ||
334            helper.IsSubShape( edge, aShape ))
335         continue;
336       SMESHDS_SubMesh* smDS = aMesh.GetMeshDS()->MeshElements( edge );
337       if ( !smDS ) continue;
338       SMDS_ElemIteratorPtr segIt = smDS->GetElements();
339       while ( segIt->more() )
340       {
341         const SMDS_MeshElement* seg = segIt->next();
342         SMESH_TNodeXYZ n1 = seg->GetNode(0);
343         SMESH_TNodeXYZ n2 = seg->GetNode(1);
344         gp_XYZ p = 0.5 * ( n1 + n2 );
345         netgen::Point3d pi(p.X(), p.Y(), p.Z());
346         ngMesh->RestrictLocalH( pi, Max(( n1 - n2 ).Modulus(), netgen::mparam.minh ));
347       }
348     }
349
350     // -------------------------
351     // Generate surface mesh
352     // -------------------------
353
354     startWith = MESHCONST_MESHSURFACE;
355     endWith   = MESHCONST_OPTSURFACE;
356
357     try {
358       OCC_CATCH_SIGNALS;
359
360 #ifdef NETGEN_V5
361       err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
362 #else
363       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
364 #endif
365       if(netgen::multithread.terminate)
366         return false;
367       if ( err )
368         error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
369     }
370     catch (Standard_Failure& ex)
371     {
372       SMESH_Comment str("Exception in  netgen::OCCGenerateMesh()");
373       str << " at " << netgen::multithread.task
374           << ": " << ex.DynamicType()->Name();
375       if ( ex.GetMessageString() && strlen( ex.GetMessageString() ))
376         str << ": " << ex.GetMessageString();
377       error(str);
378       err = 1;
379     }
380     catch (...) {
381       SMESH_Comment str("Exception in  netgen::OCCGenerateMesh()");
382       str << " at " << netgen::multithread.task;
383       error(str);
384       err = 1;
385     }
386     if ( err /*&& isMESHCONST_ANALYSE*/ && iLoop == 0 )
387     {
388       netgen::mparam.minh = netgen::mparam.maxh;
389       netgen::mparam.maxh = 0;
390       for ( int iW = 0; iW < wires.size(); ++iW )
391       {
392         StdMeshers_FaceSidePtr wire = wires[ iW ];
393         const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
394         for ( size_t iP = 0; iP < uvPtVec.size(); ++iP )
395         {
396           netgen::Point3d p( uvPtVec[iP].node->X(),
397                              uvPtVec[iP].node->Y(),
398                              uvPtVec[iP].node->Z());
399           double size = ngMesh->GetH( p );
400           netgen::mparam.minh = Min( netgen::mparam.minh, size );
401           netgen::mparam.maxh = Max( netgen::mparam.maxh, size );
402         }
403       }
404       //cerr << "min " << netgen::mparam.minh << " max " << netgen::mparam.maxh << endl;
405       netgen::mparam.minh *= 0.9;
406       netgen::mparam.maxh *= 1.1;
407
408       continue;
409     }
410
411     // ----------------------------------------------------
412     // Fill the SMESHDS with the generated nodes and faces
413     // ----------------------------------------------------
414
415     int nbNodes = ngMesh->GetNP();
416     int nbFaces = ngMesh->GetNSE();
417
418     int nbInputNodes = nodeVec.size()-1;
419     nodeVec.resize( nbNodes+1, 0 );
420
421     // add nodes
422     for ( int ngID = nbInputNodes + 1; ngID <= nbNodes; ++ngID )
423     {
424       const MeshPoint& ngPoint = ngMesh->Point( ngID );
425       SMDS_MeshNode * node = meshDS->AddNode(ngPoint(0), ngPoint(1), ngPoint(2));
426       nodeVec[ ngID ] = node;
427     }
428
429     // create faces
430     const bool reverse = false; //( aShape.Orientation() == TopAbs_REVERSED );
431     int i,j;
432     for ( i = 1; i <= nbFaces ; ++i )
433     {
434       const Element2d& elem = ngMesh->SurfaceElement(i);
435       vector<const SMDS_MeshNode*> nodes( elem.GetNP() );
436       for (j=1; j <= elem.GetNP(); ++j)
437       {
438         int pind = elem.PNum(j);
439         if ( pind < 1 )
440           break;
441         const SMDS_MeshNode* node = nodeVec[ pind ];
442         if ( reverse )
443           nodes[ nodes.size()-j ] = node;
444         else
445           nodes[ j-1 ] = node;
446         if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE )
447         {
448           const PointGeomInfo& pgi = elem.GeomInfoPi(j);
449           meshDS->SetNodeOnFace((SMDS_MeshNode*)node, faceID, pgi.u, pgi.v);
450         }
451       }
452       if ( j > elem.GetNP() )
453       {
454         SMDS_MeshFace* face = 0;
455         if ( elem.GetType() == TRIG )
456           face = helper.AddFace(nodes[0],nodes[1],nodes[2]);
457         else
458           face = helper.AddFace(nodes[0],nodes[1],nodes[2],nodes[3]);
459       }
460     }
461
462     ngLib._isComputeOk = !err;
463     break;
464
465   } // two attempts
466
467   return !err;
468 }
469
470 void NETGENPlugin_NETGEN_2D_ONLY::CancelCompute()
471 {
472   SMESH_Algo::CancelCompute();
473   netgen::multithread.terminate = 1;
474 }
475
476 //================================================================================
477 /*!
478  * \brief Return progress of Compute() [0.,1]
479  */
480 //================================================================================
481
482 double NETGENPlugin_NETGEN_2D_ONLY::GetProgress() const
483 {
484   const char* task1 = "Surface meshing";
485   //const char* task2 = "Optimizing surface";
486   double& progress = const_cast<NETGENPlugin_NETGEN_2D_ONLY*>( this )->_progress;
487   if ( _progressByTic < 0. &&
488        strncmp( netgen::multithread.task, task1, 3 ) == 0 )
489   {
490     progress = Min( 0.25, SMESH_Algo::GetProgressByTic() ); // [0, 0.25]
491   }
492   else //if ( strncmp( netgen::multithread.task, task2, 3 ) == 0)
493   {
494     if ( _progressByTic < 0 )
495     {
496       NETGENPlugin_NETGEN_2D_ONLY* me = (NETGENPlugin_NETGEN_2D_ONLY*) this;
497       me->_progressByTic = 0.25 / (_progressTic+1);
498     }
499     const_cast<NETGENPlugin_NETGEN_2D_ONLY*>( this )->_progressTic++;
500     progress = Max( progress, _progressByTic * _progressTic );
501   }
502   //cout << netgen::multithread.task << " " << _progressTic << endl;
503   return Min( progress, 0.99 );
504 }
505
506 //=============================================================================
507 /*!
508  *
509  */
510 //=============================================================================
511
512 bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
513                                            const TopoDS_Shape& aShape,
514                                            MapShapeNbElems& aResMap)
515 {
516   TopoDS_Face F = TopoDS::Face(aShape);
517   if(F.IsNull())
518     return false;
519
520   // collect info from edges
521   int nb0d = 0, nb1d = 0;
522   bool IsQuadratic = false;
523   bool IsFirst = true;
524   double fullLen = 0.0;
525   TopTools_MapOfShape tmpMap;
526   for (TopExp_Explorer exp(F, TopAbs_EDGE); exp.More(); exp.Next()) {
527     TopoDS_Edge E = TopoDS::Edge(exp.Current());
528     if( tmpMap.Contains(E) )
529       continue;
530     tmpMap.Add(E);
531     SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
532     MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
533     if( anIt==aResMap.end() ) {
534       SMESH_subMesh *sm = aMesh.GetSubMesh(F);
535       SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
536       smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
537       return false;
538     }
539     std::vector<int> aVec = (*anIt).second;
540     nb0d += aVec[SMDSEntity_Node];
541     nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
542     double aLen = SMESH_Algo::EdgeLength(E);
543     fullLen += aLen;
544     if(IsFirst) {
545       IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
546       IsFirst = false;
547     }
548   }
549   tmpMap.Clear();
550
551   // compute edge length
552   double ELen = 0;
553   if (_hypLengthFromEdges || !_hypLengthFromEdges && !_hypMaxElementArea) {
554     if ( nb1d > 0 )
555       ELen = fullLen / nb1d;
556   }
557   if ( _hypMaxElementArea ) {
558     double maxArea = _hypMaxElementArea->GetMaxArea();
559     ELen = sqrt(2. * maxArea/sqrt(3.0));
560   }
561   GProp_GProps G;
562   BRepGProp::SurfaceProperties(F,G);
563   double anArea = G.Mass();
564
565   const int hugeNb = numeric_limits<int>::max()/10;
566   if ( anArea / hugeNb > ELen*ELen )
567   {
568     SMESH_subMesh *sm = aMesh.GetSubMesh(F);
569     SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
570     smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
571     return false;
572   }
573   int nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
574   int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
575   std::vector<int> aVec(SMDSEntity_Last);
576   for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
577   if( IsQuadratic ) {
578     aVec[SMDSEntity_Node] = nbNodes;
579     aVec[SMDSEntity_Quad_Triangle] = nbFaces;
580   }
581   else {
582     aVec[SMDSEntity_Node] = nbNodes;
583     aVec[SMDSEntity_Triangle] = nbFaces;
584   }
585   SMESH_subMesh *sm = aMesh.GetSubMesh(F);
586   aResMap.insert(std::make_pair(sm,aVec));
587
588   return true;
589 }