1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : NETGENPlugin_Remesher_2D.cxx
23 // Created : Thu Sep 21 16:48:46 2017
24 // Author : Edward AGAPOV (eap)
27 #include "NETGENPlugin_Remesher_2D.hxx"
29 #include "NETGENPlugin_Mesher.hxx"
30 #include "NETGENPlugin_Hypothesis_2D.hxx"
32 #include <SMDS_SetIterator.hxx>
33 #include <SMESHDS_Mesh.hxx>
34 #include <SMESH_ControlsDef.hxx>
35 #include <SMESH_Gen.hxx>
36 #include <SMESH_MeshAlgos.hxx>
37 #include <SMESH_MesherHelper.hxx>
38 #include <SMESH_subMesh.hxx>
40 #include <Bnd_B3d.hxx>
41 #include <Precision.hxx>
43 #include <occgeom.hpp>
44 #include <meshing.hpp>
45 #include <stlgeom.hpp>
46 //#include <stltool.hxx>
48 #include <boost/container/flat_set.hpp>
50 using namespace nglib;
54 // #if defined(NETGEN_V5) && defined(WIN32)
57 // extern STLParameters stlparam;
62 //=============================================================================
64 * \brief Fill holes in the mesh, since netgen can remesh only a closed shell mesh.
65 * At destruction, remove triangles filling the holes
70 HoleFiller( SMESH_Mesh& meshDS );
72 void AddHoleBorders( Ng_STL_Geometry * ngStlGeo );
73 void KeepHole() { myHole.clear(); myCapElems.clear(); }
74 void ClearCapElements() { myCapElems.clear(); }
77 SMESHDS_Mesh* myMeshDS;
78 std::vector< std::vector< gp_XYZ > > myHole; // initial border nodes
79 std::vector< gp_XYZ > myInHolePos; // position inside each hole
80 std::vector< const SMDS_MeshElement* > myCapElems; // elements closing holes
83 //================================================================================
85 * \brief Fill holes in the mesh
87 //================================================================================
89 HoleFiller::HoleFiller( SMESH_Mesh& theMesh ):
90 myMeshDS( theMesh.GetMeshDS() )
92 SMESH_MeshEditor editor( &theMesh );
95 // const double tol = Max( 0.1 * netgen::mparam.minh, Precision::Confusion() );
96 // TIDSortedNodeSet allNodes;
97 // SMESH_MeshEditor::TListOfListOfNodes equalNodes;
98 // editor.FindCoincidentNodes( allNodes, tol, equalNodes, true );
99 // editor.MergeNodes( equalNodes, /*noHoles=*/false );
103 SMESH_MeshAlgos::TFreeBorderVec holes;
104 bool isManifold = true, isGoodOri = true;
105 SMESH_MeshAlgos::FindFreeBorders( *myMeshDS, holes, /*closedOnly=*/true,
106 &isManifold, &isGoodOri );
110 // set bad faces into a compute error
111 const char* text = "Non-manifold mesh. Only manifold mesh can be re-meshed";
112 SMESH_ComputeErrorPtr error = SMESH_ComputeError::New( COMPERR_BAD_INPUT_MESH, text );
113 SMESH::Controls::MultiConnection2D fun;
114 fun.SetMesh( myMeshDS );
115 SMDS_ElemIteratorPtr fIt = myMeshDS->elementsIterator( SMDSAbs_Face );
116 while ( fIt->more() )
118 const SMDS_MeshElement* f = fIt->next();
119 if ( fun.GetValue( f->GetID() ) > 2 )
120 error->myBadElements.push_back( f );
122 theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError() = error;
123 throw SALOME_Exception( text );
126 // don't want to sew coincident borders
127 if ( !holes.empty() )
130 double tol, len, sumLen = 0, minLen = 1e100;
132 for ( size_t i = 0; i < holes.size(); ++i )
134 nbSeg += holes[i].size();
135 SMESH_NodeXYZ p1 = holes[i][0];
136 for ( size_t iP = 1; iP < holes[i].size(); ++iP )
138 SMESH_NodeXYZ p2 = holes[i][iP];
139 len = ( p1 - p2 ).Modulus();
141 minLen = Min( minLen, len );
145 double avgLen = sumLen / nbSeg;
146 if ( minLen > 1e-5 * avgLen )
147 tol = 0.1 * minLen; // minLen is not degenerate
151 SMESH_MeshAlgos::CoincidentFreeBorders freeBords;
152 SMESH_MeshAlgos::FindCoincidentFreeBorders( *myMeshDS, tol, freeBords );
153 if ( !freeBords._coincidentGroups.empty() )
155 const char* text = "Can't re-meshed a mesh with coincident free edges";
156 SMESH_ComputeErrorPtr error = SMESH_ComputeError::New( COMPERR_BAD_INPUT_MESH, text );
157 for ( size_t i = 0; i < freeBords._borders.size(); ++i )
158 error->myBadElements.insert( error->myBadElements.end(),
159 freeBords._borders[i].begin(),
160 freeBords._borders[i].end() );
161 theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError() = error;
162 throw SALOME_Exception( text );
167 myHole.resize( holes.size() );
168 myInHolePos.resize( holes.size() );
169 std::vector<const SMDS_MeshElement*> newFaces;
170 for ( size_t i = 0; i < holes.size(); ++i )
173 SMESH_MeshAlgos::FillHole( holes[i], *myMeshDS, newFaces );
175 // keep data to be able to remove hole filling faces after remeshing
176 if ( !newFaces.empty() )
178 myHole[i].resize( holes[i].size() );
179 for ( size_t iP = 0; iP < holes[i].size(); ++iP )
180 myHole[i][iP] = SMESH_NodeXYZ( holes[i][iP] );
182 myInHolePos[i] = ( SMESH_NodeXYZ( newFaces[0]->GetNode(0)) +
183 SMESH_NodeXYZ( newFaces[0]->GetNode(1)) +
184 SMESH_NodeXYZ( newFaces[0]->GetNode(2)) ) / 3.;
185 myCapElems.insert( myCapElems.end(), newFaces.begin(), newFaces.end() );
186 // unmark to be able to remove them if meshing is canceled
187 // for ( size_t iF = 0; iF < newFaces.size(); ++iF )
188 // newFaces[iF]->setIsMarked( false );
194 SMDS_ElemIteratorPtr fIt = myMeshDS->elementsIterator( SMDSAbs_Face );
195 while ( fIt->more() )
197 const SMDS_MeshElement* f = fIt->next();
199 if ( SMESH_MeshAlgos::FaceNormal( f, normal ))
201 TIDSortedElemSet allFaces;
202 editor.Reorient2D( allFaces, normal, f );
208 //================================================================================
210 * \brief Add hole borders to be kept in a new mesh
212 //================================================================================
214 void HoleFiller::AddHoleBorders( Ng_STL_Geometry * ngStlGeo )
216 for ( size_t i = 0; i < myHole.size(); ++i )
217 for ( size_t iP = 1; iP < myHole[i].size(); ++iP )
219 Ng_STL_AddEdge( ngStlGeo,
220 myHole[i][iP-1].ChangeData(),
221 myHole[i][iP-0].ChangeData() );
224 //================================================================================
226 * \brief Remove triangles filling the holes
228 //================================================================================
230 HoleFiller::~HoleFiller()
232 if ( myMeshDS->NbNodes() < 3 )
235 if ( !myCapElems.empty() ) // old mesh not removed; simply remove myCapElems
237 for ( size_t i = 0; i < myCapElems.size(); ++i )
238 myMeshDS->RemoveFreeElement( myCapElems[i], /*sm=*/0 );
242 bool hasOrphanNodes = true;
244 const double tol = Max( 1e-3 * netgen::mparam.minh, Precision::Confusion() );
246 for ( size_t i = 0; i < myHole.size(); ++i )
248 std::vector< gp_XYZ >& borderPnt = myHole[i];
249 const gp_XYZ& inHolePos = myInHolePos[i];
250 if ( borderPnt.empty() ) continue;
251 borderPnt.pop_back(); // first point repeated at end
253 // mark all nodes located on the hole border
255 // new nodeSearcher for each hole, otherwise it contains removed nodes for i > 0
256 SMESHUtils::Deleter< SMESH_NodeSearcher > nodeSearcher;
257 if ( hasOrphanNodes )
259 std::vector< const SMDS_MeshNode* > sharedNodes;
260 sharedNodes.reserve( myMeshDS->NbNodes() );
261 SMDS_NodeIteratorPtr nIt = myMeshDS->nodesIterator();
262 while ( nIt->more() )
264 const SMDS_MeshNode* n = nIt->next();
265 if ( n->NbInverseElements() )
266 sharedNodes.push_back( n );
268 hasOrphanNodes = ((int) sharedNodes.size() < myMeshDS->NbNodes() );
269 SMDS_ElemIteratorPtr elemIt( new SMDS_NodeVectorElemIterator( sharedNodes.begin(),
270 sharedNodes.end() ));
271 nodeSearcher._obj = SMESH_MeshAlgos::GetNodeSearcher( elemIt );
275 nodeSearcher._obj = SMESH_MeshAlgos::GetNodeSearcher( *myMeshDS );
278 std::vector< const SMDS_MeshElement* > edgesToRemove;
279 edgesToRemove.reserve( borderPnt.size() );
281 // look for a border point coincident with a node
283 SMESH_NodeXYZ bordNode1;
284 for ( ; iP < borderPnt.size(); ++iP )
286 bordNode1 = nodeSearcher->FindClosestTo( borderPnt[iP] );
287 if (( bordNode1 - borderPnt[iP] ).SquareModulus() < tol * tol )
291 bordNode1._node->setIsMarked( true );
293 // find the rest nodes located on the hole border
294 boost::container::flat_set< const SMDS_MeshNode* > checkedNodes;
295 gp_XYZ p1 = bordNode1;
296 for ( size_t j = 0; j < borderPnt.size()+1; ++j, iP = ( iP+1 ) % borderPnt.size() )
298 // among nodes surrounding bordNode1 find one most close to vec12
299 gp_XYZ vec12 = borderPnt[iP] - p1;
300 bool pntReached = false; // last found node is at iP
301 while ( !pntReached )
303 const SMDS_MeshNode* bordNode = bordNode1._node;
304 SMDS_ElemIteratorPtr fIt = bordNode->GetInverseElementIterator( SMDSAbs_Face );
305 double minArea = 1e100;
306 checkedNodes.clear();
307 checkedNodes.insert( bordNode );
308 while ( fIt->more() )
310 const SMDS_MeshElement* f = fIt->next();
311 for ( int iN = 0, nbN = f->NbNodes(); iN < nbN; ++iN )
313 const SMDS_MeshNode* n = f->GetNode( iN );
314 if ( !checkedNodes.insert( n ).second )
316 SMESH_NodeXYZ pn = n;
317 gp_XYZ vecPN = pn - bordNode1;
318 if ( vecPN * vec12 <= 0 )
320 gp_XYZ vec1N = pn - p1;
321 double a = vec12.CrossSquareMagnitude( vec1N );
328 if ( minArea < std::numeric_limits<double>::min() )
331 if ( bordNode == bordNode1._node )
332 return; // bug in the loop above
334 SMESH_NodeXYZ bordNode2 = bordNode;
335 gp_XYZ vec1N = bordNode2 - p1;
336 double u = ( vec12 * vec1N ) / vec12.SquareModulus(); // param [0,1] of bordNode on vec12
339 bordNode->setIsMarked( true );
340 //cout << bordNode->GetID() << " ";
342 if ( const SMDS_MeshElement* edge = myMeshDS->FindEdge( bordNode1._node, bordNode ))
343 edgesToRemove.push_back( edge );
345 edgesToRemove.push_back( myMeshDS->AddEdge( bordNode1._node, bordNode ));
346 edgesToRemove.back()->setIsMarked( true );
348 if ( minArea > std::numeric_limits<double>::min() &&
349 minArea / vec12.SquareModulus() > tol * tol )
351 // node is far from the border, move it
352 gp_XYZ p = p1 + u * vec12;
353 myMeshDS->MoveNode( bordNode, p.X(), p.Y(), p.Z() );
355 bordNode1 = bordNode2;
357 //else -- there must be another border point between bordNode1 and bordNode
358 pntReached = ( u > 1 - tol );
363 //cout << endl << endl;
365 // remove all faces starting from inHolePos
367 // get a starting face
368 std::vector< const SMDS_MeshNode* > nodesToRemove;
369 std::vector< const SMDS_MeshElement* > facesToRemove;
370 const SMDS_MeshNode* inHoleNode = nodeSearcher->FindClosestTo( inHolePos );
371 if ( inHoleNode && ! inHoleNode->isMarked() )
373 SMDS_ElemIteratorPtr fIt = inHoleNode->GetInverseElementIterator( SMDSAbs_Face );
374 while ( fIt->more() )
375 facesToRemove.push_back( fIt->next() );
379 SMESHUtils::Deleter< SMESH_ElementSearcher > faceSearcher
380 ( SMESH_MeshAlgos::GetElementSearcher( *myMeshDS ));
381 if ( const SMDS_MeshElement* f = faceSearcher->FindClosestTo( inHolePos, SMDSAbs_Face ))
382 facesToRemove.push_back( f );
386 for ( size_t iF = 0; iF < facesToRemove.size(); ++iF )
387 facesToRemove[iF]->setIsMarked( true );
389 // remove faces and nodes
390 TIDSortedElemSet elemSet, avoidSet;
391 const SMDS_MeshElement* e;
392 while ( !facesToRemove.empty() )
394 const SMDS_MeshElement* inHoleFace = facesToRemove.back();
395 facesToRemove.pop_back();
397 // add adjacent faces into facesToRemove
398 for ( int iN = 0, nbN = inHoleFace->NbNodes(); iN < nbN; ++iN )
400 const SMDS_MeshNode* n1 = inHoleFace->GetNode( iN );
401 if ( !n1->isMarked() )
403 SMDS_ElemIteratorPtr eIt = n1->GetInverseElementIterator();
404 while ( eIt->more() )
407 if ( e->GetType() == SMDSAbs_Face )
409 if ( !e->isMarked() )
410 facesToRemove.push_back( e );
411 e->setIsMarked( true );
413 else if ( e->GetType() == SMDSAbs_Edge )
415 myMeshDS->RemoveFreeElement( e, 0, /*fromGroups=*/false );
418 if ( n1->NbInverseElements() == 1 )
419 nodesToRemove.push_back( n1 );
423 const SMDS_MeshNode* n2 = inHoleFace->GetNodeWrap( iN+1 );
424 if (( n2->isMarked() ) &&
425 ( !(e = myMeshDS->FindEdge( n1, n2 )) || !e->isMarked() )) // n1-n2 not hole border
427 if ( e ) // remove edge
428 myMeshDS->RemoveFreeElement( e, 0, /*fromGroups=*/false );
430 avoidSet.insert( inHoleFace );
431 if (( e = SMESH_MeshAlgos::FindFaceInSet( n1, n2, elemSet, avoidSet )))
433 if ( !e->isMarked() )
434 facesToRemove.push_back( e );
435 e->setIsMarked( true );
440 myMeshDS->RemoveFreeElement( inHoleFace, 0, /*fromGroups=*/false );
442 for ( size_t iN = 0; iN < nodesToRemove.size(); ++iN )
443 myMeshDS->RemoveFreeNode( nodesToRemove[iN], 0, /*fromGroups=*/false );
444 nodesToRemove.clear();
447 // remove edges from the hole border
448 // for ( size_t iE = 0; iE < edgesToRemove.size(); ++iE )
449 // myMeshDS->RemoveFreeElement( edgesToRemove[iE], 0, /*fromGroups=*/false );
458 //=============================================================================
462 //=============================================================================
464 NETGENPlugin_Remesher_2D::NETGENPlugin_Remesher_2D(int hypId, int studyId, SMESH_Gen* gen)
465 : SMESH_2D_Algo(hypId, studyId, gen)
467 _name = "NETGEN_Remesher_2D";
468 _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
469 _compatibleHypothesis.push_back("NETGEN_RemesherParameters_2D");
470 _requireShape = false;
475 //=============================================================================
477 * Check assigned hypotheses
479 //=============================================================================
481 bool NETGENPlugin_Remesher_2D::CheckHypothesis (SMESH_Mesh& theMesh,
482 const TopoDS_Shape& theShape,
483 Hypothesis_Status& theStatus)
487 // can work with no hypothesis
488 theStatus = SMESH_Hypothesis::HYP_OK;
490 const list<const SMESHDS_Hypothesis*>& hyps =
491 GetUsedHypothesis( theMesh, theShape, /*skipAux=*/true );
493 switch ( hyps.size() ) {
497 _hypothesis = hyps.front();
500 theStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
503 return theStatus == SMESH_Hypothesis::HYP_OK;
506 //=============================================================================
508 * Compute mesh on an input mesh
510 //=============================================================================
512 bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh& theMesh,
513 SMESH_MesherHelper* theHelper)
515 if ( theMesh.NbFaces() == 0 )
516 return !error( COMPERR_WARNING, "No faces in input mesh");
518 NETGENPlugin_Mesher mesher( &theMesh, theMesh.GetShapeToMesh(), /*isVol=*/false);
519 NETGENPlugin_NetgenLibWrapper ngLib;
520 netgen::Mesh * ngMesh = (netgen::Mesh*) ngLib._ngMesh;
521 Ng_STL_Geometry * ngStlGeo = Ng_STL_NewGeometry();
522 netgen::STLTopology* stlTopo = (netgen::STLTopology*) ngStlGeo;
523 netgen::multithread.terminate = 0;
525 const NETGENPlugin_RemesherHypothesis_2D* hyp =
526 dynamic_cast<const NETGENPlugin_RemesherHypothesis_2D*>( _hypothesis );
527 mesher.SetParameters( hyp );// for holeFiller
529 SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
530 HoleFiller holeFiller( theMesh );
531 //theHelper->SetIsQuadratic( theMesh.NbFaces( ORDER_QUADRATIC ));
533 // fill ngStlGeo with triangles
534 SMDS_ElemIteratorPtr fIt = meshDS->elementsIterator( SMDSAbs_Face );
535 while ( fIt->more() )
537 const SMDS_MeshElement* f = fIt->next();
538 SMESH_NodeXYZ n1 = f->GetNode( 0 );
539 SMESH_NodeXYZ n2 = f->GetNode( 1 );
540 SMESH_NodeXYZ n3 = f->GetNode( 2 );
541 Ng_STL_AddTriangle( ngStlGeo,
545 if ( f->NbNodes() > 3 )
547 n2.Set( f->GetNode( 3 ));
548 Ng_STL_AddTriangle( ngStlGeo,
555 holeFiller.AddHoleBorders( ngStlGeo );
558 Ng_Result ng_res = Ng_STL_InitSTLGeometry( ngStlGeo );
559 if ( ng_res != NG_OK )
562 holeFiller.KeepHole();
564 std::string txt = "Error Initialising the STL Geometry";
565 if ( !stlTopo->GetStatusText().empty() )
566 txt += ". " + stlTopo->GetStatusText();
567 return error( COMPERR_BAD_INPUT_MESH, txt );
570 Ng_Meshing_Parameters ngParams;
571 ng_res = Ng_STL_MakeEdges( ngStlGeo, ngLib._ngMesh, &ngParams );
572 if ( ng_res != NG_OK )
573 return error( "Error in Edge Meshing" );
578 ngParams.maxh = hyp->GetMaxSize();
579 ngParams.minh = hyp->GetMinSize();
580 ngParams.meshsize_filename = (char*) hyp->GetMeshSizeFile().c_str();
581 ngParams.quad_dominated = hyp->GetQuadAllowed();
582 netgen::stlparam.yangle = hyp->GetRidgeAngle();
583 mesher.SetParameters( hyp );
587 double diagSize = Dist( stlTopo->GetBoundingBox().PMin(), stlTopo->GetBoundingBox().PMax());
588 netgen::mparam.maxh = diagSize / GetGen()->GetBoundaryBoxSegmentation();
589 netgen::mparam.minh = netgen::mparam.maxh;
592 double h = netgen::mparam.maxh;
593 ngMesh->SetGlobalH( h );
594 ngMesh->SetMinimalH( netgen::mparam.minh );
595 ngMesh->SetLocalH( stlTopo->GetBoundingBox().PMin() - netgen::Vec3d(h, h, h),
596 stlTopo->GetBoundingBox().PMax() + netgen::Vec3d(h, h, h),
597 netgen::mparam.grading );
598 ngMesh->LoadLocalMeshSize( ngParams.meshsize_filename );
600 netgen::OCCGeometry occgeo;
601 mesher.SetLocalSize( occgeo, *ngMesh );
606 ng_res = Ng_STL_GenerateSurfaceMesh( ngStlGeo, ngLib._ngMesh, &ngParams );
608 catch (netgen::NgException & ex)
610 if ( netgen::multithread.terminate )
613 if ( ng_res != NG_OK )
614 return error( "Error in Surface Meshing" );
616 int nbN = ngMesh->GetNP();
617 int nbE = ngMesh->GetNSeg();
618 int nbF = ngMesh->GetNSE();
620 return error( "Error in Surface Meshing" );
622 // remove existing mesh
623 holeFiller.ClearCapElements();
624 SMDS_ElemIteratorPtr eIt = meshDS->elementsIterator();
625 while ( eIt->more() )
626 meshDS->RemoveFreeElement( eIt->next(), /*sm=*/0 );
627 SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator();
628 while ( nIt->more() )
629 meshDS->RemoveFreeNode( nIt->next(), /*sm=*/0 );
634 std::vector< const SMDS_MeshNode* > newNodes( nbN+1 );
635 for ( int i = 1; i <= nbN; ++i )
637 const netgen::MeshPoint& p = ngMesh->Point(i);
638 newNodes[i] = meshDS->AddNode( p(0),p(1),p(2) );
642 std::vector<const SMDS_MeshNode*> nodes(4);
643 for ( int i = 1; i <= nbE; ++i )
645 const netgen::Segment& seg = ngMesh->LineSegment(i);
647 for ( int j = 0; j < 2; ++j )
649 size_t pind = seg.pnums[j];
650 if ( pind > 0 && pind < newNodes.size() )
651 nodes.push_back( newNodes[ pind ]);
655 if ( nodes.size() == 2 && !meshDS->FindEdge( nodes[0], nodes[1] ))
656 meshDS->AddEdge( nodes[0], nodes[1] );
660 for ( int i = 1; i <= nbF; ++i )
662 const netgen::Element2d& elem = ngMesh->SurfaceElement(i);
664 for ( int j = 1; j <= elem.GetNP(); ++j )
666 size_t pind = elem.PNum(j);
667 if ( pind > 0 && pind < newNodes.size() )
668 nodes.push_back( newNodes[ pind ]);
672 switch( nodes.size() )
674 case 3: meshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
675 case 4: meshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
679 // as we don't assign the new triangles to a shape (the pseudo-shape),
680 // to avoid their removal at hypothesis modification,
681 // we mark the shape as always computed to avoid the error messages
682 // that no elements assigned to the shape
683 theMesh.GetSubMesh( theHelper->GetSubShape() )->SetIsAlwaysComputed( true );
688 //=============================================================================
690 * Do not compute mesh on geometry
692 //=============================================================================
694 bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh& theMesh,
695 const TopoDS_Shape& theShape)
700 //=============================================================================
702 * Terminate Compute()
704 //=============================================================================
706 void NETGENPlugin_Remesher_2D::CancelCompute()
708 SMESH_Algo::CancelCompute();
709 netgen::multithread.terminate = 1;
712 //================================================================================
714 * \brief Return progress of Compute() [0.,1]
716 //================================================================================
718 double NETGENPlugin_Remesher_2D::GetProgress() const
720 return netgen::multithread.percent / 100.;
723 //=============================================================================
727 //=============================================================================
729 bool NETGENPlugin_Remesher_2D::Evaluate(SMESH_Mesh& aMesh,
730 const TopoDS_Shape& aShape,
731 MapShapeNbElems& aResMap)